update CMSIS to 130

git-svn-id: https://rt-thread.googlecode.com/svn/trunk@684 bbd45198-f89e-11dd-88c7-29a3b14d5316
This commit is contained in:
bernard.xiong
2010-05-02 11:40:26 +00:00
parent dd42e9392b
commit ea22e3fb81
10 changed files with 4345 additions and 15 deletions
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,64 @@
/**************************************************************************//**
* @file system_LPC17xx.h
* @brief CMSIS Cortex-M3 Device Peripheral Access Layer Header File
* for the NXP LPC17xx Device Series
* @version V1.02
* @date 08. September 2009
*
* @note
* Copyright (C) 2009 ARM Limited. All rights reserved.
*
* @par
* ARM Limited (ARM) is supplying this software for use with Cortex-M
* processor based microcontrollers. This file can be freely distributed
* within development tools that are supporting such ARM based processors.
*
* @par
* THIS SOFTWARE IS PROVIDED "AS IS". NO WARRANTIES, WHETHER EXPRESS, IMPLIED
* OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE.
* ARM SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR
* CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.
*
******************************************************************************/
#ifndef __SYSTEM_LPC17xx_H
#define __SYSTEM_LPC17xx_H
#ifdef __cplusplus
extern "C" {
#endif
#include <stdint.h>
extern uint32_t SystemCoreClock; /*!< System Clock Frequency (Core Clock) */
/**
* Initialize the system
*
* @param none
* @return none
*
* @brief Setup the microcontroller system.
* Initialize the System and update the SystemCoreClock variable.
*/
extern void SystemInit (void);
/**
* Update SystemCoreClock variable
*
* @param none
* @return none
*
* @brief Updates the SystemCoreClock with current core Clock
* retrieved from cpu registers.
*/
extern void SystemCoreClockUpdate (void);
#ifdef __cplusplus
}
#endif
#endif /* __SYSTEM_LPC17xx_H */
Binary file not shown.
+2 -2
View File
@@ -7,13 +7,13 @@ Import('rtconfig')
group = {}
group['name'] = 'Startup'
group['CCFLAGS'] = ''
group['CPPPATH'] = [RTT_ROOT + '/bsp/lpc176x', RTT_ROOT + '/bsp/lpc176x/CMSIS']
group['CPPPATH'] = [ RTT_ROOT + '/bsp/lpc176x/CMSIS/CM3/CoreSupport', RTT_ROOT + '/bsp/lpc176x/CMSIS/CM3/DeviceSupport/NXP/LPC17xx',RTT_ROOT + '/bsp/lpc176x']
group['CPPDEFINES'] = []
group['LINKFLAGS'] = ''
src_bsp = ['application.c', 'startup.c', 'board.c']
src_drv = ['uart.c']
src_cmsis = ['CMSIS/core_cm3.c', 'CMSIS/system_LPC17xx.c']
src_cmsis = ['CMSIS/CM3/CoreSupport/core_cm3.c', 'CMSIS/CM3/DeviceSupport/NXP/LPC17xx/system_LPC17xx.c']
group['src'] = File(src_bsp + src_drv + src_cmsis)
+97 -2
View File
@@ -11,18 +11,113 @@
* Date Author Notes
* 2009-01-05 Bernard the first version
* 2010-03-04 Magicoe for LPC1766 version
* 2010-05-02 Aozima add led function
*/
/**
/**2q
* @addtogroup LPC17
*/
/*@{*/
#include <rtthread.h>
#include "LPC17xx.h"
static void rt_hw_led_init(void)
{
LPC_GPIO2->FIODIR0 |= 1<<0; /* led0:P2.0 */
LPC_GPIO2->FIODIR0 |= 1<<1; /* led1:P2.1 */
}
static void rt_hw_led_on(unsigned int led)
{
switch(led)
{
case 0: /* P2.0 = 1 */
LPC_GPIO2->FIOSET0 = 1<<0;
break;
case 1: /* P2.1 = 1 */
LPC_GPIO2->FIOSET0 = 1<<1;
break;
default:
break;
}
}
static void rt_hw_led_off(unsigned int led)
{
switch(led)
{
case 0: /* P2.0 = 0 */
LPC_GPIO2->FIOCLR0 = 1<<0;
break;
case 1: /* P2.1 = 0 */
LPC_GPIO2->FIOCLR0 = 1<<1;
break;
default:
break;
}
}
static void rt_thread_entry_led1(void* parameter)
{
/* init led configuration */
rt_hw_led_init();
while (1)
{
/* led on */
rt_kprintf("led1 on\r\n");
rt_hw_led_on(0);
rt_thread_delay(50); /* sleep 0.5 second and switch to other thread */
/* led off */
rt_kprintf("led1 off\r\n");
rt_hw_led_off(0);
rt_thread_delay(50);
}
}
char thread_led2_stack[1024];
struct rt_thread thread_led2;
void rt_thread_entry_led2(void* parameter)
{
unsigned int count=0;
while (1)
{
/* led on */
rt_kprintf("led2 on,count : %d\r\n",count);
count++;
rt_hw_led_on(1);
rt_thread_delay(RT_TICK_PER_SECOND);
/* led off */
rt_kprintf("led2 off\r\n");
rt_hw_led_off(1);
rt_thread_delay(RT_TICK_PER_SECOND);
}
}
int rt_application_init()
{
return 0;
rt_thread_t thread;
/* create led1 thread */
thread = rt_thread_create("led1",
rt_thread_entry_led1, RT_NULL,
512,
20, 5);
if (thread != RT_NULL)
rt_thread_startup(thread);
/* init led2 thread */
rt_thread_init(&thread_led2,
"led2",
rt_thread_entry_led2,
RT_NULL,
&thread_led2_stack[0],
sizeof(thread_led2_stack),10,10);
rt_thread_startup(&thread_led2);
return 0;
}
/*@}*/
+3 -2
View File
@@ -11,6 +11,7 @@
* Date Author Notes
* 2009-01-05 Bernard first implementation
* 2010-02-04 Magicoe ported to LPC17xx
* 2010-05-02 Aozima update CMSIS to 130
*/
#include <rthw.h>
@@ -18,7 +19,7 @@
#include "uart.h"
#include "board.h"
#include "CMSIS/LPC17xx.h"
#include "LPC17xx.h"
/**
* @addtogroup LPC17xx
@@ -57,7 +58,7 @@ void rt_hw_board_init()
#endif
/* init systick */
SysTick_Config(SystemFrequency/RT_TICK_PER_SECOND - 1);
SysTick_Config( SystemCoreClock/RT_TICK_PER_SECOND - 1);
/* set pend exception priority */
NVIC_SetPriority(PendSV_IRQn, (1<<__NVIC_PRIO_BITS) - 1);
+10 -9
View File
@@ -10,11 +10,12 @@
* Change Logs:
* Date Author Notes
* 2010-03-08 Bernard The first version for LPC17xx
* 2010-05-02 Aozima update CMSIS to 130
*/
#include <rthw.h>
#include <rtthread.h>
#include "CMSIS/LPC17xx.h"
#include "LPC17xx.h"
#define IER_RBR 0x01
#define IER_THRE 0x02
@@ -111,16 +112,16 @@ static rt_err_t rt_uart_init (rt_device_t dev)
{
case 0x00:
default:
pclk = SystemFrequency/4;
pclk = SystemCoreClock/4;
break;
case 0x01:
pclk = SystemFrequency;
pclk = SystemCoreClock;
break;
case 0x02:
pclk = SystemFrequency/2;
pclk = SystemCoreClock/2;
break;
case 0x03:
pclk = SystemFrequency/8;
pclk = SystemCoreClock/8;
break;
}
@@ -144,16 +145,16 @@ static rt_err_t rt_uart_init (rt_device_t dev)
{
case 0x00:
default:
pclk = SystemFrequency/4;
pclk = SystemCoreClock/4;
break;
case 0x01:
pclk = SystemFrequency;
pclk = SystemCoreClock;
break;
case 0x02:
pclk = SystemFrequency/2;
pclk = SystemCoreClock/2;
break;
case 0x03:
pclk = SystemFrequency/8;
pclk = SystemCoreClock/8;
break;
}