提交 98492b73 编写于 作者: B bernard.xiong@gmail.com

cleanup 3210 branch code.

git-svn-id: https://rt-thread.googlecode.com/svn/trunk@1163 bbd45198-f89e-11dd-88c7-29a3b14d5316
上级 753de206
......@@ -12,43 +12,19 @@
* 2010-06-25 Bernard first version
*/
/**
* @addtogroup Loongson SoC3210
*/
/*@{*/
#include <rtthread.h>
#include <soc3210.h>
struct rt_thread thread;
ALIGN(4)
rt_uint8_t thread_stack[1024];
#include <finsh.h>
void thread_entry(void* parameter)
{
int i = 0;
while (1)
{
rt_kprintf("i = %d, cause: 0x%08x, config: 0x%08x\n", i++, read_c0_cause(), read_c0_config());
rt_kprintf("HSB_MISC_CFG 0x%08x\n", HSB_MISC_REG);
rt_thread_delay(100);
}
}
void thread_test()
{
rt_err_t result = rt_thread_init(&thread,
"tid",
thread_entry, RT_NULL,
&thread_stack, sizeof(thread_stack),
200,
5);
if (result == RT_EOK)
rt_thread_startup(&thread);
else
rt_kprintf("init thread failed\n");
}
FINSH_FUNCTION_EXPORT(thread_test, test thread!!);
#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
#ifdef RT_USING_RTGUI
#include <rtgui/rtgui.h>
......@@ -56,32 +32,87 @@ FINSH_FUNCTION_EXPORT(thread_test, test thread!!);
#include <rtgui/rtgui_server.h>
#endif
int rt_application_init()
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();
{
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
}
int rt_application_init()
{
rt_thread_t tid;
/* create initialization thread */
tid = rt_thread_create("init",
rt_init_thread_entry, RT_NULL,
4096, 8, 20);
if (tid != RT_NULL) rt_thread_startup(tid);
return 0;
}
/*@}*/
......@@ -53,6 +53,7 @@
/* Using SLAB MM */
#define RT_USING_SLAB
/* #define RT_USING_SMALL_MEM */
/* SECTION: Device System */
/* Using Device System */
......@@ -68,8 +69,8 @@
/* SECTION: the runtime libc library */
/* the runtime libc library */
#define RT_USING_NEWLIB
#define RT_USING_PTHREADS
/* #define RT_USING_NEWLIB */
/* #define RT_USING_PTHREADS */
/* SECTION: finsh, a C-Express shell */
/* Using FinSH as Shell*/
......@@ -81,8 +82,9 @@
/* SECTION: device filesystem support */
#define RT_USING_DFS
#define RT_USING_DFS_ELMFAT
/* #define RT_USING_DFS_ELMFAT */
#define RT_USING_DFS_ROMFS
/* #define RT_USING_DFS_DEVFS */
/* the max number of mounted filesystem */
#define DFS_FILESYSTEMS_MAX 2
......@@ -90,6 +92,8 @@
#define DFS_FD_MAX 4
/* the max number of cached sector */
#define DFS_CACHE_MAX_NUM 4
/* Using working directory */
#define DFS_USING_WORKDIR
/* SECTION: lwip, a lighwight TCP/IP protocol stack */
/* #define RT_USING_LWIP */
......
......@@ -29,20 +29,6 @@ extern unsigned char __bss_end;
extern int rt_application_init(void);
void dump_mem(const unsigned char* addr)
{
int size;
rt_kprintf("---- memory: 0x%08x ----\n", addr);
for (size = 0; size < 32 * 4; size ++)
{
rt_kprintf("%02x ", (*addr) & 0xff);
addr ++;
if ((size + 1) % 16 == 0)
rt_kprintf("\n");
}
rt_kprintf("\n");
}
extern void tlb_refill_exception(void);
extern void general_exception(void);
extern void irq_exception(void);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册