Esempio n. 1
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 */
}
Esempio n. 2
0
void radio_rtgui_init(void)
{
    rtgui_rect_t rect;
//	rtgui_color_t c=0xff;
    rtgui_system_server_init();

    /* register dock panel */
    rect.x1 = 0;
    rect.y1 = 0;
    rect.x2 = 320;
    rect.y2 = 25;
    rtgui_panel_register("info", &rect);
    rtgui_panel_set_nofocused("info");

    /* register main panel */
    rect.x1 = 0;
    rect.y1 = 25;
    rect.x2 = 320;
    rect.y2 = 240;
    rtgui_panel_register("main", &rect);
    rtgui_panel_set_default_focused("main");


        _rtgui_lcd_driver.name            = "lcd";
        _rtgui_lcd_driver.byte_per_pixel  = 2;
        _rtgui_lcd_driver.width           = 320;
        _rtgui_lcd_driver.height          = 240;
        _rtgui_lcd_driver.draw_hline      = lcd_draw_hline;
        _rtgui_lcd_driver.draw_raw_hline  = lcd_draw_raw_hline;
        _rtgui_lcd_driver.draw_vline      = lcd_draw_vline;
        _rtgui_lcd_driver.get_pixel       = lcd_get_pixel;
        _rtgui_lcd_driver.set_pixel       = lcd_set_pixel;
        _rtgui_lcd_driver.screen_update   = lcd_update;
        _rtgui_lcd_driver.get_framebuffer = lcd_get_framebuffer;

        sep4020_lcd_init();

	  rt_memset((char*)pVideoBuffer,0xff,320*240*2);
	//	rt_memcpy((char*)pVideoBuffer,pic,320*240*2);  //TESTING IMAGE

	 
    /* add lcd driver into graphic driver */
    rtgui_graphic_driver_add(&_rtgui_lcd_driver);




	
}
Esempio n. 3
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();
}
Esempio n. 4
0
void rtgui_startup()
{
    rtgui_rect_t rect;
    
	/* GUI系统初始化 */
    rtgui_system_server_init();
        
    /* register dock panel */
    rect.x1 = 0;
    rect.y1 = 0;
    rect.x2 = 128;
    rect.y2 = 64;
    rtgui_panel_register("info", &rect);
    rtgui_panel_set_default_focused("info");
    
	/* 启动info workbench */
	info_init();
}
Esempio n. 5
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();
}
Esempio n. 6
0
void gui_init()
{
	extern void rtgui_touch_hw_init(void);
	extern rt_err_t load_setup(void);
    rtgui_rect_t rect;
	rt_device_t lcd;

	/* 初始化LCD驱动 */
    ra8875_init();
	lcd = rt_device_find("lcd");
	if (lcd != RT_NULL)
	{
		rt_device_init(lcd);
		rtgui_graphic_set_device(lcd);

		/* 初始化RT-Thread/GUI server */
	    rtgui_system_server_init();

    /* 注册面板 */
    rect.x1 = 0;
    rect.y1 = 0;
    rect.x2 = 800;
    rect.y2 = 480;
    rtgui_panel_register("main", &rect);
    rtgui_panel_set_default_focused("main");

		/* 初始化键盘驱动 */
//		rt_hw_key_init();

		/* 初始化触摸屏驱动 */
//		load_setup(); //touch装载默认值
//		rtgui_touch_hw_init();
	    rt_device_init_all();

		/* 初始化workbench */
		workbench_init();
	}
}
/**
 * RT-Thread Components Initialization
 */
void rt_components_init(void)
{
#ifdef RT_USING_MODULE
	rt_system_module_init();
#endif

#ifdef RT_USING_FINSH
	/* initialize finsh */
	finsh_system_init();
	finsh_set_device(RT_CONSOLE_DEVICE_NAME);
#endif

#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_DFS
	/* initialize the device file system */
	dfs_init();

#ifdef RT_USING_DFS_ELMFAT
	/* initialize the elm chan FatFS file systam*/
	elm_init();
#endif

#if defined(RT_USING_DFS_NFS) && defined(RT_USING_LWIP)
	extern void nfs_init(void);
	/* initialize NFSv3 client file system */
	nfs_init();
#endif

#ifdef RT_USING_DFS_YAFFS2
	yaffs2_init();
#endif

#ifdef RT_USING_DFS_UFFS
	uffs_init();
#endif

#ifdef RT_USING_DFS_JFFS2
	jffs2_init();
#endif

#ifdef RT_USING_DFS_ROMFS
	romfs_init();
#endif

#ifdef RT_USING_DFS_DEVFS
	devfs_init();
#endif
#endif

#ifdef RT_USING_NEWLIB
	libc_system_init(RT_CONSOLE_DEVICE_NAME);
#endif

#ifdef RT_USING_PTHREADS 
	pthread_system_init();
#endif

#ifdef RT_USING_RTGUI
	rtgui_system_server_init();
#endif

	return;
}
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 */
}
Esempio n. 9
0
/***************************************************************************//**
 * @brief
 *  Startup RT-Thread
 *
 * @details
 *
 * @note
 *
 ******************************************************************************/
void rtthread_startup(void)
{
    /* init board */
    rt_hw_board_init();

#ifdef RT_USING_HEAP
    #ifdef __CC_ARM
    rt_system_heap_init((void*)&Image$$RW_IRAM1$$ZI$$Limit, (void*)EFM32_SRAM_END);
    #elif __ICCARM__
    rt_system_heap_init(__segment_end("HEAP"), (void*)EFM32_SRAM_END);
    #else
    /* init memory system */
    rt_system_heap_init((void*)&__bss_end__, (void*)EFM32_SRAM_END);
    #endif
#endif

    /* enable interrupt */
    rt_hw_interrupt_enable(0x0UL);

    /* init drivers */
    rt_hw_driver_init();

    /* show version */
    rt_show_version();

    /* init tick */
    rt_system_tick_init();

    /* init kernel object */
    rt_system_object_init();

    /* init timer system */
    rt_system_timer_init();

    /* init scheduler system */
    rt_system_scheduler_init();

    /* init all devices */
    rt_device_init_all();

    /* init finsh */
#ifdef RT_USING_FINSH
    finsh_system_init();
    finsh_set_device(CONSOLE_DEVICE);
#endif

    /* Initialize gui server */
#ifdef RT_USING_RTGUI
    rtgui_system_server_init();
#endif

    /* init timer thread */
    rt_system_timer_thread_init();

    /* init idle thread */
    rt_thread_idle_init();

    /* init energy mode thread */
    efm32_emu_init();

    /* init application */
    rt_application_init();

    /* start scheduler */
    rt_system_scheduler_start();

    /* never reach here */
    return ;
}
Esempio n. 10
0
/* 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
}
Esempio n. 11
0
void radio_rtgui_init(void)
{
    rtgui_rect_t rect;

    rtgui_system_server_init();

    /* register dock panel */
    rect.x1 = 0;
    rect.y1 = 0;
    rect.x2 = 240;
    rect.y2 = 25;
    rtgui_panel_register("info", &rect);
    rtgui_panel_set_nofocused("info");

    /* register main panel */
    rect.x1 = 0;
    rect.y1 = 25;
    rect.x2 = 240;
    rect.y2 = 320;
    rtgui_panel_register("main", &rect);
    rtgui_panel_set_default_focused("main");

    //rt_hw_lcd_init();
    {
#if LCD_VERSION == 1
#include "fmt0371/FMT0371.h"
        _rtgui_lcd_driver.name            = "lcd";
        _rtgui_lcd_driver.byte_per_pixel  = 2;
        _rtgui_lcd_driver.width           = 240;
        _rtgui_lcd_driver.height          = 320;
        _rtgui_lcd_driver.draw_hline      = fmt_lcd_draw_hline;
        _rtgui_lcd_driver.draw_raw_hline  = fmt_lcd_draw_raw_hline;
        _rtgui_lcd_driver.draw_vline      = fmt_lcd_draw_vline;
        _rtgui_lcd_driver.get_pixel       = fmt_lcd_get_pixel;
        _rtgui_lcd_driver.set_pixel       = fmt_lcd_set_pixel;
        _rtgui_lcd_driver.screen_update   = fmt_lcd_update;
        _rtgui_lcd_driver.get_framebuffer = fmt_lcd_get_framebuffer;
        fmt_lcd_init();
#elif LCD_VERSION == 2
#include "ili_lcd_general.h"
        _rtgui_lcd_driver.name            = "lcd";
        _rtgui_lcd_driver.byte_per_pixel  = 2;
        _rtgui_lcd_driver.width           = 240;
        _rtgui_lcd_driver.height          = 320;
        _rtgui_lcd_driver.draw_hline      = rt_hw_lcd_draw_hline;
        _rtgui_lcd_driver.draw_raw_hline  = rt_hw_lcd_draw_raw_hline;
        _rtgui_lcd_driver.draw_vline      = rt_hw_lcd_draw_vline;
        _rtgui_lcd_driver.get_pixel       = rt_hw_lcd_get_pixel;
        _rtgui_lcd_driver.set_pixel       = rt_hw_lcd_set_pixel;
        _rtgui_lcd_driver.screen_update   = rt_hw_lcd_update;
        _rtgui_lcd_driver.get_framebuffer = rt_hw_lcd_get_framebuffer;
        lcd_Initializtion();
#elif LCD_VERSION == 3
#include "ssd1289.h"
        _rtgui_lcd_driver.name            = "lcd";
        _rtgui_lcd_driver.byte_per_pixel  = 2;
        _rtgui_lcd_driver.width           = 240;
        _rtgui_lcd_driver.height          = 320;
        _rtgui_lcd_driver.draw_hline      = ssd1289_lcd_draw_hline;
        _rtgui_lcd_driver.draw_raw_hline  = ssd1289_lcd_draw_raw_hline;
        _rtgui_lcd_driver.draw_vline      = ssd1289_lcd_draw_vline;
        _rtgui_lcd_driver.get_pixel       = ssd1289_lcd_get_pixel;
        _rtgui_lcd_driver.set_pixel       = ssd1289_lcd_set_pixel;
        _rtgui_lcd_driver.screen_update   = ssd1289_lcd_update;
        _rtgui_lcd_driver.get_framebuffer = ssd1289_lcd_get_framebuffer;
        ssd1289_init();
#endif
    }//rt_hw_lcd_init

    /* add lcd driver into graphic driver */
    rtgui_graphic_driver_add(&_rtgui_lcd_driver);

    info_init();
    player_init();

    lcd_backlight_init();
}
Esempio n. 12
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
}
Esempio n. 13
0
/**
 * RT-Thread Components Initialization
 */
void rt_components_init(void)
{
#ifdef RT_USING_MODULE
    rt_system_module_init();
#endif

#ifdef RT_USING_FINSH
    /* initialize finsh */
    finsh_system_init();
    finsh_set_device(RT_CONSOLE_DEVICE_NAME);
#endif

#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_DFS
    /* initialize the device file system */
    dfs_init();

    #ifdef RT_USING_DFS_ELMFAT
    /* initialize the elm chan FatFS file system*/
    elm_init();
    #endif

    #if defined(RT_USING_DFS_NFS) && defined(RT_USING_LWIP)
    /* initialize NFSv3 client file system */
    nfs_init();
    #endif

    #ifdef RT_USING_DFS_YAFFS2
    dfs_yaffs2_init();
    #endif

    #ifdef RT_USING_DFS_UFFS
    dfs_uffs_init();
    #endif

    #ifdef RT_USING_DFS_JFFS2
    dfs_jffs2_init();
    #endif

    #ifdef RT_USING_DFS_ROMFS
    dfs_romfs_init();
    #endif

    #ifdef RT_USING_DFS_DEVFS
    devfs_init();
    #endif
#endif /* end of RT_USING_DFS */

#ifdef RT_USING_NEWLIB
    libc_system_init(RT_CONSOLE_DEVICE_NAME);
#else
    /* the pthread system initialization will be initiallized in libc */
    #ifdef RT_USING_PTHREADS 
    pthread_system_init();
    #endif
#endif

#ifdef RT_USING_RTGUI
    rtgui_system_server_init();
#endif

#ifdef RT_USING_USB_HOST
    rt_usb_host_init();
#endif

    return;
}
Esempio n. 14
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
}
Esempio n. 15
0
/**
 * RT-Thread Components Initialization
 */
void rt_components_init(void)
{
#ifndef _MSC_VER
#ifdef RT_DEBUG_INIT
	int result;
	const struct rt_init_desc *desc;

	rt_kprintf("do components intialization.\n");
	for (desc = &__rt_init_desc_rti_board_end; desc < &__rt_init_desc_rti_end; desc ++)
	{
		rt_kprintf("initialize %s", desc->fn_name);
		result = desc->fn();
		rt_kprintf(":%d done\n", result);
	}
#else
    const init_fn_t *fn_ptr;
    
    for (fn_ptr = &__rt_init_rti_board_end; fn_ptr < &__rt_init_rti_end; fn_ptr ++)
    {
        (*fn_ptr)();
    }
#endif
#else
#ifdef RT_USING_MODULE
    rt_system_module_init();
#endif

#ifdef RT_USING_FINSH
	/* initialize finsh */
	finsh_system_init();
	finsh_set_device(RT_CONSOLE_DEVICE_NAME);
#endif

#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_DFS
	/* initialize the device file system */
	dfs_init();

#ifdef RT_USING_DFS_ELMFAT
	/* initialize the elm chan FatFS file system*/
	elm_init();
#endif

#if defined(RT_USING_DFS_NFS) && defined(RT_USING_LWIP)
	/* initialize NFSv3 client file system */
	nfs_init();
#endif

#ifdef RT_USING_DFS_YAFFS2
	dfs_yaffs2_init();
#endif

#ifdef RT_USING_DFS_UFFS
	dfs_uffs_init();
#endif

#ifdef RT_USING_DFS_JFFS2
	dfs_jffs2_init();
#endif

#ifdef RT_USING_DFS_ROMFS
	dfs_romfs_init();
#endif

#ifdef RT_USING_DFS_RAMFS
	dfs_ramfs_init();
#endif

#ifdef RT_USING_DFS_DEVFS
	devfs_init();
#endif
#endif /* end of RT_USING_DFS */

#ifdef RT_USING_NEWLIB
	libc_system_init(RT_CONSOLE_DEVICE_NAME);
#else
	/* the pthread system initialization will be initiallized in libc */
#ifdef RT_USING_PTHREADS 
	pthread_system_init();
#endif
#endif

#ifdef RT_USING_RTGUI
	rtgui_system_server_init();
#endif

#ifdef RT_USING_USB_HOST
	rt_usb_host_init();
#endif
#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        

}
Esempio n. 17
0
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 */

}
Esempio n. 18
0
File: main.c Progetto: amsl/RTGUI
int main(int argc, char *argv[])
{
    SDL_Event event;
    int button_state = 0;
    rt_device_t device;

    rt_system_tick_init();

    rt_kprintf("RTGUI simulator ....\n");

    /* init rtt system */
    rt_mq_system_init();
    rt_mb_system_init();
    rt_thread_system_init();

    finsh_thread_init();

    /* init driver */
    sdlfb_hw_init();
    device = rt_device_find("sdl");
    rtgui_gdev_set(device);

    /* init gui system */
    rtgui_system_server_init();

    /* initial user application */
    rt_application_init();

    /* handle SDL event */
    while ( !done )
    {
        /* Check for events */
        while ( SDL_PollEvent(&event) )
        {
            switch (event.type)
            {
            case SDL_MOUSEMOTION:
            {
                struct rtgui_event_mouse emouse;
                emouse.parent.type = RTGUI_EVENT_MOUSE_MOTION;
                emouse.parent.sender = RT_NULL;
                emouse.wid = RT_NULL;

                emouse.x = ((SDL_MouseMotionEvent*)&event)->x;
                emouse.y = ((SDL_MouseMotionEvent*)&event)->y;

                /* init mouse button */
                emouse.button = button_state;

                /* send event to server */
                rtgui_server_post_event(&emouse.parent, sizeof(struct rtgui_event_mouse));
            }
            break;

            case SDL_MOUSEBUTTONDOWN:
            case SDL_MOUSEBUTTONUP:
            {
                struct rtgui_event_mouse emouse;
                SDL_MouseButtonEvent* mb;

                emouse.parent.type = RTGUI_EVENT_MOUSE_BUTTON;
                emouse.parent.sender = RT_NULL;
                emouse.wid = RT_NULL;

                mb = (SDL_MouseButtonEvent*)&event;

                emouse.x = mb->x;
                emouse.y = mb->y;

                /* init mouse button */
                emouse.button = 0;

                /* set emouse button */
                if (mb->button & (1 << (SDL_BUTTON_LEFT - 1)) )
                {
                    emouse.button |= RTGUI_MOUSE_BUTTON_LEFT;
                }
                else if (mb->button & (1 << (SDL_BUTTON_RIGHT - 1)))
                {
                    emouse.button |= RTGUI_MOUSE_BUTTON_RIGHT;
                }
                else if (mb->button & (1 << (SDL_BUTTON_MIDDLE - 1)))
                {
                    emouse.button |= RTGUI_MOUSE_BUTTON_MIDDLE;
                }

                if (mb->type == SDL_MOUSEBUTTONDOWN)
                {
                    emouse.button |= RTGUI_MOUSE_BUTTON_DOWN;
                    button_state = emouse.button;
                }
                else
                {
                    emouse.button |= RTGUI_MOUSE_BUTTON_UP;
                    button_state = 0;
                }


                /* send event to server */
                rtgui_server_post_event(&emouse.parent, sizeof(struct rtgui_event_mouse));
            }
            break;

            case SDL_KEYUP:
            {
                struct rtgui_event_kbd ekbd;
                ekbd.parent.type	= RTGUI_EVENT_KBD;
                ekbd.parent.sender	= RT_NULL;
                ekbd.type = RTGUI_KEYUP;
                ekbd.wid = RT_NULL;
                ekbd.mod = event.key.keysym.mod;
                ekbd.key = event.key.keysym.sym;

                /* FIXME: unicode */
                ekbd.unicode = 0;

                /* send event to server */
                rtgui_server_post_event(&ekbd.parent, sizeof(struct rtgui_event_kbd));
            }
            break;

            case SDL_KEYDOWN:
            {
                struct rtgui_event_kbd ekbd;
                ekbd.parent.type	= RTGUI_EVENT_KBD;
                ekbd.parent.sender	= RT_NULL;
                ekbd.type = RTGUI_KEYDOWN;
                ekbd.wid = RT_NULL;
                ekbd.mod = event.key.keysym.mod;
                ekbd.key = event.key.keysym.sym;

                /* FIXME: unicode */
                ekbd.unicode = 0;

                /* send event to server */
                rtgui_server_post_event(&ekbd.parent, sizeof(struct rtgui_event_kbd));
            }
            break;

            case SDL_QUIT:
                done = 1;
                break;

            default:
                break;
            }

            SDL_Delay(20);
        }
    }

    SDL_Quit();

    return 0;
}
Esempio n. 19
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
}
Esempio n. 20
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_ROMFS)
		dfs_romfs_init();
		if (dfs_mount(RT_NULL, "/", "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_ELMFAT)
		/* init the elm chan FatFs filesystam*/
		elm_init();
		/* 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 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("uart");
		rt_kprintf("libc init done\n");
		#endif
#endif
	}
#endif

#ifdef RT_USING_RTGUI
	{
		rtgui_rect_t rect;

		rtgui_system_server_init();

		/* register dock panel */
		rect.x1 = 0;
		rect.y1 = 0;
		rect.x2 = 400;
		rect.y2 = 480;
		rtgui_panel_register("panel", &rect);

		/* register main panel */
		rect.x1 = 400;
		rect.y1 = 0;
		rect.x2 = 800;
		rect.y2 = 480;
		rtgui_panel_register("main", &rect);
		rtgui_panel_set_default_focused("main");

		rt_hw_lcd_init();
	}
#endif
}