void cmn_platform_init() { #ifdef BUILD_INT_HANDLERS platform_int_init(); #endif #ifdef BUILD_SERMUX unsigned i; unsigned bufsizes[] = SERMUX_BUFFER_SIZES; // Setup the serial multiplexer platform_uart_setup( SERMUX_PHYS_ID, SERMUX_PHYS_SPEED, 8, PLATFORM_UART_PARITY_NONE, PLATFORM_UART_STOPBITS_1 ); platform_uart_set_flow_control( SERMUX_PHYS_ID, SERMUX_FLOW_TYPE ); cmn_uart_setup_sermux(); // Set buffers for all virtual UARTs for( i = 0; i < sizeof( bufsizes ) / sizeof( unsigned ); i ++ ) platform_uart_set_buffer( i + SERMUX_SERVICE_ID_FIRST, bufsizes[ i ] ); #endif // #ifdef BUILD_SERMUX #if defined( CON_UART_ID ) && CON_UART_ID < SERMUX_SERVICE_ID_FIRST // Setup console UART platform_uart_setup( CON_UART_ID, CON_UART_SPEED, 8, PLATFORM_UART_PARITY_NONE, PLATFORM_UART_STOPBITS_1 ); platform_uart_set_flow_control( CON_UART_ID, CON_FLOW_TYPE ); platform_uart_set_buffer( CON_UART_ID, CON_BUF_SIZE ); #endif // #if defined( CON_UART_ID ) && CON_UART_ID < SERMUX_SERVICE_ID_FIRST #ifndef BUILD_WEB_SERVER // Set the send/recv functions std_set_send_func( uart_send ); std_set_get_func( uart_recv ); #endif #ifdef BUILD_XMODEM // Initialize XMODEM xmodem_init( xmodem_send, xmodem_recv ); #endif #ifdef BUILD_TERM // Initialize terminal term_init( TERM_LINES, TERM_COLS, term_out, term_in, term_translate ); #endif }
/** * Performs initialisation of the platform. */ void pexpert_init(void) { // Initialise the low-level components of the platform. platform_init(); /* * Initialise and parse the boot arguments. We do this before the console * to determine what console mode should be used, as the system may be in * graphical mode. */ platform_bootarg_parse(); // determine which console to initialise const platform_bootargs_t *args = platform_bootarg_get(); // With the platform initialised, initialise the console. if(!args->framebuffer.isVideo) { platform_console_txt_clear(); } KINFO("Initialising platform \"%s\"\n", platform_name); // Install interrupt handlers platform_int_init(); }