summaryrefslogtreecommitdiff
path: root/bsp/x86
diff options
context:
space:
mode:
authorMing, Bai <[email protected]>2013-01-08 22:40:58 +0800
committerMing, Bai <[email protected]>2013-01-08 22:40:58 +0800
commitb4de7cce57305033e86c3b187271683b609ddb26 (patch)
tree5380a19a3f6bced1d04439a94bf1f76fffb3a179 /bsp/x86
parentf3192c229349119dfd8361a09a52fbab6f99f97e (diff)
Re-normalizing the repo
Diffstat (limited to 'bsp/x86')
-rw-r--r--bsp/x86/SConscript28
-rw-r--r--bsp/x86/SConstruct64
-rw-r--r--bsp/x86/applications/SConscript22
-rw-r--r--bsp/x86/applications/startup.c20
-rw-r--r--bsp/x86/drivers/SConscript26
-rw-r--r--bsp/x86/drivers/board.c44
-rw-r--r--bsp/x86/drivers/board.h10
-rw-r--r--bsp/x86/drivers/console.c756
-rw-r--r--bsp/x86/drivers/include/grub.h186
-rw-r--r--bsp/x86/drivers/keyboard.c274
-rw-r--r--bsp/x86/drivers/serial.c146
-rw-r--r--bsp/x86/rtconfig.h354
-rw-r--r--bsp/x86/rtconfig.py118
13 files changed, 1024 insertions, 1024 deletions
diff --git a/bsp/x86/SConscript b/bsp/x86/SConscript
index a425264923..fe0ae941ae 100644
--- a/bsp/x86/SConscript
+++ b/bsp/x86/SConscript
@@ -1,14 +1,14 @@
-# for module compiling
-import os
-Import('RTT_ROOT')
-
-cwd = str(Dir('#'))
-objs = []
-list = os.listdir(cwd)
-
-for d in list:
- path = os.path.join(cwd, d)
- if os.path.isfile(os.path.join(path, 'SConscript')):
- objs = objs + SConscript(os.path.join(d, 'SConscript'))
-
-Return('objs')
+# for module compiling
+import os
+Import('RTT_ROOT')
+
+cwd = str(Dir('#'))
+objs = []
+list = os.listdir(cwd)
+
+for d in list:
+ path = os.path.join(cwd, d)
+ if os.path.isfile(os.path.join(path, 'SConscript')):
+ objs = objs + SConscript(os.path.join(d, 'SConscript'))
+
+Return('objs')
diff --git a/bsp/x86/SConstruct b/bsp/x86/SConstruct
index e588dcb599..8246fe46c9 100644
--- a/bsp/x86/SConstruct
+++ b/bsp/x86/SConstruct
@@ -1,32 +1,32 @@
-import os
-import sys
-import rtconfig
-
-if os.getenv('RTT_ROOT'):
- RTT_ROOT = os.getenv('RTT_ROOT')
-else:
- RTT_ROOT = os.path.normpath(os.getcwd() + '/../..')
-
-sys.path = sys.path + [os.path.join(RTT_ROOT, 'tools')]
-from building import *
-
-TARGET = 'rtthread.' + rtconfig.TARGET_EXT
-
-env = Environment(tools = ['mingw'],
- AS = rtconfig.AS, ASFLAGS = rtconfig.AFLAGS,
- CC = rtconfig.CC, CCFLAGS = rtconfig.CFLAGS,
- AR = rtconfig.AR, ARFLAGS = '-rc',
- LINK = rtconfig.LINK, LINKFLAGS = rtconfig.LFLAGS)
-env.PrependENVPath('PATH', rtconfig.EXEC_PATH)
-
-Export('RTT_ROOT')
-Export('rtconfig')
-
-# prepare building environment
-objs = PrepareBuilding(env, RTT_ROOT)
-
-# build program
-env.Program(TARGET, objs)
-
-# end building
-EndBuilding(TARGET)
+import os
+import sys
+import rtconfig
+
+if os.getenv('RTT_ROOT'):
+ RTT_ROOT = os.getenv('RTT_ROOT')
+else:
+ RTT_ROOT = os.path.normpath(os.getcwd() + '/../..')
+
+sys.path = sys.path + [os.path.join(RTT_ROOT, 'tools')]
+from building import *
+
+TARGET = 'rtthread.' + rtconfig.TARGET_EXT
+
+env = Environment(tools = ['mingw'],
+ AS = rtconfig.AS, ASFLAGS = rtconfig.AFLAGS,
+ CC = rtconfig.CC, CCFLAGS = rtconfig.CFLAGS,
+ AR = rtconfig.AR, ARFLAGS = '-rc',
+ LINK = rtconfig.LINK, LINKFLAGS = rtconfig.LFLAGS)
+env.PrependENVPath('PATH', rtconfig.EXEC_PATH)
+
+Export('RTT_ROOT')
+Export('rtconfig')
+
+# prepare building environment
+objs = PrepareBuilding(env, RTT_ROOT)
+
+# build program
+env.Program(TARGET, objs)
+
+# end building
+EndBuilding(TARGET)
diff --git a/bsp/x86/applications/SConscript b/bsp/x86/applications/SConscript
index 591734409c..01eb940dfb 100644
--- a/bsp/x86/applications/SConscript
+++ b/bsp/x86/applications/SConscript
@@ -1,11 +1,11 @@
-Import('RTT_ROOT')
-Import('rtconfig')
-from building import *
-
-cwd = os.path.join(str(Dir('#')), 'applications')
-src = Glob('*.c')
-CPPPATH = [cwd, str(Dir('#'))]
-
-group = DefineGroup('Applications', src, depend = [''], CPPPATH = CPPPATH)
-
-Return('group')
+Import('RTT_ROOT')
+Import('rtconfig')
+from building import *
+
+cwd = os.path.join(str(Dir('#')), 'applications')
+src = Glob('*.c')
+CPPPATH = [cwd, str(Dir('#'))]
+
+group = DefineGroup('Applications', src, depend = [''], CPPPATH = CPPPATH)
+
+Return('group')
diff --git a/bsp/x86/applications/startup.c b/bsp/x86/applications/startup.c
index e91b3e6d94..00d85af5f2 100644
--- a/bsp/x86/applications/startup.c
+++ b/bsp/x86/applications/startup.c
@@ -25,11 +25,11 @@ extern int rt_application_init(void);
//extern void rt_system_timer_init(void);
//extern void rt_system_scheduler_init(void);
//extern void rt_thread_idle_init(void);
-
-#ifdef RT_USING_FINSH
-extern void finsh_system_init(void);
-extern void finsh_set_device(const char *device);
-#endif
+
+#ifdef RT_USING_FINSH
+extern void finsh_system_init(void);
+extern void finsh_set_device(const char *device);
+#endif
extern unsigned char __bss_start[];
extern unsigned char __bss_end[];
@@ -61,7 +61,7 @@ void rtthread_startup(void)
rt_hw_interrupt_init();
/* init the console */
- rt_hw_console_init();
+ rt_hw_console_init();
rt_console_set_device("console");
/* init board */
@@ -70,7 +70,7 @@ void rtthread_startup(void)
rt_show_version();
/* init tick */
- rt_system_tick_init();
+ rt_system_tick_init();
/* init kernel object */
rt_system_object_init();
@@ -79,7 +79,7 @@ void rtthread_startup(void)
rt_system_timer_init();
/* init memory system */
-#ifdef RT_USING_HEAP
+#ifdef RT_USING_HEAP
/* RAM 16M */
rt_system_heap_init((void *)&__bss_end, (void *)(1024UL*1024*8));
#endif
@@ -93,8 +93,8 @@ void rtthread_startup(void)
#ifdef RT_USING_FINSH
/* init finsh */
finsh_system_init();
- finsh_set_device("console");
-#endif
+ finsh_set_device("console");
+#endif
/* init idle thread */
rt_thread_idle_init();
diff --git a/bsp/x86/drivers/SConscript b/bsp/x86/drivers/SConscript
index 370e4f9318..02046c4ba6 100644
--- a/bsp/x86/drivers/SConscript
+++ b/bsp/x86/drivers/SConscript
@@ -1,13 +1,13 @@
-Import('RTT_ROOT')
-Import('rtconfig')
-from building import *
-
-cwd = os.path.join(str(Dir('#')), 'drivers')
-
-src = Glob('*.c')
-
-CPPPATH = [cwd, cwd + '/include']
-
-group = DefineGroup('Drivers', src, depend = [''], CPPPATH = CPPPATH)
-
-Return('group')
+Import('RTT_ROOT')
+Import('rtconfig')
+from building import *
+
+cwd = os.path.join(str(Dir('#')), 'drivers')
+
+src = Glob('*.c')
+
+CPPPATH = [cwd, cwd + '/include']
+
+group = DefineGroup('Drivers', src, depend = [''], CPPPATH = CPPPATH)
+
+Return('group')
diff --git a/bsp/x86/drivers/board.c b/bsp/x86/drivers/board.c
index 8ec05b6747..e3a92fc147 100644
--- a/bsp/x86/drivers/board.c
+++ b/bsp/x86/drivers/board.c
@@ -26,12 +26,12 @@
static void rt_timer_handler(int vector)
{
rt_tick_increase();
-}
-
+}
+
#ifdef RT_USING_HOOK
-static void idle_hook(void)
-{
- asm volatile("sti; hlt": : :"memory");
+static void idle_hook(void)
+{
+ asm volatile("sti; hlt": : :"memory");
}
#endif
@@ -48,28 +48,28 @@ void rt_hw_board_init(void)
/* install interrupt handler */
rt_hw_interrupt_install(INTTIMER0, rt_timer_handler, RT_NULL);
- rt_hw_interrupt_umask(INTTIMER0);
-
+ rt_hw_interrupt_umask(INTTIMER0);
+
#ifdef RT_USING_HOOK
rt_thread_idle_sethook(idle_hook);
#endif
}
-
-void restart(void)
-{
- outb(KBSTATP, 0xFE); /* pulse reset low */
- while(1);
-}
-
-#ifdef RT_USING_FINSH
-#include <finsh.h>
+
+void restart(void)
+{
+ outb(KBSTATP, 0xFE); /* pulse reset low */
+ while(1);
+}
+
+#ifdef RT_USING_FINSH
+#include <finsh.h>
FINSH_FUNCTION_EXPORT(restart, reboot PC)
-
-void reboot(void)
-{
- restart();
-}
+
+void reboot(void)
+{
+ restart();
+}
FINSH_FUNCTION_EXPORT(reboot, reboot PC)
-#endif
+#endif
/*@}*/
diff --git a/bsp/x86/drivers/board.h b/bsp/x86/drivers/board.h
index 4b04efdb5d..bc79f9ccfb 100644
--- a/bsp/x86/drivers/board.h
+++ b/bsp/x86/drivers/board.h
@@ -10,11 +10,11 @@
* Change Logs:
* Date Author Notes
* 2006-10-09 Bernard first version
- */
+ */
+
+#ifndef __BOARD_H__
+#define __BOARD_H__
-#ifndef __BOARD_H__
-#define __BOARD_H__
-
void rt_hw_board_init(void);
-#endif
+#endif
diff --git a/bsp/x86/drivers/console.c b/bsp/x86/drivers/console.c
index d3ad91ec47..6bc8b03a9c 100644
--- a/bsp/x86/drivers/console.c
+++ b/bsp/x86/drivers/console.c
@@ -1,378 +1,378 @@
-/*
- * File : console.c
- * This file is part of RT-Thread RTOS
- * COPYRIGHT (C) 2006, RT-Thread Development Team
- *
- * The license and distribution terms for this file may be
- * found in the file LICENSE in this distribution or at
- * http://openlab.rt-thread.com/license/LICENSE
- *
- * Change Logs:
- * Date Author Notes
- * 2006-09-15 QiuYi the first version
- */
-
-#include <rtthread.h>
-#include <rthw.h>
-
-#include <bsp.h>
-
-
-//#include "serial.h"
-
-static unsigned addr_6845;
-static rt_uint16_t *crt_buf;
-static rt_int16_t crt_pos;
-
-//extern void rt_serial_init(void);
-extern char rt_keyboard_getc(void);
-//extern char rt_serial_getc(void);
-
-static void rt_console_putc(int c);
-
-/**
- * @addtogroup QEMU
- */
-/*@{*/
-
-/**
- * This function initializes cga
- *
- */
-void rt_cga_init(void)
-{
- rt_uint16_t volatile *cp;
- rt_uint16_t was;
- rt_uint32_t pos;
-
- cp = (rt_uint16_t *) (CGA_BUF);
- was = *cp;
- *cp = (rt_uint16_t) 0xA55A;
- if (*cp != 0xA55A)
- {
- cp = (rt_uint16_t *) (MONO_BUF);
- addr_6845 = MONO_BASE;
- }
- else
- {
- *cp = was;
- addr_6845 = CGA_BASE;
- }
-
- /* Extract cursor location */
- outb(addr_6845, 14);
- pos = inb(addr_6845+1) << 8;
- outb(addr_6845, 15);
- pos |= inb(addr_6845+1);
-
- crt_buf = (rt_uint16_t *)cp;
- crt_pos = pos;
-}
-
-/**
- * This function will write a character to cga
- *
- * @param c the char to write
- */
-static void rt_cga_putc(int c)
-{
- /* if no attribute given, then use black on white */
- if (!(c & ~0xff)) c |= 0x0700;
-
- switch (c & 0xff)
- {
- case '\b':
- if (crt_pos > 0)
- {
- crt_pos--;
- crt_buf[crt_pos] = (c&~0xff) | ' ';
- }
- break;
- case '\n':
- crt_pos += CRT_COLS;
- /* cascade */
- case '\r':
- crt_pos -= (crt_pos % CRT_COLS);
- break;
- case '\t':
- rt_console_putc(' ');
- rt_console_putc(' ');
- rt_console_putc(' ');
- rt_console_putc(' ');
- rt_console_putc(' ');
- break;
- default:
- crt_buf[crt_pos++] = c; /* write the character */
- break;
- }
-
- if (crt_pos >= CRT_SIZE)
- {
- rt_int32_t i;
- rt_memcpy(crt_buf, crt_buf + CRT_COLS, (CRT_SIZE - CRT_COLS) << 1);
- for (i = CRT_SIZE - CRT_COLS; i < CRT_SIZE; i++)
- crt_buf[i] = 0x0700 | ' ';
- crt_pos -= CRT_COLS;
- }
-
- outb(addr_6845, 14);
- outb(addr_6845+1, crt_pos >> 8);
- outb(addr_6845, 15);
- outb(addr_6845+1, crt_pos);
-}
-
-/**
- * This function will write a character to serial an cga
- *
- * @param c the char to write
- */
-static void rt_console_putc(int c)
-{
- rt_cga_putc(c);
-// rt_serial_putc(c);
-}
-
-/* RT-Thread Device Interface */
-#define CONSOLE_RX_BUFFER_SIZE 64
-static struct rt_device console_device;
-static rt_uint8_t rx_buffer[CONSOLE_RX_BUFFER_SIZE];
-static rt_uint32_t read_index, save_index;
-
-static rt_err_t rt_console_init (rt_device_t dev)
-{
- return RT_EOK;
-}
-
-static rt_err_t rt_console_open(rt_device_t dev, rt_uint16_t oflag)
-{
- return RT_EOK;
-}
-
-static rt_err_t rt_console_close(rt_device_t dev)
-{
- return RT_EOK;
-}
-
-static rt_err_t rt_console_control(rt_device_t dev, rt_uint8_t cmd, void *args)
-{
- return RT_EOK;
-}
-
-static rt_size_t rt_console_write(rt_device_t dev, rt_off_t pos, const void * buffer, rt_size_t size)
-{
- rt_size_t i = size;
- const char* str = buffer;
-
- while(i--)
- {
- rt_console_putc(*str++);
- }
-
- return size;
-}
-
-static rt_size_t rt_console_read(rt_device_t dev, rt_off_t pos, void* buffer, rt_size_t size)
-{
- rt_uint8_t* ptr = buffer;
- rt_err_t err_code = RT_EOK;
-
- /* interrupt mode Rx */
- while (size)
- {
- rt_base_t level;
-
- /* disable interrupt */
- level = rt_hw_interrupt_disable();
-
- if (read_index != save_index)
- {
- /* read a character */
- *ptr++ = rx_buffer[read_index];
- size--;
-
- /* move to next position */
- read_index ++;
- if (read_index >= CONSOLE_RX_BUFFER_SIZE)
- read_index = 0;
- }
- else
- {
- /* set error code */
- err_code = -RT_EEMPTY;
-
- /* enable interrupt */
- rt_hw_interrupt_enable(level);
- break;
- }
-
- /* enable interrupt */
- rt_hw_interrupt_enable(level);
- }
-
- /* set error code */
- rt_set_errno(err_code);
- return (rt_uint32_t)ptr - (rt_uint32_t)buffer;
-}
-
-static void rt_console_isr(int vector)
-{
-// rt_kprintf("rt_console_isr\r\n");
-// RT_ASSERT(INTKEYBOARD == vector);
-// finsh_notify();
-
- char c;
- rt_base_t level;
-
- while(1)
- {
- c = rt_keyboard_getc();
-// rt_kprintf(" %x", c);
-
- if(c == 0)
- {
- break;
- }
- else if(c > 0)
- {
- /* disable interrupt */
- level = rt_hw_interrupt_disable();
-
- /* save character */
- rx_buffer[save_index] = c;
- save_index ++;
- if (save_index >= CONSOLE_RX_BUFFER_SIZE)
- save_index = 0;
-
- /* if the next position is read index, discard this 'read char' */
- if (save_index == read_index)
- {
- read_index ++;
- if (read_index >= CONSOLE_RX_BUFFER_SIZE)
- read_index = 0;
- }
-
- /* enable interrupt */
- rt_hw_interrupt_enable(level);
- }
- }
-
- /* invoke callback */
- if (console_device.rx_indicate != RT_NULL)
- {
- rt_size_t rx_length;
-
- /* get rx length */
- rx_length = read_index > save_index ?
- CONSOLE_RX_BUFFER_SIZE - read_index + save_index :
- save_index - read_index;
-
-// rt_kprintf("\r\nrx_length %d\r\n", rx_length);
- if(rx_length > 0)
- {
- console_device.rx_indicate(&console_device, rx_length);
- }
- }
- else
- {
-// rt_kprintf("\r\nconsole_device.rx_indicate == RT_NULL\r\n");
- }
-}
-
-/**
- * This function initializes console
- *
- */
-void rt_hw_console_init(void)
-{
- rt_cga_init();
-// rt_serial_init();
-
-
- /* install keyboard isr */
- rt_hw_interrupt_install(INTKEYBOARD, rt_console_isr, RT_NULL);
- rt_hw_interrupt_umask(INTKEYBOARD);
-
- console_device.type = RT_Device_Class_Char;
- console_device.rx_indicate = RT_NULL;
- console_device.tx_complete = RT_NULL;
- console_device.init = rt_console_init;
- console_device.open = rt_console_open;
- console_device.close = rt_console_close;
- console_device.read = rt_console_read;
- console_device.write = rt_console_write;
- console_device.control = rt_console_control;
- console_device.user_data = RT_NULL;
-
- /* register a character device */
- rt_device_register(&console_device,
- "console",
- RT_DEVICE_FLAG_RDWR | RT_DEVICE_FLAG_INT_RX | RT_DEVICE_FLAG_STREAM);
-}
-
-/**
- * This function is used to display a string on console, normally, it's
- * invoked by rt_kprintf
- *
- * @param str the displayed string
- *
- * Modified:
- * caoxl 2009-10-14
- * the name is change to rt_hw_console_output in the v0.3.0
- *
- */
-
-//void rt_console_puts(const char* str)
-void rt_hw_console_output(const char* str)
-{
- while (*str)
- {
- rt_console_putc (*str++);
- }
-}
-
-//#define BY2CONS 512
-//
-//static struct
-//{
-// rt_uint8_t buf[BY2CONS];
-// rt_uint32_t rpos;
-// rt_uint32_t wpos;
-//} cons;
-//
-//static void rt_console_intr(char (*proc)(void))
-//{
-// int c;
-//
-// while ((c = (*proc)()) != -1)
-// {
-// if (c == 0)
-// continue;
-// cons.buf[cons.wpos++] = c;
-// if (cons.wpos == BY2CONS)
-// cons.wpos = 0;
-// }
-//}
-
-///**
-// * return the next input character from the console,either from serial,
-// * or keyboard
-// *
-// */
-//int rt_console_getc(void)
-//{
-// int c;
-//
-// rt_console_intr(rt_serial_getc);
-// rt_console_intr(rt_keyboard_getc);
-//
-// if (cons.rpos != cons.wpos)
-// {
-// c = cons.buf[cons.rpos++];
-// if (cons.rpos == BY2CONS)
-// cons.rpos = 0;
-// return c;
-// }
-// return 0;
-//}
-
-/*@}*/
+/*
+ * File : console.c
+ * This file is part of RT-Thread RTOS
+ * COPYRIGHT (C) 2006, RT-Thread Development Team
+ *
+ * The license and distribution terms for this file may be
+ * found in the file LICENSE in this distribution or at
+ * http://openlab.rt-thread.com/license/LICENSE
+ *
+ * Change Logs:
+ * Date Author Notes
+ * 2006-09-15 QiuYi the first version
+ */
+
+#include <rtthread.h>
+#include <rthw.h>
+
+#include <bsp.h>
+
+
+//#include "serial.h"
+
+static unsigned addr_6845;
+static rt_uint16_t *crt_buf;
+static rt_int16_t crt_pos;
+
+//extern void rt_serial_init(void);
+extern char rt_keyboard_getc(void);
+//extern char rt_serial_getc(void);
+
+static void rt_console_putc(int c);
+
+/**
+ * @addtogroup QEMU
+ */
+/*@{*/
+
+/**
+ * This function initializes cga
+ *
+ */
+void rt_cga_init(void)
+{
+ rt_uint16_t volatile *cp;
+ rt_uint16_t was;
+ rt_uint32_t pos;
+
+ cp = (rt_uint16_t *) (CGA_BUF);
+ was = *cp;
+ *cp = (rt_uint16_t) 0xA55A;
+ if (*cp != 0xA55A)
+ {
+ cp = (rt_uint16_t *) (MONO_BUF);
+ addr_6845 = MONO_BASE;
+ }
+ else
+ {
+ *cp = was;
+ addr_6845 = CGA_BASE;
+ }
+
+ /* Extract cursor location */
+ outb(addr_6845, 14);
+ pos = inb(addr_6845+1) << 8;
+ outb(addr_6845, 15);
+ pos |= inb(addr_6845+1);
+
+ crt_buf = (rt_uint16_t *)cp;
+ crt_pos = pos;
+}
+
+/**
+ * This function will write a character to cga
+ *
+ * @param c the char to write
+ */
+static void rt_cga_putc(int c)
+{
+ /* if no attribute given, then use black on white */
+ if (!(c & ~0xff)) c |= 0x0700;
+
+ switch (c & 0xff)
+ {
+ case '\b':
+ if (crt_pos > 0)
+ {
+ crt_pos--;
+ crt_buf[crt_pos] = (c&~0xff) | ' ';
+ }
+ break;
+ case '\n':
+ crt_pos += CRT_COLS;
+ /* cascade */
+ case '\r':
+ crt_pos -= (crt_pos % CRT_COLS);
+ break;
+ case '\t':
+ rt_console_putc(' ');
+ rt_console_putc(' ');
+ rt_console_putc(' ');
+ rt_console_putc(' ');
+ rt_console_putc(' ');
+ break;
+ default:
+ crt_buf[crt_pos++] = c; /* write the character */
+ break;
+ }
+
+ if (crt_pos >= CRT_SIZE)
+ {
+ rt_int32_t i;
+ rt_memcpy(crt_buf, crt_buf + CRT_COLS, (CRT_SIZE - CRT_COLS) << 1);
+ for (i = CRT_SIZE - CRT_COLS; i < CRT_SIZE; i++)
+ crt_buf[i] = 0x0700 | ' ';
+ crt_pos -= CRT_COLS;
+ }
+
+ outb(addr_6845, 14);
+ outb(addr_6845+1, crt_pos >> 8);
+ outb(addr_6845, 15);
+ outb(addr_6845+1, crt_pos);
+}
+
+/**
+ * This function will write a character to serial an cga
+ *
+ * @param c the char to write
+ */
+static void rt_console_putc(int c)
+{
+ rt_cga_putc(c);
+// rt_serial_putc(c);
+}
+
+/* RT-Thread Device Interface */
+#define CONSOLE_RX_BUFFER_SIZE 64
+static struct rt_device console_device;
+static rt_uint8_t rx_buffer[CONSOLE_RX_BUFFER_SIZE];
+static rt_uint32_t read_index, save_index;
+
+static rt_err_t rt_console_init (rt_device_t dev)
+{
+ return RT_EOK;
+}
+
+static rt_err_t rt_console_open(rt_device_t dev, rt_uint16_t oflag)
+{
+ return RT_EOK;
+}
+
+static rt_err_t rt_console_close(rt_device_t dev)
+{
+ return RT_EOK;
+}
+
+static rt_err_t rt_console_control(rt_device_t dev, rt_uint8_t cmd, void *args)
+{
+ return RT_EOK;
+}
+
+static rt_size_t rt_console_write(rt_device_t dev, rt_off_t pos, const void * buffer, rt_size_t size)
+{
+ rt_size_t i = size;
+ const char* str = buffer;
+
+ while(i--)
+ {
+ rt_console_putc(*str++);
+ }
+
+ return size;
+}
+
+static rt_size_t rt_console_read(rt_device_t dev, rt_off_t pos, void* buffer, rt_size_t size)
+{
+ rt_uint8_t* ptr = buffer;
+ rt_err_t err_code = RT_EOK;
+
+ /* interrupt mode Rx */
+ while (size)
+ {
+ rt_base_t level;
+
+ /* disable interrupt */
+ level = rt_hw_interrupt_disable();
+
+ if (read_index != save_index)
+ {
+ /* read a character */
+ *ptr++ = rx_buffer[read_index];
+ size--;
+
+ /* move to next position */
+ read_index ++;
+ if (read_index >= CONSOLE_RX_BUFFER_SIZE)
+ read_index = 0;
+ }
+ else
+ {
+ /* set error code */
+ err_code = -RT_EEMPTY;
+
+ /* enable interrupt */
+ rt_hw_interrupt_enable(level);
+ break;
+ }
+
+ /* enable interrupt */
+ rt_hw_interrupt_enable(level);
+ }
+
+ /* set error code */
+ rt_set_errno(err_code);
+ return (rt_uint32_t)ptr - (rt_uint32_t)buffer;
+}
+
+static void rt_console_isr(int vector)
+{
+// rt_kprintf("rt_console_isr\r\n");
+// RT_ASSERT(INTKEYBOARD == vector);
+// finsh_notify();
+
+ char c;
+ rt_base_t level;
+
+ while(1)
+ {
+ c = rt_keyboard_getc();
+// rt_kprintf(" %x", c);
+
+ if(c == 0)
+ {
+ break;
+ }
+ else if(c > 0)
+ {
+ /* disable interrupt */
+ level = rt_hw_interrupt_disable();
+
+ /* save character */
+ rx_buffer[save_index] = c;
+ save_index ++;
+ if (save_index >= CONSOLE_RX_BUFFER_SIZE)
+ save_index = 0;
+
+ /* if the next position is read index, discard this 'read char' */
+ if (save_index == read_index)
+ {
+ read_index ++;
+ if (read_index >= CONSOLE_RX_BUFFER_SIZE)
+ read_index = 0;
+ }
+
+ /* enable interrupt */
+ rt_hw_interrupt_enable(level);
+ }
+ }
+
+ /* invoke callback */
+ if (console_device.rx_indicate != RT_NULL)
+ {
+ rt_size_t rx_length;
+
+ /* get rx length */
+ rx_length = read_index > save_index ?
+ CONSOLE_RX_BUFFER_SIZE - read_index + save_index :
+ save_index - read_index;
+
+// rt_kprintf("\r\nrx_length %d\r\n", rx_length);
+ if(rx_length > 0)
+ {
+ console_device.rx_indicate(&console_device, rx_length);
+ }
+ }
+ else
+ {
+// rt_kprintf("\r\nconsole_device.rx_indicate == RT_NULL\r\n");
+ }
+}
+
+/**
+ * This function initializes console
+ *
+ */
+void rt_hw_console_init(void)
+{
+ rt_cga_init();
+// rt_serial_init();
+
+
+ /* install keyboard isr */
+ rt_hw_interrupt_install(INTKEYBOARD, rt_console_isr, RT_NULL);
+ rt_hw_interrupt_umask(INTKEYBOARD);
+
+ console_device.type = RT_Device_Class_Char;
+ console_device.rx_indicate = RT_NULL;
+ console_device.tx_complete = RT_NULL;
+ console_device.init = rt_console_init;
+ console_device.open = rt_console_open;
+ console_device.close = rt_console_close;
+ console_device.read = rt_console_read;
+ console_device.write = rt_console_write;
+ console_device.control = rt_console_control;
+ console_device.user_data = RT_NULL;
+
+ /* register a character device */
+ rt_device_register(&console_device,
+ "console",
+ RT_DEVICE_FLAG_RDWR | RT_DEVICE_FLAG_INT_RX | RT_DEVICE_FLAG_STREAM);
+}
+
+/**
+ * This function is used to display a string on console, normally, it's
+ * invoked by rt_kprintf
+ *
+ * @param str the displayed string
+ *
+ * Modified:
+ * caoxl 2009-10-14
+ * the name is change to rt_hw_console_output in the v0.3.0
+ *
+ */
+
+//void rt_console_puts(const char* str)
+void rt_hw_console_output(const char* str)
+{
+ while (*str)
+ {
+ rt_console_putc (*str++);
+ }
+}
+
+//#define BY2CONS 512
+//
+//static struct
+//{
+// rt_uint8_t buf[BY2CONS];
+// rt_uint32_t rpos;
+// rt_uint32_t wpos;
+//} cons;
+//
+//static void rt_console_intr(char (*proc)(void))
+//{
+// int c;
+//
+// while ((c = (*proc)()) != -1)
+// {
+// if (c == 0)
+// continue;
+// cons.buf[cons.wpos++] = c;
+// if (cons.wpos == BY2CONS)
+// cons.wpos = 0;
+// }
+//}
+
+///**
+// * return the next input character from the console,either from serial,
+// * or keyboard
+// *
+// */
+//int rt_console_getc(void)
+//{
+// int c;
+//
+// rt_console_intr(rt_serial_getc);
+// rt_console_intr(rt_keyboard_getc);
+//
+// if (cons.rpos != cons.wpos)
+// {
+// c = cons.buf[cons.rpos++];
+// if (cons.rpos == BY2CONS)
+// cons.rpos = 0;
+// return c;
+// }
+// return 0;
+//}
+
+/*@}*/
diff --git a/bsp/x86/drivers/include/grub.h b/bsp/x86/drivers/include/grub.h
index 18d08a78ad..dcfa36b819 100644
--- a/bsp/x86/drivers/include/grub.h
+++ b/bsp/x86/drivers/include/grub.h
@@ -1,93 +1,93 @@
-/*
- * File : grub.h
- * This file is part of RT-Thread RTOS
- * COPYRIGHT (C) 2006, RT-Thread Develop Team
- *
- * The license and distribution terms for this file may be
- * found in the file LICENSE in this distribution or at
- * http://openlab.rt-thread.com/license/LICENSE
- *
- * Change Logs:
- * Date Author Notes
- * 2006-10-09 Bernard the grub related definitions
- * (multiboot)
- */
-
-#ifndef __GRUB_H__
-#define __GRUB_H__
-
-/* the magic number for the multiboot header. */
-#define MULTIBOOT_HEADER_MAGIC 0x1BADB002
-
-/* the flags for the multiboot header. */
-#define MULTIBOOT_HEADER_FLAGS 0x00000003
-
-/* the magic number passed by a multiboot-compliant boot loader. */
-#define MULTIBOOT_BOOTLOADER_MAGIC 0x2BADB002
-
-#ifndef __ASM__
-/* the multiboot header. */
-typedef struct multiboot_header
-{
- unsigned long magic;
- unsigned long flags;
- unsigned long checksum;
- unsigned long header_addr;
- unsigned long load_addr;
- unsigned long load_end_addr;
- unsigned long bss_end_addr;
- unsigned long entry_addr;
-} multiboot_header_t;
-
-/* the section header table for elf. */
-typedef struct elf_section_header_table
-{
- unsigned long num;
- unsigned long size;
- unsigned long addr;
- unsigned long shndx;
-} elf_section_header_table_t;
-
-/* the multiboot information. */
-typedef struct multiboot_info
-{
- unsigned long flags;
- unsigned long mem_lower;
- unsigned long mem_upper;
- unsigned long boot_device;
- unsigned long cmdline;
- unsigned long mods_count;
- unsigned long mods_addr;
- union
- {
- aout_symbol_table_t aout_sym;
- elf_section_header_table_t elf_sec;
- } u;
- unsigned long mmap_length;
- unsigned long mmap_addr;
-} multiboot_info_t;
-
-/* the module structure. */
-typedef struct module
-{
- unsigned long mod_start;
- unsigned long mod_end;
- unsigned long string;
- unsigned long reserved;
-} module_t;
-
-/* the memory map. be careful that the offset 0 is base_addr_low
- but no size. */
-typedef struct memory_map
-{
- unsigned long size;
- unsigned long base_addr_low;
- unsigned long base_addr_high;
- unsigned long length_low;
- unsigned long length_high;
- unsigned long type;
-} memory_map_t;
-
-#endif
-
-#endif
+/*
+ * File : grub.h
+ * This file is part of RT-Thread RTOS
+ * COPYRIGHT (C) 2006, RT-Thread Develop Team
+ *
+ * The license and distribution terms for this file may be
+ * found in the file LICENSE in this distribution or at
+ * http://openlab.rt-thread.com/license/LICENSE
+ *
+ * Change Logs:
+ * Date Author Notes
+ * 2006-10-09 Bernard the grub related definitions
+ * (multiboot)
+ */
+
+#ifndef __GRUB_H__
+#define __GRUB_H__
+
+/* the magic number for the multiboot header. */
+#define MULTIBOOT_HEADER_MAGIC 0x1BADB002
+
+/* the flags for the multiboot header. */
+#define MULTIBOOT_HEADER_FLAGS 0x00000003
+
+/* the magic number passed by a multiboot-compliant boot loader. */
+#define MULTIBOOT_BOOTLOADER_MAGIC 0x2BADB002
+
+#ifndef __ASM__
+/* the multiboot header. */
+typedef struct multiboot_header
+{
+ unsigned long magic;
+ unsigned long flags;
+ unsigned long checksum;
+ unsigned long header_addr;
+ unsigned long load_addr;
+ unsigned long load_end_addr;
+ unsigned long bss_end_addr;
+ unsigned long entry_addr;
+} multiboot_header_t;
+
+/* the section header table for elf. */
+typedef struct elf_section_header_table
+{
+ unsigned long num;
+ unsigned long size;
+ unsigned long addr;
+ unsigned long shndx;
+} elf_section_header_table_t;
+
+/* the multiboot information. */
+typedef struct multiboot_info
+{
+ unsigned long flags;
+ unsigned long mem_lower;
+ unsigned long mem_upper;
+ unsigned long boot_device;
+ unsigned long cmdline;
+ unsigned long mods_count;
+ unsigned long mods_addr;
+ union
+ {
+ aout_symbol_table_t aout_sym;
+ elf_section_header_table_t elf_sec;
+ } u;
+ unsigned long mmap_length;
+ unsigned long mmap_addr;
+} multiboot_info_t;
+
+/* the module structure. */
+typedef struct module
+{
+ unsigned long mod_start;
+ unsigned long mod_end;
+ unsigned long string;
+ unsigned long reserved;
+} module_t;
+
+/* the memory map. be careful that the offset 0 is base_addr_low
+ but no size. */
+typedef struct memory_map
+{
+ unsigned long size;
+ unsigned long base_addr_low;
+ unsigned long base_addr_high;
+ unsigned long length_low;
+ unsigned long length_high;
+ unsigned long type;
+} memory_map_t;
+
+#endif
+
+#endif
diff --git a/bsp/x86/drivers/keyboard.c b/bsp/x86/drivers/keyboard.c
index 5bf3de3906..21c9fba28d 100644
--- a/bsp/x86/drivers/keyboard.c
+++ b/bsp/x86/drivers/keyboard.c
@@ -1,138 +1,138 @@
-/*
- * File : keyboard.c
- * This file is part of RT-Thread RTOS
- * COPYRIGHT (C) 2006, RT-Thread Development Team
- *
- * The license and distribution terms for this file may be
- * found in the file LICENSE in this distribution or at
- * http://openlab.rt-thread.com/license/LICENSE
- *
- * Change Logs:
- * Date Author Notes
+/*
+ * File : keyboard.c
+ * This file is part of RT-Thread RTOS
+ * COPYRIGHT (C) 2006, RT-Thread Development Team
+ *
+ * The license and distribution terms for this file may be
+ * found in the file LICENSE in this distribution or at
+ * http://openlab.rt-thread.com/license/LICENSE
+ *
+ * Change Logs:
+ * Date Author Notes
* 2006-09-15 QiuYi the first version
- */
-
-#include <rtthread.h>
-#include <rthw.h>
-
-#include <bsp.h>
-
-#define NO 0
-
-#define SHIFT (1 << 0)
-#define CTL (1 << 1)
-#define ALT (1 << 2)
-
-#define CAPSLOCK (1<<3)
-#define NUMLOCK (1<<4)
-#define SCROLLOCK (1<<5)
-
-static int shiftcode[256] =
-{
- [29] CTL,
- [42] SHIFT,
- [54] SHIFT,
- [56] ALT,
-};
-
-static int togglecode[256] =
-{
- [58] CAPSLOCK,
- [69] NUMLOCK,
- [70] SCROLLOCK,
-};
-
-static char normalmap[256] =
-{
- NO, 033, '1', '2', '3', '4', '5', '6',
- '7', '8', '9', '0', '-', '=', '\b', '\t',
- 'q', 'w', 'e', 'r', 't', 'y', 'u', 'i',
- 'o', 'p', '[', ']', '\n', NO, 'a', 's',
- 'd', 'f', 'g', 'h', 'j', 'k', 'l', ';',
- '\'', '`', NO, '\\', 'z', 'x', 'c', 'v',
- 'b', 'n', 'm', ',', '.', '/', NO, '*',
- NO, ' ', NO, NO, NO, NO, NO, NO,
- NO, NO, NO, NO, NO, NO, NO, '7',
- '8', '9', '-', '4', '5', '6', '+', '1',
- '2', '3', '0', '.',
-};
-
-static char shiftmap[256] =
-{
- NO, 033, '!', '@', '#', '$', '%', '^',
- '&', '*', '(', ')', '_', '+', '\b', '\t',
- 'Q', 'W', 'E', 'R', 'T', 'Y', 'U', 'I',
- 'O', 'P', '{', '}', '\n', NO, 'A', 'S',
- 'D', 'F', 'G', 'H', 'J', 'K', 'L', ';',
- '"', '~', NO, '|', 'Z', 'X', 'C', 'V',
- 'B', 'N', 'M', '<', '>', '?', NO, '*',
- NO, ' ', NO, NO, NO, NO, NO, NO,
- NO, NO, NO, NO, NO, NO, NO, '7',
- '8', '9', '-', '4', '5', '6', '+', '1',
- '2', '3', '0', '.',
-};
-
-#define C(x) (x-'@')
-
-static char ctlmap[256] =
-{
- NO, NO, NO, NO, NO, NO, NO, NO,
- NO, NO, NO, NO, NO, NO, NO, NO,
- C('Q'), C('W'), C('E'), C('R'), C('T'), C('Y'), C('U'), C('I'),
- C('O'), C('P'), NO, NO, '\r', NO, C('A'), C('S'),
- C('D'), C('F'), C('G'), C('H'), C('J'), C('K'), C('L'), NO,
- NO, NO, NO, C('\\'), C('Z'), C('X'), C('C'), C('V'),
- C('B'), C('N'), C('M'), NO, NO, C('/'), NO, NO,
-};
-
-static char *charcode[4] =
-{
- normalmap,
- shiftmap,
- ctlmap,
- ctlmap,
-};
-
-/**
- * @addtogroup QEMU
- */
-/*@{*/
-
-/**
- * This function get a char from the keyboard
- */
-char rt_keyboard_getc(void)
-{
- int c;
- rt_uint8_t data;
- static rt_uint32_t shift;
-
- if ((inb(KBSTATP) & KBS_DIB) == 0)
- return -1;
-
- data = inb(KBDATAP);
-
- if (data & 0x80)
- {
- /* key up */
- shift &= ~shiftcode[data&~0x80];
- return 0;
- }
-
- /* key down */
- shift |= shiftcode[data];
- shift ^= togglecode[data];
- c = charcode[shift&(CTL|SHIFT)][data];
-
- if (shift&CAPSLOCK)
- {
- if ('a' <= c && c <= 'z')
- c += 'A' - 'a';
- else if ('A' <= c && c <= 'Z')
- c += 'a' - 'A';
- }
-
- return c;
-}
-
-/*@}*/
+ */
+
+#include <rtthread.h>
+#include <rthw.h>
+
+#include <bsp.h>
+
+#define NO 0
+
+#define SHIFT (1 << 0)
+#define CTL (1 << 1)
+#define ALT (1 << 2)
+
+#define CAPSLOCK (1<<3)
+#define NUMLOCK (1<<4)
+#define SCROLLOCK (1<<5)
+
+static int shiftcode[256] =
+{
+ [29] CTL,
+ [42] SHIFT,
+ [54] SHIFT,
+ [56] ALT,
+};
+
+static int togglecode[256] =
+{
+ [58] CAPSLOCK,
+ [69] NUMLOCK,
+ [70] SCROLLOCK,
+};
+
+static char normalmap[256] =
+{
+ NO, 033, '1', '2', '3', '4', '5', '6',
+ '7', '8', '9', '0', '-', '=', '\b', '\t',
+ 'q', 'w', 'e', 'r', 't', 'y', 'u', 'i',
+ 'o', 'p', '[', ']', '\n', NO, 'a', 's',
+ 'd', 'f', 'g', 'h', 'j', 'k', 'l', ';',
+ '\'', '`', NO, '\\', 'z', 'x', 'c', 'v',
+ 'b', 'n', 'm', ',', '.', '/', NO, '*',
+ NO, ' ', NO, NO, NO, NO, NO, NO,
+ NO, NO, NO, NO, NO, NO, NO, '7',
+ '8', '9', '-', '4', '5', '6', '+', '1',
+ '2', '3', '0', '.',
+};
+
+static char shiftmap[256] =
+{
+ NO, 033, '!', '@', '#', '$', '%', '^',
+ '&', '*', '(', ')', '_', '+', '\b', '\t',
+ 'Q', 'W', 'E', 'R', 'T', 'Y', 'U', 'I',
+ 'O', 'P', '{', '}', '\n', NO, 'A', 'S',
+ 'D', 'F', 'G', 'H', 'J', 'K', 'L', ';',
+ '"', '~', NO, '|', 'Z', 'X', 'C', 'V',
+ 'B', 'N', 'M', '<', '>', '?', NO, '*',
+ NO, ' ', NO, NO, NO, NO, NO, NO,
+ NO, NO, NO, NO, NO, NO, NO, '7',
+ '8', '9', '-', '4', '5', '6', '+', '1',
+ '2', '3', '0', '.',
+};
+
+#define C(x) (x-'@')
+
+static char ctlmap[256] =
+{
+ NO, NO, NO, NO, NO, NO, NO, NO,
+ NO, NO, NO, NO, NO, NO, NO, NO,
+ C('Q'), C('W'), C('E'), C('R'), C('T'), C('Y'), C('U'), C('I'),
+ C('O'), C('P'), NO, NO, '\r', NO, C('A'), C('S'),
+ C('D'), C('F'), C('G'), C('H'), C('J'), C('K'), C('L'), NO,
+ NO, NO, NO, C('\\'), C('Z'), C('X'), C('C'), C('V'),
+ C('B'), C('N'), C('M'), NO, NO, C('/'), NO, NO,
+};
+
+static char *charcode[4] =
+{
+ normalmap,
+ shiftmap,
+ ctlmap,
+ ctlmap,
+};
+
+/**
+ * @addtogroup QEMU
+ */
+/*@{*/
+
+/**
+ * This function get a char from the keyboard
+ */
+char rt_keyboard_getc(void)
+{
+ int c;
+ rt_uint8_t data;
+ static rt_uint32_t shift;
+
+ if ((inb(KBSTATP) & KBS_DIB) == 0)
+ return -1;
+
+ data = inb(KBDATAP);
+
+ if (data & 0x80)
+ {
+ /* key up */
+ shift &= ~shiftcode[data&~0x80];
+ return 0;
+ }
+
+ /* key down */
+ shift |= shiftcode[data];
+ shift ^= togglecode[data];
+ c = charcode[shift&(CTL|SHIFT)][data];
+
+ if (shift&CAPSLOCK)
+ {
+ if ('a' <= c && c <= 'z')
+ c += 'A' - 'a';
+ else if ('A' <= c && c <= 'Z')
+ c += 'a' - 'A';
+ }
+
+ return c;
+}
+
+/*@}*/
diff --git a/bsp/x86/drivers/serial.c b/bsp/x86/drivers/serial.c
index f2484417e2..e2796aa063 100644
--- a/bsp/x86/drivers/serial.c
+++ b/bsp/x86/drivers/serial.c
@@ -1,75 +1,75 @@
-/*
- * File : serial.c
- * This file is part of RT-Thread RTOS
- * COPYRIGHT (C) 2006, RT-Thread Development Team
- *
- * The license and distribution terms for this file may be
- * found in the file LICENSE in this distribution or at
- * http://openlab.rt-thread.com/license/LICENSE
- *
- * Change Logs:
- * Date Author Notes
- * 2006-09-15 QiuYi the first version
+/*
+ * File : serial.c
+ * This file is part of RT-Thread RTOS
+ * COPYRIGHT (C) 2006, RT-Thread Development Team
+ *
+ * The license and distribution terms for this file may be
+ * found in the file LICENSE in this distribution or at
+ * http://openlab.rt-thread.com/license/LICENSE
+ *
+ * Change Logs:
+ * Date Author Notes
+ * 2006-09-15 QiuYi the first version
* 2006-10-10 Bernard use keyboard instead of serial
- */
-
-#include <rtthread.h>
-#include <rthw.h>
-
-#include <bsp.h>
+ */
+
+#include <rtthread.h>
+#include <rthw.h>
+
+#include <bsp.h>
extern char rt_keyboard_getc(void);
-
-/**
- * @addtogroup QEMU
- */
-/*@{*/
-
-/**
- * This function initializes serial
- */
-void rt_serial_init(void)
-{
- outb(COM1+3,0x80); /* set DLAB of line control reg */
- outb(COM1,0x0c); /* LS of divisor (48 -> 2400 bps */
- outb(COM1+1,0x00); /* MS of divisor */
- outb(COM1+3,0x03); /* reset DLAB */
- outb(COM1+4,0x0b); /* set DTR,RTS, OUT_2 */
- outb(COM1+1,0x0d); /* enable all intrs but writes */
- inb(COM1); /* read data port to reset things (?) */
-}
-
-/**
- * This function read a character from serial without interrupt enable mode
- *
- * @return the read char
- */
-char rt_serial_getc(void)
-{
- return rt_keyboard_getc();
-
-#if 0
- while(!(inb(COM1+COMSTATUS) & COMDATA));
-
- return inb(COM1+COMREAD);
-#endif
-}
-
-/**
- * This function will write a character to serial without interrupt enable mode
- *
- * @param c the char to write
- */
-void rt_serial_putc(const char c)
-{
- int val;
-
- while(1)
- {
- if ((val = inb(COM1+COMSTATUS)) & THRE)
- break;
- }
-
- outb(COM1+COMWRITE, c&0xff);
-}
-
-/*@}*/
+
+/**
+ * @addtogroup QEMU
+ */
+/*@{*/
+
+/**
+ * This function initializes serial
+ */
+void rt_serial_init(void)
+{
+ outb(COM1+3,0x80); /* set DLAB of line control reg */
+ outb(COM1,0x0c); /* LS of divisor (48 -> 2400 bps */
+ outb(COM1+1,0x00); /* MS of divisor */
+ outb(COM1+3,0x03); /* reset DLAB */
+ outb(COM1+4,0x0b); /* set DTR,RTS, OUT_2 */
+ outb(COM1+1,0x0d); /* enable all intrs but writes */
+ inb(COM1); /* read data port to reset things (?) */
+}
+
+/**
+ * This function read a character from serial without interrupt enable mode
+ *
+ * @return the read char
+ */
+char rt_serial_getc(void)
+{
+ return rt_keyboard_getc();
+
+#if 0
+ while(!(inb(COM1+COMSTATUS) & COMDATA));
+
+ return inb(COM1+COMREAD);
+#endif
+}
+
+/**
+ * This function will write a character to serial without interrupt enable mode
+ *
+ * @param c the char to write
+ */
+void rt_serial_putc(const char c)
+{
+ int val;
+
+ while(1)
+ {
+ if ((val = inb(COM1+COMSTATUS)) & THRE)
+ break;
+ }
+
+ outb(COM1+COMWRITE, c&0xff);
+}
+
+/*@}*/
diff --git a/bsp/x86/rtconfig.h b/bsp/x86/rtconfig.h
index 29cd287b73..95965fbed2 100644
--- a/bsp/x86/rtconfig.h
+++ b/bsp/x86/rtconfig.h
@@ -1,177 +1,177 @@
-/* RT-Thread config file */
-#ifndef __RTTHREAD_CFG_H__
-#define __RTTHREAD_CFG_H__
-
-#define RT_USING_NEWLIB
-//#define RT_USING_PTHREADS
-#define RT_USING_DFS_DEVFS
-
-/* RT_NAME_MAX*/
-#define RT_NAME_MAX 8
-
-/* RT_ALIGN_SIZE*/
-#define RT_ALIGN_SIZE 8
-
-/* PRIORITY_MAX */
-#define RT_THREAD_PRIORITY_MAX 32
-
-/* Tick per Second */
-#define RT_TICK_PER_SECOND 1000
-
-/* SECTION: RT_DEBUG */
-/* Thread Debug */
-#define RT_DEBUG
-#define RT_THREAD_DEBUG
-
-#define RT_USING_OVERFLOW_CHECK
-
-/* Using Hook */
-#define RT_USING_HOOK
-
-/* Using Software Timer */
-/* #define RT_USING_TIMER_SOFT */
-#define RT_TIMER_THREAD_PRIO 4
-#define RT_TIMER_THREAD_STACK_SIZE 512
-#define RT_TIMER_TICK_PER_SECOND 10
-
-/* SECTION: IPC */
-/* Using Semaphore*/
-#define RT_USING_SEMAPHORE
-
-/* Using Mutex */
-#define RT_USING_MUTEX
-
-/* Using Event */
-#define RT_USING_EVENT
-
-/* Using MailBox */
-#define RT_USING_MAILBOX
-
-/* Using Message Queue */
-#define RT_USING_MESSAGEQUEUE
-
-/* SECTION: Memory Management */
-/* Using Memory Pool Management*/
-#define RT_USING_MEMPOOL
-
-/* Using Dynamic Heap Management */
-#define RT_USING_HEAP
-
-/* Using Small MM */
-#define RT_USING_SMALL_MEM
-
-/* SECTION: Device System */
-/* Using Device System */
-#define RT_USING_DEVICE
-
-/* SECTION: Console options */
-#define RT_USING_CONSOLE
-/* the buffer size of console*/
-#define RT_CONSOLEBUF_SIZE 128
-
-#define IDLE_THREAD_STACK_SIZE 1024 /* idle stack 1K */
-
-/* SECTION: finsh, a C-Express shell */
-#define RT_USING_FINSH
-/* Using symbol table */
-#define FINSH_USING_SYMTAB
-#define FINSH_USING_DESCRIPTION
-
-/* SECTION: device filesystem */
- #define RT_USING_DFS
-
-#define RT_USING_DFS_ELMFAT
-#define RT_DFS_ELM_WORD_ACCESS
-/* Reentrancy (thread safe) of the FatFs module. */
-#define RT_DFS_ELM_REENTRANT
-/* Number of volumes (logical drives) to be used. */
-#define RT_DFS_ELM_DRIVES 2
-/* #define RT_DFS_ELM_USE_LFN 1 */
-#define RT_DFS_ELM_MAX_LFN 255
-/* Maximum sector size to be handled. */
-#define RT_DFS_ELM_MAX_SECTOR_SIZE 512
-
-/* the max number of mounted filesystem */
-#define DFS_FILESYSTEMS_MAX 2
-/* the max number of opened files */
-#define DFS_FD_MAX 4
-
-/* SECTION: lwip, a lighwight TCP/IP protocol stack */
-//#define RT_USING_LWIP
-/* LwIP uses RT-Thread Memory Management */
-#define RT_LWIP_USING_RT_MEM
-/* Enable ICMP protocol*/
-#define RT_LWIP_ICMP
-/* Enable UDP protocol*/
-#define RT_LWIP_UDP
-/* Enable TCP protocol*/
-#define RT_LWIP_TCP
-/* Enable DNS */
-#define RT_LWIP_DNS
-
-/* the number of simulatenously active TCP connections*/
-#define RT_LWIP_TCP_PCB_NUM 5
-
-/* Using DHCP */
-/* #define RT_LWIP_DHCP */
-
-/* ip address of target*/
-#define RT_LWIP_IPADDR0 192
-#define RT_LWIP_IPADDR1 168
-#define RT_LWIP_IPADDR2 1
-#define RT_LWIP_IPADDR3 30
-
-/* gateway address of target*/
-#define RT_LWIP_GWADDR0 192
-#define RT_LWIP_GWADDR1 168
-#define RT_LWIP_GWADDR2 1
-#define RT_LWIP_GWADDR3 1
-
-/* mask address of target*/
-#define RT_LWIP_MSKADDR0 255
-#define RT_LWIP_MSKADDR1 255
-#define RT_LWIP_MSKADDR2 255
-#define RT_LWIP_MSKADDR3 0
-
-/* tcp thread options */
-#define RT_LWIP_TCPTHREAD_PRIORITY 12
-#define RT_LWIP_TCPTHREAD_MBOX_SIZE 10
-#define RT_LWIP_TCPTHREAD_STACKSIZE 1024
-
-/* ethernet if thread options */
-#define RT_LWIP_ETHTHREAD_PRIORITY 15
-#define RT_LWIP_ETHTHREAD_MBOX_SIZE 10
-#define RT_LWIP_ETHTHREAD_STACKSIZE 512
-
-/* TCP sender buffer space */
-#define RT_LWIP_TCP_SND_BUF 8192
-/* TCP receive window. */
-#define RT_LWIP_TCP_WND 8192
-
-/* SECTION: RT-Thread/GUI */
-/* #define RT_USING_RTGUI */
-
-/* name length of RTGUI object */
-#define RTGUI_NAME_MAX 12
-/* support 16 weight font */
-#define RTGUI_USING_FONT16
-/* support Chinese font */
-#define RTGUI_USING_FONTHZ
-/* use DFS as file interface */
-#define RTGUI_USING_DFS_FILERW
-/* use font file as Chinese font */
-#define RTGUI_USING_HZ_FILE
-/* use Chinese bitmap font */
-#define RTGUI_USING_HZ_BMP
-/* use small size in RTGUI */
-#define RTGUI_USING_SMALL_SIZE
-/* use mouse cursor */
-/* #define RTGUI_USING_MOUSE_CURSOR */
-/* default font size in RTGUI */
-#define RTGUI_DEFAULT_FONT_SIZE 16
-
-/* image support */
-/* #define RTGUI_IMAGE_XPM */
-/* #define RTGUI_IMAGE_BMP */
-
-#endif
+/* RT-Thread config file */
+#ifndef __RTTHREAD_CFG_H__
+#define __RTTHREAD_CFG_H__
+
+#define RT_USING_NEWLIB
+//#define RT_USING_PTHREADS
+#define RT_USING_DFS_DEVFS
+
+/* RT_NAME_MAX*/
+#define RT_NAME_MAX 8
+
+/* RT_ALIGN_SIZE*/
+#define RT_ALIGN_SIZE 8
+
+/* PRIORITY_MAX */
+#define RT_THREAD_PRIORITY_MAX 32
+
+/* Tick per Second */
+#define RT_TICK_PER_SECOND 1000
+
+/* SECTION: RT_DEBUG */
+/* Thread Debug */
+#define RT_DEBUG
+#define RT_THREAD_DEBUG
+
+#define RT_USING_OVERFLOW_CHECK
+
+/* Using Hook */
+#define RT_USING_HOOK
+
+/* Using Software Timer */
+/* #define RT_USING_TIMER_SOFT */
+#define RT_TIMER_THREAD_PRIO 4
+#define RT_TIMER_THREAD_STACK_SIZE 512
+#define RT_TIMER_TICK_PER_SECOND 10
+
+/* SECTION: IPC */
+/* Using Semaphore*/
+#define RT_USING_SEMAPHORE
+
+/* Using Mutex */
+#define RT_USING_MUTEX
+
+/* Using Event */
+#define RT_USING_EVENT
+
+/* Using MailBox */
+#define RT_USING_MAILBOX
+
+/* Using Message Queue */
+#define RT_USING_MESSAGEQUEUE
+
+/* SECTION: Memory Management */
+/* Using Memory Pool Management*/
+#define RT_USING_MEMPOOL
+
+/* Using Dynamic Heap Management */
+#define RT_USING_HEAP
+
+/* Using Small MM */
+#define RT_USING_SMALL_MEM
+
+/* SECTION: Device System */
+/* Using Device System */
+#define RT_USING_DEVICE
+
+/* SECTION: Console options */
+#define RT_USING_CONSOLE
+/* the buffer size of console*/
+#define RT_CONSOLEBUF_SIZE 128
+
+#define IDLE_THREAD_STACK_SIZE 1024 /* idle stack 1K */
+
+/* SECTION: finsh, a C-Express shell */
+#define RT_USING_FINSH
+/* Using symbol table */
+#define FINSH_USING_SYMTAB
+#define FINSH_USING_DESCRIPTION
+
+/* SECTION: device filesystem */
+ #define RT_USING_DFS
+
+#define RT_USING_DFS_ELMFAT
+#define RT_DFS_ELM_WORD_ACCESS
+/* Reentrancy (thread safe) of the FatFs module. */
+#define RT_DFS_ELM_REENTRANT
+/* Number of volumes (logical drives) to be used. */
+#define RT_DFS_ELM_DRIVES 2
+/* #define RT_DFS_ELM_USE_LFN 1 */
+#define RT_DFS_ELM_MAX_LFN 255
+/* Maximum sector size to be handled. */
+#define RT_DFS_ELM_MAX_SECTOR_SIZE 512
+
+/* the max number of mounted filesystem */
+#define DFS_FILESYSTEMS_MAX 2
+/* the max number of opened files */
+#define DFS_FD_MAX 4
+
+/* SECTION: lwip, a lighwight TCP/IP protocol stack */
+//#define RT_USING_LWIP
+/* LwIP uses RT-Thread Memory Management */
+#define RT_LWIP_USING_RT_MEM
+/* Enable ICMP protocol*/
+#define RT_LWIP_ICMP
+/* Enable UDP protocol*/
+#define RT_LWIP_UDP
+/* Enable TCP protocol*/
+#define RT_LWIP_TCP
+/* Enable DNS */
+#define RT_LWIP_DNS
+
+/* the number of simulatenously active TCP connections*/
+#define RT_LWIP_TCP_PCB_NUM 5
+
+/* Using DHCP */
+/* #define RT_LWIP_DHCP */
+
+/* ip address of target*/
+#define RT_LWIP_IPADDR0 192
+#define RT_LWIP_IPADDR1 168
+#define RT_LWIP_IPADDR2 1
+#define RT_LWIP_IPADDR3 30
+
+/* gateway address of target*/
+#define RT_LWIP_GWADDR0 192
+#define RT_LWIP_GWADDR1 168
+#define RT_LWIP_GWADDR2 1
+#define RT_LWIP_GWADDR3 1
+
+/* mask address of target*/
+#define RT_LWIP_MSKADDR0 255
+#define RT_LWIP_MSKADDR1 255
+#define RT_LWIP_MSKADDR2 255
+#define RT_LWIP_MSKADDR3 0
+
+/* tcp thread options */
+#define RT_LWIP_TCPTHREAD_PRIORITY 12
+#define RT_LWIP_TCPTHREAD_MBOX_SIZE 10
+#define RT_LWIP_TCPTHREAD_STACKSIZE 1024
+
+/* ethernet if thread options */
+#define RT_LWIP_ETHTHREAD_PRIORITY 15
+#define RT_LWIP_ETHTHREAD_MBOX_SIZE 10
+#define RT_LWIP_ETHTHREAD_STACKSIZE 512
+
+/* TCP sender buffer space */
+#define RT_LWIP_TCP_SND_BUF 8192
+/* TCP receive window. */
+#define RT_LWIP_TCP_WND 8192
+
+/* SECTION: RT-Thread/GUI */
+/* #define RT_USING_RTGUI */
+
+/* name length of RTGUI object */
+#define RTGUI_NAME_MAX 12
+/* support 16 weight font */
+#define RTGUI_USING_FONT16
+/* support Chinese font */
+#define RTGUI_USING_FONTHZ
+/* use DFS as file interface */
+#define RTGUI_USING_DFS_FILERW
+/* use font file as Chinese font */
+#define RTGUI_USING_HZ_FILE
+/* use Chinese bitmap font */
+#define RTGUI_USING_HZ_BMP
+/* use small size in RTGUI */
+#define RTGUI_USING_SMALL_SIZE
+/* use mouse cursor */
+/* #define RTGUI_USING_MOUSE_CURSOR */
+/* default font size in RTGUI */
+#define RTGUI_DEFAULT_FONT_SIZE 16
+
+/* image support */
+/* #define RTGUI_IMAGE_XPM */
+/* #define RTGUI_IMAGE_BMP */
+
+#endif
diff --git a/bsp/x86/rtconfig.py b/bsp/x86/rtconfig.py
index 06011252a7..83ae8dc9d5 100644
--- a/bsp/x86/rtconfig.py
+++ b/bsp/x86/rtconfig.py
@@ -1,59 +1,59 @@
-import os
-
-# toolchains options
-ARCH='ia32'
-CPU=''
-CROSS_TOOL='gcc'
-
-if os.getenv('RTT_CC'):
- CROSS_TOOL = os.getenv('RTT_CC')
-
-# cross_tool provides the cross compiler
-# EXEC_PATH is the compiler execute path, for example, CodeSourcery,
-
-if CROSS_TOOL == 'gcc':
- PLATFORM = 'gcc'
- EXEC_PATH = 'E:/Program Files/CodeSourcery/Sourcery_CodeBench_Lite_for_IA32_ELF/bin'
-elif CROSS_TOOL == 'keil':
- print '================ERROR============================'
- print 'Not support keil yet!'
- print '================================================='
- exit(0)
-elif CROSS_TOOL == 'iar':
- print '================ERROR============================'
- print 'Not support iar yet!'
- print '================================================='
- exit(0)
-
-if os.getenv('RTT_EXEC_PATH'):
- EXEC_PATH = os.getenv('RTT_EXEC_PATH')
-
-BUILD = 'debug'
-
-if PLATFORM == 'gcc':
- # toolchains
- PREFIX = 'i686-elf-'
- CC = PREFIX + 'gcc'
- AS = PREFIX + 'gcc'
- AR = PREFIX + 'ar'
- LINK = PREFIX + 'gcc'
- TARGET_EXT = 'elf'
- SIZE = PREFIX + 'size'
- OBJDUMP = PREFIX + 'objdump'
- OBJCPY = PREFIX + 'objcopy'
-
- DEVICE = ' -mtune=generic'
- CFLAGS = DEVICE + ' -Wall'
- AFLAGS = ' -c' + DEVICE + ' -x assembler-with-cpp'
- LFLAGS = DEVICE + ' -Wl,--gc-sections,-Map=rtthread-ia32.map,-cref,-u,_start -T x86_ram.lds'
-
- CPATH = ''
- LPATH = ''
-
- if BUILD == 'debug':
- CFLAGS += ' -O0 -gdwarf-2'
- AFLAGS += ' -gdwarf-2'
- else:
- CFLAGS += ' -O2'
-
- POST_ACTION = OBJCPY + ' -O binary $TARGET rtthread.bin\n' + SIZE + ' $TARGET \n'
+import os
+
+# toolchains options
+ARCH='ia32'
+CPU=''
+CROSS_TOOL='gcc'
+
+if os.getenv('RTT_CC'):
+ CROSS_TOOL = os.getenv('RTT_CC')
+
+# cross_tool provides the cross compiler
+# EXEC_PATH is the compiler execute path, for example, CodeSourcery,
+
+if CROSS_TOOL == 'gcc':
+ PLATFORM = 'gcc'
+ EXEC_PATH = 'E:/Program Files/CodeSourcery/Sourcery_CodeBench_Lite_for_IA32_ELF/bin'
+elif CROSS_TOOL == 'keil':
+ print '================ERROR============================'
+ print 'Not support keil yet!'
+ print '================================================='
+ exit(0)
+elif CROSS_TOOL == 'iar':
+ print '================ERROR============================'
+ print 'Not support iar yet!'
+ print '================================================='
+ exit(0)
+
+if os.getenv('RTT_EXEC_PATH'):
+ EXEC_PATH = os.getenv('RTT_EXEC_PATH')
+
+BUILD = 'debug'
+
+if PLATFORM == 'gcc':
+ # toolchains
+ PREFIX = 'i686-elf-'
+ CC = PREFIX + 'gcc'
+ AS = PREFIX + 'gcc'
+ AR = PREFIX + 'ar'
+ LINK = PREFIX + 'gcc'
+ TARGET_EXT = 'elf'
+ SIZE = PREFIX + 'size'
+ OBJDUMP = PREFIX + 'objdump'
+ OBJCPY = PREFIX + 'objcopy'
+
+ DEVICE = ' -mtune=generic'
+ CFLAGS = DEVICE + ' -Wall'
+ AFLAGS = ' -c' + DEVICE + ' -x assembler-with-cpp'
+ LFLAGS = DEVICE + ' -Wl,--gc-sections,-Map=rtthread-ia32.map,-cref,-u,_start -T x86_ram.lds'
+
+ CPATH = ''
+ LPATH = ''
+
+ if BUILD == 'debug':
+ CFLAGS += ' -O0 -gdwarf-2'
+ AFLAGS += ' -gdwarf-2'
+ else:
+ CFLAGS += ' -O2'
+
+ POST_ACTION = OBJCPY + ' -O binary $TARGET rtthread.bin\n' + SIZE + ' $TARGET \n'