Ver código fonte

fixed a compiling error and format the coding style

git-svn-id: https://rt-thread.googlecode.com/svn/trunk@2195 bbd45198-f89e-11dd-88c7-29a3b14d5316
dzzxzz@gmail.com 13 anos atrás
pai
commit
4dc24e6a86

+ 11 - 10
bsp/dev3210/application.c

@@ -1,7 +1,7 @@
 /*
- * File      : app.c
+ * File      : application.c
  * This file is part of RT-Thread RTOS
- * COPYRIGHT (C) 2006, RT-Thread Development Team
+ * COPYRIGHT (C) 2006 - 2012, RT-Thread Development Team
  *
  * The license and distribution terms for this file may be
  * found in the file LICENSE in this distribution or at
@@ -32,7 +32,7 @@
 #include <rtgui/rtgui_server.h>
 #endif
 
-void rt_init_thread_entry(void* parameter)
+void rt_init_thread_entry(void *parameter)
 {
 	/* Filesystem Initialization */
 #ifdef RT_USING_DFS
@@ -89,30 +89,31 @@ void rt_init_thread_entry(void* parameter)
 		rect.y1 = 0;
 		rect.x2 = 400;
 		rect.y2 = 480;
-		rtgui_panel_register("panel", &rect);
+//		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");
+//		rtgui_panel_register("main", &rect);
+//		rtgui_panel_set_default_focused("main");
 
 		rt_hw_lcd_init();
 	}
 #endif
 }
 
-int rt_application_init()
+int rt_application_init(void)
 {
 	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);
+							rt_init_thread_entry, RT_NULL,
+							4096, 8, 20);
+	if (tid != RT_NULL)
+		rt_thread_startup(tid);
 
 	return 0;
 }

+ 12 - 11
bsp/dev3210/board.c

@@ -1,7 +1,7 @@
 /*
  * File      : board.c
  * This file is part of RT-Thread RTOS
- * COPYRIGHT (C) 2006, RT-Thread Develop Team
+ * COPYRIGHT (C) 2006 - 2012, RT-Thread Development Team
  *
  * The license and distribution terms for this file may be
  * found in the file LICENSE in this distribution or at
@@ -22,18 +22,19 @@
 /**
  * @addtogroup Loongson SoC3210
  */
+
 /*@{*/
 
 /**
  * This is the timer interrupt service routine.
  */
-void rt_hw_timer_handler()
+void rt_hw_timer_handler(void)
 {
-    unsigned int count;
+	unsigned int count;
 
-    count = read_c0_compare();
-    write_c0_compare(count);
-    write_c0_count(0);
+	count = read_c0_compare();
+	write_c0_compare(count);
+	write_c0_count(0);
 
 	/* increase a OS tick */
 	rt_tick_increase();
@@ -42,16 +43,16 @@ void rt_hw_timer_handler()
 /**
  * This function will initial OS timer
  */
-void rt_hw_timer_init()
+void rt_hw_timer_init(void)
 {
-    write_c0_compare(CPU_HZ/2/RT_TICK_PER_SECOND);
-    write_c0_count(0);
+	write_c0_compare(CPU_HZ/2/RT_TICK_PER_SECOND);
+	write_c0_count(0);
 }
 
 /**
  * This function will initial sam7s64 board.
  */
-void rt_hw_board_init()
+void rt_hw_board_init(void)
 {
 #ifdef RT_USING_UART
 	/* init hardware UART device */
@@ -79,7 +80,7 @@ void rt_hw_board_init()
 #define UARTLSR_PE		(1 << 2)
 #define UARTLSR_OE		(1 << 1)
 #define UARTLSR_DR		(1 << 0)
-void rt_hw_console_output(const char* ptr)
+void rt_hw_console_output(const char *ptr)
 {
 	/* stream mode */
 	while (*ptr)

+ 5 - 4
bsp/dev3210/lnn800x480.c

@@ -1,7 +1,7 @@
 /*
- * File      : lcd_800480.c
+ * File      : lnn800x480.c
  * This file is part of RT-Thread RTOS
- * COPYRIGHT (C) 2010, RT-Thread Develop Team
+ * COPYRIGHT (C) 2010 - 2012, RT-Thread Development Team
  *
  * The license and distribution terms for this file may be
  * found in the file LICENSE in this distribution or at
@@ -77,10 +77,11 @@ static rt_err_t rt_lcd_control (rt_device_t dev, rt_uint8_t cmd, void *args)
 	return RT_EOK;
 }
 
-void rt_hw_lcd_init()
+void rt_hw_lcd_init(void)
 {
 	rt_device_t lcd = rt_malloc(sizeof(struct rt_device));
-	if (lcd == RT_NULL) return; /* no memory yet */
+	if (lcd == RT_NULL)
+		return; /* no memory yet */
 
 	_lcd_info.bits_per_pixel = 16;
 	_lcd_info.pixel_format = RTGRAPHIC_PIXEL_FORMAT_RGB565P;

+ 15 - 4
bsp/dev3210/newlib_stub.c

@@ -1,3 +1,16 @@
+/*
+ * File      : newlib_stub.c
+ * This file is part of RT-Thread RTOS
+ * COPYRIGHT (C) 2009 - 2012, 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://www.rt-thread.org/license/LICENSE
+ *
+ * Change Logs:
+ * Date           Author       Notes
+ */
+
 #include <rtthread.h>
 
 #include <stdio.h>
@@ -6,14 +19,12 @@
 
 /* some newlib leaked function in CodeSourcery G++ Lite for MIPS version */
 
-int
-getpid()
+int getpid(void)
 {
 	return 0;
 }
 
-int
-gettimeofday(struct timeval *__tp, void *__tzp)
+int gettimeofday(struct timeval *__tp, void *__tzp)
 {
 	struct timespec tp;
 

+ 1 - 1
bsp/dev3210/rtconfig.py

@@ -12,7 +12,7 @@ if os.getenv('RTT_CC'):
 
 if  CROSS_TOOL == 'gcc':
 	PLATFORM    = 'gcc'
-	EXEC_PATH   = 'E:/Program Files/CodeSourcery/Sourcery G++ Lite/bin'
+	EXEC_PATH   = 'C:/Program Files/CodeSourcery/Sourcery_CodeBench_Lite_for_MIPS_ELF/bin'
 elif CROSS_TOOL == 'keil':
     print '================ERROR============================'
     print 'Not support keil yet!'

+ 1 - 1
bsp/dev3210/startup.c

@@ -1,7 +1,7 @@
 /*
  * File      : startup.c
  * This file is part of RT-Thread RTOS
- * COPYRIGHT (C) 2006, RT-Thread Develop Team
+ * COPYRIGHT (C) 2006 - 2012, RT-Thread Development Team
  *
  * The license and distribution terms for this file may be
  * found in the file LICENSE in this distribution or at

+ 24 - 11
bsp/dev3210/uart.c

@@ -1,3 +1,16 @@
+/*
+ * File      : uart.c
+ * This file is part of RT-Thread RTOS
+ * COPYRIGHT (C) 2009 - 2012, 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://www.rt-thread.org/license/LICENSE
+ *
+ * Change Logs:
+ * Date           Author       Notes
+ */
+
 #include <rthw.h>
 #include <rtthread.h>
 
@@ -50,9 +63,9 @@ static void rt_uart_irqhandler(int irqno)
 {
 	rt_ubase_t level;
 	rt_uint8_t isr;
-    struct rt_uart_soc3210* uart = &uart_device;
+	struct rt_uart_soc3210* uart = &uart_device;
 
-    /* read interrupt status and clear it */
+	/* read interrupt status and clear it */
 	isr = UART_IIR(uart->hw_base);
 	isr = (isr >> 1) & 0x3;
 
@@ -71,7 +84,7 @@ static void rt_uart_irqhandler(int irqno)
 		}
 
 		/* invoke callback */
-		if(uart->parent.rx_indicate != RT_NULL)
+		if (uart->parent.rx_indicate != RT_NULL)
 		{
 			rt_size_t length;
 			if (uart->read_index > uart->save_index)
@@ -149,10 +162,10 @@ static rt_err_t rt_uart_close(rt_device_t dev)
 	return RT_EOK;
 }
 
-static rt_size_t rt_uart_read(rt_device_t dev, rt_off_t pos, void* buffer, rt_size_t size)
+static rt_size_t rt_uart_read(rt_device_t dev, rt_off_t pos, void *buffer, rt_size_t size)
 {
-	rt_uint8_t* ptr;
-	struct rt_uart_soc3210 *uart = (struct rt_uart_soc3210*)dev;
+	rt_uint8_t *ptr;
+	struct rt_uart_soc3210 *uart = (struct rt_uart_soc3210 *)dev;
 
 	RT_ASSERT(uart != RT_NULL);
 
@@ -197,14 +210,14 @@ static rt_size_t rt_uart_read(rt_device_t dev, rt_off_t pos, void* buffer, rt_si
 	return 0;
 }
 
-static rt_size_t rt_uart_write(rt_device_t dev, rt_off_t pos, const void* buffer, rt_size_t size)
+static rt_size_t rt_uart_write(rt_device_t dev, rt_off_t pos, const void *buffer, rt_size_t size)
 {
 	char *ptr;
-	struct rt_uart_soc3210 *uart = (struct rt_uart_soc3210*)dev;
+	struct rt_uart_soc3210 *uart = (struct rt_uart_soc3210 *)dev;
 
 	RT_ASSERT(uart != RT_NULL);
 
-	ptr = (char*)buffer;
+	ptr = (char *)buffer;
 
 	if (dev->flag & RT_DEVICE_FLAG_STREAM)
 	{
@@ -230,7 +243,7 @@ static rt_size_t rt_uart_write(rt_device_t dev, rt_off_t pos, const void* buffer
 	}
 	else
 	{
-		while ( size != 0 )
+		while (size != 0)
 		{
 			/* FIFO status, contain valid data */
 			while (!(UART_LSR(uart->hw_base) & (UARTLSR_TE | UARTLSR_TFE)));
@@ -248,7 +261,7 @@ static rt_size_t rt_uart_write(rt_device_t dev, rt_off_t pos, const void* buffer
 
 void rt_hw_uart_init(void)
 {
-	struct rt_uart_soc3210* uart;
+	struct rt_uart_soc3210 *uart;
 
 	/* get uart device */
 	uart = &uart_device;

+ 13 - 0
bsp/dev3210/uart.h

@@ -1,3 +1,16 @@
+/*
+ * File      : uart.h
+ * This file is part of RT-Thread RTOS
+ * COPYRIGHT (C) 2009 - 2012, 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://www.rt-thread.org/license/LICENSE
+ *
+ * Change Logs:
+ * Date           Author       Notes
+ */
+
 #ifndef __UART_H__
 #define __UART_H__