fix the end of line error
git-svn-id: https://rt-thread.googlecode.com/svn/trunk@760 bbd45198-f89e-11dd-88c7-29a3b14d5316
This commit is contained in:
parent
0df924ddaa
commit
95a579baf7
|
@ -1,29 +1,29 @@
|
||||||
/*
|
/*
|
||||||
* File : app.c
|
* File : app.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, 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
|
||||||
* http://openlab.rt-thread.com/license/LICENSE
|
* http://openlab.rt-thread.com/license/LICENSE
|
||||||
*
|
*
|
||||||
* Change Logs:
|
* Change Logs:
|
||||||
* Date Author Notes
|
* Date Author Notes
|
||||||
* 2008-12-11 xuxinming the first version
|
* 2008-12-11 xuxinming the first version
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <rtthread.h>
|
#include <rtthread.h>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @addtogroup LPC2478
|
* @addtogroup LPC2478
|
||||||
*/
|
*/
|
||||||
/*@{*/
|
/*@{*/
|
||||||
|
|
||||||
char thread1_stack[512];
|
char thread1_stack[512];
|
||||||
char thread2_stack[512];
|
char thread2_stack[512];
|
||||||
|
|
||||||
struct rt_thread thread1;
|
struct rt_thread thread1;
|
||||||
struct rt_thread thread2;
|
struct rt_thread thread2;
|
||||||
|
|
||||||
void thread1_entry(void* parameter)
|
void thread1_entry(void* parameter)
|
||||||
{
|
{
|
||||||
|
@ -37,25 +37,25 @@ void thread1_entry(void* parameter)
|
||||||
rt_thread_delay(100);
|
rt_thread_delay(100);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void thread2_entry(void* parameter)
|
void thread2_entry(void* parameter)
|
||||||
{
|
{
|
||||||
int count = 0;
|
int count = 0;
|
||||||
while (1)
|
while (1)
|
||||||
{
|
{
|
||||||
rt_kprintf("Thread2 count:%d\n", count++);
|
rt_kprintf("Thread2 count:%d\n", count++);
|
||||||
rt_thread_delay(50);
|
rt_thread_delay(50);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int rt_application_init()
|
int rt_application_init()
|
||||||
{
|
{
|
||||||
rt_thread_init(&thread1,
|
rt_thread_init(&thread1,
|
||||||
"thread1",
|
"thread1",
|
||||||
thread1_entry, RT_NULL,
|
thread1_entry, RT_NULL,
|
||||||
&thread1_stack[0], sizeof(thread1_stack),
|
&thread1_stack[0], sizeof(thread1_stack),
|
||||||
20, 10);
|
20, 10);
|
||||||
|
|
||||||
rt_thread_init(&thread2,
|
rt_thread_init(&thread2,
|
||||||
"thread2",
|
"thread2",
|
||||||
|
@ -67,6 +67,6 @@ int rt_application_init()
|
||||||
rt_thread_startup(&thread2);
|
rt_thread_startup(&thread2);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*@}*/
|
/*@}*/
|
||||||
|
|
|
@ -36,70 +36,70 @@ void rt_timer_handler(int vector)
|
||||||
T0IR |= 0x01; /* clear interrupt flag */
|
T0IR |= 0x01; /* clear interrupt flag */
|
||||||
rt_tick_increase();
|
rt_tick_increase();
|
||||||
VICVectAddr = 0; /* Acknowledge Interrupt */
|
VICVectAddr = 0; /* Acknowledge Interrupt */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This function is used to display a string on console, normally, it's
|
/**
|
||||||
* invoked by rt_kprintf
|
* This function is used to display a string on console, normally, it's
|
||||||
*
|
* invoked by rt_kprintf
|
||||||
* @param str the displayed string
|
*
|
||||||
*/
|
* @param str the displayed string
|
||||||
void rt_hw_console_output(const char* str)
|
*/
|
||||||
{
|
void rt_hw_console_output(const char* str)
|
||||||
while (*str)
|
{
|
||||||
{
|
while (*str)
|
||||||
if (*str=='\n')
|
{
|
||||||
{
|
if (*str=='\n')
|
||||||
while (!(U0LSR & 0x20));
|
{
|
||||||
U0THR = '\r';
|
while (!(U0LSR & 0x20));
|
||||||
}
|
U0THR = '\r';
|
||||||
|
}
|
||||||
while (!(U0LSR & 0x20));
|
|
||||||
U0THR = *str;
|
while (!(U0LSR & 0x20));
|
||||||
|
U0THR = *str;
|
||||||
str ++;
|
|
||||||
}
|
str ++;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
#define BAUD_RATE 115200
|
|
||||||
#define U0PINS 0x50
|
#define BAUD_RATE 115200
|
||||||
void rt_hw_console_init()
|
#define U0PINS 0x50
|
||||||
{
|
void rt_hw_console_init()
|
||||||
rt_uint32_t fdiv;
|
{
|
||||||
|
rt_uint32_t fdiv;
|
||||||
/* Enable RxD and TxD pins */
|
|
||||||
PINSEL0 = U0PINS;
|
/* Enable RxD and TxD pins */
|
||||||
|
PINSEL0 = U0PINS;
|
||||||
/* 8 bits, no Parity, 1 Stop bit */
|
|
||||||
U0LCR = 0x83;
|
/* 8 bits, no Parity, 1 Stop bit */
|
||||||
|
U0LCR = 0x83;
|
||||||
/* Setup Baudrate */
|
|
||||||
fdiv = ( PCLK / 16 ) / BAUD_RATE ; /*baud rate */
|
/* Setup Baudrate */
|
||||||
U0DLM = fdiv / 256;
|
fdiv = ( PCLK / 16 ) / BAUD_RATE ; /*baud rate */
|
||||||
U0DLL = fdiv % 256;
|
U0DLM = fdiv / 256;
|
||||||
U0FCR = 0x00; /* Enable and reset TX and RX FIFO. */
|
U0DLL = fdiv % 256;
|
||||||
U0LCR = 0x03; /* DLAB = 0 */
|
U0FCR = 0x00; /* Enable and reset TX and RX FIFO. */
|
||||||
|
U0LCR = 0x03; /* DLAB = 0 */
|
||||||
/* DLAB = 0 */
|
|
||||||
U0LCR = 0x03;
|
/* DLAB = 0 */
|
||||||
}
|
U0LCR = 0x03;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This function will init LPC2478 board
|
* This function will init LPC2478 board
|
||||||
*/
|
*/
|
||||||
void rt_hw_board_init()
|
void rt_hw_board_init()
|
||||||
{
|
{
|
||||||
/* init console for rt_kprintf function */
|
/* init console for rt_kprintf function */
|
||||||
rt_hw_console_init();
|
rt_hw_console_init();
|
||||||
|
|
||||||
T0IR = 0xff;
|
T0IR = 0xff;
|
||||||
T0TC = 0;
|
T0TC = 0;
|
||||||
T0MCR = 0x03;
|
T0MCR = 0x03;
|
||||||
T0MR0 = (DATA_COUNT);
|
T0MR0 = (DATA_COUNT);
|
||||||
|
|
||||||
rt_hw_interrupt_install(TIMER0_INT, rt_timer_handler, RT_NULL);
|
rt_hw_interrupt_install(TIMER0_INT, rt_timer_handler, RT_NULL);
|
||||||
rt_hw_interrupt_umask(TIMER0_INT);
|
rt_hw_interrupt_umask(TIMER0_INT);
|
||||||
|
|
||||||
T0TCR = 0x01; //enable timer0 counter
|
T0TCR = 0x01; //enable timer0 counter
|
||||||
}
|
}
|
||||||
|
|
|
@ -98,9 +98,9 @@ void rt_hw_finsh_init(void);
|
||||||
|
|
||||||
#define VECT_ADDR_INDEX 0x100
|
#define VECT_ADDR_INDEX 0x100
|
||||||
#define VECT_CNTL_INDEX 0x200
|
#define VECT_CNTL_INDEX 0x200
|
||||||
|
|
||||||
#define CCLK 60000000 /* Fosc = 12MHz, M = 5 */
|
#define CCLK 60000000 /* Fosc = 12MHz, M = 5 */
|
||||||
#define PCLK 15000000 /* CCLK/4, use default */
|
#define PCLK 15000000 /* CCLK/4, use default */
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
** Function name: TargetInit
|
** Function name: TargetInit
|
||||||
|
|
Loading…
Reference in New Issue