Index: redboot//current/cdl/redboot.cdl =================================================================== RCS file: /home/cvs/ecc/ecc/redboot/current/cdl/redboot.cdl,v retrieving revision 1.32 diff -u -5 -p -r1.32 redboot.cdl --- redboot//current/cdl/redboot.cdl 2001/01/30 19:04:07 1.32 +++ redboot//current/cdl/redboot.cdl 2001/01/31 19:48:36 @@ -147,10 +147,22 @@ cdl_package CYGPKG_REDBOOT { This option allows control over how long the CLI command line should be. This space will be allocated statically rather than from RedBoot's stack." } + cdl_option CYGNUM_REDBOOT_CLI_IDLE_TIMEOUT { + display "Command processing idle timeout (ms)" + flavor data + default_value 10 + description " + This option controls the timeout period before the + command processing is considered 'idle'. Making this + number smaller will cause idle processing to take place + more often, etc. The default value of 10ms is a reasonable + tradeoff between responsiveness and overhead." + } + cdl_component CYGPKG_REDBOOT_FLASH { display "Allow RedBoot to support FLASH programming" flavor bool default_value 1 active_if CYGPKG_IO_FLASH Index: redboot//current/include/redboot.h =================================================================== RCS file: /home/cvs/ecc/ecc/redboot/current/include/redboot.h,v retrieving revision 1.16 diff -u -5 -p -r1.16 redboot.h --- redboot//current/include/redboot.h 2001/01/31 18:30:23 1.16 +++ redboot//current/include/redboot.h 2001/01/31 18:35:42 @@ -153,11 +153,23 @@ struct init_tab_entry { } CYG_HAL_TABLE_TYPE; #define _RedBoot_init(_f_,_p_) \ struct init_tab_entry _init_tab_##_p_##_f_ CYG_HAL_TABLE_QUALIFIED_ENTRY(RedBoot_inits,_f_) = { _f_ }; #define RedBoot_init(_f_,_p_) _RedBoot_init(_f_,_p_) - +// Main loop [idle] call-back functions +#define RedBoot_IDLE_FIRST 0000 +#define RedBoot_IDLE_BEFORE_NETIO 3000 +#define RedBoot_IDLE_NETIO 5000 +#define RedBoot_IDLE_AFTER_NETIO 7000 +#define RedBoot_IDLE_LAST 9999 +struct idle_tab_entry { + void_fun_ptr fun; +} CYG_HAL_TABLE_TYPE; +#define _RedBoot_idle(_f_,_p_) \ +struct idle_tab_entry _idle_tab_##_p_##_f_ CYG_HAL_TABLE_QUALIFIED_ENTRY(RedBoot_idle,_f_) = { _f_ }; +#define RedBoot_idle(_f_,_p_) _RedBoot_idle(_f_,_p_) + // Option processing support struct option_info { char flag; bool takes_arg; Index: redboot//current/src/main.c =================================================================== RCS file: /home/cvs/ecc/ecc/redboot/current/src/main.c,v retrieving revision 1.37 diff -u -5 -p -r1.37 main.c --- redboot//current/src/main.c 2001/01/31 18:30:23 1.37 +++ redboot//current/src/main.c 2001/01/31 19:48:35 @@ -99,14 +99,19 @@ RedBoot_cmd("reset", // Define table boundaries CYG_HAL_TABLE_BEGIN( __RedBoot_INIT_TAB__, RedBoot_inits ); CYG_HAL_TABLE_END( __RedBoot_INIT_TAB_END__, RedBoot_inits ); extern struct init_tab_entry __RedBoot_INIT_TAB__[], __RedBoot_INIT_TAB_END__; + CYG_HAL_TABLE_BEGIN( __RedBoot_CMD_TAB__, RedBoot_commands ); CYG_HAL_TABLE_END( __RedBoot_CMD_TAB_END__, RedBoot_commands ); extern struct cmd __RedBoot_CMD_TAB__[], __RedBoot_CMD_TAB_END__; +CYG_HAL_TABLE_BEGIN( __RedBoot_IDLE_TAB__, RedBoot_idle ); +CYG_HAL_TABLE_END( __RedBoot_IDLE_TAB_END__, RedBoot_idle ); +extern struct idle_tab_entry __RedBoot_IDLE_TAB__[], __RedBoot_IDLE_TAB_END__; + #ifdef HAL_ARCH_PROGRAM_NEW_STACK extern void HAL_ARCH_PROGRAM_NEW_STACK(void *fun); #endif void @@ -131,10 +136,11 @@ cyg_start(void) bool prompt = true; static char line[CYGPKG_REDBOOT_MAX_CMD_LINE]; struct cmd *cmd; int cur = CYGACC_CALL_IF_SET_CONSOLE_COMM(CYGNUM_CALL_IF_SET_COMM_ID_QUERY_CURRENT); struct init_tab_entry *init_entry; + struct idle_tab_entry *idle_entry; CYGACC_CALL_IF_SET_CONSOLE_COMM(CYGNUM_HAL_VIRTUAL_VECTOR_CONSOLE_CHANNEL); #ifdef CYGPKG_REDBOOT_ANY_CONSOLE console_selected = false; #endif @@ -164,25 +170,23 @@ cyg_start(void) unsigned char *hold_script = script; int script_timeout_ms = script_timeout * CYGNUM_REDBOOT_FLASH_SCRIPT_TIMEOUT_RESOLUTION; printf("== Executing boot script in %d.%03d seconds - enter ^C to abort\n", script_timeout_ms/1000, script_timeout_ms%1000); script = (unsigned char *)0; - while (script_timeout_ms >= 10) { - res = gets(line, sizeof(line), 10); + while (script_timeout_ms >= CYGNUM_REDBOOT_CLI_IDLE_TIMEOUT) { + res = gets(line, sizeof(line), CYGNUM_REDBOOT_CLI_IDLE_TIMEOUT); if (res == _GETS_OK) { printf("== Executing boot script in %d.%03d seconds - enter ^C to abort\n", script_timeout_ms/1000, script_timeout_ms%1000); continue; // Ignore anything but ^C } if (res != _GETS_TIMEOUT) break; -#ifdef CYGPKG_REDBOOT_NETWORKING - if (have_net) { - // Check for incoming TCP debug connection - net_io_test(); + for (idle_entry = __RedBoot_IDLE_TAB__; + idle_entry != &__RedBoot_IDLE_TAB_END__; idle_entry++) { + (*idle_entry->fun)(); } -#endif - script_timeout_ms -= 10; + script_timeout_ms -= CYGNUM_REDBOOT_CLI_IDLE_TIMEOUT; } if (res == _GETS_CTRLC) { script = (unsigned char *)0; // Disable script } else { script = hold_script; // Re-enable script @@ -193,19 +197,17 @@ cyg_start(void) while (true) { if (prompt) { printf("RedBoot> "); prompt = false; } - res = gets(line, sizeof(line), 250); + res = gets(line, sizeof(line), CYGNUM_REDBOOT_CLI_IDLE_TIMEOUT); if (res == _GETS_TIMEOUT) { // No input arrived -#ifdef CYGPKG_REDBOOT_NETWORKING - if (have_net) { - // Check for incoming TCP debug connection - net_io_test(); + for (idle_entry = __RedBoot_IDLE_TAB__; + idle_entry != &__RedBoot_IDLE_TAB_END__; idle_entry++) { + (*idle_entry->fun)(); } -#endif } else { if (res == _GETS_GDB) { // Special case of '$' - need to start GDB protocol gdb_active = true; CYGACC_CALL_IF_SET_CONSOLE_COMM(cur); Index: redboot//current/src/net/net_io.c =================================================================== RCS file: /home/cvs/ecc/ecc/redboot/current/src/net/net_io.c,v retrieving revision 1.19 diff -u -5 -p -r1.19 net_io.c --- redboot//current/src/net/net_io.c 2001/01/31 18:30:23 1.19 +++ redboot//current/src/net/net_io.c 2001/01/31 18:36:27 @@ -474,13 +474,15 @@ net_io_init(void) #ifdef DEBUG_TCP printf("show tcp = %p\n", (void *)&show_tcp); #endif } +// Check for incoming TCP debug connection void net_io_test(void) { + if (!have_net) return; __tcp_poll(); if (state != tcp_sock.state) { // Something has changed if (tcp_sock.state == _ESTABLISHED) { // A new connection has arrived @@ -492,10 +494,15 @@ net_io_test(void) net_io_init(); // Get ready for another connection } } state = tcp_sock.state; } + +// This schedules the 'net_io_test()' function to be run by RedBoot's +// main command loop when idle (i.e. when no input arrives after some +// period of time). +RedBoot_idle(net_io_test, RedBoot_IDLE_NETIO); // // Network initialization // #include