LPC122x.h 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668
  1. /****************************************************************************
  2. * $Id:: LPC122x.h 5637 2010-11-18 00:02:05Z nxp28433 $
  3. * Project: NXP LPC122x software example
  4. *
  5. * Description:
  6. * CMSIS Cortex-M0 Core Peripheral Access Layer Header File for
  7. * NXP LPC122x Device Series
  8. *
  9. ****************************************************************************
  10. * Software that is described herein is for illustrative purposes only
  11. * which provides customers with programming information regarding the
  12. * products. This software is supplied "AS IS" without any warranties.
  13. * NXP Semiconductors assumes no responsibility or liability for the
  14. * use of the software, conveys no license or title under any patent,
  15. * copyright, or mask work right to the product. NXP Semiconductors
  16. * reserves the right to make changes in the software without
  17. * notification. NXP Semiconductors also make no representation or
  18. * warranty that such application will be suitable for the specified
  19. * use without further testing or modification.
  20. ****************************************************************************/
  21. #ifndef __LPC122x_H__
  22. #define __LPC122x_H__
  23. #ifdef __cplusplus
  24. extern "C" {
  25. #endif
  26. /** @addtogroup LPC122x_Definitions LPC122x Definitions
  27. This file defines all structures and symbols for LPC122x:
  28. - Registers and bitfields
  29. - peripheral base address
  30. - peripheral ID
  31. - PIO definitions
  32. @{
  33. */
  34. /******************************************************************************/
  35. /* Processor and Core Peripherals */
  36. /******************************************************************************/
  37. /** @addtogroup LPC122x_CMSIS LPC122x CMSIS Definitions
  38. Configuration of the Cortex-M0 Processor and Core Peripherals
  39. @{
  40. */
  41. /*
  42. * ==========================================================================
  43. * ---------- Interrupt Number Definition -----------------------------------
  44. * ==========================================================================
  45. */
  46. typedef enum IRQn
  47. {
  48. /****** Cortex-M0 Processor Exceptions Numbers ***************************************************/
  49. NonMaskableInt_IRQn = -14, /*!< 2 Non Maskable Interrupt */
  50. MemoryManagement_IRQn = -12, /*!< 4 Cortex-M0 Memory Management Interrupt */
  51. BusFault_IRQn = -11, /*!< 5 Cortex-M0 Bus Fault Interrupt */
  52. UsageFault_IRQn = -10, /*!< 6 Cortex-M0 Usage Fault Interrupt */
  53. SVCall_IRQn = -5, /*!< 11 Cortex-M0 SV Call Interrupt */
  54. DebugMonitor_IRQn = -4, /*!< 12 Cortex-M0 Debug Monitor Interrupt */
  55. PendSV_IRQn = -2, /*!< 14 Cortex-M0 Pend SV Interrupt */
  56. SysTick_IRQn = -1, /*!< 15 Cortex-M0 System Tick Interrupt */
  57. /****** LPC122x Specific Interrupt Numbers *******************************************************/
  58. WAKEUP0_IRQn = 0, /*!< The I/O pins can be used as wakeup source. */
  59. WAKEUP1_IRQn = 1,
  60. WAKEUP2_IRQn = 2,
  61. WAKEUP3_IRQn = 3,
  62. WAKEUP4_IRQn = 4,
  63. WAKEUP5_IRQn = 5,
  64. WAKEUP6_IRQn = 6,
  65. WAKEUP7_IRQn = 7,
  66. WAKEUP8_IRQn = 8,
  67. WAKEUP9_IRQn = 9,
  68. WAKEUP10_IRQn = 10,
  69. WAKEUP11_IRQn = 11, /*!< 0 through 11 are WAKEUP interrupts */
  70. I2C_IRQn = 12, /*!< I2C Interrupt */
  71. TIMER_16_0_IRQn = 13, /*!< 16-bit Timer0 Interrupt */
  72. TIMER_16_1_IRQn = 14, /*!< 16-bit Timer1 Interrupt */
  73. TIMER_32_0_IRQn = 15, /*!< 32-bit Timer0 Interrupt */
  74. TIMER_32_1_IRQn = 16, /*!< 32-bit Timer1 Interrupt */
  75. SSP_IRQn = 17, /*!< SSP Interrupt */
  76. UART0_IRQn = 18, /*!< UART0 Interrupt */
  77. UART1_IRQn = 19, /*!< UART1 Interrupt */
  78. CMP_IRQn = 20, /*!< Comparator Interrupt */
  79. ADC_IRQn = 21, /*!< A/D Converter Interrupt */
  80. WDT_IRQn = 22, /*!< Watchdog timer Interrupt */
  81. BOD_IRQn = 23, /*!< Brown Out Detect(BOD) Interrupt */
  82. FLASH_IRQn = 24, /*!< Flash Interrupt */
  83. EINT0_IRQn = 25, /*!< External Interrupt 0 Interrupt */
  84. EINT1_IRQn = 26, /*!< External Interrupt 1 Interrupt */
  85. EINT2_IRQn = 27, /*!< External Interrupt 2 Interrupt */
  86. PMU_IRQn = 28, /*!< PMU Interrupt */
  87. DMA_IRQn = 29, /*!< DMA Interrupt */
  88. RTC_IRQn = 30, /*!< RTC Interrupt */
  89. EDM_IRQn = 31, /*!< EDT Interrupt */
  90. } IRQn_Type;
  91. /*
  92. * ==========================================================================
  93. * ----------- Processor and Core Peripheral Section ------------------------
  94. * ==========================================================================
  95. */
  96. /* Configuration of the Cortex-M3 Processor and Core Peripherals */
  97. #define __MPU_PRESENT 1 /*!< MPU present or not */
  98. #define __NVIC_PRIO_BITS 2 /*!< Number of Bits used for Priority Levels */
  99. #define __Vendor_SysTickConfig 0 /*!< Set to 1 if different SysTick Config is used */
  100. /*@}*/ /* end of group LPC122x_CMSIS */
  101. #include "core_cm0.h" /* Cortex-M0 processor and core peripherals */
  102. #include "system_LPC122x.h" /* System Header */
  103. /******************************************************************************/
  104. /* Device Specific Peripheral Registers structures */
  105. /******************************************************************************/
  106. #if defined ( __CC_ARM )
  107. #pragma anon_unions
  108. #endif
  109. /*------------- System Control (SYSCON) --------------------------------------*/
  110. /** @addtogroup LPC122x_SYSCON LPC122x System Control Block
  111. @{
  112. */
  113. typedef struct
  114. {
  115. __IO uint32_t SYSMEMREMAP; /* Sys mem. Remap, Offset 0x0 */
  116. __IO uint32_t PRESETCTRL;
  117. __IO uint32_t SYSPLLCTRL; /* Sys PLL control */
  118. __IO uint32_t SYSPLLSTAT;
  119. uint32_t RESERVED0[4];
  120. __IO uint32_t SYSOSCCTRL; /* Offset 0x20 */
  121. __IO uint32_t WDTOSCCTRL;
  122. __IO uint32_t IRCCTRL;
  123. uint32_t RESERVED0b;
  124. __IO uint32_t SYSRESSTAT; /* Offset 0x30 */
  125. uint32_t RESERVED1[3];
  126. __IO uint32_t SYSPLLCLKSEL; /* Offset 0x40 */
  127. __IO uint32_t SYSPLLCLKUEN;
  128. uint32_t RESERVED2[10];
  129. __IO uint32_t MAINCLKSEL; /* Offset 0x70 */
  130. __IO uint32_t MAINCLKUEN;
  131. __IO uint32_t SYSAHBCLKDIV;
  132. uint32_t RESERVED3[1];
  133. __IO uint32_t SYSAHBCLKCTRL; /* Offset 0x80 */
  134. uint32_t RESERVED4[4];
  135. __IO uint32_t SSPCLKDIV;
  136. __IO uint32_t UART0CLKDIV;
  137. __IO uint32_t UART1CLKDIV;
  138. __IO uint32_t RTCCLKDIV;
  139. uint32_t RESERVED5[2];
  140. __IO uint32_t TRACECLKDIV;
  141. __IO uint32_t SYSTICKCLKDIV; /* Offset 0xB0 */
  142. __IO uint32_t I2CCLKDIV;
  143. uint32_t RESERVED6[10];
  144. __IO uint32_t CLKOUTCLKSEL; /* Offset 0xE0 */
  145. __IO uint32_t CLKOUTUEN;
  146. __IO uint32_t CLKOUTDIV;
  147. uint32_t RESERVED7[5];
  148. __IO uint32_t PIOPORCAP0; /* Offset 0x100 */
  149. __IO uint32_t PIOPORCAP1;
  150. uint32_t RESERVED8[11];
  151. __IO uint32_t FILTERCLKCFG6;
  152. __IO uint32_t FILTERCLKCFG5;
  153. __IO uint32_t FILTERCLKCFG4;
  154. __IO uint32_t FILTERCLKCFG3; /* Offset 0x140 */
  155. __IO uint32_t FILTERCLKCFG2;
  156. __IO uint32_t FILTERCLKCFG1;
  157. __IO uint32_t FILTERCLKCFG0;
  158. __IO uint32_t BODCTRL; /* Offset 0x150 */
  159. uint32_t RESERVED9[1];
  160. __IO uint32_t SYSTCKCAL;
  161. uint32_t RESERVED10[5];
  162. __IO uint32_t INT_IRQ_LATENCY; /* Offset 0x170 */
  163. __IO uint32_t INTNMI;
  164. uint32_t RESERVED11[34];
  165. __IO uint32_t STARTAPRP0; /* Offset 0x200 */
  166. __IO uint32_t STARTERP0;
  167. __IO uint32_t STARTRSRP0CLR;
  168. __IO uint32_t STARTSRP0;
  169. __IO uint32_t STARTAPRP1;
  170. __IO uint32_t STARTERP1;
  171. __IO uint32_t STARTRSRP1CLR;
  172. __IO uint32_t STARTSRP1;
  173. uint32_t RESERVED12[4];
  174. __IO uint32_t PDSLEEPCFG; /* Offset 0x230 */
  175. __IO uint32_t PDAWAKECFG;
  176. __IO uint32_t PDRUNCFG;
  177. uint32_t RESERVED13;
  178. __IO uint32_t EZHBOOT;
  179. __IO uint32_t EZHCTRL;
  180. __IO uint32_t EZHMUXSEL;
  181. __IO uint32_t EZHARM2EZH;
  182. __IO uint32_t EZHEZH2ARM;
  183. __IO uint32_t EZHEZHPC;
  184. __IO uint32_t EZHEZHSP;
  185. __IO uint32_t EZHINTERRUPT;
  186. uint32_t RESERVED14[101];
  187. __I uint32_t DEVICE_ID;
  188. } LPC_SYSCON_TypeDef;
  189. /*------------- Pin Connect Block (IOCON) --------------------------------*/
  190. /** @addtogroup LPC122x_IOCON LPC122x I/O Configuration Block
  191. @{
  192. */
  193. typedef struct
  194. {
  195. __IO uint32_t PIO2_28; /* 0x00 */
  196. __IO uint32_t PIO2_29;
  197. __IO uint32_t PIO0_19;
  198. __IO uint32_t PIO0_20;
  199. __IO uint32_t PIO0_21;
  200. __IO uint32_t PIO0_22;
  201. __IO uint32_t PIO0_23;
  202. __IO uint32_t PIO0_24;
  203. __IO uint32_t SWDIO_PIO0_25; /* 0x20 */
  204. __IO uint32_t SWCLK_PIO0_26;
  205. __IO uint32_t PIO0_27;
  206. __IO uint32_t PIO2_12;
  207. __IO uint32_t PIO2_13;
  208. __IO uint32_t PIO2_14;
  209. __IO uint32_t PIO2_15;
  210. __IO uint32_t PIO0_28;
  211. __IO uint32_t PIO0_29; /* 0x40 */
  212. __IO uint32_t PIO0_0;
  213. __IO uint32_t PIO0_1;
  214. __IO uint32_t PIO0_2;
  215. uint32_t RESERVED0;
  216. __IO uint32_t PIO0_3;
  217. __IO uint32_t PIO0_4;
  218. __IO uint32_t PIO0_5;
  219. __IO uint32_t PIO0_6; /* 0x60 */
  220. __IO uint32_t PIO0_7;
  221. __IO uint32_t PIO0_8;
  222. __IO uint32_t PIO0_9;
  223. __IO uint32_t PIO2_0;
  224. __IO uint32_t PIO2_1;
  225. __IO uint32_t PIO2_2;
  226. __IO uint32_t PIO2_3;
  227. __IO uint32_t PIO2_4; /* 0x80 */
  228. __IO uint32_t PIO2_5;
  229. __IO uint32_t PIO2_6;
  230. __IO uint32_t PIO2_7;
  231. __IO uint32_t PIO0_10;
  232. __IO uint32_t PIO0_11;
  233. __IO uint32_t PIO0_12;
  234. __IO uint32_t RESET_P0_13;
  235. __IO uint32_t PIO0_14; /* 0xA0 */
  236. __IO uint32_t PIO0_15;
  237. __IO uint32_t PIO0_16;
  238. __IO uint32_t PIO0_17;
  239. __IO uint32_t PIO0_18;
  240. __IO uint32_t PIO0_30;
  241. __IO uint32_t PIO0_31;
  242. __IO uint32_t PIO1_0;
  243. __IO uint32_t PIO1_1; /* 0xC0 */
  244. __IO uint32_t PIO1_2;
  245. __IO uint32_t PIO1_3;
  246. __IO uint32_t PIO1_4;
  247. __IO uint32_t PIO1_5;
  248. __IO uint32_t PIO1_6;
  249. uint32_t RESERVED1[2];
  250. __IO uint32_t PIO2_8; /* 0xE0 */
  251. __IO uint32_t PIO2_9;
  252. __IO uint32_t PIO2_10;
  253. __IO uint32_t PIO2_11;
  254. #if 0
  255. /* LOC registers are no longer needed on LPC122x V1. */
  256. __IO uint32_t EZH0_LOC;
  257. __IO uint32_t EZH1_LOC;
  258. __IO uint32_t CT32B0_0_LOC;
  259. __IO uint32_t EZH2_LOC;
  260. __IO uint32_t CT32B0_1_LOC; /* 0x100 */
  261. __IO uint32_t EZH3_LOC;
  262. __IO uint32_t CT32B0_2_LOC;
  263. __IO uint32_t EZH4_LOC;
  264. __IO uint32_t CT32B0_3_LOC;
  265. __IO uint32_t EZH5_LOC;
  266. __IO uint32_t EZH6_LOC;
  267. __IO uint32_t CT32B1_0_LOC;
  268. __IO uint32_t EZH7_LOC; /* 0x120 */
  269. __IO uint32_t CT32B1_1_LOC;
  270. __IO uint32_t EZH8_LOC;
  271. __IO uint32_t CT32B1_2_LOC;
  272. __IO uint32_t EZH9_LOC;
  273. __IO uint32_t CT32B1_3_LOC;
  274. __IO uint32_t EZH10_LOC;
  275. __IO uint32_t EZH11_LOC;
  276. __IO uint32_t CT16B0_0_LOC; /* 0x140 */
  277. __IO uint32_t EZH12_LOC;
  278. __IO uint32_t CT16B0_1_LOC;
  279. __IO uint32_t EZH13_LOC;
  280. __IO uint32_t EZH14_LOC;
  281. __IO uint32_t EZH15_LOC;
  282. __IO uint32_t CT16B1_0_LOC;
  283. __IO uint32_t CT16B1_1_LOC;
  284. #endif
  285. } LPC_IOCON_TypeDef;
  286. /*------------- microDMA (DMA) --------------------------*/
  287. /** @addtogroup LPC122x_DMA LPC122x microDMA
  288. @{
  289. */
  290. typedef struct
  291. {
  292. __I uint32_t STATUS;
  293. __O uint32_t CFG;
  294. __IO uint32_t CTRL_BASE_PTR;
  295. __I uint32_t ALT_CTRL_BASE_PTR;
  296. __I uint32_t WAITONREQ_STATUS;
  297. __O uint32_t CHNL_SW_REQUEST;
  298. __IO uint32_t CHNL_USEBURST_SET;
  299. __O uint32_t CHNL_USEBURST_CLR;
  300. __IO uint32_t CHNL_REQ_MASK_SET;
  301. __O uint32_t CHNL_REQ_MASK_CLR;
  302. __IO uint32_t CHNL_ENABLE_SET;
  303. __O uint32_t CHNL_ENABLE_CLR;
  304. __IO uint32_t CHNL_PRI_ALT_SET;
  305. __O uint32_t CHNL_PRI_ALT_CLR;
  306. __IO uint32_t CHNL_PRIORITY_SET;
  307. __O uint32_t CHNL_PRIORITY_CLR;
  308. uint32_t RESERVE0[3];
  309. __IO uint32_t ERR_CLR; /* 0x4C */
  310. uint32_t RESERVE1[12];
  311. __IO uint32_t CHNL_IRQ_STATUS; /* 0x80 */
  312. __IO uint32_t IRQ_ERR_ENABLE;
  313. __IO uint32_t CHNL_IRQ_ENABLE;
  314. } LPC_DMA_TypeDef;
  315. /*@}*/ /* end of group LPC122x_DMA */
  316. /*------------- Comparator (CMP) --------------------------------*/
  317. /** @addtogroup LPC122x_CMD LPC122x Comparator
  318. @{
  319. */
  320. typedef struct
  321. {
  322. __IO uint32_t CMP;
  323. __IO uint32_t VLAD;
  324. } LPC_COMP_TypeDef;
  325. /*@}*/ /* end of group LPC122x_CMD */
  326. /*------------- Real Timer Clock (RTC) --------------------------*/
  327. /** @addtogroup LPC122x_RTC LPC122x Real-time Clock
  328. @{
  329. */
  330. typedef struct
  331. {
  332. __I uint32_t DR;
  333. __IO uint32_t MR;
  334. __IO uint32_t LR;
  335. __IO uint32_t CR;
  336. __IO uint32_t IMSC;
  337. __I uint32_t IRS;
  338. __I uint32_t MIS;
  339. __IO uint32_t ICR;
  340. } LPC_RTC_TypeDef;
  341. /*@}*/ /* end of group LPC122x_RTC */
  342. /*------------- Power Management Unit (PMU) --------------------------*/
  343. /** @addtogroup LPC122x_PMU LPC122x Power Management Unit
  344. @{
  345. */
  346. typedef struct
  347. {
  348. __IO uint32_t PCON;
  349. __IO uint32_t GPREG0;
  350. __IO uint32_t GPREG1;
  351. __IO uint32_t GPREG2;
  352. __IO uint32_t GPREG3;
  353. __IO uint32_t GPREG4;
  354. } LPC_PMU_TypeDef;
  355. /*@}*/ /* end of group LPC122x_PMU */
  356. /*------------- General Purpose Input/Output (GPIO) --------------------------*/
  357. /** @addtogroup LPC122x_GPIO LPC122x General Purpose Input/Output
  358. @{
  359. */
  360. typedef struct
  361. {
  362. __IO uint32_t MASK;
  363. __I uint32_t PIN;
  364. __IO uint32_t OUT;
  365. __O uint32_t SET;
  366. __O uint32_t CLR;
  367. __O uint32_t NOT;
  368. uint32_t RESERVE[2];
  369. __IO uint32_t DIR;
  370. __IO uint32_t IS;
  371. __IO uint32_t IBE;
  372. __IO uint32_t IEV;
  373. __IO uint32_t IE;
  374. __I uint32_t RIS;
  375. __I uint32_t MIS;
  376. __O uint32_t IC;
  377. } LPC_GPIO_TypeDef;
  378. /*@}*/ /* end of group LPC122x_GPIO */
  379. /*------------- Timer (TMR) --------------------------------------------------*/
  380. /** @addtogroup LPC122x_TMR LPC122x 16/32-bit Counter/Timer
  381. @{
  382. */
  383. typedef struct
  384. {
  385. __IO uint32_t IR;
  386. __IO uint32_t TCR;
  387. __IO uint32_t TC;
  388. __IO uint32_t PR;
  389. __IO uint32_t PC;
  390. __IO uint32_t MCR;
  391. __IO uint32_t MR0;
  392. __IO uint32_t MR1;
  393. __IO uint32_t MR2;
  394. __IO uint32_t MR3;
  395. __IO uint32_t CCR;
  396. __I uint32_t CR0;
  397. __I uint32_t CR1;
  398. __I uint32_t CR2;
  399. __I uint32_t CR3;
  400. __IO uint32_t EMR;
  401. uint32_t RESERVED2[12];
  402. __IO uint32_t CTCR;
  403. __IO uint32_t PWMC;
  404. } LPC_TMR_TypeDef;
  405. /*@}*/ /* end of group LPC122x_TMR */
  406. /*------------- Universal Asynchronous Receiver Transmitter (UART) -----------*/
  407. /** @addtogroup LPC122x_UART LPC122x Universal Asynchronous Receiver/Transmitter
  408. @{
  409. */
  410. typedef struct
  411. {
  412. union {
  413. __I uint32_t RBR;
  414. __O uint32_t THR;
  415. __IO uint32_t DLL;
  416. };
  417. union {
  418. __IO uint32_t DLM;
  419. __IO uint32_t IER;
  420. };
  421. union {
  422. __I uint32_t IIR;
  423. __O uint32_t FCR;
  424. };
  425. __IO uint32_t LCR;
  426. __IO uint32_t MCR;
  427. __I uint32_t LSR;
  428. __I uint32_t MSR;
  429. __IO uint32_t SCR;
  430. __IO uint32_t ACR;
  431. __IO uint32_t ICR;
  432. __IO uint32_t FDR;
  433. uint32_t RESERVED0;
  434. __IO uint32_t TER;
  435. uint32_t RESERVED1[6];
  436. __IO uint32_t RS485CTRL;
  437. __IO uint32_t ADRMATCH;
  438. __IO uint32_t RS485DLY;
  439. __I uint32_t FIFOLVL;
  440. } LPC_UART_TypeDef;
  441. /*@}*/ /* end of group LPC122x_UART */
  442. /*------------- Synchronous Serial Communication (SSP) -----------------------*/
  443. /** @addtogroup LPC122x_SSP LPC122x Synchronous Serial Port
  444. @{
  445. */
  446. typedef struct
  447. {
  448. __IO uint32_t CR0;
  449. __IO uint32_t CR1;
  450. __IO uint32_t DR;
  451. __I uint32_t SR;
  452. __IO uint32_t CPSR;
  453. __IO uint32_t IMSC;
  454. __IO uint32_t RIS;
  455. __IO uint32_t MIS;
  456. __IO uint32_t ICR;
  457. } LPC_SSP_TypeDef;
  458. /*@}*/ /* end of group LPC122x_SSP */
  459. /*------------- Inter-Integrated Circuit (I2C) -------------------------------*/
  460. /** @addtogroup LPC122x_I2C LPC122x I2C-Bus Interface
  461. @{
  462. */
  463. typedef struct
  464. {
  465. __IO uint32_t CONSET;
  466. __I uint32_t STAT;
  467. __IO uint32_t DAT;
  468. __IO uint32_t ADR0;
  469. __IO uint32_t SCLH;
  470. __IO uint32_t SCLL;
  471. __O uint32_t CONCLR;
  472. __IO uint32_t MMCTRL;
  473. __IO uint32_t ADR1;
  474. __IO uint32_t ADR2;
  475. __IO uint32_t ADR3;
  476. __I uint32_t DATA_BUFFER;
  477. __IO uint32_t MASK0;
  478. __IO uint32_t MASK1;
  479. __IO uint32_t MASK2;
  480. __IO uint32_t MASK3;
  481. } LPC_I2C_TypeDef;
  482. /*@}*/ /* end of group LPC122x_I2C */
  483. /*------------- Watchdog Timer (WDT) -----------------------------------------*/
  484. /** @addtogroup LPC122x_WDT LPC122x WatchDog Timer
  485. @{
  486. */
  487. typedef struct
  488. {
  489. __IO uint32_t MOD;
  490. __IO uint32_t TC;
  491. __O uint32_t FEED;
  492. __I uint32_t TV;
  493. __IO uint32_t CLKSEL;
  494. __IO uint32_t WARNINT;
  495. __IO uint32_t WINDOW;
  496. } LPC_WDT_TypeDef;
  497. /*@}*/ /* end of group LPC122x_WDT */
  498. /*------------- Analog-to-Digital Converter (ADC) ----------------------------*/
  499. /** @addtogroup LPC122x_ADC LPC122x Analog-to-Digital Converter
  500. @{
  501. */
  502. typedef struct
  503. {
  504. __IO uint32_t CR;
  505. __IO uint32_t GDR;
  506. uint32_t RESERVED0;
  507. __IO uint32_t INTEN;
  508. __IO uint32_t DR[8];
  509. __I uint32_t STAT;
  510. } LPC_ADC_TypeDef;
  511. /*@}*/ /* end of group LPC122x_ADC */
  512. /*------------- Flash Memory Controller (FMC) -----------------------------------*/
  513. typedef struct
  514. {
  515. __IO uint32_t TBCFG; /* Time Base Config register */
  516. __IO uint32_t FINSTR; /* Flash Instruction register */
  517. __I uint32_t INSSTA; /* Raw Instruction Status register */
  518. __IO uint32_t INSSCLR; /* Raw Instruction Clear register */
  519. __IO uint32_t INT_EN; /* Interrupt Enable register */
  520. __I uint32_t INT_STA; /* Interrupt Status register */
  521. uint32_t RESERVED0;
  522. __IO uint32_t ADDRLAT; /* Address Latch registers */
  523. __IO uint32_t DATALAT; /* Data Latch register */
  524. __IO uint32_t FIMC; /* Flash Manaul Operation register */
  525. __IO uint32_t RDCFG; /* Read Configuration register */
  526. __IO uint32_t EPPCFG; /* Flash Programming Permission Cofig register */
  527. __IO uint32_t EPPAA; /* Flash Programming Permission Address A register */
  528. __IO uint32_t EPPAB; /* Flash Programming Permission Address B register */
  529. } LPC_FMC_TypeDef;
  530. /*------------- CRC Engine (CRC) -----------------------------------------*/
  531. typedef struct
  532. {
  533. __IO uint32_t MODE;
  534. __IO uint32_t SEED;
  535. union {
  536. __I uint32_t SUM;
  537. __O uint32_t WR_DATA_DWORD;
  538. __O uint16_t WR_DATA_WORD;
  539. uint16_t RESERVED_WORD;
  540. __O uint8_t WR_DATA_BYTE;
  541. uint8_t RESERVED_BYTE[3];
  542. };
  543. __I uint32_t ID;
  544. } LPC_CRC_TypeDef;
  545. #if defined ( __CC_ARM )
  546. #pragma no_anon_unions
  547. #endif
  548. /******************************************************************************/
  549. /* Peripheral memory map */
  550. /******************************************************************************/
  551. /* Base addresses */
  552. #define LPC_FLASH_BASE (0x00000000)
  553. #define LPC_RAM_BASE (0x10000000)
  554. #define LPC_APB0_BASE (0x40000000)
  555. #define LPC_AHB_BASE (0x50000000)
  556. /* APB0 peripherals */
  557. #define LPC_I2C_BASE (LPC_APB0_BASE + 0x00000)
  558. #define LPC_WDT_BASE (LPC_APB0_BASE + 0x04000)
  559. #define LPC_UART0_BASE (LPC_APB0_BASE + 0x08000)
  560. #define LPC_UART1_BASE (LPC_APB0_BASE + 0x0C000)
  561. #define LPC_CT16B0_BASE (LPC_APB0_BASE + 0x10000)
  562. #define LPC_CT16B1_BASE (LPC_APB0_BASE + 0x14000)
  563. #define LPC_CT32B0_BASE (LPC_APB0_BASE + 0x18000)
  564. #define LPC_CT32B1_BASE (LPC_APB0_BASE + 0x1C000)
  565. #define LPC_ADC_BASE (LPC_APB0_BASE + 0x20000)
  566. #define LPC_PMU_BASE (LPC_APB0_BASE + 0x38000)
  567. #define LPC_SSP_BASE (LPC_APB0_BASE + 0x40000)
  568. #define LPC_IOCON_BASE (LPC_APB0_BASE + 0x44000)
  569. #define LPC_SYSCON_BASE (LPC_APB0_BASE + 0x48000)
  570. #define LPC_DMA_BASE (LPC_APB0_BASE + 0x4C000)
  571. #define LPC_RTC_BASE (LPC_APB0_BASE + 0x50000)
  572. #define LPC_COMP_BASE (LPC_APB0_BASE + 0x54000)
  573. /* AHB peripherals */
  574. #define LPC_GPIO_BASE (LPC_AHB_BASE + 0x00000)
  575. #define LPC_GPIO0_BASE (LPC_AHB_BASE + 0x00000)
  576. #define LPC_GPIO1_BASE (LPC_AHB_BASE + 0x10000)
  577. #define LPC_GPIO2_BASE (LPC_AHB_BASE + 0x20000)
  578. #define LPC_FMC_BASE (LPC_AHB_BASE + 0x60000)
  579. #define LPC_CRC_BASE (LPC_AHB_BASE + 0x70000)
  580. /******************************************************************************/
  581. /* Peripheral declaration */
  582. /******************************************************************************/
  583. #define LPC_I2C ((LPC_I2C_TypeDef *) LPC_I2C_BASE )
  584. #define LPC_WDT ((LPC_WDT_TypeDef *) LPC_WDT_BASE )
  585. #define LPC_UART0 ((LPC_UART_TypeDef *) LPC_UART0_BASE )
  586. #define LPC_UART1 ((LPC_UART_TypeDef *) LPC_UART1_BASE )
  587. #define LPC_TMR16B0 ((LPC_TMR_TypeDef *) LPC_CT16B0_BASE)
  588. #define LPC_TMR16B1 ((LPC_TMR_TypeDef *) LPC_CT16B1_BASE)
  589. #define LPC_TMR32B0 ((LPC_TMR_TypeDef *) LPC_CT32B0_BASE)
  590. #define LPC_TMR32B1 ((LPC_TMR_TypeDef *) LPC_CT32B1_BASE)
  591. #define LPC_ADC ((LPC_ADC_TypeDef *) LPC_ADC_BASE )
  592. #define LPC_PMU ((LPC_PMU_TypeDef *) LPC_PMU_BASE )
  593. #define LPC_SSP ((LPC_SSP_TypeDef *) LPC_SSP_BASE )
  594. #define LPC_IOCON ((LPC_IOCON_TypeDef *) LPC_IOCON_BASE )
  595. #define LPC_SYSCON ((LPC_SYSCON_TypeDef *) LPC_SYSCON_BASE)
  596. #define LPC_DMA ((LPC_DMA_TypeDef *) LPC_DMA_BASE )
  597. #define LPC_RTC ((LPC_RTC_TypeDef *) LPC_RTC_BASE )
  598. #define LPC_COMP ((LPC_COMP_TypeDef *) LPC_COMP_BASE )
  599. #define LPC_GPIO0 ((LPC_GPIO_TypeDef *) LPC_GPIO0_BASE )
  600. #define LPC_GPIO1 ((LPC_GPIO_TypeDef *) LPC_GPIO1_BASE )
  601. #define LPC_GPIO2 ((LPC_GPIO_TypeDef *) LPC_GPIO2_BASE )
  602. #define LPC_FMC ((LPC_FMC_TypeDef *) LPC_FMC_BASE )
  603. #define LPC_CRC ((LPC_CRC_TypeDef *) LPC_CRC_BASE )
  604. #ifdef __cplusplus
  605. }
  606. #endif
  607. #endif // __LPC122x_H__