Пример #1
0
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();
}
Пример #2
0
void rt_init_thread_entry(void* parameter)
{
	/* initialize spi driver */
		rt_hw_spi_init();
	/* initialize LCD drv for GUI */
	rtgui_lcd_init();
	/* initialize GUI system */
	rtgui_system_server_init();
	/* initialize keyboard */
	rt_hw_key_init();
	/* initialize touch */
	touch_calibration_init();

	/* say hello world in screen */
	ui_hello();
	
	finsh_system_init();
}
Пример #3
0
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();
}
Пример #4
0
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
}
Пример #5
0
/* 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

}
Пример #6
0
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
}
Пример #7
0
void rt_init_thread_entry(void *parameter)
{
    rt_device_t lcd;  
    
    rt_hw_led_init();
	rt_hw_key_init();
	rt_hw_adc_init();
	rt_hw_lcd_init();      
	rt_hw_cpu_init();

#ifdef RT_USING_RTGUI
	extern void rtgui_system_server_init(void);

	/* 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();
   
	/* startup rtgui */
	rtgui_startup();
#else
	{
	char buf[20] = {'\0'};
    struct lcd_msg msg;
    rt_device_t device;   
    device = rt_device_find("lcd");
	rt_device_control(device, RT_DEVICE_CTRL_LCD_CLEAR_SCR, RT_NULL);
	x = 1;
	y = 1;
	rt_device_control(device, RT_DEVICE_CTRL_LCD_PUT_STRING, "ADC"); 
	x = 1;
	y = 20;
	rt_device_control(device, RT_DEVICE_CTRL_LCD_PUT_STRING, "CPU");
	x = 1;
	y = 40;
	rt_device_control(device, RT_DEVICE_CTRL_LCD_PUT_STRING, "KEY");
    
    while(1)
    {
        if (rt_mq_recv(&mq, &msg, sizeof(msg), RT_WAITING_FOREVER) == RT_EOK)
        {
        	switch(msg.type)
    		{
    			case ADC_MSG:
					x = 40;
					y = 1;
					rt_memset(buf, 0, sizeof(buf));
					rt_sprintf(buf, "%04d", msg.adc_value);
					rt_device_control(device, RT_DEVICE_CTRL_LCD_PUT_STRING, buf); 
					break;
				case CPU_MSG:
					x = 40;
					y = 20;
					rt_memset(buf, 0, sizeof(buf));
					rt_sprintf(buf, "%03d %03d", msg.major, msg.minor);
					rt_device_control(device, RT_DEVICE_CTRL_LCD_PUT_STRING, buf); 
					break;
				case KEY_MSG:
					x = 40;
					y = 40;
					rt_memset(buf, 0, sizeof(buf));
                    switch(msg.key)
                	{
                		case KEY_DOWN:
							rt_sprintf(buf, "DOWN KEY ");
							break;
						case KEY_UP:
							rt_sprintf(buf, "UP KEY   ");
							break;	
                		case KEY_RIGHT:
							rt_sprintf(buf, "RIGHT KEY");
							break;
						case KEY_LEFT:
							rt_sprintf(buf, "LEFT KEY ");
							break;	
                		case KEY_ENTER:
							rt_sprintf(buf, "ENTER KEY");
							break;
						default:
							rt_sprintf(buf, "NO KEY   ");
							break;								
                	}
					rt_device_control(device, RT_DEVICE_CTRL_LCD_PUT_STRING, buf); 
                    break;                    
    		}
        }
    }
	}
#endif
}
Пример #8
0
/* 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
}
Пример #9
0
/* 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();
}