提交 4dc24e6a 编写于 作者: D dzzxzz@gmail.com

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
上级 94d413a7
/* /*
* File : app.c * File : application.c
* This file is part of RT-Thread RTOS * 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 * The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at * found in the file LICENSE in this distribution or at
...@@ -32,7 +32,7 @@ ...@@ -32,7 +32,7 @@
#include <rtgui/rtgui_server.h> #include <rtgui/rtgui_server.h>
#endif #endif
void rt_init_thread_entry(void* parameter) void rt_init_thread_entry(void *parameter)
{ {
/* Filesystem Initialization */ /* Filesystem Initialization */
#ifdef RT_USING_DFS #ifdef RT_USING_DFS
...@@ -89,30 +89,31 @@ void rt_init_thread_entry(void* parameter) ...@@ -89,30 +89,31 @@ void rt_init_thread_entry(void* parameter)
rect.y1 = 0; rect.y1 = 0;
rect.x2 = 400; rect.x2 = 400;
rect.y2 = 480; rect.y2 = 480;
rtgui_panel_register("panel", &rect); // rtgui_panel_register("panel", &rect);
/* register main panel */ /* register main panel */
rect.x1 = 400; rect.x1 = 400;
rect.y1 = 0; rect.y1 = 0;
rect.x2 = 800; rect.x2 = 800;
rect.y2 = 480; rect.y2 = 480;
rtgui_panel_register("main", &rect); // rtgui_panel_register("main", &rect);
rtgui_panel_set_default_focused("main"); // rtgui_panel_set_default_focused("main");
rt_hw_lcd_init(); rt_hw_lcd_init();
} }
#endif #endif
} }
int rt_application_init() int rt_application_init(void)
{ {
rt_thread_t tid; rt_thread_t tid;
/* create initialization thread */ /* create initialization thread */
tid = rt_thread_create("init", tid = rt_thread_create("init",
rt_init_thread_entry, RT_NULL, rt_init_thread_entry, RT_NULL,
4096, 8, 20); 4096, 8, 20);
if (tid != RT_NULL) rt_thread_startup(tid); if (tid != RT_NULL)
rt_thread_startup(tid);
return 0; return 0;
} }
/* /*
* File : board.c * File : board.c
* This file is part of RT-Thread RTOS * 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 * The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at * found in the file LICENSE in this distribution or at
...@@ -22,18 +22,19 @@ ...@@ -22,18 +22,19 @@
/** /**
* @addtogroup Loongson SoC3210 * @addtogroup Loongson SoC3210
*/ */
/*@{*/ /*@{*/
/** /**
* This is the timer interrupt service routine. * 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(); count = read_c0_compare();
write_c0_compare(count); write_c0_compare(count);
write_c0_count(0); write_c0_count(0);
/* increase a OS tick */ /* increase a OS tick */
rt_tick_increase(); rt_tick_increase();
...@@ -42,16 +43,16 @@ void rt_hw_timer_handler() ...@@ -42,16 +43,16 @@ void rt_hw_timer_handler()
/** /**
* This function will initial OS timer * 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_compare(CPU_HZ/2/RT_TICK_PER_SECOND);
write_c0_count(0); write_c0_count(0);
} }
/** /**
* This function will initial sam7s64 board. * This function will initial sam7s64 board.
*/ */
void rt_hw_board_init() void rt_hw_board_init(void)
{ {
#ifdef RT_USING_UART #ifdef RT_USING_UART
/* init hardware UART device */ /* init hardware UART device */
...@@ -79,7 +80,7 @@ void rt_hw_board_init() ...@@ -79,7 +80,7 @@ void rt_hw_board_init()
#define UARTLSR_PE (1 << 2) #define UARTLSR_PE (1 << 2)
#define UARTLSR_OE (1 << 1) #define UARTLSR_OE (1 << 1)
#define UARTLSR_DR (1 << 0) #define UARTLSR_DR (1 << 0)
void rt_hw_console_output(const char* ptr) void rt_hw_console_output(const char *ptr)
{ {
/* stream mode */ /* stream mode */
while (*ptr) while (*ptr)
......
/* /*
* File : lcd_800480.c * File : lnn800x480.c
* This file is part of RT-Thread RTOS * 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 * The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at * 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) ...@@ -77,10 +77,11 @@ static rt_err_t rt_lcd_control (rt_device_t dev, rt_uint8_t cmd, void *args)
return RT_EOK; return RT_EOK;
} }
void rt_hw_lcd_init() void rt_hw_lcd_init(void)
{ {
rt_device_t lcd = rt_malloc(sizeof(struct rt_device)); 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.bits_per_pixel = 16;
_lcd_info.pixel_format = RTGRAPHIC_PIXEL_FORMAT_RGB565P; _lcd_info.pixel_format = RTGRAPHIC_PIXEL_FORMAT_RGB565P;
......
/*
* 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 <rtthread.h>
#include <stdio.h> #include <stdio.h>
...@@ -6,14 +19,12 @@ ...@@ -6,14 +19,12 @@
/* some newlib leaked function in CodeSourcery G++ Lite for MIPS version */ /* some newlib leaked function in CodeSourcery G++ Lite for MIPS version */
int int getpid(void)
getpid()
{ {
return 0; return 0;
} }
int int gettimeofday(struct timeval *__tp, void *__tzp)
gettimeofday(struct timeval *__tp, void *__tzp)
{ {
struct timespec tp; struct timespec tp;
......
...@@ -12,7 +12,7 @@ if os.getenv('RTT_CC'): ...@@ -12,7 +12,7 @@ if os.getenv('RTT_CC'):
if CROSS_TOOL == 'gcc': if CROSS_TOOL == 'gcc':
PLATFORM = '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': elif CROSS_TOOL == 'keil':
print '================ERROR============================' print '================ERROR============================'
print 'Not support keil yet!' print 'Not support keil yet!'
......
/* /*
* File : startup.c * File : startup.c
* This file is part of RT-Thread RTOS * 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 * The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at * found in the file LICENSE in this distribution or at
......
/*
* 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 <rthw.h>
#include <rtthread.h> #include <rtthread.h>
...@@ -50,9 +63,9 @@ static void rt_uart_irqhandler(int irqno) ...@@ -50,9 +63,9 @@ static void rt_uart_irqhandler(int irqno)
{ {
rt_ubase_t level; rt_ubase_t level;
rt_uint8_t isr; 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 = UART_IIR(uart->hw_base);
isr = (isr >> 1) & 0x3; isr = (isr >> 1) & 0x3;
...@@ -71,7 +84,7 @@ static void rt_uart_irqhandler(int irqno) ...@@ -71,7 +84,7 @@ static void rt_uart_irqhandler(int irqno)
} }
/* invoke callback */ /* invoke callback */
if(uart->parent.rx_indicate != RT_NULL) if (uart->parent.rx_indicate != RT_NULL)
{ {
rt_size_t length; rt_size_t length;
if (uart->read_index > uart->save_index) if (uart->read_index > uart->save_index)
...@@ -149,10 +162,10 @@ static rt_err_t rt_uart_close(rt_device_t dev) ...@@ -149,10 +162,10 @@ static rt_err_t rt_uart_close(rt_device_t dev)
return RT_EOK; 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; rt_uint8_t *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); 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 ...@@ -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; 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; 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); RT_ASSERT(uart != RT_NULL);
ptr = (char*)buffer; ptr = (char *)buffer;
if (dev->flag & RT_DEVICE_FLAG_STREAM) 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 ...@@ -230,7 +243,7 @@ static rt_size_t rt_uart_write(rt_device_t dev, rt_off_t pos, const void* buffer
} }
else else
{ {
while ( size != 0 ) while (size != 0)
{ {
/* FIFO status, contain valid data */ /* FIFO status, contain valid data */
while (!(UART_LSR(uart->hw_base) & (UARTLSR_TE | UARTLSR_TFE))); 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 ...@@ -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) void rt_hw_uart_init(void)
{ {
struct rt_uart_soc3210* uart; struct rt_uart_soc3210 *uart;
/* get uart device */ /* get uart device */
uart = &uart_device; uart = &uart_device;
......
/*
* 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__ #ifndef __UART_H__
#define __UART_H__ #define __UART_H__
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册