提交 0cd49e7c 编写于 作者: z13955633063's avatar z13955633063

Merge branch 'master' of https://github.com/RT-Thread/rt-thread

add new bsp for risc-v
......@@ -18,7 +18,7 @@ extern void rt_hw_board_init(void);
extern void rt_application_init(void);
#ifdef RT_USING_FINSH
extern void finsh_system_init(void);
extern int finsh_system_init(void);
extern void finsh_set_device(const char* device);
#endif
......
......@@ -29,6 +29,7 @@ define block FIQ_STACK with alignment = 8, size = __ICFEDIT_size_fiqstack__ { };
define block UND_STACK with alignment = 8, size = __ICFEDIT_size_undstack__ { };
define block ABT_STACK with alignment = 8, size = __ICFEDIT_size_abtstack__ { };
define block HEAP with alignment = 8, size = __ICFEDIT_size_heap__ { };
define block RTT_INIT_FUNC with fixed order { readonly section .rti_fn* };
initialize by copy { readwrite };
do not initialize { section .noinit };
......@@ -38,7 +39,7 @@ keep { section .rti_fn* };
place at address mem :__ICFEDIT_intvec_start__ {readonly section .intvec};
place in ROM_region { readonly };
place in ROM_region { readonly, block RTT_INIT_FUNC };
place in RAM_region { readwrite,
block CSTACK, block SVC_STACK, block IRQ_STACK, block FIQ_STACK,
block UND_STACK, block ABT_STACK, block HEAP };
......@@ -70,7 +70,7 @@ void rtthread_startup(void)
#ifdef RT_USING_FINSH
/* init finsh */
extern void finsh_system_init(void);
extern int finsh_system_init(void);
finsh_system_init();
finsh_set_device("uart0");
#endif
......
......@@ -62,7 +62,7 @@ extern void rt_application_init(void);
#endif
#ifdef RT_USING_FINSH
extern void finsh_system_init(void);
extern int finsh_system_init(void);
#endif
......
......@@ -468,7 +468,7 @@ void finsh_system_var_init(const void* begin, const void* end)
*
* This function will initialize finsh shell
*/
void finsh_system_init(void)
int finsh_system_init(void)
{
rt_err_t result;
......
......@@ -25,7 +25,7 @@
extern int rt_application_init(void);
#ifdef RT_USING_FINSH
extern void finsh_system_init(void);
extern int finsh_system_init(void);
extern void finsh_set_device(const char* device);
#endif
......
......@@ -30,7 +30,7 @@ extern void rt_hw_serial_init(void);
/*@{*/
#ifdef RT_USING_FINSH
extern void finsh_system_init(void);
extern int finsh_system_init(void);
extern void finsh_set_device(char* device);
#endif
......
......@@ -30,7 +30,7 @@ extern void rt_hw_serial_init(void);
/*@{*/
#ifdef RT_USING_FINSH
extern void finsh_system_init(void);
extern int finsh_system_init(void);
extern void finsh_set_device(char* device);
#endif
......
......@@ -30,7 +30,7 @@ extern void rt_hw_serial_init(void);
/*@{*/
#ifdef RT_USING_FINSH
extern void finsh_system_init(void);
extern int finsh_system_init(void);
extern void finsh_set_device(char* device);
#endif
......
......@@ -21,7 +21,7 @@
extern int rt_application_init(void);
#ifdef RT_USING_FINSH
extern void finsh_system_init(void);
extern int finsh_system_init(void);
extern void finsh_set_device(const char* device);
#endif
......
......@@ -34,7 +34,7 @@
/*@{*/
#ifdef RT_USING_FINSH
extern void finsh_system_init(void);
extern int finsh_system_init(void);
#endif
extern int rt_application_init(void);
......@@ -43,7 +43,7 @@ extern void rt_show_version(void);
extern rt_err_t rt_hw_serial_init(void);
#endif
#ifdef RT_USING_FINSH
extern void finsh_system_init(void);
extern int finsh_system_init(void);
#endif
#ifdef __CC_ARM
......
......@@ -18,7 +18,7 @@
#ifdef RT_USING_FINSH
#include <finsh.h>
extern void finsh_system_init(void);
extern int finsh_system_init(void);
#endif
#include <LPC24xx.h>
......
......@@ -11,8 +11,8 @@
* Date Author Notes
* 2009-01-05 Bernard the first version
*/
#include <rtthread.h>
#ifdef RT_USING_FINSH
#include <finsh.h>
#include <shell.h>
......@@ -23,11 +23,11 @@ extern int demo_init(void);
void rt_init_thread_entry(void* parameter)
{
/* initialization finsh shell Component */
/* initialization finsh shell Component */
finsh_system_init();
demo_init();
demo_init();
}
int rt_application_init()
......@@ -39,7 +39,6 @@ int rt_application_init()
2048, RT_THREAD_PRIORITY_MAX/3, 20);
if (tid != RT_NULL)
rt_thread_startup(tid);
return 0;
}
......@@ -24,8 +24,6 @@
#include <components.h>
#endif
/**
* This is the timer interrupt service routine.
*
......@@ -41,9 +39,6 @@ void SysTick_Handler(void)
rt_interrupt_leave();
}
/**
* This function will initial LPC54xx board.
*/
......@@ -58,7 +53,7 @@ void rt_hw_board_init()
/* Set the Vector Table base location at 0x00000000 */
SCB->VTOR = (0x00000000 & NVIC_VTOR_MASK);
#endif
SystemCoreClockUpdate();
SystemCoreClockUpdate();
/* init systick 1 systick = 1/(100M / 100) 100systick = 1s*/
SysTick_Config(SystemCoreClock / RT_TICK_PER_SECOND);
/* set pend exception priority */
......@@ -68,29 +63,17 @@ void rt_hw_board_init()
rt_hw_uart_init();
rt_console_set_device(RT_CONSOLE_DEVICE_NAME);
#if LPC_EXT_SDRAM == 1
lpc_sdram_hw_init();
mpu_init();
#endif
#ifdef RT_USING_COMPONENTS_INIT
/* initialization board with RT-Thread Components */
rt_components_board_init();
#endif
}
/* initialization for system heap */
int rt_hw_board_heap_init(void)
{
#ifdef RT_USING_HEAP
#if LPC_EXT_SDRAM
#include "drv_sram.h"
rt_system_heap_init((void *)LPC_EXT_SDRAM_BEGIN, (void *)LPC_EXT_SDRAM_END);
sram_init();
#else
rt_system_heap_init((void *)HEAP_BEGIN, (void *)HEAP_END);
#endif
#endif
return 0;
......
......@@ -25,50 +25,50 @@ extern int rt_application_init(void);
*/
void rtthread_startup(void)
{
/* initialize board */
rt_hw_board_init();
/* initialize board */
rt_hw_board_init();
/* show version */
rt_show_version();
/* show version */
rt_show_version();
/* initialize tick */
rt_system_tick_init();
/* initialize tick */
rt_system_tick_init();
/* initialize kernel object */
rt_system_object_init();
/* initialize kernel object */
rt_system_object_init();
/* initialize timer system */
rt_system_timer_init();
/* initialize timer system */
rt_system_timer_init();
/* initialize system heap */
rt_system_heap_init(HEAP_BEGIN, HEAP_END);
/* initialize scheduler system */
rt_system_scheduler_init();
/* initialize scheduler system */
rt_system_scheduler_init();
/* initialize application */
rt_application_init();
/* initialize application */
rt_application_init();
/* initialize timer thread */
rt_system_timer_thread_init();
/* initialize idle thread */
rt_thread_idle_init();
/* initialize idle thread */
rt_thread_idle_init();
/* start scheduler */
rt_system_scheduler_start();
/* start scheduler */
rt_system_scheduler_start();
/* never reach here */
return ;
/* never reach here */
return ;
}
int main(void)
{
/* disable interrupt first */
rt_hw_interrupt_disable();
/* disable interrupt first */
rt_hw_interrupt_disable();
/* startup RT-Thread RTOS */
rtthread_startup();
/* startup RT-Thread RTOS */
rtthread_startup();
return 0;
return 0;
}
......@@ -5,42 +5,42 @@
struct led_ctrl
{
uint32_t num;
uint32_t port;
uint32_t num;
uint32_t port;
};
struct lpc_led
{
/* inherit from rt_device */
struct rt_device parent;
struct led_ctrl ctrl[LED_NUM];
/* inherit from rt_device */
struct rt_device parent;
struct led_ctrl ctrl[LED_NUM];
};
static struct lpc_led led;
static rt_err_t rt_led_init(rt_device_t dev)
{
/*led2 Blue:P0.31 ,led1 Green:P0.30 ,led0 Red:P0_29 P38,P32*/
LPC_SYSCON->AHBCLKCTRLSET[0] = (1UL << 14); /* enable GPIO0 clock*/
LPC_SYSCON->PRESETCTRLSET[0] = (1UL << 14); /* Resets a GPIO0 peripheral */
LPC_SYSCON->PRESETCTRLCLR[0] = (1UL << 14);
/* set P0.31, P0.30, P0.29 output. */
LPC_GPIO->DIR[0] |= 0x07UL << 29;
/* turn off all the led */
LPC_GPIO->SET[0] = 0x07UL << 29;
led.ctrl[0].num = 29;
led.ctrl[0].port = 0;
led.ctrl[1].num = 30;
led.ctrl[1].port = 0;
led.ctrl[2].num = 31;
led.ctrl[2].port = 0;
return RT_EOK;
/*led2 Blue:P0.31 ,led1 Green:P0.30 ,led0 Red:P0_29 P38,P32*/
LPC_SYSCON->AHBCLKCTRLSET[0] = (1UL << 14); /* enable GPIO0 clock*/
LPC_SYSCON->PRESETCTRLSET[0] = (1UL << 14); /* Resets a GPIO0 peripheral */
LPC_SYSCON->PRESETCTRLCLR[0] = (1UL << 14);
/* set P0.31, P0.30, P0.29 output. */
LPC_GPIO->DIR[0] |= 0x07UL << 29;
/* turn off all the led */
LPC_GPIO->SET[0] = 0x07UL << 29;
led.ctrl[0].num = 29;
led.ctrl[0].port = 0;
led.ctrl[1].num = 30;
led.ctrl[1].port = 0;
led.ctrl[2].num = 31;
led.ctrl[2].port = 0;
return RT_EOK;
}
static rt_err_t rt_led_open(rt_device_t dev, rt_uint16_t oflag)
......@@ -53,7 +53,6 @@ static rt_err_t rt_led_close(rt_device_t dev)
return RT_EOK;
}
static rt_size_t rt_led_read(rt_device_t dev, rt_off_t pos, void *buffer,
rt_size_t size)
{
......@@ -66,22 +65,19 @@ static rt_size_t rt_led_read(rt_device_t dev, rt_off_t pos, void *buffer,
for (index = 0; index < nr; index++)
{
//if ((LPC_GPIO->PIN[led.ctrl[pos + index].port]) & 1 << led.ctrl[pos + index].num)
if ((LPC_GPIO->B[0][led.ctrl[pos + index].num]))
{
*value = 0;
}
else
{
*value = 1;
}
value++;
if ((LPC_GPIO->B[0][led.ctrl[pos + index].num]))
{
*value = 0;
}
else
{
*value = 1;
}
value++;
}
return index;
}
static rt_size_t rt_led_write(rt_device_t dev, rt_off_t pos,
const void *buffer, rt_size_t size)
{
......@@ -93,21 +89,20 @@ static rt_size_t rt_led_write(rt_device_t dev, rt_off_t pos,
RT_ASSERT((pos + size) <= LED_NUM);
for (index = 0; index < nw; index++)
{
if (*value > 0)
{
//LPC_GPIO->CLR[led.ctrl[pos + index].port] |= (1 << led.ctrl[pos + index].num);
LPC_GPIO->CLR[0] |= (1 << led.ctrl[pos + index].num);
}
else
{
//LPC_GPIO->SET[led.ctrl[pos + index].port] |= (1 << led.ctrl[pos + index].num);
LPC_GPIO->SET[0] |= (1 << led.ctrl[pos + index].num);
}
}
return index;
}
if (*value > 0)
{
//LPC_GPIO->CLR[led.ctrl[pos + index].port] |= (1 << led.ctrl[pos + index].num);
LPC_GPIO->CLR[0] |= (1 << led.ctrl[pos + index].num);
}
else
{
//LPC_GPIO->SET[led.ctrl[pos + index].port] |= (1 << led.ctrl[pos + index].num);
LPC_GPIO->SET[0] |= (1 << led.ctrl[pos + index].num);
}
}
return index;
}
static rt_err_t rt_led_control(rt_device_t dev, rt_uint8_t cmd, void *args)
{
......@@ -134,8 +129,6 @@ int rt_led_hw_init(void)
return 0;
}
void Led_Control(rt_uint32_t Set_led, rt_uint32_t value)
{
if ( Set_led == 0 )
......@@ -144,11 +137,11 @@ void Led_Control(rt_uint32_t Set_led, rt_uint32_t value)
switch (value)
{
case 0:
/* Light off */
/* Light off */
LPC_GPIO->B[0][led.ctrl[Set_led].num] = 1UL;
break;
case 1:
/* Lights on */
/* Lights on */
LPC_GPIO->B[0][led.ctrl[Set_led].num] = 0UL;
break;
default:
......@@ -162,28 +155,28 @@ void Led_Control(rt_uint32_t Set_led, rt_uint32_t value)
switch (value)
{
case 0:
/* Light off */
/* Light off */
LPC_GPIO->B[0][led.ctrl[Set_led].num] = 1UL;
break;
case 1:
/* Lights on */
/* Lights on */
LPC_GPIO->B[0][led.ctrl[Set_led].num] = 0UL;
break;
default:
break;
}
}
if ( Set_led == 2 )
if ( Set_led == 2 )
{
/* set led status */
switch (value)
{
case 0:
/* Lights off */
/* Lights off */
LPC_GPIO->B[0][led.ctrl[Set_led].num] = 1UL;
break;
case 1:
/* Lights on */
/* Lights on */
LPC_GPIO->B[0][led.ctrl[Set_led].num] = 0UL;
break;
default:
......@@ -191,10 +184,8 @@ void Led_Control(rt_uint32_t Set_led, rt_uint32_t value)
}
}
}
INIT_DEVICE_EXPORT(rt_led_hw_init);
#ifdef RT_USING_FINSH
#include <finsh.h>
void led_test(rt_uint32_t led_num, rt_uint32_t value)
......@@ -204,7 +195,3 @@ void led_test(rt_uint32_t led_num, rt_uint32_t value)
}
FINSH_FUNCTION_EXPORT(led_test, e.g: led_test(0, 100).)
#endif
......@@ -25,7 +25,6 @@ static uint32_t _UART_GetHighDiv(uint32_t val, uint8_t strict);
static int32_t _CalcErr(uint32_t n, uint32_t d, uint32_t *prev);
static ErrorCode_t _UART_CalcDiv(UART_BAUD_T *ub);
static void _UART_CalcMul(UART_BAUD_T *ub);
struct lpc_uart
{
......@@ -33,16 +32,13 @@ struct lpc_uart
IRQn_Type UART_IRQn;
};
static rt_err_t lpc_configure(struct rt_serial_device *serial, struct serial_configure *cfg)
{
struct lpc_uart *uart;
UART_BAUD_T baud;
UART_CFG_T UART_cfg;
UART_BAUD_T baud;
UART_CFG_T UART_cfg;
RT_ASSERT(serial != RT_NULL);
uart = (struct lpc_uart *)serial->parent.user_data;
......@@ -52,38 +48,36 @@ static rt_err_t lpc_configure(struct rt_serial_device *serial, struct serial_con
* 1 Stop bit
* None parity
*/
/* Set up baudrate parameters */
baud.clk = Chip_Clock_GetAsyncSyscon_ClockRate(); /* Clock frequency */
baud.baud = cfg->baud_rate; /* Required baud rate */
baud.ovr = 0; /* Set the oversampling to the recommended rate */
baud.mul = baud.div = 0;
if(!baud.mul)
{
_UART_CalcMul(&baud);
}
_UART_CalcDiv(&baud);
/* Set fractional control register */
LPC_ASYNC_SYSCON->FRGCTRL = ((uint32_t) baud.mul << 8) | 0xFF;
/* Configure the UART */
UART_cfg.cfg = UART_CFG_8BIT;
UART_cfg.div = baud.div; /* Use the calculated div value */
UART_cfg.ovr = baud.ovr; /* Use oversampling rate from baud */
UART_cfg.res = UART_BIT_DLY(cfg->baud_rate);
/* P254,255,246 */
uart->UART->OSR = (UART_cfg.ovr - 1) & 0x0F;
uart->UART->BRG = (UART_cfg.div - 1) & 0xFFFF;
uart->UART->CFG = UART_CFG_ENABLE | (UART_cfg.cfg & ~UART_CFG_RES);
/* Set up baudrate parameters */
baud.clk = Chip_Clock_GetAsyncSyscon_ClockRate(); /* Clock frequency */
baud.baud = cfg->baud_rate; /* Required baud rate */
baud.ovr = 0; /* Set the oversampling to the recommended rate */
baud.mul = baud.div = 0;
if(!baud.mul)
{
_UART_CalcMul(&baud);
}
_UART_CalcDiv(&baud);
/* Set fractional control register */
LPC_ASYNC_SYSCON->FRGCTRL = ((uint32_t) baud.mul << 8) | 0xFF;
/* Configure the UART */
UART_cfg.cfg = UART_CFG_8BIT;
UART_cfg.div = baud.div; /* Use the calculated div value */
UART_cfg.ovr = baud.ovr; /* Use oversampling rate from baud */
UART_cfg.res = UART_BIT_DLY(cfg->baud_rate);
/* P254,255,246 */
uart->UART->OSR = (UART_cfg.ovr - 1) & 0x0F;
uart->UART->BRG = (UART_cfg.div - 1) & 0xFFFF;
uart->UART->CFG = UART_CFG_ENABLE | (UART_cfg.cfg & ~UART_CFG_RES);
return RT_EOK;
}
static rt_err_t lpc_control(struct rt_serial_device *serial, int cmd, void *arg)
{
struct lpc_uart *uart;
......@@ -95,7 +89,7 @@ static rt_err_t lpc_control(struct rt_serial_device *serial, int cmd, void *arg)
{
case RT_DEVICE_CTRL_CLR_INT:
/* disable rx irq */
uart->UART->INTENCLR &= ~0x01;
uart->UART->INTENCLR &= ~0x01;
break;
case RT_DEVICE_CTRL_SET_INT:
/* enable rx irq */
......@@ -106,16 +100,15 @@ static rt_err_t lpc_control(struct rt_serial_device *serial, int cmd, void *arg)
return RT_EOK;
}
static int lpc_putc(struct rt_serial_device *serial, char c)
{
struct lpc_uart *uart;
uart = (struct lpc_uart *)serial->parent.user_data;
while(!(uart->UART->STAT & (0x01<<2)));
uart->UART->TXDAT = c ;
while(!(uart->UART->STAT & (0x01<<2)));
uart->UART->TXDAT = c ;
return 1;
}
......@@ -157,9 +150,9 @@ void UART0_IRQHandler(void)
volatile uint32_t INTSTAT, tmp;
/* enter interrupt */
rt_interrupt_enter();
INTSTAT = LPC_USART0->INTSTAT;
INTSTAT = LPC_USART0->INTSTAT;
INTSTAT &= 0x01;
switch (INTSTAT)
{
......@@ -174,48 +167,42 @@ void UART0_IRQHandler(void)
rt_interrupt_leave();
}
void rt_hw_uart_init(void)
{
struct lpc_uart *uart;
struct serial_configure config = RT_SERIAL_CONFIG_DEFAULT;
uart = &uart0;
uart = &uart0;
serial0.ops = &lpc_uart_ops;
serial0.config = config;
serial0.parent.user_data = uart;
/* Enable IOCON clock Then your cfg will effective P38 */
LPC_SYSCON->AHBCLKCTRLSET[0] = (1UL << 13);
/* Setup UART TX,RX Pin configuration cfg Pin as Tx, Rx */
/* P63,P77
Selects pin function 1 IOCON_FUNC1
No addition pin function IOCON_MODE_INACT
Enables digital function by setting 1 to bit 7(default) IOCON_DIGITAL_EN
*/
LPC_IOCON->PIO[0][0] = (0x1 | (0x0 << 3) | (0x1 << 7));
LPC_IOCON->PIO[0][1] = (0x1 | (0x0 << 3) | (0x1 << 7));
/* Enable asynchronous APB bridge and subsystem P30 */
LPC_SYSCON->ASYNCAPBCTRL = 0x01;
/* The UART clock rate is the main system clock divided by this value P59 */
LPC_ASYNC_SYSCON->ASYNCCLKDIV = 1; /* Set Async clock divider to 1 */
/* Enable peripheral clock(asynchronous APB) to UART0 P57*/
LPC_ASYNC_SYSCON->ASYNCAPBCLKCTRLSET = (1 << 0x01);
/* Controls the clock for the Fractional Rate Generator used with the USARTs P57*/
LPC_ASYNC_SYSCON->ASYNCAPBCLKCTRLSET = (1 << 0x0F); /* Enable clock to Fractional divider */
/* Enable IOCON clock Then your cfg will effective P38 */
LPC_SYSCON->AHBCLKCTRLSET[0] = (1UL << 13);
/* Setup UART TX,RX Pin configuration cfg Pin as Tx, Rx */
/* P63,P77
Selects pin function 1 IOCON_FUNC1
No addition pin function IOCON_MODE_INACT
Enables digital function by setting 1 to bit 7(default) IOCON_DIGITAL_EN
*/
LPC_IOCON->PIO[0][0] = (0x1 | (0x0 << 3) | (0x1 << 7));
LPC_IOCON->PIO[0][1] = (0x1 | (0x0 << 3) | (0x1 << 7));
/* Enable asynchronous APB bridge and subsystem P30 */
LPC_SYSCON->ASYNCAPBCTRL = 0x01;
/* The UART clock rate is the main system clock divided by this value P59 */
LPC_ASYNC_SYSCON->ASYNCCLKDIV = 1; /* Set Async clock divider to 1 */
/* Enable peripheral clock(asynchronous APB) to UART0 P57*/
LPC_ASYNC_SYSCON->ASYNCAPBCLKCTRLSET = (1 << 0x01);
/* Controls the clock for the Fractional Rate Generator used with the USARTs P57*/
LPC_ASYNC_SYSCON->ASYNCAPBCLKCTRLSET = (1 << 0x0F); /* Enable clock to Fractional divider */
/* preemption = 1, sub-priority = 1 */
NVIC_SetPriority(uart->UART_IRQn, ((0x01 << 3) | 0x01));
......@@ -232,102 +219,104 @@ void rt_hw_uart_init(void)
/* PRIVATE: Division logic to divide without integer overflow */
static uint32_t _UART_DivClk(uint32_t pclk, uint32_t m)
{
uint32_t q, r, u = pclk >> 24, l = pclk << 8;
m = m + 256;
q = (1 << 24) / m;
r = (1 << 24) - (q * m);
return ((q * u) << 8) + (((r * u) << 8) + l) / m;
uint32_t q, r, u = pclk >> 24, l = pclk << 8;
m = m + 256;
q = (1 << 24) / m;
r = (1 << 24) - (q * m);
return ((q * u) << 8) + (((r * u) << 8) + l) / m;
}
/* PRIVATE: Get highest Over sampling value */
static uint32_t _UART_GetHighDiv(uint32_t val, uint8_t strict)
{
int32_t i, max = strict ? 16 : 5;
for (i = 16; i >= max; i--) {
if (!(val % i)) {
return i;
}
}
return 0;
int32_t i, max = strict ? 16 : 5;
for (i = 16; i >= max; i--)
{
if (!(val % i))
{
return i;
}
}
return 0;
}
/* Calculate error difference */
static int32_t _CalcErr(uint32_t n, uint32_t d, uint32_t *prev)
{
uint32_t err = n - (n / d) * d;
uint32_t herr = ((n / d) + 1) * d - n;
if (herr < err) {
err = herr;
}
if (*prev <= err) {
return 0;
}
*prev = err;
return (herr == err) + 1;
uint32_t err = n - (n / d) * d;
uint32_t herr = ((n / d) + 1) * d - n;
if (herr < err) {
err = herr;
}
if (*prev <= err) {
return 0;
}
*prev = err;
return (herr == err) + 1;
}
/* Calculate the base DIV value */
static ErrorCode_t _UART_CalcDiv(UART_BAUD_T *ub)
{
int32_t i = 0;
uint32_t perr = ~0UL;
if (!ub->div) {
i = ub->ovr ? ub->ovr : 16;
}
for (; i > 4; i--) {
int32_t tmp = _CalcErr(ub->clk, ub->baud * i, &perr);
/* Continue when no improvement seen in err value */
if (!tmp) {
continue;
}
ub->div = tmp - 1;
if (ub->ovr == i) {
break;
}
ub->ovr = i;
}
if (!ub->ovr) {
return ERR_UART_BAUDRATE;
}
ub->div += ub->clk / (ub->baud * ub->ovr);
if (!ub->div) {
return ERR_UART_BAUDRATE;
}
ub->baud = ub->clk / (ub->div * ub->ovr);
return LPC_OK;
int32_t i = 0;
uint32_t perr = ~0UL;
if (!ub->div) {
i = ub->ovr ? ub->ovr : 16;
}
for (; i > 4; i--) {
int32_t tmp = _CalcErr(ub->clk, ub->baud * i, &perr);
/* Continue when no improvement seen in err value */
if (!tmp) {
continue;
}
ub->div = tmp - 1;
if (ub->ovr == i) {
break;
}
ub->ovr = i;
}
if (!ub->ovr) {
return ERR_UART_BAUDRATE;
}
ub->div += ub->clk / (ub->baud * ub->ovr);
if (!ub->div) {
return ERR_UART_BAUDRATE;
}
ub->baud = ub->clk / (ub->div * ub->ovr);
return LPC_OK;
}
/* Calculate the best MUL value */
static void _UART_CalcMul(UART_BAUD_T *ub)
{
uint32_t m, perr = ~0UL, pclk = ub->clk, ovr = ub->ovr;
/* If clock is UART's base clock calculate only the divider */
for (m = 0; m < 256; m++) {
uint32_t ov = ovr, x, v, tmp;
/* Get clock and calculate error */
x = _UART_DivClk(pclk, m);
tmp = _CalcErr(x, ub->baud, &perr);
v = (x / ub->baud) + tmp - 1;
/* Update if new error is better than previous best */
if (!tmp || (ovr && (v % ovr)) ||
(!ovr && ((ov = _UART_GetHighDiv(v, ovr)) == 0))) {
continue;
}
ub->ovr = ov;
ub->mul = m;
ub->clk = x;
ub->div = tmp - 1;
}
uint32_t m, perr = ~0UL, pclk = ub->clk, ovr = ub->ovr;
/* If clock is UART's base clock calculate only the divider */
for (m = 0; m < 256; m++) {
uint32_t ov = ovr, x, v, tmp;
/* Get clock and calculate error */
x = _UART_DivClk(pclk, m);
tmp = _CalcErr(x, ub->baud, &perr);
v = (x / ub->baud) + tmp - 1;
/* Update if new error is better than previous best */
if (!tmp || (ovr && (v % ovr)) ||
(!ovr && ((ov = _UART_GetHighDiv(v, ovr)) == 0))) {
continue;
}
ub->ovr = ov;
ub->mul = m;
ub->clk = x;
ub->div = tmp - 1;
}
}
#ifndef __DRV_UART_H_
#define __DRV_UART_H_
void rt_hw_uart_init(void);
#endif /* __BOARD_H_ */
# RT-Thread building script for component
Import('rtconfig')
Import('RTT_ROOT')
from building import *
cwd = GetCurrentDir()
src = Glob('peri_driver/*/*.c')
src += Glob('common/board/*.c')
src += Glob('common/chip/*.c')
# add for startup script
if rtconfig.CROSS_TOOL == 'gcc':
print "not gcc startup file"
exit(0)
elif rtconfig.CROSS_TOOL == 'keil':
src += [cwd + '/common/startup/keil_startup_lpc82x.s']
elif rtconfig.CROSS_TOOL == 'iar':
src += [cwd + '/common/startup/iar_startup_lpc82x.s']
CPPPATH = [ cwd + '/peri_driver', cwd + '/common/board',
cwd + '/common/chip', cwd + '/common/CMSIS']
if GetDepend(['RT_USING_BSP_CMSIS']):
CPPPATH += [cwd + '/common/CMSIS/']
elif GetDepend(['RT_USING_RTT_CMSIS']):
CPPPATH += [RTT_ROOT + '/components/CMSIS/Include']
CPPDEFINES = ['CORE_M0PLUS']
group = DefineGroup('Libraries', src, depend = [''], CPPPATH = CPPPATH, CPPDEFINES=CPPDEFINES)
Return('group')
此差异已折叠。
此差异已折叠。
此差异已折叠。
/**************************************************************************//**
* @file core_cmFunc.h
* @brief CMSIS Cortex-M Core Function Access Header File
* @version V4.30
* @date 20. October 2015
******************************************************************************/
/* Copyright (c) 2009 - 2015 ARM LIMITED
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
- Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
- Neither the name of ARM nor the names of its contributors may be used
to endorse or promote products derived from this software without
specific prior written permission.
*
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
---------------------------------------------------------------------------*/
#if defined ( __ICCARM__ )
#pragma system_include /* treat file as system include file for MISRA check */
#elif defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050)
#pragma clang system_header /* treat file as system include file */
#endif
#ifndef __CORE_CMFUNC_H
#define __CORE_CMFUNC_H
/* ########################### Core Function Access ########################### */
/** \ingroup CMSIS_Core_FunctionInterface
\defgroup CMSIS_Core_RegAccFunctions CMSIS Core Register Access Functions
@{
*/
/*------------------ RealView Compiler -----------------*/
#if defined ( __CC_ARM )
#include "cmsis_armcc.h"
/*------------------ ARM Compiler V6 -------------------*/
#elif defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050)
#include "cmsis_armcc_V6.h"
/*------------------ GNU Compiler ----------------------*/
#elif defined ( __GNUC__ )
#include "cmsis_gcc.h"
/*------------------ ICC Compiler ----------------------*/
#elif defined ( __ICCARM__ )
#include <cmsis_iar.h>
/*------------------ TI CCS Compiler -------------------*/
#elif defined ( __TMS470__ )
#include <cmsis_ccs.h>
/*------------------ TASKING Compiler ------------------*/
#elif defined ( __TASKING__ )
/*
* The CMSIS functions have been implemented as intrinsics in the compiler.
* Please use "carm -?i" to get an up to date list of all intrinsics,
* Including the CMSIS ones.
*/
/*------------------ COSMIC Compiler -------------------*/
#elif defined ( __CSMC__ )
#include <cmsis_csm.h>
#endif
/*@} end of CMSIS_Core_RegAccFunctions */
#endif /* __CORE_CMFUNC_H */
/**************************************************************************//**
* @file core_cmInstr.h
* @brief CMSIS Cortex-M Core Instruction Access Header File
* @version V4.30
* @date 20. October 2015
******************************************************************************/
/* Copyright (c) 2009 - 2015 ARM LIMITED
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
- Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
- Neither the name of ARM nor the names of its contributors may be used
to endorse or promote products derived from this software without
specific prior written permission.
*
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
---------------------------------------------------------------------------*/
#if defined ( __ICCARM__ )
#pragma system_include /* treat file as system include file for MISRA check */
#elif defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050)
#pragma clang system_header /* treat file as system include file */
#endif
#ifndef __CORE_CMINSTR_H
#define __CORE_CMINSTR_H
/* ########################## Core Instruction Access ######################### */
/** \defgroup CMSIS_Core_InstructionInterface CMSIS Core Instruction Interface
Access to dedicated instructions
@{
*/
/*------------------ RealView Compiler -----------------*/
#if defined ( __CC_ARM )
#include "cmsis_armcc.h"
/*------------------ ARM Compiler V6 -------------------*/
#elif defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050)
#include "cmsis_armcc_V6.h"
/*------------------ GNU Compiler ----------------------*/
#elif defined ( __GNUC__ )
#include "cmsis_gcc.h"
/*------------------ ICC Compiler ----------------------*/
#elif defined ( __ICCARM__ )
#include <cmsis_iar.h>
/*------------------ TI CCS Compiler -------------------*/
#elif defined ( __TMS470__ )
#include <cmsis_ccs.h>
/*------------------ TASKING Compiler ------------------*/
#elif defined ( __TASKING__ )
/*
* The CMSIS functions have been implemented as intrinsics in the compiler.
* Please use "carm -?i" to get an up to date list of all intrinsics,
* Including the CMSIS ones.
*/
/*------------------ COSMIC Compiler -------------------*/
#elif defined ( __CSMC__ )
#include <cmsis_csm.h>
#endif
/*@}*/ /* end of group CMSIS_Core_InstructionInterface */
#endif /* __CORE_CMINSTR_H */
/*
* @brief Common board API functions
*
* @note
* Copyright(C) NXP Semiconductors, 2013
* All rights reserved.
*
* @par
* Software that is described herein is for illustrative purposes only
* which provides customers with programming information regarding the
* LPC products. This software is supplied "AS IS" without any warranties of
* any kind, and NXP Semiconductors and its licensor disclaim any and
* all warranties, express or implied, including all implied warranties of
* merchantability, fitness for a particular purpose and non-infringement of
* intellectual property rights. NXP Semiconductors assumes no responsibility
* or liability for the use of the software, conveys no license or rights under any
* patent, copyright, mask work right, or any other intellectual property rights in
* or to any products. NXP Semiconductors reserves the right to make changes
* in the software without notification. NXP Semiconductors also makes no
* representation or warranty that such application will be suitable for the
* specified use without further testing or modification.
*
* @par
* Permission to use, copy, modify, and distribute this software and its
* documentation is hereby granted, under NXP Semiconductors' and its
* licensor's relevant copyrights in the software, without fee, provided that it
* is used in conjunction with NXP Semiconductors microcontrollers. This
* copyright, permission, and disclaimer notice must appear in all copies of
* this code.
*/
#ifndef __BOARD_API_H_
#define __BOARD_API_H_
#include "lpc_types.h"
#include <stdio.h>
#ifdef __cplusplus
extern "C" {
#endif
/** @defgroup BOARD_COMMON_API BOARD: Common board functions
* @ingroup BOARD_Common
* This file contains common board definitions that are shared across
* boards and devices. All of these functions do not need to be
* implemented for a specific board, but if they are implemented, they
* should use this API standard.
* @{
*/
/**
* @brief Setup and initialize hardware prior to call to main()
* @return None
* @note Board_SystemInit() is called prior to the application and sets up system
* clocking, memory, and any resources needed prior to the application
* starting.
*/
void Board_SystemInit(void);
/**
* @brief Setup pin multiplexer per board schematics
* @return None
* @note Board_SetupMuxing() should be called from SystemInit() prior to application
* main() is called. So that the PINs are set in proper state.
*/
void Board_SetupMuxing(void);
/**
* @brief Setup system clocking
* @return None
* @note This sets up board clocking.
*/
void Board_SetupClocking(void);
/**
* @brief Setup external system memory
* @return None
* @note This function is typically called after pin mux setup and clock setup and
* sets up any external memory needed by the system (DRAM, SRAM, etc.). Not all
* boards need this function.
*/
void Board_SetupExtMemory(void);
/**
* @brief Set up and initialize all required blocks and functions related to the board hardware.
* @return None
*/
void Board_Init(void);
/**
* @brief Initializes board UART for output, required for printf redirection
* @return None
*/
void Board_Debug_Init(void);
/**
* @brief Sends a single character on the UART, required for printf redirection
* @param ch : character to send
* @return None
*/
void Board_UARTPutChar(char ch);
/**
* @brief Sends a single character on the UART, automatic process '\n' -> '\r\n'
* @param ch : character to send
* @return None
*/
void Board_UARTPutTextChar(char ch);
/**
* @brief Classic implementation of itoa -- integer to ASCII
* @param value : value to convert
* @param result : result string
* @param base : output radix
* @return result string or NULL
*/
char *Board_itoa(int value, char *result, int base);
/**
* @brief Get a single character from the UART, required for scanf input
* @return EOF if not character was received, or character value
*/
int Board_UARTGetChar(void);
/**
* @brief Prints a string to the UART
* @param str : Terminated string to output
* @return None
*/
void Board_UARTPutSTR(const char *str);
/**
* @brief Get if a key is down
* @param keyIndex : The index of the key to detect
* @return 1 = key is down , 0 = key is up
*/
uint32_t Board_Key_GetKeyDown(uint32_t keyIndex);
/**
* @brief Sets the state of a board LED to on or off
* @param LEDNumber : LED number to set state for
* @param State : true for on, false for off
* @return None
*/
void Board_LED_Set(uint8_t LEDNumber, bool State);
/**
* @brief Returns the current state of a board LED
* @param LEDNumber : LED number to set state for
* @return true if the LED is on, otherwise false
*/
bool Board_LED_Test(uint8_t LEDNumber);
/**
* @brief Toggles the current state of a board LED
* @param LEDNumber : LED number to change state for
* @return None
*/
void Board_LED_Toggle(uint8_t LEDNumber);
/**
* @brief Turn on Board LCD Backlight
* @param Intensity : Backlight intensity (0 = off, >=1 = on)
* @return None
* @note On boards where a GPIO is used to control backlight on/off state, a '0' or '1'
* value will turn off or on the backlight. On some boards, a non-0 value will
* control backlight intensity via a PWN. For PWM systems, the intensity value
* is a percentage value between 0 and 100%.
*/
void Board_SetLCDBacklight(uint8_t Intensity);
/**
* @brief Function prototype for a MS delay function. Board layers or example code may
* define this function as needed.
*/
typedef void (*p_msDelay_func_t)(uint32_t);
/* The DEBUG* functions are selected based on system configuration.
Code that uses the DEBUG* functions will have their I/O routed to
the UART, semihosting, or nowhere. */
#if defined(DEBUG_ENABLE)
#if defined(DEBUG_SEMIHOSTING)
#define DEBUGINIT()
#define DEBUGOUT(...) printf(__VA_ARGS__)
#define DEBUGSTR(str) printf(str)
#define DEBUGIN() (int) EOF
#else
#define DEBUGINIT() Board_Debug_Init()
#define DEBUGOUT(...) printf(__VA_ARGS__)
#define DEBUGSTR(str) Board_UARTPutSTR(str)
#define DEBUGIN() Board_UARTGetChar()
#endif /* defined(DEBUG_SEMIHOSTING) */
#else
#define DEBUGINIT()
#define DEBUGOUT(...)
#define DEBUGSTR(str)
#define DEBUGIN() (int) EOF
#endif /* defined(DEBUG_ENABLE) */
/**
* @}
*/
#ifdef __cplusplus
}
#endif
#endif /* __BOARD_API_H_ */
此差异已折叠。
/*
* @brief NXP LPCXpresso LPC824 board file
*
* @note
* Copyright(C) NXP Semiconductors, 2012
* All rights reserved.
*
* @par
* Software that is described herein is for illustrative purposes only
* which provides customers with programming information regarding the
* LPC products. This software is supplied "AS IS" without any warranties of
* any kind, and NXP Semiconductors and its licensor disclaim any and
* all warranties, express or implied, including all implied warranties of
* merchantability, fitness for a particular purpose and non-infringement of
* intellectual property rights. NXP Semiconductors assumes no responsibility
* or liability for the use of the software, conveys no license or rights under any
* patent, copyright, mask work right, or any other intellectual property rights in
* or to any products. NXP Semiconductors reserves the right to make changes
* in the software without notification. NXP Semiconductors also makes no
* representation or warranty that such application will be suitable for the
* specified use without further testing or modification.
*
* @par
* Permission to use, copy, modify, and distribute this software and its
* documentation is hereby granted, under NXP Semiconductors' and its
* licensor's relevant copyrights in the software, without fee, provided that it
* is used in conjunction with NXP Semiconductors microcontrollers. This
* copyright, permission, and disclaimer notice must appear in all copies of
* this code.
*/
#ifndef __BOARD_H_
#define __BOARD_H_
#include "chip.h"
/* board_api.h is included at the bottom of this file after DEBUG setup */
#ifdef __cplusplus
extern "C" {
#endif
/** @defgroup BOARD_NXP_LPCXPRESSO_824 NXP LPC824 LPCXpresso board support software API functions
* @ingroup LPCOPEN_8XX_BOARD_LPCXPRESSO_824
* The board support software API functions provide some simple abstracted
* functions used across multiple LPCOpen board examples. See @ref BOARD_COMMON_API
* for the functions defined by this board support layer.<br>
* @{
*/
/** @defgroup LPCOPEN_8XX_BOARD_LPCXPRESSO_824_OPTIONS BOARD: LPC824 LPCXpresso board build options
* This board has options that configure its operation at build-time.<br>
* @{
*/
/** Define the frequency in Hz, of the main oscillator (from Xtal)
* Note that it only takes effect if main oscillator is selected as clock source
*/
#define MAIN_OSC_XTAL_FREQ_HZ 12000000
/** Define the frequency in Hz, of the external clock input.
* Note that it only takes effect if external clock is selected as clock source
*/
#define EXT_CLOCK_IN_FREQ_HZ 0
//#define USE_IRC_AS_ROOT_CLOCK /*注释掉使用外部晶体 打开定义则是使用内部IRC*/
#define BOARD_LED_CNT 8
#define BOARD_KEY_CNT 3
typedef enum _enum_boardKeys
{
BOARD_KEY_0 = 0,
BOARD_KEY_1 = 1,
BOARD_KEY_2 = 2,
}enum_boardKeys;
// define LED bits (bit <--> pin on port 0) only if in board.c file
#ifdef _BOARD_C_
static const uint8_t ledBits[BOARD_LED_CNT] = {7, 13, 16, 17, 19, 27, 28, 18};
static const uint8_t cs_keyBits[BOARD_KEY_CNT] = {12, 4 , 1};
static const uint8_t cs_keyIoConNdce[BOARD_KEY_CNT] = {IOCON_PIO12, IOCON_PIO4, IOCON_PIO1};
#endif
/** Define DEBUG_ENABLE to enable IO via the DEBUGSTR, DEBUGOUT, and
DEBUGIN macros. If not defined, DEBUG* functions will be optimized
out of the code at build time.
*/
#define DEBUG_ENABLE
/** Define DEBUG_SEMIHOSTING along with DEBUG_ENABLE to enable IO support
via semihosting. You may need to use a C library that supports
semihosting with this option.
*/
//#define DEBUG_SEMIHOSTING
/** Board UART used for debug output and input using the DEBUG* macros. This
is also the port used for Board_UARTPutChar, Board_UARTGetChar, and
Board_UARTPutSTR functions. Although you can setup multiple UARTs here,
the board code only supoprts UART0 in the Board_UART_Init() fucntion,
so be sure to change it there too if not using UART0.
*/
#define DEBUG_UART LPC_USART1
/**
* @}
*/
/* Board name */
#define BOARD_NXP_LPCXPRESSO_824
#include "board_api.h"
#ifdef __cplusplus
}
#endif
#endif /* __BOARD_H_ */
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
/*
* @brief Error code returned by LPC8xx Boot ROM drivers/library functions
*
* @note
* Copyright(C) NXP Semiconductors, 2012
* All rights reserved.
*
* @par
* Software that is described herein is for illustrative purposes only
* which provides customers with programming information regarding the
* LPC products. This software is supplied "AS IS" without any warranties of
* any kind, and NXP Semiconductors and its licensor disclaim any and
* all warranties, express or implied, including all implied warranties of
* merchantability, fitness for a particular purpose and non-infringement of
* intellectual property rights. NXP Semiconductors assumes no responsibility
* or liability for the use of the software, conveys no license or rights under any
* patent, copyright, mask work right, or any other intellectual property rights in
* or to any products. NXP Semiconductors reserves the right to make changes
* in the software without notification. NXP Semiconductors also makes no
* representation or warranty that such application will be suitable for the
* specified use without further testing or modification.
*
* @par
* Permission to use, copy, modify, and distribute this software and its
* documentation is hereby granted, under NXP Semiconductors' and its
* licensor's relevant copyrights in the software, without fee, provided that it
* is used in conjunction with NXP Semiconductors microcontrollers. This
* copyright, permission, and disclaimer notice must appear in all copies of
* this code.
*/
#ifndef __ERROR_8XX_H__
#define __ERROR_8XX_H__
/** @defgroup ROMAPI_ERRORCODES_8XX CHIP: LPC8xx ROM API error codes
* @ingroup ROMAPI_8XX
* @{
*/
/** Error code returned by Boot ROM drivers/library functions
*
* Error codes are a 32-bit value with :
* - The 16 MSB contains the peripheral code number
* - The 16 LSB contains an error code number associated to that peripheral
*
*/
typedef enum
{
/**\b 0x00000000*/ LPC_OK = 0, /**< enum value returned on Successful completion */
/**\b 0x00000001*/ LPC_ERROR, /**< enum value returned on general error (I2C) */
/* ISP related errors */
ERR_ISP_BASE = 0x00000000,
/**\b 0x00000001*/ ERR_ISP_INVALID_COMMAND = ERR_ISP_BASE + 1,
/**\b 0x00000002*/ ERR_ISP_SRC_ADDR_ERROR, /*!< Source address not on word boundary */
/**\b 0x00000003*/ ERR_ISP_DST_ADDR_ERROR, /*!< Destination address not on word or 256 byte boundary */
/**\b 0x00000004*/ ERR_ISP_SRC_ADDR_NOT_MAPPED,
/**\b 0x00000005*/ ERR_ISP_DST_ADDR_NOT_MAPPED,
/**\b 0x00000006*/ ERR_ISP_COUNT_ERROR, /*!< Byte count is not multiple of 4 or is not a permitted value */
/**\b 0x00000007*/ ERR_ISP_INVALID_SECTOR,
/**\b 0x00000008*/ ERR_ISP_SECTOR_NOT_BLANK,
/**\b 0x00000009*/ ERR_ISP_SECTOR_NOT_PREPARED_FOR_WRITE_OPERATION,
/**\b 0x0000000A*/ ERR_ISP_COMPARE_ERROR,
/**\b 0x0000000B*/ ERR_ISP_BUSY, /*!< Flash programming hardware interface is busy */
/**\b 0x0000000C*/ ERR_ISP_PARAM_ERROR, /*!< Insufficient number of parameters */
/**\b 0x0000000D*/ ERR_ISP_ADDR_ERROR, /*!< Address not on word boundary */
/**\b 0x0000000E*/ ERR_ISP_ADDR_NOT_MAPPED,
/**\b 0x0000000F*/ ERR_ISP_CMD_LOCKED, /*!< Command is locked */
/**\b 0x00000010*/ ERR_ISP_INVALID_CODE, /*!< Unlock code is invalid */
/**\b 0x00000011*/ ERR_ISP_INVALID_BAUD_RATE,
/**\b 0x00000012*/ ERR_ISP_INVALID_STOP_BIT,
/**\b 0x00000013*/ ERR_ISP_CODE_READ_PROTECTION_ENABLED,
/* I2C related errors */
ERR_I2C_BASE = 0x00060000,
/**\b 0x00060001*/ ERR_I2C_NAK = ERR_I2C_BASE + 1, /*!< NAK */
/**\b 0x00060002*/ ERR_I2C_BUFFER_OVERFLOW, /*!< Buffer overflow */
/**\b 0x00060003*/ ERR_I2C_BYTE_COUNT_ERR, /*!< Byte count error */
/**\b 0x00060004*/ ERR_I2C_LOSS_OF_ARBRITRATION, /*!< Loss of arbitration */
/**\b 0x00060005*/ ERR_I2C_SLAVE_NOT_ADDRESSED, /*!< Slave not addressed */
/**\b 0x00060006*/ ERR_I2C_LOSS_OF_ARBRITRATION_NAK_BIT, /*!< Loss arbritation NAK */
/**\b 0x00060007*/ ERR_I2C_GENERAL_FAILURE, /*!< General failure */
/**\b 0x00060008*/ ERR_I2C_REGS_SET_TO_DEFAULT, /*!< Set to default */
/**\b 0x00060009*/ ERR_I2C_TIMEOUT, /*!< I2C Timeout */
/* UART related errors */
/**\b 0x00080001*/ ERR_NO_ERROR = LPC_OK, /*!< Receive is busy */
ERR_UART_BASE = 0x00080000,
/**\b 0x00080001*/ ERR_UART_RXD_BUSY = ERR_UART_BASE + 1, /*!< Receive is busy */
/**\b 0x00080002*/ ERR_UART_TXD_BUSY, /*!< Transmit is busy */
/**\b 0x00080003*/ ERR_UART_OVERRUN_FRAME_PARITY_NOISE, /*!< Overrun, Frame, Parity , Receive Noise error */
/**\b 0x00080004*/ ERR_UART_UNDERRUN, /*!< Underrun */
/**\b 0x00080005*/ ERR_UART_PARAM, /*!< Parameter error */
} ErrorCode_t;
/**
* @}
*/
#endif /* __ERROR_8XX_H__ */
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
# 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')
此差异已折叠。
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')
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
<?xml version="1.0" encoding="iso-8859-1"?>
<workspace>
<project>
<path>$WS_DIR$\project.ewp</path>
</project>
<batchBuild/>
</workspace>
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册