comparison packages/redboot/current/src/io.c @ 1122:92e31da869cc

Add ^C abort functionality to BOOTP and PING operations.
author gthomas
date Wed, 16 Jul 2003 19:08:54 +0000
parents f5fa0e095f5e
children fa9edbd9ccaa
comparison
equal deleted inserted replaced
1121:7992fe4e88eb 1122:92e31da869cc
7 //========================================================================== 7 //==========================================================================
8 //####ECOSGPLCOPYRIGHTBEGIN#### 8 //####ECOSGPLCOPYRIGHTBEGIN####
9 // ------------------------------------------- 9 // -------------------------------------------
10 // This file is part of eCos, the Embedded Configurable Operating System. 10 // This file is part of eCos, the Embedded Configurable Operating System.
11 // Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 Red Hat, Inc. 11 // Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 Red Hat, Inc.
12 // Copyright (C) 2002 Gary Thomas 12 // Copyright (C) 2002, 2003 Gary Thomas
13 // 13 //
14 // eCos is free software; you can redistribute it and/or modify it under 14 // eCos is free software; you can redistribute it and/or modify it under
15 // the terms of the GNU General Public License as published by the Free 15 // the terms of the GNU General Public License as published by the Free
16 // Software Foundation; either version 2 or (at your option) any later version. 16 // Software Foundation; either version 2 or (at your option) any later version.
17 // 17 //
245 CYGACC_COMM_IF_CONTROL(*__chan, __COMMCTL_SET_TIMEOUT, ms); 245 CYGACC_COMM_IF_CONTROL(*__chan, __COMMCTL_SET_TIMEOUT, ms);
246 } 246 }
247 } 247 }
248 } 248 }
249 249
250 //
251 // Test for ^C on the console. CAUTION! discards all console input
252 //
253 bool
254 _rb_break(int timeout)
255 {
256 char c;
257 mon_set_read_char_timeout(timeout);
258 if (mon_read_char_with_timeout(&c)) {
259 if (c == 0x03) { // Test for ^C
260 return true;
261 }
262 }
263 return false;
264 }
265
250 #ifdef CYGFUN_REDBOOT_BOOT_SCRIPT 266 #ifdef CYGFUN_REDBOOT_BOOT_SCRIPT
251 #define __STRINGIFY(x) #x 267 #define __STRINGIFY(x) #x
252 #define _STRINGIFY(x) __STRINGIFY(x) 268 #define _STRINGIFY(x) __STRINGIFY(x)
253 #define _STARTUP_STR _STRINGIFY(CYG_HAL_STARTUP) "}" 269 #define _STARTUP_STR _STRINGIFY(CYG_HAL_STARTUP) "}"
254 270