void rt_platform_init(void) { #ifdef RT_USING_DFS /* initialize sd card */ rt_hw_sdcard_init(); #if defined(RT_USING_MTD_NAND) rt_hw_mtd_nand_init(); #endif #if defined(RT_USING_MTD_NOR) sst25vfxx_mtd_init("nor", 0, RT_UINT32_MAX); #endif #endif /* RT_USING_DFS */ #ifdef RT_USING_RTGUI /* start sdl thread to simulate an LCD */ rt_hw_sdl_start(); #endif /* RT_USING_RTGUI */ #ifdef _WIN32 rt_thread_idle_sethook(rt_hw_win32_low_cpu); #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 }