static int ns16550_pm_resume(struct td_device *td_dev) { struct ns16550_pm_device *pmdev = td_dev->priv; pmdev->zephyr_device->config->init(pmdev->zephyr_device); uart_console_init(td_dev); return 0; }
static void consoleInit(void) { struct uart_init_info info; uart_generic_info_init(&info); uart_init(CONFIG_UART_CONSOLE_INDEX, &info); uart_console_init(); }
static int ns16550_pm_init(struct td_device *td_dev) { /* Re-init uart with device settings */ ns16550_pm_isr = td_dev; /* Re-init hardware : assumed to be done by Zephyr before this point */ //uart_init(dev); uart_console_init(td_dev); return 0; }
void stdio_init(void) { struct uart_console_dev * dev; struct tty_dev * tty; FILE * f_tty; FILE * f_raw; dev = uart_console_init(115200, SERIAL_8N1); f_raw = uart_console_fopen(dev); tty = tty_attach(f_raw); f_tty = tty_fopen(tty); stderr = (struct file *)&stm32_uart_file; stdout = f_tty; stdin = f_tty; }
int main(int argc, char **argv) { int32_t r; process_init(); // run before any function that starts a process pic32_init(); watchdog_init(); leds_init(); leds_progress_init(); buzzer_init(); clock_init(); rtimer_init(); ctimer_init(); leds_on(LEDS_ALL); /* Serial line init part 2/3: set up the UART port. */ uart_console_init(UART_BAUDRATE); // usb_serial_init(); // usb_serial_set_input(serial_line_input_byte); /* Serial line init part 3/3: start the OS process. */ serial_line_init(); asm volatile("ei"); // enable interrupts PRINTF("CPU Clock: %uMhz\n", pic32_clock_get_system_clock() / 1000000); PRINTF("Peripheral Clock: %uMhz\n", pic32_clock_get_peripheral_clock() / 1000000); random_init(4321); process_start(&etimer_process, NULL); process_start(&sensors_process, NULL); SENSORS_ACTIVATE(button_sensor); /* Starting autostarting process */ print_processes(autostart_processes); autostart_start(autostart_processes); leds_off(LEDS_ALL); watchdog_start(); PRINTF("Starting the main scheduler loop\n"); /* * This is the scheduler loop. */ while (1) { do { /* Reset watchdog. */ watchdog_periodic(); r = process_run(); } while (r > 0); #if LPM_MODE > LPM_MODE_NONE watchdog_stop(); /* low-power mode start */ asm volatile("wait"); /* low-power mode end */ watchdog_start(); #endif // LPM_MODE } return 0; }