📄 lpc210x.h
字号:
/******************************************************************************
uC/OS-II Porting for LPC210x
By: Pary WU <parywu@mail2000.com.tw>
History:
0406271325:parywu
The first stable release.
******************************************************************************/
#ifndef __LPC210X_H_0406161429
#define __LPC210X_H_0406161429
/* ARM modes */
#define MODE_NOINT_USR 0xd0
#define MODE_NOINT_FIQ 0xd1
#define MODE_NOINT_IRQ 0xd2
#define MODE_NOINT_SVC 0xd3
#define MODE_NOINT_ABT 0xd7
#define MODE_NOINT_UND 0xdb
#define MODE_NOINT_SYS 0xdf
#define MODE_NOFIQ_USR 0x50
#define MODE_NOFIQ_FIQ 0x51
#define MODE_NOFIQ_IRQ 0x52
#define MODE_NOFIQ_SVC 0x53
#define MODE_NOFIQ_ABT 0x57
#define MODE_NOFIQ_UND 0x5b
#define MODE_NOFIQ_SYS 0x5f
#define MODE_THUMB_BIT 0x20
// System Control
#define rMAMCR (*(volatile unsigned char *) (0xe01fc000))
#define rMAMTIM (*(volatile unsigned char *) (0xe01fc004))
#define rMEMMAP (*(volatile unsigned char *) (0xe01fc040))
#define rPLLCON (*(volatile unsigned char *) (0xe01fc080))
#define rPLLCFG (*(volatile unsigned char *) (0xe01fc084))
#define rPLLSTAT (*(volatile unsigned short *)(0xe01fc088))
#define rPLLFEED (*(volatile unsigned char *) (0xe01fc08c))
#define rPCON (*(volatile unsigned char *) (0xe01fc0c0))
#define rPCONP (*(volatile unsigned int *) (0xe01fc0c4))
#define rVPBDIV (*(volatile unsigned char *) (0xe01fc100))
#define rEXTINT (*(volatile unsigned char *) (0xe01fc140))
#define rEXTWAKE (*(volatile unsigned char *) (0xe01fc144))
// PLL bits
#define PLLCON_PLLE 0x01
#define PLLCON_PLLC 0x02
#define PLLCFG_MSEL 0x1f
#define PLLCFG_PSEL 0x60
#define PLLCFG(MSEL, PSEL) (unsigned char)((MSEL)|((PSEL)<<5))
#define PLLSTAT_PLOCK 0x40
// VIC
#define rVICIRQStatus (*(volatile unsigned int *) (0xfffff000))
#define rVICFIQStatus (*(volatile unsigned int *) (0xfffff004))
#define rVICRawIntr (*(volatile unsigned int *) (0xfffff008))
#define rVICIntSelect (*(volatile unsigned int *) (0xfffff00c))
#define rVICIntEnable (*(volatile unsigned int *) (0xfffff010))
#define rVICIntEnClr (*(volatile unsigned int *) (0xfffff014))
#define rVICSoftInt (*(volatile unsigned int *) (0xfffff018))
#define rVICSoftIntClear (*(volatile unsigned int *) (0xfffff01c))
#define rVICProtection (*(volatile unsigned int *) (0xfffff020))
#define rVICVectAddr (*(volatile unsigned int *) (0xfffff030))
#define rVICDefVectAddr (*(volatile unsigned int *) (0xfffff034))
#define rVICVectAddr0 (*(volatile unsigned int *) (0xfffff100))
#define rVICVectAddr1 (*(volatile unsigned int *) (0xfffff104))
#define rVICVectAddr2 (*(volatile unsigned int *) (0xfffff108))
#define rVICVectAddr3 (*(volatile unsigned int *) (0xfffff10c))
#define rVICVectAddr4 (*(volatile unsigned int *) (0xfffff110))
#define rVICVectAddr5 (*(volatile unsigned int *) (0xfffff114))
#define rVICVectAddr6 (*(volatile unsigned int *) (0xfffff118))
#define rVICVectAddr7 (*(volatile unsigned int *) (0xfffff11c))
#define rVICVectAddr8 (*(volatile unsigned int *) (0xfffff120))
#define rVICVectAddr9 (*(volatile unsigned int *) (0xfffff124))
#define rVICVectAddr10 (*(volatile unsigned int *) (0xfffff128))
#define rVICVectAddr11 (*(volatile unsigned int *) (0xfffff12c))
#define rVICVectAddr12 (*(volatile unsigned int *) (0xfffff130))
#define rVICVectAddr13 (*(volatile unsigned int *) (0xfffff134))
#define rVICVectAddr14 (*(volatile unsigned int *) (0xfffff138))
#define rVICVectAddr15 (*(volatile unsigned int *) (0xfffff13c))
#define rVICVectCntl0 (*(volatile unsigned int *) (0xfffff200))
#define rVICVectCntl1 (*(volatile unsigned int *) (0xfffff204))
#define rVICVectCntl2 (*(volatile unsigned int *) (0xfffff208))
#define rVICVectCntl3 (*(volatile unsigned int *) (0xfffff20c))
#define rVICVectCntl4 (*(volatile unsigned int *) (0xfffff210))
#define rVICVectCntl5 (*(volatile unsigned int *) (0xfffff214))
#define rVICVectCntl6 (*(volatile unsigned int *) (0xfffff218))
#define rVICVectCntl7 (*(volatile unsigned int *) (0xfffff21c))
#define rVICVectCntl8 (*(volatile unsigned int *) (0xfffff220))
#define rVICVectCntl9 (*(volatile unsigned int *) (0xfffff224))
#define rVICVectCntl10 (*(volatile unsigned int *) (0xfffff228))
#define rVICVectCntl11 (*(volatile unsigned int *) (0xfffff22c))
#define rVICVectCntl12 (*(volatile unsigned int *) (0xfffff230))
#define rVICVectCntl13 (*(volatile unsigned int *) (0xfffff234))
#define rVICVectCntl14 (*(volatile unsigned int *) (0xfffff238))
#define rVICVectCntl15 (*(volatile unsigned int *) (0xfffff23c))
// GPIO
#define rIOPIN (*(volatile unsigned int *) (0xe0028000))
#define rIOSET (*(volatile unsigned int *) (0xe0028004))
#define rIODIR (*(volatile unsigned int *) (0xe0028008))
#define rIOCLR (*(volatile unsigned int *) (0xe002800c))
#define rPINSEL0 (*(volatile unsigned int *) (0xe002c000))
#define rPINSEL1 (*(volatile unsigned int *) (0xe002c004))
//UART0
#define rU0RBR (*(volatile unsigned char *) (0xe000c000))
#define rU0THR (*(volatile unsigned char *) (0xe000c000))
#define rU0IER (*(volatile unsigned char *) (0xe000c004))
#define rU0IIR (*(volatile unsigned char *) (0xe000c008))
#define rU0FCR (*(volatile unsigned char *) (0xe000c008))
#define rU0LCR (*(volatile unsigned char *) (0xe000c00c))
#define rU0LSR (*(volatile unsigned char *) (0xe000c014))
#define rU0SCR (*(volatile unsigned char *) (0xe000c01c))
// DLAB = 1
#define rU0DLL (*(volatile unsigned char *) (0xe000c000))
#define rU0DLM (*(volatile unsigned char *) (0xe000c004))
//UART1
#define rU1RBR (*(volatile unsigned char *) (0xe0010000))
#define rU1THR (*(volatile unsigned char *) (0xe0010000))
#define rU1IER (*(volatile unsigned char *) (0xe0010004))
#define rU1IIR (*(volatile unsigned char *) (0xe0010008))
#define rU1FCR (*(volatile unsigned char *) (0xe0010008))
#define rU1LCR (*(volatile unsigned char *) (0xe001000c))
#define rU1LSR (*(volatile unsigned char *) (0xe0010014))
#define rU1SCR (*(volatile unsigned char *) (0xe001001c))
// DLAB = 1
#define rU1DLL (*(volatile unsigned char *) (0xe0010000))
#define rU1DLM (*(volatile unsigned char *) (0xe0010004))
// I2C
#define rI2CONSET (*(volatile unsigned char *) (0xe001c000))
#define rI2STAT (*(volatile unsigned char *) (0xe001c004))
#define rI2DAT (*(volatile unsigned char *) (0xe001c008))
#define rI2ADR (*(volatile unsigned char *) (0xe001c00c))
#define rI2SCLH (*(volatile unsigned short *)(0xe001c010))
#define rI2SCLL (*(volatile unsigned short *)(0xe001c014))
#define rI2CONCLR (*(volatile unsigned char *) (0xe001c018))
// SPI
#define rSPCR (*(volatile unsigned char *) (0xe0020000))
#define rSPSR (*(volatile unsigned char *) (0xe0020004))
#define rSPDR (*(volatile unsigned char *) (0xe0020008))
#define rSPCCR (*(volatile unsigned char *) (0xe002000c))
#define rSPINT (*(volatile unsigned char *) (0xe002001c))
// Time 0
#define rT0IR (*(volatile unsigned int *) (0xe0004000))
#define rT0TCR (*(volatile unsigned int *) (0xe0004004))
#define rT0TC (*(volatile unsigned int *) (0xe0004008))
#define rT0PR (*(volatile unsigned int *) (0xe000400c))
#define rT0PC (*(volatile unsigned int *) (0xe0004010))
#define rT0MCR (*(volatile unsigned int *) (0xe0004014))
#define rT0MR0 (*(volatile unsigned int *) (0xe0004018))
#define rT0MR1 (*(volatile unsigned int *) (0xe000401c))
#define rT0MR2 (*(volatile unsigned int *) (0xe0004020))
#define rT0MR3 (*(volatile unsigned int *) (0xe0004024))
#define rT0CCR (*(volatile unsigned int *) (0xe0004028))
#define rT0CR0 (*(volatile unsigned int *) (0xe000402c))
#define rT0CR1 (*(volatile unsigned int *) (0xe0004030))
#define rT0CR2 (*(volatile unsigned int *) (0xe0004034))
#define rT0CR3 (*(volatile unsigned int *) (0xe0004038))
#define rT0EMR (*(volatile unsigned int *) (0xe000403c))
// Time 1
#define rT1IR (*(volatile unsigned int *) (0xe0008000))
#define rT1TCR (*(volatile unsigned int *) (0xe0008004))
#define rT1TC (*(volatile unsigned int *) (0xe0008008))
#define rT1PR (*(volatile unsigned int *) (0xe000800c))
#define rT1PC (*(volatile unsigned int *) (0xe0008010))
#define rT1MCR (*(volatile unsigned int *) (0xe0008014))
#define rT1MR0 (*(volatile unsigned int *) (0xe0008018))
#define rT1MR1 (*(volatile unsigned int *) (0xe000801c))
#define rT1MR2 (*(volatile unsigned int *) (0xe0008020))
#define rT1MR3 (*(volatile unsigned int *) (0xe0008024))
#define rT1CCR (*(volatile unsigned int *) (0xe0008028))
#define rT1CR0 (*(volatile unsigned int *) (0xe000802c))
#define rT1CR1 (*(volatile unsigned int *) (0xe0008030))
#define rT1CR2 (*(volatile unsigned int *) (0xe0008034))
#define rT1CR3 (*(volatile unsigned int *) (0xe0008038))
#define rT1EMR (*(volatile unsigned int *) (0xe000803c))
// PWM
#define rPWMIR (*(volatile unsigned int *) (0xe0014000))
#define rPWMTCR (*(volatile unsigned int *) (0xe0014004))
#define rPWMTC (*(volatile unsigned int *) (0xe0014008))
#define rPWMPR (*(volatile unsigned int *) (0xe001400c))
#define rPWMPC (*(volatile unsigned int *) (0xe0014010))
#define rPWMMCR (*(volatile unsigned int *) (0xe0014014))
#define rPWMMR0 (*(volatile unsigned int *) (0xe0014018))
#define rPWMMR1 (*(volatile unsigned int *) (0xe001401c))
#define rPWMMR2 (*(volatile unsigned int *) (0xe0014020))
#define rPWMMR3 (*(volatile unsigned int *) (0xe0014024))
#define rPWMMR4 (*(volatile unsigned int *) (0xe0014040))
#define rPWMMR5 (*(volatile unsigned int *) (0xe0014044))
#define rPWMMR6 (*(volatile unsigned int *) (0xe0014048))
#define rPWMPCR (*(volatile unsigned int *) (0xe001404c))
#define rPWMLER (*(volatile unsigned int *) (0xe0014050))
// RTC
#define rILR (*(volatile unsigned char *) (0xe0024000))
#define rCTC (*(volatile unsigned short *)(0xe0024004))
#define rCCR (*(volatile unsigned char *) (0xe0024008))
#define rCIIR (*(volatile unsigned char *) (0xe002400c))
#define rAMR (*(volatile unsigned char *) (0xe0024010))
#define rCT1ME0 (*(volatile unsigned int *) (0xe0024014))
#define rCT1ME1 (*(volatile unsigned int *) (0xe0024018))
#define rCT1ME2 (*(volatile unsigned int *) (0xe002401c))
#define rSEC (*(volatile unsigned char *) (0xe0024020))
#define rMIN (*(volatile unsigned char *) (0xe0024024))
#define rHOUR (*(volatile unsigned char *) (0xe0024028))
#define rDOM (*(volatile unsigned char *) (0xe002402c))
#define rDOW (*(volatile unsigned char *) (0xe0024030))
#define rDOY (*(volatile unsigned short *)(0xe0024034))
#define rMONTH (*(volatile unsigned char *) (0xe0024038))
#define rYEAR (*(volatile unsigned char *) (0xe002403c))
#define rALSEC (*(volatile unsigned char *) (0xe0024060))
#define rALMIN (*(volatile unsigned char *) (0xe0024064))
#define rALHOUR (*(volatile unsigned char *) (0xe0024068))
#define rALDOM (*(volatile unsigned char *) (0xe002406c))
#define rALDOW (*(volatile unsigned char *) (0xe0024070))
#define rALDOY (*(volatile unsigned short *)(0xe0024074))
#define rALMON (*(volatile unsigned char *) (0xe0024078))
#define rALYEAR (*(volatile unsigned short *)(0xe002407c))
#define rPREINT (*(volatile unsigned short *)(0xe0024080))
#define rPREFRAC (*(volatile unsigned short *)(0xe0024084))
// Watchdog
#define rWDMOD (*(volatile unsigned char *) (0xe0000000))
#define rWDTC (*(volatile unsigned int *) (0xe0000004))
#define rWDFEED (*(volatile unsigned char *) (0xe0000008))
#define rWDTV (*(volatile unsigned int *) (0xe000000c))
// Interrupts
#define INT_SIZE 17
#define INT_CH_WDT 0 /* interrupt channel 0, WDT */
#define INT_CH_RSV1 1 /* interrupt channel 1, RSV1 */
#define INT_CH_DCRX 2 /* interrupt channel 2, Embedded DbgCommRx */
#define INT_CH_DCTX 3 /* interrupt channel 3, Embedded DbgCommTx */
#define INT_CH_TIMER0 4 /* interrupt channel 4, Timer0 */
#define INT_CH_TIMER1 5 /* interrupt channel 5, Timer1 */
#define INT_CH_UART0 6 /* interrupt channel 6, UART0 */
#define INT_CH_UART1 7 /* interrupt channel 7, UART1 */
#define INT_CH_PWM0 8 /* interrupt channel 8, PWM0 */
#define INT_CH_I2C 9 /* interrupt channel 9, I2C */
#define INT_CH_SPI 10 /* interrupt channel 10, SPI */
#define INT_CH_RSV2 11 /* interrupt channel 11, RSV2 */
#define INT_CH_PLL 12 /* interrupt channel 12, PLL */
#define INT_CH_RTC 13 /* interrupt channel 13, RTC */
#define INT_CH_EINT0 14 /* interrupt channel 14, EINT0 */
#define INT_CH_EINT1 15 /* interrupt channel 15, EINT1 */
#define INT_CH_EINT2 16 /* interrupt channel 16, EINT2 */
#endif /* __LPC210X_H_0406161429 */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -