comparison packages/redboot/current/src/main.c @ 907:a289defa82f0

go command enhancements
author msalter
date Fri, 04 Apr 2003 15:41:16 +0000
parents 900f348771ef
children 6aa5728bb6a0
comparison
equal deleted inserted replaced
906:371979c5cc1e 907:a289defa82f0
58 #include <cyg/hal/hal_arch.h> 58 #include <cyg/hal/hal_arch.h>
59 #include <cyg/hal/hal_intr.h> 59 #include <cyg/hal/hal_intr.h>
60 #include <cyg/hal/hal_if.h> 60 #include <cyg/hal/hal_if.h>
61 #include <cyg/hal/hal_cache.h> 61 #include <cyg/hal/hal_cache.h>
62 #include CYGHWR_MEMORY_LAYOUT_H 62 #include CYGHWR_MEMORY_LAYOUT_H
63
64 #ifdef CYGPKG_IO_ETH_DRIVERS
65 #include <cyg/io/eth/eth_drv.h> // Logical driver interfaces
66 #endif
63 67
64 #include <cyg/hal/hal_tables.h> 68 #include <cyg/hal/hal_tables.h>
65 69
66 #ifdef CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS 70 #ifdef CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS
67 #ifdef CYGBLD_HAL_PLATFORM_STUB_H 71 #ifdef CYGBLD_HAL_PLATFORM_STUB_H
418 } 422 }
419 423
420 void 424 void
421 do_go(int argc, char *argv[]) 425 do_go(int argc, char *argv[])
422 { 426 {
427 int i, cur;
423 unsigned long entry; 428 unsigned long entry;
424 unsigned long oldints; 429 unsigned long oldints;
425 bool wait_time_set; 430 bool wait_time_set;
426 int wait_time, res; 431 int wait_time, res;
427 bool cache_enabled = false; 432 bool cache_enabled = false;
428 struct option_info opts[2]; 433 bool stop_net = false;
434 struct option_info opts[3];
429 char line[8]; 435 char line[8];
430 hal_virtual_comm_table_t *__chan = CYGACC_CALL_IF_CONSOLE_PROCS(); 436 hal_virtual_comm_table_t *__chan;
431 437
432 entry = entry_address; // Default from last 'load' operation 438 entry = entry_address; // Default from last 'load' operation
433 init_opts(&opts[0], 'w', true, OPTION_ARG_TYPE_NUM, 439 init_opts(&opts[0], 'w', true, OPTION_ARG_TYPE_NUM,
434 (void **)&wait_time, (bool *)&wait_time_set, "wait timeout"); 440 (void **)&wait_time, (bool *)&wait_time_set, "wait timeout");
435 init_opts(&opts[1], 'c', false, OPTION_ARG_TYPE_FLG, 441 init_opts(&opts[1], 'c', false, OPTION_ARG_TYPE_FLG,
436 (void **)&cache_enabled, (bool *)0, "go with caches enabled"); 442 (void **)&cache_enabled, (bool *)0, "go with caches enabled");
437 if (!scan_opts(argc, argv, 1, opts, 2, (void *)&entry, OPTION_ARG_TYPE_NUM, "starting address")) 443 init_opts(&opts[2], 'n', false, OPTION_ARG_TYPE_FLG,
444 (void **)&stop_net, (bool *)0, "go with network driver stopped");
445 if (!scan_opts(argc, argv, 1, opts, 3, (void *)&entry, OPTION_ARG_TYPE_NUM, "starting address"))
438 { 446 {
439 return; 447 return;
440 } 448 }
441 if (wait_time_set) { 449 if (wait_time_set) {
442 int script_timeout_ms = wait_time * 1000; 450 int script_timeout_ms = wait_time * 1000;
455 return; 463 return;
456 } 464 }
457 script_timeout_ms -= CYGNUM_REDBOOT_CLI_IDLE_TIMEOUT; 465 script_timeout_ms -= CYGNUM_REDBOOT_CLI_IDLE_TIMEOUT;
458 } 466 }
459 } 467 }
468
469 // Mask interrupts on all channels
470 cur = CYGACC_CALL_IF_SET_CONSOLE_COMM(CYGNUM_CALL_IF_SET_COMM_ID_QUERY_CURRENT);
471 for (i = 0; i < CYGNUM_HAL_VIRTUAL_VECTOR_NUM_CHANNELS; i++) {
472 CYGACC_CALL_IF_SET_CONSOLE_COMM(i);
473 __chan = CYGACC_CALL_IF_CONSOLE_PROCS();
474 CYGACC_COMM_IF_CONTROL( *__chan, __COMMCTL_IRQ_DISABLE );
475 }
476 CYGACC_CALL_IF_SET_CONSOLE_COMM(cur);
477
478 __chan = CYGACC_CALL_IF_CONSOLE_PROCS();
460 CYGACC_COMM_IF_CONTROL(*__chan, __COMMCTL_ENABLE_LINE_FLUSH); 479 CYGACC_COMM_IF_CONTROL(*__chan, __COMMCTL_ENABLE_LINE_FLUSH);
461 480
481 #ifdef CYGPKG_IO_ETH_DRIVERS
482 if (stop_net)
483 eth_drv_stop();
484 #endif
485
462 HAL_DISABLE_INTERRUPTS(oldints); 486 HAL_DISABLE_INTERRUPTS(oldints);
463 HAL_DCACHE_SYNC(); 487 HAL_DCACHE_SYNC();
464 if (!cache_enabled) { 488 if (!cache_enabled) {
465 HAL_ICACHE_DISABLE(); 489 HAL_ICACHE_DISABLE();
466 HAL_DCACHE_DISABLE(); 490 HAL_DCACHE_DISABLE();