int main(int argc, char ** argv) { struct vcom vcom; int i = 0; DCC_LOG_CONNECT(); DCC_LOG_INIT(); thinkos_init(THINKOS_OPT_PRIORITY(0) | THINKOS_OPT_ID(0)); vcom.usb = usb_cdc_init(); vcom.serial = serial_init(stm32f_uart5); thinkos_thread_create((void *)usb_recv_task, (void *)&vcom, usb_recv_stack, STACK_SIZE, 0); thinkos_thread_create((void *)usb_ctrl_task, (void *)&vcom, usb_ctrl_stack, STACK_SIZE, 0); thinkos_thread_create((void *)serial_recv_task, (void *)&vcom, serial_recv_stack, STACK_SIZE, 0); thinkos_thread_create((void *)serial_ctrl_task, (void *)&vcom, serial_ctrl_stack, STACK_SIZE, 0); for (i = 0; ;i++) { thinkos_sleep(10000); } return 0; }
int main(int argc, char ** argv) { int i; DCC_LOG_INIT(); DCC_LOG_CONNECT(); DCC_LOG(LOG_TRACE, "1. cm3_udelay_calibrate()"); /* calibrate usecond delay loop */ cm3_udelay_calibrate(); DCC_LOG(LOG_TRACE, "2. io_init()"); io_init(); DCC_LOG(LOG_TRACE, "3. thinkos_init()"); thinkos_init(THINKOS_OPT_PRIORITY(0) | THINKOS_OPT_ID(32)); tmr_sem = thinkos_sem_alloc(0); DCC_LOG1(LOG_TRACE, "tmr_sem=%d", tmr_sem); oneshot_timer_init(168000000 / 2); periodic_timer_init(2); for (i = 0; ; ++i) { if ((i & 0x7) == 0) DCC_LOG3(LOG_TRACE, "i=%d IRQ=%d TMR=%d", i, irq_count, tmr_count); thinkos_sem_wait(tmr_sem); thinkos_sem_wait(tmr_sem); // if (irq_count != tmr_count) // DCC_LOG2(LOG_TRACE, "IRQ=%d TMR=%d", irq_count, tmr_count); // thinkos_sleep((1 + (i % 9)) * 100); } return 0; }
int main(int argc, char ** argv) { usb_cdc_class_t * cdc; FILE * f_tty; FILE * f_raw; struct tty_dev * tty; int i; DCC_LOG_INIT(); DCC_LOG_CONNECT(); DCC_LOG(LOG_TRACE, "1. cm3_udelay_calibrate()"); cm3_udelay_calibrate(); DCC_LOG(LOG_TRACE, "2. thinkos_init()"); thinkos_init(THINKOS_OPT_PRIORITY(8) | THINKOS_OPT_ID(7)); DCC_LOG(LOG_TRACE, "usb_cdc_init()"); cdc = usb_cdc_init(&stm32f_otg_fs_dev, *((uint64_t *)STM32F_UID)); DCC_LOG(LOG_TRACE, "usb_cdc_fopen()"); f_raw = usb_cdc_fopen(cdc); tty = tty_attach(f_raw); f_tty = tty_fopen(tty); for (i = 0; ;i++) { // usb_xmodem_recv(cdc); thinkos_sleep(2000); fprintf(f_tty, "[%d] hello world...\n", i); } return 0; }
int main(int argc, char ** argv) { usb_cdc_class_t * cdc; DCC_LOG_INIT(); DCC_LOG_CONNECT(); DCC_LOG(LOG_TRACE, "1. cm3_udelay_calibrate()"); cm3_udelay_calibrate(); DCC_LOG(LOG_TRACE, "2. thinkos_init()"); thinkos_init(THINKOS_OPT_PRIORITY(8) | THINKOS_OPT_ID(7)); DCC_LOG(LOG_TRACE, "3. io_init()"); io_init(); DCC_LOG(LOG_TRACE, "4. external_bus_init()"); external_bus_init(); DCC_LOG(LOG_TRACE, "5. stdio_init()"); stdio_init(); printf("\n---\n"); DCC_LOG(LOG_TRACE, "6. trace_init()"); trace_init(); DCC_LOG(LOG_TRACE, "7. env_init()"); env_init(); /* create some threads */ DCC_LOG(LOG_TRACE, "8. monitor_init()"); monitor_init(); DCC_LOG(LOG_TRACE, "9. watchdog_init()"); watchdog_init(); DCC_LOG(LOG_TRACE, "10. net_init()"); net_init(); DCC_LOG(LOG_TRACE, "11. pkt_xmt_init()"); pkt_xmt_init(); net_pkt_mode(true); DCC_LOG(LOG_TRACE, "12. console_shell_init()"); console_shell_init(); DCC_LOG(LOG_TRACE, "13. usb_cdc_init()"); usb_cdc_sn_set(*((uint64_t *)STM32F_UID)); cdc = usb_cdc_init(&stm32f_otg_fs_dev, cdc_acm_def_str, cdc_acm_def_strcnt); DCC_LOG(LOG_TRACE, "14. usb_shell()"); for (;;) { usb_shell(cdc); } }
int main(int argc, char ** argv) { uint32_t * uid = STM32F_UID; int i = 0; DCC_LOG_INIT(); DCC_LOG_CONNECT(); /* calibrate usecond delay loop */ cm3_udelay_calibrate(); DCC_LOG(LOG_TRACE, "1. io_init()"); io_init(); DCC_LOG(LOG_TRACE, "2. leds_init()"); leds_init(); DCC_LOG(LOG_TRACE, "3. stdio_init()"); stdio_init(); printf("\n\n"); printf("-----------------------------------------\n"); printf(" RS485 token ring network test\n"); printf("-----------------------------------------\n"); printf("\n"); DCC_LOG(LOG_TRACE, "4. thinkos_init()"); thinkos_init(THINKOS_OPT_PRIORITY(0) | THINKOS_OPT_ID(32)); DCC_LOG(LOG_TRACE, "5. net_init()"); net_init(); thinkos_thread_create((void *)supervisor_task, (void *)NULL, supervisor_stack, sizeof(supervisor_stack), THINKOS_OPT_PRIORITY(0) | THINKOS_OPT_ID(0)); thinkos_thread_create((void *)tx_task, (void *)NULL, tx_stack, sizeof(tx_stack), THINKOS_OPT_PRIORITY(1) | THINKOS_OPT_ID(1)); thinkos_thread_create((void *)rx_task, (void *)NULL, rx_stack, sizeof(rx_stack), THINKOS_OPT_PRIORITY(2) | THINKOS_OPT_ID(2)); printf("UID=%08x:%08x:%08x\n", uid[2], uid[1], uid[0]); DCC_LOG3(LOG_TRACE, "UID=%08x:%08x:%08x", uid[2], uid[1], uid[0]); for (i = 0; ; ++i) { thinkos_sleep(1000); } return 0; }
int main(int argc, char ** argv) { DCC_LOG_INIT(); DCC_LOG_CONNECT(); DCC_LOG(LOG_TRACE, "1. io_init()."); board_init(); DCC_LOG(LOG_TRACE, "2. thinkos_init()."); thinkos_init(THINKOS_OPT_PRIORITY(0) | THINKOS_OPT_ID(0)); board_test(); __thinkos_thread_abort(0); return 0; }
int main(int argc, char ** argv) { struct dmon_comm * comm; DCC_LOG_INIT(); DCC_LOG_CONNECT(); #ifndef UDELAY_FACTOR DCC_LOG(LOG_TRACE, "1. cm3_udelay_calibrate()."); cm3_udelay_calibrate(); #endif DCC_LOG(LOG_TRACE, "2. thinkos_init()."); thinkos_init(THINKOS_OPT_PRIORITY(0) | THINKOS_OPT_ID(0)); #if THINKOS_ENABLE_MPU DCC_LOG(LOG_TRACE, "3. thinkos_mpu_init()"); thinkos_mpu_init(0x0c00); #endif DCC_LOG(LOG_TRACE, "4. board_init()."); this_board.init(); DCC_LOG(LOG_TRACE, "5. thinkos_console_init()"); thinkos_console_init(); DCC_LOG(LOG_TRACE, "6. usb_comm_init()"); comm = usb_comm_init(&stm32f_otg_fs_dev); DCC_LOG(LOG_TRACE, "7. thinkos_dmon_init()"); thinkos_dmon_init(comm, monitor_task); #if THINKOS_ENABLE_MPU DCC_LOG(LOG_TRACE, "8. thinkos_userland()"); thinkos_userland(); #endif DCC_LOG(LOG_TRACE, "9. thinkos_thread_abort()"); thinkos_thread_abort(thinkos_thread_self()); return 0; }
int main(int argc, char ** argv) { struct usb_cdc_class * cdc; struct serial_dev * serial; struct vcom vcom; int i; DCC_LOG_INIT(); DCC_LOG_CONNECT(); /* calibrate usecond delay loop */ cm3_udelay_calibrate(); DCC_LOG(LOG_TRACE, "1. io_init()"); io_init(); DCC_LOG(LOG_TRACE, "2. thinkos_init()"); thinkos_init(THINKOS_OPT_PRIORITY(3) | THINKOS_OPT_ID(3)); leds_init(); cdc = usb_cdc_init(&stm32f_usb_fs_dev, cdc_acm_str, cdc_acm_strcnt); serial = serial2_open(); vcom.serial = serial; vcom.cdc = cdc; vcom.mode = VCOM_MODE_NONE; thinkos_thread_create((void *)led_task, (void *)NULL, led_stack, sizeof(led_stack) | THINKOS_OPT_PRIORITY(1) | THINKOS_OPT_ID(1)); thinkos_thread_create((void *)serial_recv_task, (void *)&vcom, serial_recv_stack, sizeof(serial_recv_stack) | THINKOS_OPT_PRIORITY(0) | THINKOS_OPT_ID(0)); thinkos_thread_create((void *)serial_ctrl_task, (void *)&vcom, serial_ctrl_stack, sizeof(serial_ctrl_stack) | THINKOS_OPT_PRIORITY(2) | THINKOS_OPT_ID(2)); usb_vbus(true); for (i = 0; i < 5; ++i) { led_on(LED_AMBER); thinkos_sleep(100); led_off(LED_AMBER); led_on(LED_RED); thinkos_sleep(100); led_off(LED_RED); } for (;;) { usb_recv_task(&vcom); } }
int main(int argc, char ** argv) { int led = 0; int ret; int i; DCC_LOG_INIT(); DCC_LOG_CONNECT(); /* calibrate usecond delay loop */ cm3_udelay_calibrate(); DCC_LOG(LOG_TRACE, "1. io_init()"); io_init(); DCC_LOG(LOG_TRACE, "2. leds_init()"); leds_init(); DCC_LOG(LOG_TRACE, "3. thinkos_init()"); thinkos_init(THINKOS_OPT_PRIORITY(0) | THINKOS_OPT_ID(32)); DCC_LOG(LOG_TRACE, "4. stdio_init()"); stdio_init(); printf("\n\n"); printf("-----------------------------------------\n"); printf(" I2C slave test\n"); printf("-----------------------------------------\n"); printf("\n"); for (i = 0; i < IO_MEM_SIZE; ++i) io_mem[i] = i * 2; i2c_slave_init(100000, 0x55, io_mem, IO_MEM_SIZE); i2c_slave_enable(); for (i = 0; ; ++i) { if ((i & 0xff) == 0) { led = i % 5; led_on(led); } ret = i2c_slave_io(); switch (ret) { case I2C_XFER_IN: printf("In "); break; case I2C_XFER_OUT: printf("Out "); break; case I2C_XFER_ERR: printf("Err "); break; } led_off(led); } return 0; }
int main(int argc, char ** argv) { int ret; DCC_LOG_INIT(); DCC_LOG_CONNECT(); stdio_init(); printf("\n---\n"); cm3_udelay_calibrate(); thinkos_init(THINKOS_OPT_PRIORITY(0) | THINKOS_OPT_ID(0)); trace_init(); tracef("## YARD-ICE " VERSION_NUM " - " VERSION_DATE " ##"); stm32f_nvram_env_init(); bsp_io_ini(); rtc_init(); supervisor_init(); __os_sleep(10); #if ENABLE_NETWORK DCC_LOG(LOG_TRACE, "network_config()."); network_config(); #endif DCC_LOG(LOG_TRACE, "modules_init()."); modules_init(); tracef("* Starting system module ..."); DCC_LOG(LOG_TRACE, "sys_start()."); sys_start(); tracef("* Initializing YARD-ICE debugger..."); DCC_LOG(LOG_TRACE, "debugger_init()."); debugger_init(); tracef("* Initializing JTAG module ..."); DCC_LOG(LOG_TRACE, "jtag_start()."); if ((ret = jtag_start()) < 0) { tracef("jtag_start() failed! [ret=%d]", ret); debugger_except("JTAG driver fault"); } #if (ENABLE_NAND) tracef("* Initializing NAND module..."); if (mod_nand_start() < 0) { tracef("mod_nand_start() failed!"); return 0; } #endif #if (ENABLE_I2C) tracef("* starting I2C module ... "); i2c_init(); #endif tracef("* configuring initial target ... "); init_target(); #if (ENABLE_VCOM) tracef("* starting VCOM daemon ... "); /* connect the UART to the JTAG auxiliary pins */ jtag3ctrl_aux_uart(true); vcom_start(); #endif #if (ENABLE_COMM) tracef("* starting COMM daemon ... "); comm_tcp_start(&debugger.comm); #endif #if (ENABLE_TFTP) tracef("* starting TFTP server ... "); tftpd_start(); #endif #if (ENABLE_GDB) tracef("* starting GDB daemon ... "); gdb_rspd_start(); #endif #if ENABLE_USB tracef("* starting USB shell ... "); usb_shell(); #endif #if ENABLE_TELNET tracef("* starting TELNET server ... "); telnet_shell(); #endif return console_shell(); }