void nfs_start(void) { 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"); }
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); #ifdef STM32F10X_CL extern void rt_hw_stm32_eth_init(void); #endif /* 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 }
int mnt_init(void) { dfs_init(); #ifdef RT_USING_DFS_WINSHAREDIR extern int dfs_win32_init(void); extern rt_err_t rt_win_sharedir_init(const char *name); dfs_win32_init(); rt_win_sharedir_init("wshare"); if (dfs_mount("wshare", "/", "wdir", 0, 0) == 0) { rt_kprintf("File System on root initialized!\n"); } else { rt_kprintf("File System on root initialization failed!\n"); } if (dfs_mount("sd0", "/sd", "elm", 0, 0) == 0) { rt_kprintf("File System on sd initialized!\n"); } else { rt_kprintf("File System on sd initialization failed!\n"); } #else if (dfs_mount("sd0", "/", "elm", 0, 0) == 0) { rt_kprintf("File System on sd initialized!\n"); } else { rt_kprintf("File System on sd initialization failed!\n"); } #endif return 0; }
int mnt_init(void) { nftl_attach("nand0"); if (dfs_mount("nand0", "/", "elm", 0, 0) == 0) { rt_kprintf("Mount FatFs file system to root, Done!\n"); } else { rt_kprintf("Mount FatFs file system failed.\n"); } /* initilize sd card */ mci_hw_init("sd0"); /* mount sd card fat partition 1 as root directory */ if (dfs_mount("sd0", "/SD", "elm", 0, 0) == 0) rt_kprintf("File System initialized!\n"); else rt_kprintf("File System init failed!\n"); return 0; }
void rt_init_thread_entry(void *parameter) { int fd; rt_uint32_t sz; char buffer[20]; #ifdef RT_USING_DFS dfs_init(); #ifdef RT_USING_DFS_ELMFAT 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"); /*Open a file*/ fd = open("/fattest.txt", O_RDWR|O_CREAT, 0); if (fd < 0) { rt_kprintf("open file for write failed\n"); return; } sz = write(fd,"Hello RT-Thread!",sizeof("Hello RT-Thread!")); if (sz != 0) { rt_kprintf("written %d\n",sz); } else rt_kprintf("haven't written\n"); lseek(fd, 0, SEEK_SET); sz = read(fd, buffer, sizeof(buffer)); if (sz != 0) { rt_kprintf("READ %d:",sz); while (sz--) rt_kprintf("%c",buffer[sz]);//opposite rt_kprintf("\n"); } else rt_kprintf("haven't read\n"); close(fd); } else rt_kprintf("File System initialzation failed!\n"); #endif #endif }
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(); /* 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_init_thread_entry(void* parameter) { #ifdef RT_USING_LWIP /* initialize eth interface */ lpc_emac_hw_init(); #endif #ifdef RT_USING_COMPONENTS_INIT /* initialization RT-Thread Components */ rt_components_init(); #endif { extern rt_err_t mci_hw_init(const char *device_name); mci_hw_init("sd0"); } /* Filesystem Initialization */ #ifdef RT_USING_DFS { #ifdef 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"); #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"); #endif } #endif /* do some thing here. */ #if defined(RT_USING_DFS) && defined(RT_USING_LWIP) /* start ftp server */ rt_kprintf("ftp server begin...\n"); ftpd_start(); rt_kprintf("ftp server started!!\n"); #endif }
static void thread_entry(void* parameter) { /* File System Initialization */ #ifdef RT_USING_DFS { /* initialize the device file system */ dfs_init(); #ifdef RT_USING_DFS_ELMFAT /* initialize the elm FAT file system*/ elm_init(); #endif #ifdef RT_USING_DFS_ROMFS /* initialize romfs */ dfs_romfs_init(); #endif if (dfs_mount(RT_NULL, "/", "rom", 0, DFS_ROMFS_ROOT) == 0) { rt_kprintf("ROM File System initialized!\n"); { do_init(); rt_thread_delay(RT_TICK_PER_SECOND); } } else rt_kprintf("ROM File System initialzation failed!\n"); } #endif usbd_hw_init(); /* set console and finsh to USB vcom */ #ifdef RT_USING_CONSOLE rt_console_set_device("vcom"); #endif #ifdef RT_USING_FINSH finsh_set_device("vcom"); #endif #ifdef RT_USING_USB_HOST rt_usb_host_init(); /* register stm32 usb host controller driver */ rt_hw_susb_init(); rt_device_init_all(); #endif }
static void rt_thread_entry_usbmsc(void* parameter) { int ret; dfs_init(); elm_init(); USBH_Init(&USB_OTG_Core, USB_OTG_FS_CORE_ID, &USB_Host, &USBH_MSC_cb, &USR_cb); rt_kprintf("\r\nUSBH_Init\r\n"); #if defined(RT_USING_DFS_ROMFS) dfs_romfs_init(); if (dfs_mount(RT_NULL, "/", "rom", 0, &romfs_root) == 0) { rt_kprintf("Root File System initialized!\n"); } else rt_kprintf("Root File System initialzation failed!\n"); #endif //USB_OTG_Core.regs.GREGS->GUSBCFG|=(1<<29); //USB_OTG_WRITE_REG32(USB_OTG_Core.regs.GREGS->GUSBCFG,value) rt_thread_delay(RT_TICK_PER_SECOND); while (1) { //GPIO_SetBits(GPIOD, GPIO_Pin_15); USBH_Process(&USB_OTG_Core,&USB_Host); rt_thread_delay(RT_TICK_PER_SECOND/20); // 根据写入速度调整 //GPIO_ResetBits(GPIOD, GPIO_Pin_15); } }
void sd_mount(void *parameter) { while (1) { rt_thread_mdelay(500); if(rt_device_find("sd0") != RT_NULL) { if (dfs_mount("sd0", "/", "elm", 0, 0) == RT_EOK) { LOG_I("sd card mount to '/'"); break; } else { LOG_W("sd card mount to '/' failed!"); } } } }
/* thread phase init */ void rt_init_thread_entry(void *parameter) { /* 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 SD directory */ if (dfs_mount("sd0", "/", "elm", 0, 0) == 0) rt_kprintf("File System initialized!\n"); else rt_kprintf("File System init failed!\n"); } #endif }
/* thread phase init */ void rt_init_thread_entry(void *parameter) { /* initialize platform */ platform_init(); #ifdef RT_USING_LWIP /* register Ethernet interface device */ lpc17xx_emac_hw_init(); /* initialize lwip stack */ /* register ethernetif device */ eth_system_device_init(); /* initialize lwip system */ lwip_system_init(); rt_kprintf("TCP/IP initialized!\n"); #endif /* Filesystem Initialization */ #ifdef RT_USING_DFS rt_hw_sdcard_init(); /* initialize the device file system */ dfs_init(); #ifdef RT_USING_DFS_ELMFAT /* initialize the elm chan FatFS file system*/ elm_init(); #endif /* 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 #ifdef RT_USING_FINSH /* initialize finsh */ finsh_system_init(); finsh_set_device(RT_CONSOLE_DEVICE_NAME); #endif }
void rt_init_thread_entry(void* parameter) { { extern void rt_platform_init(void); rt_platform_init(); } /* Filesystem Initialization */ #if defined(RT_USING_DFS) && defined(RT_USING_DFS_ELMFAT) /* 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"); } else { rt_kprintf("File System initialzation failed!\n"); } #endif /* RT_USING_DFS && RT_USING_DFS_ELMFAT */ #ifdef RT_USING_LWIP /* initialize lwip stack */ /* register ethernetif device */ eth_system_device_init(); /* initialize lwip system */ lwip_system_init(); rt_kprintf("TCP/IP initialized!\n"); #endif #ifdef RT_USING_FINSH /* initialize finsh */ finsh_system_init(); finsh_set_device(RT_CONSOLE_DEVICE_NAME); #endif //led_tog_init(); }
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(); }
static rt_bool_t filesystem_format(void) { int rc; startup_log("try to format disk..."); rc = dfs_mkfs("elm", "nand0"); if (rc != 0) return RT_FALSE; if (dfs_mount("nand0", "/", "elm", 0, 0) == 0) { startup_log("Mount Root done"); return RT_TRUE; } else { startup_log("Mount Root failed"); return RT_FALSE; } }
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) { /Users/ganyibin/Documents/opensource/RT-thread/rt-thread/bsp/stm32f20x/applications/startup.c rt_kprintf("File System initialized!\n"); } else rt_kprintf("File System initialzation failed!\n"); #endif }
void rt_init_thread_entry(void* parameter) { #ifdef RT_USING_LWIP /* initialize eth interface */ rt_hw_stm32_eth_init(); #endif #ifdef RT_USING_COMPONENTS_INIT /* initialization RT-Thread Components */ rt_components_init(); #endif rt_platform_init(); /* do some thing here. */ #if defined(RT_USING_DFS) && defined(RT_USING_LWIP) && defined(RT_USING_DFS_NFS) { /* NFSv3 Initialization */ rt_kprintf("begin init NFSv3 File System ...\n"); if (dfs_mount(RT_NULL, "/", "nfs", 0, RT_NFS_HOST_EXPORT) == 0) rt_kprintf("NFSv3 File System initialized!\n"); else rt_kprintf("NFSv3 File System initialzation failed!\n"); } #endif k9f2g08_nand_init(); FSMC_NAND_Init(); FSMC_NAND_ReadID(&NAND_ID); rt_kprintf("\tMaker = %02x\n", NAND_ID.Maker_ID); rt_kprintf("\tdevice = %02x\n", NAND_ID.Device_ID); rt_kprintf("\tThird = %02x\n", NAND_ID.Third_ID); rt_kprintf("\tFourth = %02x\n", NAND_ID.Fourth_ID); nand_test(); }
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 dfs_thread_entry(void* parameter) { char *rev_meail;//定义指针,用来保存邮件内容 /******************启动文件系统***************/ /* init the device filesystem */ dfs_init(); elm_init(); /* mount sd card fat partition 1 as root directory */ if (dfs_mount("sd0", "/", "elm", 0, 0) == 0) { rt_kprintf("文件系统初始化成功!\n"); } else rt_kprintf("文件系统初始化失败!\n"); /*************************初始化LD3320***********************/ ld3320_gpio_configuration(); ld3320_nvic_cfg(); ld3320_spi_init(); LD_reset(); nAsrStatus = LD_ASR_NONE; bMp3Play=0; if(wugege_read_ini(sys_ini_name)!=1) rt_kprintf("读取系统配置文件失败,语音识别将受到严重影响\n"); rt_kprintf("读取系统配置文件成功\n"); if(PlayDemoSound_mp3(sys_shi_mp3)<0) rt_kprintf(" 播放初始化音乐失败,请确认是否能使用LD3320!\n"); rt_kprintf("播放初始化音乐成功!\n"); rt_thread_delay(10);//延迟该线程10ms sys_wake=1; sys_wake_count=0; while(1) { if(RT_EOK==(rt_mb_recv(&mb,(rt_uint32_t*)&rev_meail,RT_WAITING_NO))) { rt_kprintf("接收到邮件,播放音乐%s\r\n",rev_meail); if(PlayDemoSound_mp3(rev_meail)<0) rt_kprintf("播放音乐失败%s \r\n",rev_meail); rt_kprintf("接收到邮件,播放音乐完毕\r\n"); // *rev_meail=NULL; nAsrStatus = LD_ASR_NONE; } rt_thread_delay(5);//延迟该线程5ms while(bMp3Play != 0) rt_thread_delay(5); switch (nAsrStatus) { case LD_ASR_RUNING: // LD3320芯片正在语音识别中 break; case LD_ASR_ERROR: // LD3320芯片发生错误 break; case LD_ASR_NONE: // LD3320芯片无动作 { nAsrStatus=LD_ASR_RUNING; if (RunASR(sys_wake)==0) // 启动一次ASR识别流程:ASR初始化,ASR添加关键词语,启动ASR运算 { nAsrStatus = LD_ASR_ERROR; } break; } case LD_ASR_FOUNDOK: // LD3320芯片识别到语音 { char mp3_name[25]; //mp3文件名缓冲区 char action[15]; char ini_name[20]; int nAsrRes = LD_GetResult(); // 一次ASR识别流程结束,去取ASR识别结果 if(nAsrRes==49) { sys_wake=1; sys_wake_count=0; PlayDemoSound_mp3(sys_shi_mp3); rt_kprintf("系统唤醒成功 \n"); } else if(sys_wake) { get_mps_ini_file(mp3_name,ini_name,action,nAsrRes); rt_kprintf("识别用户的mp3名字 %s 配置文件%s 命令%s 原始码%d\r\n",mp3_name,ini_name,action,nAsrRes); sys_wake_count=0; sys_wake=1; deal_action(action); if(PlayDemoSound_mp3(mp3_name)<0) rt_kprintf("播放音乐失败%s \r\n",mp3_name); if(0!=strcmp(ini_name,sys_ini_name)) { strcpy(sys_ini_name,ini_name); rt_kprintf("重新载入配置文件%s \r\n",sys_ini_name); if(wugege_read_ini(sys_ini_name)!=1) rt_kprintf("读取系统配置文件失败,语音识别将受到严重影响\r\n"); } } rt_kprintf("\r\n识别到用户关键字为:%d \r\n",nAsrRes); nAsrStatus = LD_ASR_NONE; break; } case LD_ASR_FOUNDZERO: //无识别结果 nAsrStatus = LD_ASR_NONE; break; default: nAsrStatus = LD_ASR_NONE; break; } } }
void rt_init_thread_entry(void *parameter) { #ifdef RT_USING_LWIP #ifdef RT_USING_TAPNETIF tap_netif_hw_init(); #else pcap_netif_hw_init(); #endif #endif rt_platform_init(); /* initialization RT-Thread Components */ rt_components_init(); #ifdef RT_USING_RTGUI /* start sdl thread to simulate an LCD. SDL may depend on DFS and should be * called after rt_components_init. */ rt_hw_sdl_start(); #endif /* RT_USING_RTGUI */ /* File system Initialization */ #ifdef RT_USING_DFS { #ifdef RT_USING_DFS_WINSHAREDIR { extern rt_err_t rt_win_sharedir_init(const char *name); extern int dfs_win32_init(void); rt_win_sharedir_init("wdd"); dfs_win32_init(); if (dfs_mount("wdd", "/", "wdir", 0, 0) == 0) rt_kprintf("win32 share directory initialized!\n"); else rt_kprintf("win32 share directory initialized failed!\n"); } #endif #ifdef RT_USING_DFS_ELMFAT /* mount sd card fatfs as root directory */ #ifdef _WIN32 if (dfs_mount("sd0", "/disk/sd", "elm", 0, 0) == 0) #else if (dfs_mount("sd0", "/", "elm", 0, 0) == 0) #endif rt_kprintf("fatfs initialized!\n"); else rt_kprintf("fatfs initialization failed!\n"); #endif #ifdef RT_USING_DFS_UFFS /* mount uffs as the nand flash file system */ if (dfs_mount("nand0", "/disk/nand", "uffs", 0, 0) == 0) rt_kprintf("uffs initialized!\n"); else rt_kprintf("uffs initialization failed!\n"); #endif #ifdef RT_USING_DFS_JFFS2 /* mount jffs2 as the nor flash file system */ if (dfs_mount("nor", "/disk/nor", "jffs2", 0, 0) == 0) rt_kprintf("jffs2 initialized!\n"); else rt_kprintf("jffs2 initialization failed!\n"); #endif } #endif }
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) { platform_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(); #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(RT_CONSOLE_DEVICE_NAME); #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 #ifdef RT_USING_I2C { rt_i2c_core_init(); davinci_i2c_init("I2C1"); } #endif #ifdef RT_USING_SPI { rt_hw_spi_init(); } #endif #ifdef RT_USING_SDIO rt_mmcsd_core_init(); rt_mmcsd_blk_init(); rt_hw_mmcsd_init(); rt_thread_delay(RT_TICK_PER_SECOND*2); /* 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!%d\n", rt_get_errno()); #endif } #endif #ifdef RT_USING_LWIP { /* register ethernetif device */ eth_system_device_init(); rt_hw_davinci_emac_init(); /* init lwip system */ lwip_system_init(); } #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 }
void rt_init_thread_entry(void* parameter) { rt_components_init(); LED_init(); Motor_Init(); rt_kprintf("start device init\n"); //rt_hw_i2c1_init(); i2cInit(); rt_hw_spi2_init(); rt_hw_spi3_init(); rt_event_init(&ahrs_event, "ahrs", RT_IPC_FLAG_FIFO); dmp_init(); sonar_init(); HMC5983_Init(); adns3080_Init(); //config_bt(); rt_thread_init(&led_thread, "led", led_thread_entry, RT_NULL, led_stack, 256, 16, 1); rt_thread_startup(&led_thread); spi_flash_init(); // bmp085_init("i2c1"); rt_kprintf("device init succeed\n"); if (dfs_mount("flash0", "/", "elm", 0, 0) == 0) { rt_kprintf("flash0 mount to /.\n"); } else { rt_kprintf("flash0 mount to / failed.\n"); } //default settings PID_Init(&p_rate_pid, 0, 0, 0); PID_Init(&r_rate_pid, 0, 0, 0); PID_Init(&y_rate_pid, 0, 0, 0); PID_Init(&p_angle_pid, 0, 0, 0); PID_Init(&r_angle_pid, 0, 0, 0); PID_Init(&y_angle_pid, 0, 0, 0); PID_Init(&x_v_pid, 0, 0, 0); PID_Init(&y_v_pid, 0, 0, 0); PID_Init(&x_d_pid, 0, 0, 0); PID_Init(&y_d_pid, 0, 0, 0); PID_Init(&h_pid, 0, 0, 0); load_settings(&settings, "/setting", &p_angle_pid, &p_rate_pid , &r_angle_pid, &r_rate_pid , &y_angle_pid, &y_rate_pid , &x_d_pid, &x_v_pid , &y_d_pid, &y_v_pid , &h_pid); settings.roll_min = settings.pitch_min = settings.yaw_min = 1000; settings.th_min = 1000; settings.roll_max = settings.pitch_max = settings.yaw_max = 2000; settings.th_max = 2000; // if(settings.pwm_init_mode) // { // Motor_Set(1000,1000,1000,1000); // // rt_thread_delay(RT_TICK_PER_SECOND*5); // // Motor_Set(0,0,0,0); // // settings.pwm_init_mode=0; // save_settings(&settings,"/setting"); // // rt_kprintf("pwm init finished!\n"); // } get_pid(); PID_Set_Filt_Alpha(&p_rate_pid, 1.0 / 166.0, 20.0); PID_Set_Filt_Alpha(&r_rate_pid, 1.0 / 166.0, 20.0); PID_Set_Filt_Alpha(&y_rate_pid, 1.0 / 166.0, 20.0); PID_Set_Filt_Alpha(&p_angle_pid, 1.0 / 166.0, 20.0); PID_Set_Filt_Alpha(&r_angle_pid, 1.0 / 166.0, 20.0); PID_Set_Filt_Alpha(&y_angle_pid, 1.0 / 75.0, 20.0); PID_Set_Filt_Alpha(&x_v_pid, 1.0 / 100.0, 20.0); PID_Set_Filt_Alpha(&y_v_pid, 1.0 / 100.0, 20.0); PID_Set_Filt_Alpha(&x_d_pid, 1.0 / 100.0, 20.0); PID_Set_Filt_Alpha(&y_d_pid, 1.0 / 100.0, 20.0); PID_Set_Filt_Alpha(&h_pid, 1.0 / 60.0, 20.0); rt_thread_init(&control_thread, "control", control_thread_entry, RT_NULL, control_stack, 1024, 3, 5); rt_thread_startup(&control_thread); rt_thread_init(&correct_thread, "correct", correct_thread_entry, RT_NULL, correct_stack, 1024, 12, 1); rt_thread_startup(&correct_thread); LED1(5); }
void rt_init_thread_entry(void *parameter) { #ifdef RT_USING_LWIP pcap_netif_hw_init(); #endif rt_platform_init(); /* initialization RT-Thread Components */ rt_components_init(); #if defined(RT_USING_COMPONENTS_INIT) && defined(__GNUC__) && defined(RT_USING_FINSH) finsh_set_device(RT_CONSOLE_DEVICE_NAME); #endif /* File system Initialization */ #ifdef RT_USING_DFS { #ifdef RT_USING_DFS_WINSHAREDIR { extern rt_err_t rt_win_sharedir_init(const char *name); extern int dfs_win32_init(void); rt_win_sharedir_init("wdd"); dfs_win32_init(); if (dfs_mount("wdd", "/", "wdir", 0, 0) == 0) rt_kprintf("win32 share directory initialized!\n"); else rt_kprintf("win32 share directory initialized failed!\n"); } #endif #ifdef RT_USING_DFS_ELMFAT /* mount sd card fatfs as root directory */ #ifdef _WIN32 if (dfs_mount("sd0", "/disk/sd", "elm", 0, 0) == 0) #else if (dfs_mount("sd0", "/", "elm", 0, 0) == 0) #endif rt_kprintf("fatfs initialized!\n"); else rt_kprintf("fatfs initialization failed!\n"); #endif #ifdef RT_USING_DFS_UFFS /* mount uffs as the nand flash file system */ if (dfs_mount("nand0", "/disk/nand", "uffs", 0, 0) == 0) rt_kprintf("uffs initialized!\n"); else rt_kprintf("uffs initialization failed!\n"); #endif #ifdef RT_USING_DFS_JFFS2 /* mount jffs2 as the nor flash file system */ if (dfs_mount("nor", "/disk/nor", "jffs2", 0, 0) == 0) rt_kprintf("jffs2 initialized!\n"); else rt_kprintf("jffs2 initialization failed!\n"); #endif } #endif }
void rt_init_thread_entry(void* parameter) { #ifdef RT_USING_COMPONENTS_INIT /* initialization RT-Thread Components */ rt_components_init(); #endif /* LwIP Initialization */ #ifdef RT_USING_LWIP { extern void lwip_sys_init(void); /* register ethernetif device */ eth_system_device_init(); rt_hw_stm32_eth_init(); /* re-init device driver */ rt_device_init_all(); /* init lwip system */ lwip_sys_init(); rt_kprintf("TCP/IP initialized!\n"); } #endif //FS #ifdef RT_USING_DFS dfs_init(); #ifdef RT_USING_MTD_NAND nand_mtd_init(); dfs_uffs_init(); if (dfs_mount("psram0", "/", "uffs", 0, 0) == 0) { rt_kprintf("uffs mount / partion ok\n"); } else rt_kprintf("uffs mount / partion failed!\n"); #endif #endif rt_hw_lcd_init(); //GUI #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(); /* 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_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 }
void rt_init_thread_entry(void* parameter) { { extern void rt_platform_init(void); rt_platform_init(); } /* Filesystem Initialization */ #if defined(RT_USING_DFS) && defined(RT_USING_DFS_ELMFAT) /* 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"); } else { rt_kprintf("File System initialzation failed!\n"); } #endif /* RT_USING_DFS && RT_USING_DFS_ELMFAT */ #ifdef RT_USING_LWIP /* initialize lwip stack */ /* register ethernetif device */ eth_system_device_init(); /* initialize lwip system */ lwip_system_init(); rt_kprintf("TCP/IP initialized!\n"); #endif #ifdef RT_USING_FINSH /* initialize finsh */ finsh_system_init(); finsh_set_device(RT_CONSOLE_DEVICE_NAME); #endif #ifdef RT_USING_RTGUI { rt_device_t device; struct rt_device_rect_info info; extern int rtgui_system_server_init(void); rtgui_system_server_init(); device = rt_device_find("lcd"); /* re-set graphic device */ rtgui_graphic_set_device(device); rtgui_system_server_init(); /* ´¥ÃþÆÁУ׼ calibration();*/ /* ²âÊÔ´¥ÃþÆÁ°´Å¥ ¼°¼òÒ×¼ÆËãÆ÷ ui_button();*/ /*ÔËÐÐdemo */ application_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) { /* 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 }