2010-10-16 07:40:44 +08:00
|
|
|
/*
|
2012-06-30 09:41:48 +08:00
|
|
|
* File : application.c
|
2010-10-16 07:40:44 +08:00
|
|
|
* This file is part of RT-Thread RTOS
|
2012-06-30 09:41:48 +08:00
|
|
|
* COPYRIGHT (C) 2006 - 2012, RT-Thread Development Team
|
2010-10-16 07:40:44 +08:00
|
|
|
*
|
|
|
|
* The license and distribution terms for this file may be
|
|
|
|
* found in the file LICENSE in this distribution or at
|
|
|
|
* http://www.rt-thread.org/license/LICENSE
|
|
|
|
*
|
|
|
|
* Change Logs:
|
|
|
|
* Date Author Notes
|
|
|
|
* 2010-06-25 Bernard first version
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <rtthread.h>
|
|
|
|
#include <soc3210.h>
|
|
|
|
|
2010-11-30 22:22:18 +08:00
|
|
|
#ifdef RT_USING_DFS
|
|
|
|
#include <dfs.h>
|
|
|
|
#include <dfs_elm.h>
|
|
|
|
#ifdef RT_USING_DFS_ROMFS
|
|
|
|
#include <dfs_romfs.h>
|
|
|
|
#endif
|
|
|
|
#ifdef RT_USING_DFS_DEVFS
|
|
|
|
#include <devfs.h>
|
|
|
|
#endif
|
|
|
|
#endif
|
2010-10-16 07:40:44 +08:00
|
|
|
|
2010-11-18 20:33:52 +08:00
|
|
|
#ifdef RT_USING_RTGUI
|
2010-10-16 07:40:44 +08:00
|
|
|
#include <rtgui/rtgui.h>
|
|
|
|
#include <rtgui/event.h>
|
|
|
|
#include <rtgui/rtgui_server.h>
|
2010-11-18 20:33:52 +08:00
|
|
|
#endif
|
2010-10-16 07:40:44 +08:00
|
|
|
|
2012-06-30 09:41:48 +08:00
|
|
|
void rt_init_thread_entry(void *parameter)
|
2010-10-16 07:40:44 +08:00
|
|
|
{
|
2010-11-30 22:22:18 +08:00
|
|
|
/* 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
|
|
|
|
|
2010-11-18 20:33:52 +08:00
|
|
|
#ifdef RT_USING_RTGUI
|
2010-11-30 22:22:18 +08:00
|
|
|
{
|
|
|
|
rtgui_rect_t rect;
|
|
|
|
|
|
|
|
rtgui_system_server_init();
|
|
|
|
|
|
|
|
/* register dock panel */
|
|
|
|
rect.x1 = 0;
|
|
|
|
rect.y1 = 0;
|
|
|
|
rect.x2 = 400;
|
|
|
|
rect.y2 = 480;
|
2012-06-30 09:41:48 +08:00
|
|
|
// rtgui_panel_register("panel", &rect);
|
2010-11-30 22:22:18 +08:00
|
|
|
|
|
|
|
/* register main panel */
|
|
|
|
rect.x1 = 400;
|
|
|
|
rect.y1 = 0;
|
|
|
|
rect.x2 = 800;
|
|
|
|
rect.y2 = 480;
|
2012-06-30 09:41:48 +08:00
|
|
|
// rtgui_panel_register("main", &rect);
|
|
|
|
// rtgui_panel_set_default_focused("main");
|
2010-11-30 22:22:18 +08:00
|
|
|
|
|
|
|
rt_hw_lcd_init();
|
|
|
|
}
|
2010-11-18 20:33:52 +08:00
|
|
|
#endif
|
2010-11-30 22:22:18 +08:00
|
|
|
}
|
|
|
|
|
2012-06-30 09:41:48 +08:00
|
|
|
int rt_application_init(void)
|
2010-11-30 22:22:18 +08:00
|
|
|
{
|
|
|
|
rt_thread_t tid;
|
|
|
|
|
|
|
|
/* create initialization thread */
|
|
|
|
tid = rt_thread_create("init",
|
2012-06-30 09:41:48 +08:00
|
|
|
rt_init_thread_entry, RT_NULL,
|
|
|
|
4096, 8, 20);
|
|
|
|
if (tid != RT_NULL)
|
|
|
|
rt_thread_startup(tid);
|
2010-10-16 07:40:44 +08:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|