static void console_serial_event_callback(void *context, A_UINT16 event, A_UINT32 arg0, A_UINT32 arg1) { #if 1 //#ifdef RTOS_TX_BLOCKING extern void wakeup_task_execute_cli_cmd(void); #endif switch (event) { case SERIAL_EVENT_RX_AVAIL : #if 0 //#ifndef RTOS_TX_BLOCKING console_process_char(); #else wakeup_task_execute_cli_cmd(); #endif break; case SERIAL_EVENT_RX_WAKE : /* this is a one-shot event, it will not occur until we * re-enable RX wake in the uart driver */ Console_info->flags &= ~CONSOLE_FLAGS_RX_WAKE_ENABLED; schedule_console_idle_recv_timer(); #if 0 //#ifndef RTOS_TX_BLOCKING console_process_char(); #else wakeup_task_execute_cli_cmd(); #endif break; default: break; } }
void console_thread_func( uint32_t arg ) { wiced_result_t result; uint8_t received_character; UNUSED_PARAMETER(result); /* turn off buffers, so IO occurs immediately */ setvbuf( stdin, NULL, _IONBF, 0 ); setvbuf( stdout, NULL, _IONBF, 0 ); setvbuf( stderr, NULL, _IONBF, 0 ); for(;;) { result = wiced_uart_receive_bytes( cons.uart, &received_character, 1, 1000 ); if( result == WICED_SUCCESS ) { console_process_char( received_character ); } else { if( cons.quit == WICED_TRUE ) { wiced_rtos_set_semaphore(&cons.console_quit_semaphore); break; } } } }
void console_app_main( void ) { /* turn off buffers, so IO occurs immediately */ setvbuf( stdin, NULL, _IONBF, 0 ); setvbuf( stdout, NULL, _IONBF, 0 ); setvbuf( stderr, NULL, _IONBF, 0 ); printf( "Console app\r\n" ); console_init( commands, MAX_LINE_LENGTH, line_buffer, MAX_HISTORY_LENGTH, history_buffer_storage); while ( 1 ) { console_process_char( getchar( ) ); } }
cmd_err_t console_process_char_with_tab_complete( char c ) { tab_handling_func = console_do_tab; return console_process_char( c ); }