int console_init(void) { printf("console_init: entry\n"); /* add all the statically defined commands to the list */ cmd_block *block; for (block = &__commands_start; block != &__commands_end; block++) { console_register_commands(block); } return 0; }
int console_init(void) { LTRACE_ENTRY; command_lock = malloc(sizeof(mutex_t)); mutex_init(command_lock); /* add all the statically defined commands to the list */ cmd_block *block; for (block = &__commands_start; block != &__commands_end; block++) { console_register_commands(block); } init_history(); return 0; }
int console_init(void) { LTRACE_ENTRY; command_lock = calloc(sizeof(mutex_t), 1); mutex_init(command_lock); /* add all the statically defined commands to the list */ cmd_block *block; for (block = &__commands_start; block != &__commands_end; block++) { console_register_commands(block); } #if CONSOLE_ENABLE_HISTORY init_history(); #endif return 0; }
LOCAL void console_mod_start(void) { SERIAL_PORT_PROPERTIES port_properties; SER_PORT_UART_CONFIG port_config; A_STATUS status; #ifdef CONFIG_CLI console_register_commands(Default_console_commands,NUM_DEFAULT_CONSOLE_CMDS); #else console_mod_register_commands(Default_console_commands,NUM_DEFAULT_CONSOLE_CMDS); #endif /* open the logical port */ Console_info->port = SERP_Open(Console_info->config.logical_port_name, NULL, console_serial_event_callback, &port_properties); A_MEMZERO(&port_config,sizeof(port_config)); port_config.Baud = Console_info->config.baud; port_config.DataBits = 8; port_config.StopBits = 1; /* configure port */ status = SERP_Ioctl(Console_info->port, SER_PORT_IOCTL_CONFIG_UART_PORT, &port_config, sizeof(port_config)); A_ASSERT(A_SUCCESS(status)); /* set receiver threshold to 1 character */ SERP_Ioctl(Console_info->port,SER_PORT_IOCTL_SET_RX_THRESH,NULL,1); if (Console_info->config.flags & CONSOLE_CONFIG_FLAGS_ALLOW_RX_SUSPEND) { Console_info->flags |= CONSOLE_FLAGS_ALLOW_RX_SUSPEND; } if (Console_info->config.flags & CONSOLE_CONFIG_FLAGS_USE_HW_RX_WAKE) { /* try using hardware for RX wake */ Console_info->flags |= CONSOLE_FLAGS_USE_HW_RX_SUSP; } if ((UART_SERP_UART0_INSTANCE_ID == Console_info->config.phys_uart_id) || (Console_info->flags & CONSOLE_FLAGS_ALLOW_RX_SUSPEND)) { console_suspend_rx(0,NULL); /* install uart control commands */ #ifdef CONFIG_CLI console_register_commands(&Console_uart_control,1); #else console_mod_register_commands(&Console_uart_control,1); //ychen #endif } #ifndef USE_STANDALONE_CONSOLE _A_OS_INDIRECTION_TABLE->cmnos.serial._serial_putc = console_putc_replacement; #endif _A_OS_INDIRECTION_TABLE->cmnos.serial._serial_getc = console_getc_replacement; _A_OS_INDIRECTION_TABLE->cmnos.serial._serial_restore_funcs = console_restore_replacement; CONSOLE_OUTPUT("\nCLI:"); Console_info->flags = 0; CONSOLE_OUTPUT(CONSOLE_PROMPT_LINE); }