/* initialize for touch & calibration */ int touch_calibration_init(void) { rt_uint8_t magic = 0; calculate_data_t data; struct rtgui_calibration_ops *ops; ops = calibration_get_ops(); /* initialization the eeprom on chip */ EEPROM_Init(); /* initialization the touch driver */ rtgui_touch_hw_init("spi10"); /* set callback to save calibration data */ calibration_set_after(calibration_data_save); /* initialization rtgui tonch server */ rtgui_touch_init(ops); /* restore calibration data */ EEPROM_Read(0, CALIBRATION_DATA_PAGE, &magic, MODE_8_BIT, 1); if (CALIBRATION_DATA_MAGIC != magic) { rt_kprintf("touch is not calibration,now calibration it please.\n"); calibration_init(RT_NULL); } else { EEPROM_Read(CALIBRATION_DATA_OFFSET, CALIBRATION_DATA_PAGE, &data, MODE_8_BIT, sizeof(calculate_data_t)); calibration_set_data(&data); } /* power down the EEPROM */ EEPROM_PowerDown(ENABLE); return 0; }
void rt_init_thread_entry(void* parameter) { #ifdef RT_USING_COMPONENTS_INIT /* initialization RT-Thread Components */ rt_components_init(); #endif #ifdef RT_USING_FINSH finsh_set_device(RT_CONSOLE_DEVICE_NAME); #endif /* RT_USING_FINSH */ /* Filesystem Initialization */ #if defined(RT_USING_DFS) && defined(RT_USING_DFS_ELMFAT) /* mount sd card fat partition 1 as root directory */ if (dfs_mount("sd0", "/", "elm", 0, 0) == 0) { rt_kprintf("File System initialized!\n"); } else rt_kprintf("File System initialzation failed!\n"); #endif /* RT_USING_DFS */ #ifdef RT_USING_RTGUI { extern void rt_hw_lcd_init(); extern void rtgui_touch_hw_init(void); rt_device_t lcd; /* init lcd */ rt_hw_lcd_init(); /* init touch panel */ rtgui_touch_hw_init(); /* re-init device driver */ rt_device_init_all(); /* find lcd device */ lcd = rt_device_find("lcd"); /* set lcd device as rtgui graphic driver */ rtgui_graphic_set_device(lcd); #ifndef RT_USING_COMPONENTS_INIT /* init rtgui system server */ rtgui_system_server_init(); #endif calibration_set_restore(cali_setup); calibration_set_after(cali_store); calibration_init(); } #endif /* #ifdef RT_USING_RTGUI */ }
void rt_platform_init(void) { #ifdef RT_USING_SPI rt_hw_spi2_init(); #ifdef RT_USING_DFS w25qxx_init("flash0", "spi20"); #endif /* RT_USING_DFS */ #ifdef RT_USING_RTGUI /* initilize touch panel */ rtgui_touch_hw_init("spi21"); #endif /* RT_USING_RTGUI */ #endif /* RT_USING_SPI */ #ifdef RT_USING_USB_HOST /* register stm32 usb host controller driver */ rt_hw_susb_init(); #endif #ifdef RT_USING_DFS /* initilize sd card */ #ifdef RT_USING_SDIO rt_mmcsd_core_init(); rt_mmcsd_blk_init(); stm32f4xx_sdio_init(); rt_thread_delay(RT_TICK_PER_SECOND); #else rt_hw_sdcard_init(); #endif #endif /* RT_USING_DFS */ #ifdef RT_USING_RTGUI /* initilize ra8875 lcd controller */ ra8875_init(); /* initilize key module */ rt_hw_key_init(); #endif /* RT_USING_RTGUI */ #ifdef RT_USING_RTC rt_hw_rtc_init(); #endif /* RT_USING_RTC */ rt_thread_delay(50); rt_device_init_all(); }
void rt_init_thread_entry(void* parameter) { /* initialize LCD drv for GUI */ rtgui_lcd_init(); /* Filesystem Initialization */ mci_hw_init("sd0"); /* initialize the device file system */ dfs_init(); /* initialize the elm chan FatFS file system*/ elm_init(); /* mount sd card fat partition 1 as root directory */ if (dfs_mount("sd0", "/", "elm", 0, 0) == 0) { rt_kprintf("File System initialized!\n"); #if (RT_DFS_ELM_USE_LFN != 0) && (defined RT_DFS_ELM_CODE_PAGE_FILE) { extern void ff_convert_init(void); ff_convert_init(); } #endif } else { rt_kprintf("File System initialzation failed!\n"); } /* initialize GUI system */ rtgui_system_server_init(); /* initialize keyboard */ rt_hw_key_init(); /* initialize touch */ rt_hw_spi_init(); rtgui_touch_hw_init(); /* GUI examples initializtion */ application_init(); finsh_system_init(); }
void rt_init_thread_entry(void* parameter) { /* Filesystem Initialization */ #ifdef RT_USING_DFS { /* init the device filesystem */ dfs_init(); #ifdef RT_USING_DFS_ELMFAT /* init the elm chan FatFs filesystam*/ elm_init(); /* mount sd card fat partition 1 as root directory */ if (dfs_mount("sd0", "/", "elm", 0, 0) == 0) { rt_kprintf("File System initialized!\n"); } else rt_kprintf("File System initialzation failed!\n"); #endif } #endif /* LwIP Initialization */ #ifdef RT_USING_LWIP { extern void lwip_sys_init(void); /* register ethernetif device */ eth_system_device_init(); #ifdef STM32F10X_CL rt_hw_stm32_eth_init(); #else /* STM32F103 */ #if STM32_ETH_IF == 0 rt_hw_enc28j60_init(); #elif STM32_ETH_IF == 1 rt_hw_dm9000_init(); #endif #endif /* re-init device driver */ rt_device_init_all(); /* init lwip system */ lwip_sys_init(); rt_kprintf("TCP/IP initialized!\n"); } #endif #ifdef RT_USING_RTGUI { extern void rtgui_system_server_init(void); extern void rt_hw_lcd_init(); extern void rtgui_touch_hw_init(void); rt_device_t lcd; /* init lcd */ rt_hw_lcd_init(); /* init touch panel */ rtgui_touch_hw_init(); /* re-init device driver */ rt_device_init_all(); /* find lcd device */ lcd = rt_device_find("lcd"); /* set lcd device as rtgui graphic driver */ rtgui_graphic_set_device(lcd); /* init rtgui system server */ rtgui_system_server_init(); } #endif /* #ifdef RT_USING_RTGUI */ }
void rt_init_thread_entry(void *parameter) { /* Filesystem Initialization */ #ifdef RT_USING_DFS { /* init the device filesystem */ dfs_init(); #if defined(RT_USING_DFS_ELMFAT) /* init the elm chan FatFs filesystam*/ elm_init(); /* mount sd card fat partition 1 as root directory */ if (dfs_mount("sd0", "/", "elm", 0, 0) == 0) { rt_kprintf("File System initialized!\n"); } else rt_kprintf("File System initialzation failed!\n"); #endif #if defined(RT_USING_DFS_ROMFS) dfs_romfs_init(); if (dfs_mount(RT_NULL, "/rom", "rom", 0, &romfs_root) == 0) { rt_kprintf("ROM File System initialized!\n"); } else rt_kprintf("ROM File System initialzation failed!\n"); #endif #if defined(RT_USING_DFS_DEVFS) devfs_init(); if (dfs_mount(RT_NULL, "/dev", "devfs", 0, 0) == 0) rt_kprintf("Device File System initialized!\n"); else rt_kprintf("Device File System initialzation failed!\n"); #ifdef RT_USING_NEWLIB /* init libc */ libc_system_init("uart0"); #endif #endif #if defined(RT_USING_DFS) && defined(RT_USING_LWIP) && defined(RT_USING_DFS_NFS) /* NFSv3 Initialization */ nfs_init(); if (dfs_mount(RT_NULL, "/nfs", "nfs", 0, RT_NFS_HOST_EXPORT) == 0) rt_kprintf("NFSv3 File System initialized!\n"); else rt_kprintf("NFSv3 File System initialzation failed!\n"); #endif #if defined(RT_USING_DFS_UFFS) /* init the uffs filesystem */ dfs_uffs_init(); /* mount flash device as flash directory */ if (dfs_mount("nand0", "/nand0", "uffs", 0, 0) == 0) rt_kprintf("UFFS File System initialized!\n"); else rt_kprintf("UFFS File System initialzation failed!\n"); #endif } #endif #ifdef RT_USING_RTGUI { extern void rtgui_system_server_init(void); rt_device_t lcd; /* init lcd */ rt_hw_lcd_init(); /* init touch panel */ rtgui_touch_hw_init(); /* init keypad */ rt_hw_key_init(); /* find lcd device */ lcd = rt_device_find("lcd"); /* set lcd device as rtgui graphic driver */ rtgui_graphic_set_device(lcd); /* initalize rtgui system server */ rtgui_system_server_init(); } #endif /* LwIP Initialization */ #ifdef RT_USING_LWIP { extern void lwip_sys_init(void); eth_system_device_init(); /* register ethernetif device */ rt_hw_dm9000_init(); /* init lwip system */ lwip_sys_init(); rt_kprintf("TCP/IP initialized!\n"); } #endif #ifdef RT_USING_FTK { rt_thread_t ftk_thread; /* init lcd */ rt_hw_lcd_init(); /* init touch panel */ rtgui_touch_hw_init(); /* init keypad */ rt_hw_key_init(); /* create ftk thread */ ftk_thread = rt_thread_create("ftk", rt_ftk_thread_entry, RT_NULL, 10 * 1024, 8, 20); /* startup ftk thread */ if (ftk_thread != RT_NULL) rt_thread_startup(ftk_thread); } #endif }
/* thread phase init */ void rt_init_thread_entry(void *parameter) { /* Filesystem Initialization */ #ifdef RT_USING_DFS { extern void ff_convert_init(); /* init the device filesystem */ dfs_init(); /* init the elm FAT filesystam*/ elm_init(); /* mount spi flash fat as root directory */ if (dfs_mount("spi0", "/", "elm", 0, 0) == 0) { rt_kprintf("SPI File System initialized!\n"); /* mount sd card fat partition 1 as SD directory */ if (dfs_mount("sd0", "/SD", "elm", 0, 0) == 0) rt_kprintf("SD File System initialized!\n"); else rt_kprintf("SD File System init failed!\n"); } else rt_kprintf("SPI File System init failed!\n"); #ifdef RT_DFS_ELM_USE_LFN ff_convert_init(); #endif } #endif load_setup(); /* RTGUI Initialization */ #ifdef RT_USING_RTGUI { extern void rt_hw_key_init(void); extern void remote_init(void); extern void rtgui_touch_hw_init(void); radio_rtgui_init(); rt_hw_key_init(); rtgui_touch_hw_init(); remote_init(); } #endif /* set default setup */ { extern void vol(uint16_t v); extern void brightness_set(unsigned int value); vol(radio_setup.default_volume); brightness_set(radio_setup.lcd_brightness); } /* start RTC */ rt_hw_rtc_init(); /* LwIP Initialization */ #ifdef RT_USING_LWIP { extern void lwip_sys_init(void); extern void rt_hw_dm9000_init(void); eth_system_device_init(); /* register ethernetif device */ rt_hw_dm9000_init(); /* init all device */ rt_device_init_all(); /* init lwip system */ lwip_sys_init(); rt_kprintf("TCP/IP initialized!\n"); } #endif #if STM32_EXT_SRAM /* init netbuf worker */ net_buf_init(320 * 1024); #endif }
void rt_init_thread_entry(void* parameter) { #if RT_USING_RTC rt_device_t rtc_dev; #endif #if TEST_TRAP || EM_ALL_TYPE_BASE || TEST_485 rt_thread_t thread_h; #endif RT_APPS_INIT_DEBUG(("invoke rt_init_thread_entry()!\n")); say_thread_start(); #if TEST_485 thread_h = rt_thread_create("t485", rt_test_485_entry, RT_NULL, 512, 30, 10); if (thread_h != RT_NULL) rt_thread_startup(thread_h); #endif #if TEST_TRAP trap_test_init(); #endif #if EM_ALL_TYPE_BASE && !TEST_485 /* recv ptct info server */ thread_h = rt_thread_create("rpct-ser", recv_em_frame, RT_NULL, 1024, 30, 10); if (thread_h != RT_NULL) rt_thread_startup(thread_h); #endif #if RT_USING_RS485_BUS && !TEST_485 #if EM_MASTER_DEV || EM_MULTI_MASTER_DEV rs485_master_init(); /* David */ #elif WIRELESS_MASTER_NODE rs485_slave_init(); #endif #endif /* Filesystem Initialization */ #if RT_USING_FILESYSTEM RT_APPS_INIT_DEBUG(("will init fs\n")); rt_hw_spiflash_init(); sf_set_prote_level_to_none(); /* init the device filesystem */ dfs_init(); #ifdef RT_USING_DFS_ELMFAT /* init the elm chan FatFs filesystam*/ elm_init(); #if 1 /* mount spi-flash fat partition 1 as root directory */ if (dfs_mount("sf0", "/", "elm", 0, 0) == 0) #else /* mount sd card fat partition 1 as root directory */ if (dfs_mount("sd0", "/", "elm", 0, 0) == 0) #endif rt_kprintf("File System initialized!\n"); else rt_kprintf("File System initialzation failed!\n"); #endif #endif /* LwIP Initialization */ #if RT_USING_TCPIP_STACK init_tcpip_lwip_stack(); #endif #if RT_USING_GUI { extern void rtgui_startup(); extern void rt_hw_lcd_init(); extern void rtgui_touch_hw_init(void); rt_device_t lcd; /* init lcd */ rt_hw_lcd_init(); /* init touch panel */ rtgui_touch_hw_init(); /* re-init device driver */ rt_device_init_all(); /* find lcd device */ lcd = rt_device_find("lcd"); /* set lcd device as rtgui graphic driver */ rtgui_graphic_set_device(lcd); /* startup rtgui */ rtgui_startup(); } #endif /* #if RT_USING_GUI */ nvic_cfg_app(); #if USE_STM32_IWDG IWDG_Enable(); #endif #if RT_USING_RTC rtc_dev = rt_device_find("rtc"); if (NULL != rtc_dev) { rtc_dev->control(rtc_dev, RT_DEVICE_CTRL_RTC_CALI_SET, NULL); } else { rt_kprintf("find rtc device fail\n"); } #endif #if EM_ALL_TYPE_BASE extern void sinkinfo_ipc_init(void); sinkinfo_ipc_init(); #endif #if (RT_USING_RS485_BUS && EM_ALL_TYPE_BASE && !TEST_485) ammeter_init(); #endif #if WIRELESS_MASTER_NODE creat_4432master_th(); #elif WIRELESS_SLAVE_NODE /* #if WIRELESS_MASTER_NODE */ creat_4432slave_th(); #else /* none */ #endif /* #if WIRELESS_MASTER_NODE */ #if RT_USING_ADE7880 && !TEST_485 start_7880(); /* 有较长的延迟, 秒级别, David */ #endif #if EM_ALL_TYPE_BASE && !TEST_485 sinkinfo_init(); #endif }
void rt_init_thread_entry(void* parameter) { rt_hw_sdcard_init(); /* Filesystem Initialization */ #ifdef RT_USING_DFS { /* init the device filesystem */ dfs_init(); #if defined(RT_USING_DFS_ELMFAT) /* init the elm chan FatFs filesystam*/ elm_init(); /* mount sd card fat partition 1 as root directory */ if (dfs_mount("sd0", "/", "elm", 0, 0) == 0) { rt_kprintf("File System initialized!\n"); } else rt_kprintf("File System initialzation failed!\n"); #endif #if defined(RT_USING_DFS_ROMFS) dfs_romfs_init(); if (dfs_mount(RT_NULL, "/rom", "rom", 0, &romfs_root) == 0) { rt_kprintf("ROM File System initialized!\n"); } else rt_kprintf("ROM File System initialzation failed!\n"); #endif #if defined(RT_USING_DFS_DEVFS) devfs_init(); if (dfs_mount(RT_NULL, "/dev", "devfs", 0, 0) == 0) rt_kprintf("Device File System initialized!\n"); else rt_kprintf("Device File System initialzation failed!\n"); #ifdef RT_USING_NEWLIB /* init libc */ libc_system_init("uart0"); #endif #endif #if defined(RT_USING_DFS_UFFS) { /* init the uffs filesystem */ dfs_uffs_init(); /* mount flash device as flash directory */ if(dfs_mount("nand0", "/nand0", "uffs", 0, 0) == 0) rt_kprintf("UFFS File System initialized!\n"); else rt_kprintf("UFFS File System initialzation failed!\n"); } #endif } #endif #ifdef RT_USING_RTGUI { /* init lcd */ rt_hw_lcd_init(); /* init touch panel */ rtgui_touch_hw_init(); /* init keypad */ rt_hw_key_init(); /* re-init device driver */ rt_device_init_all(); /* startup rtgui */ //rtgui_startup(); } #endif /* LwIP Initialization */ #ifdef RT_USING_LWIP { extern void lwip_sys_init(void); eth_system_device_init(); /* register ethernetif device */ rt_hw_dm9000_init(); /* re-init device driver */ rt_device_init_all(); /* init lwip system */ lwip_sys_init(); rt_kprintf("TCP/IP initialized!\n"); } #endif #ifdef RT_USING_FTK { rt_thread_t ftk_thread; int FTK_MAIN(int argc, char* argv[]); /* init lcd */ rt_hw_lcd_init(); /* init touch panel */ rtgui_touch_hw_init(); /* init keypad */ rt_hw_key_init(); /* re-init device driver */ rt_device_init_all(); /* create ftk thread */ ftk_thread = rt_thread_create("ftk", FTK_MAIN, RT_NULL, 10 * 1024, 8, 20); /* startup ftk thread */ if(ftk_thread != RT_NULL) rt_thread_startup(ftk_thread); } #endif }
/* thread phase init */ void rt_init_thread_entry(void *parameter) { #ifdef RT_USING_SPI { extern void rt_hw_spi0_init(void); rt_hw_spi0_init(); } #endif #ifdef RT_USING_I2C { extern void rt_hw_i2c_init(void); rt_i2c_core_init(); rt_hw_i2c_init(); } #endif /* Filesystem Initialization */ #ifdef RT_USING_DFS { /* init the device filesystem */ dfs_init(); /* init the elm FAT filesystam*/ elm_init(); /* mount sd card fat partition 1 as root directory */ if (dfs_mount("sd0", "/", "elm", 0, 0) == 0) rt_kprintf("File System initialized!\n"); else rt_kprintf("File System init failed!\n"); } #endif /* LwIP Initialization */ #ifdef RT_USING_LWIP { extern void lwip_sys_init(void); extern void lpc17xx_emac_hw_init(void); eth_system_device_init(); /* register ethernetif device */ lpc_emac_hw_init(); /* init all device */ rt_device_init_all(); /* init lwip system */ lwip_sys_init(); rt_kprintf("TCP/IP initialized!\n"); } #endif #ifdef RT_USING_RTGUI { extern void rtgui_system_server_init(void); extern void application_init(void); rt_device_t lcd; /* init lcd */ rt_hw_lcd_init(); /* re-init device driver */ rt_device_init_all(); /* find lcd device */ lcd = rt_device_find("lcd"); if (lcd != RT_NULL) { /* set lcd device as rtgui graphic driver */ rtgui_graphic_set_device(lcd); /* init rtgui system server */ rtgui_system_server_init(); rt_hw_joystick_init(); rtgui_touch_hw_init("spi20"); /* startup rtgui in demo of RT-Thread/GUI examples */ application_init(); } } #endif #ifdef RT_USING_FINSH /* initialize finsh */ finsh_system_init(); finsh_set_device(FINSH_DEVICE_NAME); #endif }
/* thread phase init */ void rt_init_thread_entry(void *parameter) { // #ifdef RT_USING_I2C // rt_i2c_core_init(); // rt_hw_i2c_init(); // #endif rt_hw_spi_init(); rt_system_module_init(); /* Filesystem Initialization */ #ifdef RT_USING_DFS { extern rt_err_t mci_hw_init(const char *device_name); /* initilize sd card */ mci_hw_init("sd0"); /* init the device filesystem */ dfs_init(); /* init the elm FAT filesystam*/ elm_init(); #ifdef RT_USING_NFTL { extern void rt_hw_mtd_nand_init(void); rt_hw_mtd_nand_init(); nftl_init(); nftl_mount(); // list_mem(); } #else /* mount sd card fat partition 1 as root directory */ if (dfs_mount("sd0", "/", "elm", 0, 0) == 0) rt_kprintf("File System initialized!\n"); else rt_kprintf("File System init failed!\n"); #endif } #endif /* LwIP Initialization */ #ifdef RT_USING_LWIP { extern void lwip_sys_init(void); eth_system_device_init(); /* register ethernetif device */ lpc_emac_hw_init(); /* init all device */ rt_device_init_all(); /* init lwip system */ lwip_sys_init(); rt_kprintf("TCP/IP initialized!\n"); } #endif #ifdef RT_USING_RTGUI { extern void realtouch_ui_init(void); extern void rt_hw_key_init(void); rt_device_t lcd; /* init lcd */ rt_hw_lcd_init(); /* re-init device driver */ rt_device_init_all(); /* find lcd device */ lcd = rt_device_find("lcd"); if (lcd != RT_NULL) { /* set lcd device as rtgui graphic driver */ rtgui_graphic_set_device(lcd); /* init rtgui system server */ rtgui_system_server_init(); rt_thread_delay(5); rt_hw_key_init(); rtgui_touch_hw_init("spi10"); /* startup rtgui realtouch ui */ realtouch_ui_init(); } } #endif #ifdef RT_USING_FINSH /* initialize finsh */ finsh_system_init(); finsh_set_device(FINSH_DEVICE_NAME); #endif }
/* thread phase init */ void rt_init_thread_entry(void *parameter) { /* Filesystem Initialization */ #ifdef RT_USING_DFS { extern void ff_convert_init(); /* init the device filesystem */ dfs_init(); /* init the elm FAT filesystam*/ elm_init(); /* mount sd card fat partition 1 as SD directory */ if (dfs_mount("sd0", "/", "elm", 0, 0) == 0) rt_kprintf("SD File System initialized!\n"); else rt_kprintf("SD File System init failed!\n"); #ifdef RT_DFS_ELM_USE_LFN ff_convert_init(); #endif } #endif /* load_setup(); */ /* RTGUI Initialization */ #ifdef RT_USING_RTGUI { extern void rt_hw_key_init(void); extern void remote_init(void); extern void rtgui_touch_hw_init(void); radio_rtgui_init(); rt_hw_key_init(); rtgui_touch_hw_init(); remote_init(); brightness_set(radio_setup.lcd_brightness); //PCM1770_VolumeSet(radio_setup.default_volume); } #endif /* start RTC */ rt_hw_rtc_init(); /* LwIP Initialization */ #ifdef RT_USING_LWIP { extern void lwip_sys_init(void); extern void rt_hw_dm9000_init(void); eth_system_device_init(); /* register ethernetif device */ rt_hw_dm9000_init(); /* init all device */ rt_device_init_all(); /* init lwip system */ lwip_sys_init(); rt_kprintf("TCP/IP initialized!\n"); } #endif #if STM32_EXT_SRAM /* init netbuf worker */ net_buf_init(320 * 1024); #endif /* TODO(CXF): start ftp and agent */ ftpd_start(); }