/* * @brief LPC43xx/LPC18xx MCU header * * Copyright(C) NXP Semiconductors, 2012 * All rights reserved. * * 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. * * 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. * * Simplified version of NXP LPCOPEN LPC43XX/LPC18XX headers * 05/15/13 Micromint USA */ #ifndef __LPC43XX_H #define __LPC43XX_H #ifdef __cplusplus extern "C" { #endif /** @defgroup LPC43XX_H: LPC43xx include file * @ingroup LPC43XX_Headers * @{ */ /* Treat __CORE_Mx as CORE_Mx for mbed builds */ #if defined(__CORTEX_M0) && !defined(CORE_M0) #define CORE_M0 #endif #if defined(__CORTEX_M3) && !defined(CORE_M3) #define CORE_M3 #endif /* Default to M4 core if no core explicitly declared */ #if !defined(CORE_M0) && !defined(CORE_M3) #define CORE_M4 #endif /* Start of section using anonymous unions */ #if defined(__ARMCC_VERSION) // Kill warning "#pragma push with no matching #pragma pop" #pragma diag_suppress 2525 #pragma push #pragma anon_unions #elif defined(__CWCC__) #pragma push #pragma cpp_extensions on #elif defined(__IAR_SYSTEMS_ICC__) //#pragma push // FIXME not usable for IAR #pragma language=extended #else /* defined(__GNUC__) and others */ /* Assume anonymous unions are enabled by default */ #endif #if defined(CORE_M4) /** * @brief LPC43xx Cortex CMSIS definitions */ #define __CM4_REV 0x0000 /*!< Cortex-M4 Core Revision */ #define __MPU_PRESENT 1 /*!< MPU present or not */ #define __NVIC_PRIO_BITS 3 /*!< Number of Bits used for Priority Levels */ #define __Vendor_SysTickConfig 0 /*!< Set to 1 if different SysTick Config is used */ #define __FPU_PRESENT 1 /*!< FPU present or not */ #define CHIP_LPC43XX /*!< LPCOPEN */ /** * @brief LPC43xx peripheral interrupt numbers */ typedef enum { /* ------------------------- Cortex-M4 Processor Exceptions Numbers ----------------------------- */ Reset_IRQn = -15,/*!< 1 Reset Vector, invoked on Power up and warm reset */ NonMaskableInt_IRQn = -14,/*!< 2 Non maskable Interrupt, cannot be stopped or preempted */ HardFault_IRQn = -13,/*!< 3 Hard Fault, all classes of Fault */ MemoryManagement_IRQn = -12,/*!< 4 Memory Management, MPU mismatch, including Access Violation and No Match */ BusFault_IRQn = -11,/*!< 5 Bus Fault, Pre-Fetch-, Memory Access Fault, other address/memory related Fault */ UsageFault_IRQn = -10,/*!< 6 Usage Fault, i.e. Undef Instruction, Illegal State Transition */ SVCall_IRQn = -5,/*!< 11 System Service Call via SVC instruction */ DebugMonitor_IRQn = -4,/*!< 12 Debug Monitor */ PendSV_IRQn = -2,/*!< 14 Pendable request for system service */ SysTick_IRQn = -1,/*!< 15 System Tick Timer */ /* --------------------------- LPC18xx/43xx Specific Interrupt Numbers ------------------------------- */ DAC_IRQn = 0,/*!< 0 DAC */ M0CORE_IRQn = 1,/*!< 1 M0a */ DMA_IRQn = 2,/*!< 2 DMA */ RESERVED1_IRQn = 3,/*!< 3 EZH/EDM */ RESERVED2_IRQn = 4, ETHERNET_IRQn = 5,/*!< 5 ETHERNET */ SDIO_IRQn = 6,/*!< 6 SDIO */ LCD_IRQn = 7,/*!< 7 LCD */ USB0_IRQn = 8,/*!< 8 USB0 */ USB1_IRQn = 9,/*!< 9 USB1 */ SCT_IRQn = 10,/*!< 10 SCT */ RITIMER_IRQn = 11,/*!< 11 RITIMER */ TIMER0_IRQn = 12,/*!< 12 TIMER0 */ TIMER1_IRQn = 13,/*!< 13 TIMER1 */ TIMER2_IRQn = 14,/*!< 14 TIMER2 */ TIMER3_IRQn = 15,/*!< 15 TIMER3 */ MCPWM_IRQn = 16,/*!< 16 MCPWM */ ADC0_IRQn = 17,/*!< 17 ADC0 */ I2C0_IRQn = 18,/*!< 18 I2C0 */ I2C1_IRQn = 19,/*!< 19 I2C1 */ SPI_INT_IRQn = 20,/*!< 20 SPI_INT */ ADC1_IRQn = 21,/*!< 21 ADC1 */ SSP0_IRQn = 22,/*!< 22 SSP0 */ SSP1_IRQn = 23,/*!< 23 SSP1 */ USART0_IRQn = 24,/*!< 24 USART0 */ UART1_IRQn = 25,/*!< 25 UART1 */ USART2_IRQn = 26,/*!< 26 USART2 */ USART3_IRQn = 27,/*!< 27 USART3 */ I2S0_IRQn = 28,/*!< 28 I2S0 */ I2S1_IRQn = 29,/*!< 29 I2S1 */ RESERVED4_IRQn = 30, SGPIO_INT_IRQn = 31,/*!< 31 SGPIO_IINT */ PIN_INT0_IRQn = 32,/*!< 32 PIN_INT0 */ PIN_INT1_IRQn = 33,/*!< 33 PIN_INT1 */ PIN_INT2_IRQn = 34,/*!< 34 PIN_INT2 */ PIN_INT3_IRQn = 35,/*!< 35 PIN_INT3 */ PIN_INT4_IRQn = 36,/*!< 36 PIN_INT4 */ PIN_INT5_IRQn = 37,/*!< 37 PIN_INT5 */ PIN_INT6_IRQn = 38,/*!< 38 PIN_INT6 */ PIN_INT7_IRQn = 39,/*!< 39 PIN_INT7 */ GINT0_IRQn = 40,/*!< 40 GINT0 */ GINT1_IRQn = 41,/*!< 41 GINT1 */ EVENTROUTER_IRQn = 42,/*!< 42 EVENTROUTER */ C_CAN1_IRQn = 43,/*!< 43 C_CAN1 */ RESERVED6_IRQn = 44, RESERVED7_IRQn = 45,/*!< 45 VADC */ ATIMER_IRQn = 46,/*!< 46 ATIMER */ RTC_IRQn = 47,/*!< 47 RTC */ RESERVED8_IRQn = 48, WWDT_IRQn = 49,/*!< 49 WWDT */ RESERVED9_IRQn = 50, C_CAN0_IRQn = 51,/*!< 51 C_CAN0 */ QEI_IRQn = 52,/*!< 52 QEI */ } IRQn_Type; #include "core_cm4.h" /*!< Cortex-M4 processor and core peripherals */ #elif defined(CORE_M3) /** * @brief LPC18xx Cortex CMSIS definitions */ #define __MPU_PRESENT 1 /*!< MPU present or not */ #define __NVIC_PRIO_BITS 3 /*!< Number of Bits used for Priority Levels */ #define __Vendor_SysTickConfig 0 /*!< Set to 1 if different SysTick Config is used */ #define __FPU_PRESENT 0 /*!< FPU present or not */ #define CHIP_LPC18XX /*!< LPCOPEN */ /** * @brief LPC18xx peripheral interrupt numbers */ typedef enum { /* ------------------------- Cortex-M3 Processor Exceptions Numbers ----------------------------- */ Reset_IRQn = -15,/*!< 1 Reset Vector, invoked on Power up and warm reset */ NonMaskableInt_IRQn = -14,/*!< 2 Non maskable Interrupt, cannot be stopped or preempted */ HardFault_IRQn = -13,/*!< 3 Hard Fault, all classes of Fault */ MemoryManagement_IRQn = -12,/*!< 4 Memory Management, MPU mismatch, including Access Violation and No Match */ BusFault_IRQn = -11,/*!< 5 Bus Fault, Pre-Fetch-, Memory Access Fault, other address/memory related Fault */ UsageFault_IRQn = -10,/*!< 6 Usage Fault, i.e. Undef Instruction, Illegal State Transition */ SVCall_IRQn = -5, /*!< 11 System Service Call via SVC instruction */ DebugMonitor_IRQn = -4, /*!< 12 Debug Monitor */ PendSV_IRQn = -2, /*!< 14 Pendable request for system service */ SysTick_IRQn = -1, /*!< 15 System Tick Timer */ /* --------------------------- LPC18xx/43xx Specific Interrupt Numbers ------------------------------- */ DAC_IRQn = 0,/*!< 0 DAC */ RESERVED0_IRQn = 1, DMA_IRQn = 2,/*!< 2 DMA */ RESERVED1_IRQn = 3,/*!< 3 EZH/EDM */ RESERVED2_IRQn = 4, ETHERNET_IRQn = 5,/*!< 5 ETHERNET */ SDIO_IRQn = 6,/*!< 6 SDIO */ LCD_IRQn = 7,/*!< 7 LCD */ USB0_IRQn = 8,/*!< 8 USB0 */ USB1_IRQn = 9,/*!< 9 USB1 */ SCT_IRQn = 10,/*!< 10 SCT */ RITIMER_IRQn = 11,/*!< 11 RITIMER */ TIMER0_IRQn = 12,/*!< 12 TIMER0 */ TIMER1_IRQn = 13,/*!< 13 TIMER1 */ TIMER2_IRQn = 14,/*!< 14 TIMER2 */ TIMER3_IRQn = 15,/*!< 15 TIMER3 */ MCPWM_IRQn = 16,/*!< 16 MCPWM */ ADC0_IRQn = 17,/*!< 17 ADC0 */ I2C0_IRQn = 18,/*!< 18 I2C0 */ I2C1_IRQn = 19,/*!< 19 I2C1 */ RESERVED3_IRQn = 20, ADC1_IRQn = 21,/*!< 21 ADC1 */ SSP0_IRQn = 22,/*!< 22 SSP0 */ SSP1_IRQn = 23,/*!< 23 SSP1 */ USART0_IRQn = 24,/*!< 24 USART0 */ UART1_IRQn = 25,/*!< 25 UART1 */ USART2_IRQn = 26,/*!< 26 USART2 */ USART3_IRQn = 27,/*!< 27 USART3 */ I2S0_IRQn = 28,/*!< 28 I2S0 */ I2S1_IRQn = 29,/*!< 29 I2S1 */ RESERVED4_IRQn = 30, RESERVED5_IRQn = 31, PIN_INT0_IRQn = 32,/*!< 32 PIN_INT0 */ PIN_INT1_IRQn = 33,/*!< 33 PIN_INT1 */ PIN_INT2_IRQn = 34,/*!< 34 PIN_INT2 */ PIN_INT3_IRQn = 35,/*!< 35 PIN_INT3 */ PIN_INT4_IRQn = 36,/*!< 36 PIN_INT4 */ PIN_INT5_IRQn = 37,/*!< 37 PIN_INT5 */ PIN_INT6_IRQn = 38,/*!< 38 PIN_INT6 */ PIN_INT7_IRQn = 39,/*!< 39 PIN_INT7 */ GINT0_IRQn = 40,/*!< 40 GINT0 */ GINT1_IRQn = 41,/*!< 41 GINT1 */ EVENTROUTER_IRQn = 42,/*!< 42 EVENTROUTER */ C_CAN1_IRQn = 43,/*!< 43 C_CAN1 */ RESERVED6_IRQn = 44, RESERVED7_IRQn = 45,/*!< 45 VADC */ ATIMER_IRQn = 46,/*!< 46 ATIMER */ RTC_IRQn = 47,/*!< 47 RTC */ RESERVED8_IRQn = 48, WWDT_IRQn = 49,/*!< 49 WWDT */ RESERVED9_IRQn = 50, C_CAN0_IRQn = 51,/*!< 51 C_CAN0 */ QEI_IRQn = 52,/*!< 52 QEI */ } IRQn_Type; #include "core_cm3.h" /*!< Cortex-M3 processor and core peripherals */ #elif defined(CORE_M0) /** * @brief LPC43xx (M0 Core) Cortex CMSIS definitions */ #define __MPU_PRESENT 0 /*!< MPU present or not */ #define __NVIC_PRIO_BITS 2 /*!< Number of Bits used for Priority Levels */ #define __Vendor_SysTickConfig 0 /*!< Set to 1 if different SysTick Config is used */ #define __FPU_PRESENT 0 /*!< FPU present or not */ #define CHIP_LPC43XX /*!< LPCOPEN */ /** * @brief LPC43xx (M0 Core) peripheral interrupt numbers */ typedef enum { /* ------------------------- Cortex-M0 Processor Exceptions Numbers ----------------------------- */ Reset_IRQn = -15,/*!< 1 Reset Vector, invoked on Power up and warm reset */ NonMaskableInt_IRQn = -14,/*!< 2 Non maskable Interrupt, cannot be stopped or preempted */ HardFault_IRQn = -13,/*!< 3 Hard Fault, all classes of Fault */ SVCall_IRQn = -5, /*!< 11 System Service Call via SVC instruction */ DebugMonitor_IRQn = -4, /*!< 12 Debug Monitor */ PendSV_IRQn = -2, /*!< 14 Pendable request for system service */ SysTick_IRQn = -1, /*!< 15 System Tick Timer */ /* --------------------------- LPC18xx/43xx Specific Interrupt Numbers ------------------------------- */ DAC_IRQn = 0,/*!< 0 DAC */ M0_M4CORE_IRQn = 1,/*!< 1 M0a */ DMA_IRQn = 2,/*!< 2 DMA r */ RESERVED1_IRQn = 3,/*!< 3 EZH/EDM */ FLASHEEPROM_IRQn = 4,/*!< 4 ORed Flash EEPROM Bank A, B, EEPROM */ ETHERNET_IRQn = 5,/*!< 5 ETHERNET */ SDIO_IRQn = 6,/*!< 6 SDIO */ LCD_IRQn = 7,/*!< 7 LCD */ USB0_IRQn = 8,/*!< 8 USB0 */ USB1_IRQn = 9,/*!< 9 USB1 */ SCT_IRQn = 10,/*!< 10 SCT */ RITIMER_IRQn = 11,/*!< 11 ORed RITIMER, WDT */ TIMER0_IRQn = 12,/*!< 12 TIMER0 */ GINT1_IRQn = 13,/*!< 13 GINT1 */ PIN_INT4_IRQn = 14,/*!< 14 GPIO 4 */ TIMER3_IRQn = 15,/*!< 15 TIMER3 */ MCPWM_IRQn = 16,/*!< 16 MCPWM */ ADC0_IRQn = 17,/*!< 17 ADC0 */ I2C0_IRQn = 18,/*!< 18 ORed I2C0, I2C1 */ SGPIO_INT_IRQn = 19,/*!< 19 SGPIO */ SPI_INT_IRQn = 20,/*!< 20 SPI_INT */ ADC1_IRQn = 21,/*!< 21 ADC1 */ SSP0_IRQn = 22,/*!< 22 ORed SSP0, SSP1 */ EVENTROUTER_IRQn = 23,/*!< 23 EVENTROUTER */ USART0_IRQn = 24,/*!< 24 USART0 */ UART1_IRQn = 25,/*!< 25 UART1 */ USART2_IRQn = 26,/*!< 26 USART2 */ USART3_IRQn = 27,/*!< 27 USART3 */ I2S0_IRQn = 28,/*!< 28 ORed I2S0, I2S1 */ C_CAN0_IRQn = 29,/*!< 29 C_CAN0 */ I2S1_IRQn = 29,/*!< 29 I2S1 */ RESERVED2_IRQn = 30, RESERVED3_IRQn = 31, } IRQn_Type; #include "core_cm0.h" /*!< Cortex-M4 processor and core peripherals */ #else #error Please #define CORE_M0, CORE_M3 or CORE_M4 #endif #include "system_LPC43xx.h" /** * @brief State Configurable Timer register block structure */ #define LPC_SCT_BASE 0x40000000 #define CONFIG_SCT_nEV (16) /*!< Number of events */ #define CONFIG_SCT_nRG (16) /*!< Number of match/compare registers */ #define CONFIG_SCT_nOU (16) /*!< Number of outputs */ typedef struct { __IO uint32_t CONFIG; /*!< Configuration Register */ union { __IO uint32_t CTRL_U; /*!< Control Register */ struct { __IO uint16_t CTRL_L; /*!< Low control register */ __IO uint16_t CTRL_H; /*!< High control register */ }; }; __IO uint16_t LIMIT_L; /*!< limit register for counter L */ __IO uint16_t LIMIT_H; /*!< limit register for counter H */ __IO uint16_t HALT_L; /*!< halt register for counter L */ __IO uint16_t HALT_H; /*!< halt register for counter H */ __IO uint16_t STOP_L; /*!< stop register for counter L */ __IO uint16_t STOP_H; /*!< stop register for counter H */ __IO uint16_t START_L; /*!< start register for counter L */ __IO uint16_t START_H; /*!< start register for counter H */ uint32_t RESERVED1[10]; /*!< 0x03C reserved */ union { __IO uint32_t COUNT_U; /*!< counter register */ struct { __IO uint16_t COUNT_L; /*!< counter register for counter L */ __IO uint16_t COUNT_H; /*!< counter register for counter H */ }; }; __IO uint16_t STATE_L; /*!< state register for counter L */ __IO uint16_t STATE_H; /*!< state register for counter H */ __I uint32_t INPUT; /*!< input register */ __IO uint16_t REGMODE_L; /*!< match - capture registers mode register L */ __IO uint16_t REGMODE_H; /*!< match - capture registers mode register H */ __IO uint32_t OUTPUT; /*!< output register */ __IO uint32_t OUTPUTDIRCTRL; /*!< output counter direction Control Register */ __IO uint32_t RES; /*!< conflict resolution register */ __IO uint32_t DMA0REQUEST; /*!< DMA0 Request Register */ __IO uint32_t DMA1REQUEST; /*!< DMA1 Request Register */ uint32_t RESERVED2[35]; __IO uint32_t EVEN; /*!< event enable register */ __IO uint32_t EVFLAG; /*!< event flag register */ __IO uint32_t CONEN; /*!< conflict enable register */ __IO uint32_t CONFLAG; /*!< conflict flag register */ union { __IO union { /*!< ... Match / Capture value */ uint32_t U; /*!< SCTMATCH[i].U Unified 32-bit register */ struct { uint16_t L; /*!< SCTMATCH[i].L Access to L value */ uint16_t H; /*!< SCTMATCH[i].H Access to H value */ }; } MATCH[CONFIG_SCT_nRG]; __I union { uint32_t U; /*!< SCTCAP[i].U Unified 32-bit register */ struct { uint16_t L; /*!< SCTCAP[i].L Access to L value */ uint16_t H; /*!< SCTCAP[i].H Access to H value */ }; } CAP[CONFIG_SCT_nRG]; }; uint32_t RESERVED3[32 - CONFIG_SCT_nRG]; /*!< ...-0x17C reserved */ union { __IO uint16_t MATCH_L[CONFIG_SCT_nRG]; /*!< 0x180-... Match Value L counter */ __I uint16_t CAP_L[CONFIG_SCT_nRG]; /*!< 0x180-... Capture Value L counter */ }; uint16_t RESERVED4[32 - CONFIG_SCT_nRG]; /*!< ...-0x1BE reserved */ union { __IO uint16_t MATCH_H[CONFIG_SCT_nRG]; /*!< 0x1C0-... Match Value H counter */ __I uint16_t CAP_H[CONFIG_SCT_nRG]; /*!< 0x1C0-... Capture Value H counter */ }; uint16_t RESERVED5[32 - CONFIG_SCT_nRG]; /*!< ...-0x1FE reserved */ union { __IO union { /*!< 0x200-... Match Reload / Capture Control value */ uint32_t U; /*!< SCTMATCHREL[i].U Unified 32-bit register */ struct { uint16_t L; /*!< SCTMATCHREL[i].L Access to L value */ uint16_t H; /*!< SCTMATCHREL[i].H Access to H value */ }; } MATCHREL[CONFIG_SCT_nRG]; __IO union { uint32_t U; /*!< SCTCAPCTRL[i].U Unified 32-bit register */ struct { uint16_t L; /*!< SCTCAPCTRL[i].L Access to L value */ uint16_t H; /*!< SCTCAPCTRL[i].H Access to H value */ }; } CAPCTRL[CONFIG_SCT_nRG]; }; uint32_t RESERVED6[32 - CONFIG_SCT_nRG]; /*!< ...-0x27C reserved */ union { __IO uint16_t MATCHREL_L[CONFIG_SCT_nRG]; /*!< 0x280-... Match Reload value L counter */ __IO uint16_t CAPCTRL_L[CONFIG_SCT_nRG]; /*!< 0x280-... Capture Control value L counter */ }; uint16_t RESERVED7[32 - CONFIG_SCT_nRG]; /*!< ...-0x2BE reserved */ union { __IO uint16_t MATCHREL_H[CONFIG_SCT_nRG]; /*!< 0x2C0-... Match Reload value H counter */ __IO uint16_t CAPCTRL_H[CONFIG_SCT_nRG]; /*!< 0x2C0-... Capture Control value H counter */ }; uint16_t RESERVED8[32 - CONFIG_SCT_nRG]; /*!< ...-0x2FE reserved */ __IO struct { /*!< 0x300-0x3FC SCTEVENT[i].STATE / SCTEVENT[i].CTRL*/ uint32_t STATE; /*!< Event State Register */ uint32_t CTRL; /*!< Event Control Register */ } EVENT[CONFIG_SCT_nEV]; uint32_t RESERVED9[128 - 2 * CONFIG_SCT_nEV]; /*!< ...-0x4FC reserved */ __IO struct { /*!< 0x500-0x57C SCTOUT[i].SET / SCTOUT[i].CLR */ uint32_t SET; /*!< Output n Set Register */ uint32_t CLR; /*!< Output n Clear Register */ } OUT[CONFIG_SCT_nOU]; uint32_t RESERVED10[191 - 2 * CONFIG_SCT_nOU]; /*!< ...-0x7F8 reserved */ __I uint32_t MODULECONTENT; /*!< 0x7FC Module Content */ } LPC_SCT_T; /** * @brief GPDMA Channel register block structure */ #define LPC_GPDMA_BASE 0x40002000 typedef struct { __IO uint32_t SRCADDR; /*!< DMA Channel Source Address Register */ __IO uint32_t DESTADDR; /*!< DMA Channel Destination Address Register */ __IO uint32_t LLI; /*!< DMA Channel Linked List Item Register */ __IO uint32_t CONTROL; /*!< DMA Channel Control Register */ __IO uint32_t CONFIG; /*!< DMA Channel Configuration Register */ __I uint32_t RESERVED1[3]; } LPC_GPDMA_CH_T; #define GPDMA_CHANNELS 8 /** * @brief GPDMA register block */ typedef struct { /*!< GPDMA Structure */ __I uint32_t INTSTAT; /*!< DMA Interrupt Status Register */ __I uint32_t INTTCSTAT; /*!< DMA Interrupt Terminal Count Request Status Register */ __O uint32_t INTTCCLEAR; /*!< DMA Interrupt Terminal Count Request Clear Register */ __I uint32_t INTERRSTAT; /*!< DMA Interrupt Error Status Register */ __O uint32_t INTERRCLR; /*!< DMA Interrupt Error Clear Register */ __I uint32_t RAWINTTCSTAT; /*!< DMA Raw Interrupt Terminal Count Status Register */ __I uint32_t RAWINTERRSTAT; /*!< DMA Raw Error Interrupt Status Register */ __I uint32_t ENBLDCHNS; /*!< DMA Enabled Channel Register */ __IO uint32_t SOFTBREQ; /*!< DMA Software Burst Request Register */ __IO uint32_t SOFTSREQ; /*!< DMA Software Single Request Register */ __IO uint32_t SOFTLBREQ; /*!< DMA Software Last Burst Request Register */ __IO uint32_t SOFTLSREQ; /*!< DMA Software Last Single Request Register */ __IO uint32_t CONFIG; /*!< DMA Configuration Register */ __IO uint32_t SYNC; /*!< DMA Synchronization Register */ __I uint32_t RESERVED0[50]; LPC_GPDMA_CH_T CH[GPDMA_CHANNELS]; } LPC_GPDMA_T; /** * @brief SD/MMC & SDIO register block structure */ #define LPC_SDMMC_BASE 0x40004000 typedef struct { /*!< SDMMC Structure */ __IO uint32_t CTRL; /*!< Control Register */ __IO uint32_t PWREN; /*!< Power Enable Register */ __IO uint32_t CLKDIV; /*!< Clock Divider Register */ __IO uint32_t CLKSRC; /*!< SD Clock Source Register */ __IO uint32_t CLKENA; /*!< Clock Enable Register */ __IO uint32_t TMOUT; /*!< Timeout Register */ __IO uint32_t CTYPE; /*!< Card Type Register */ __IO uint32_t BLKSIZ; /*!< Block Size Register */ __IO uint32_t BYTCNT; /*!< Byte Count Register */ __IO uint32_t INTMASK; /*!< Interrupt Mask Register */ __IO uint32_t CMDARG; /*!< Command Argument Register */ __IO uint32_t CMD; /*!< Command Register */ __I uint32_t RESP0; /*!< Response Register 0 */ __I uint32_t RESP1; /*!< Response Register 1 */ __I uint32_t RESP2; /*!< Response Register 2 */ __I uint32_t RESP3; /*!< Response Register 3 */ __I uint32_t MINTSTS; /*!< Masked Interrupt Status Register */ __IO uint32_t RINTSTS; /*!< Raw Interrupt Status Register */ __I uint32_t STATUS; /*!< Status Register */ __IO uint32_t FIFOTH; /*!< FIFO Threshold Watermark Register */ __I uint32_t CDETECT; /*!< Card Detect Register */ __I uint32_t WRTPRT; /*!< Write Protect Register */ __IO uint32_t GPIO; /*!< General Purpose Input/Output Register */ __I uint32_t TCBCNT; /*!< Transferred CIU Card Byte Count Register */ __I uint32_t TBBCNT; /*!< Transferred Host to BIU-FIFO Byte Count Register */ __IO uint32_t DEBNCE; /*!< Debounce Count Register */ __IO uint32_t USRID; /*!< User ID Register */ __I uint32_t VERID; /*!< Version ID Register */ __I uint32_t RESERVED0; __IO uint32_t UHS_REG; /*!< UHS-1 Register */ __IO uint32_t RST_N; /*!< Hardware Reset */ __I uint32_t RESERVED1; __IO uint32_t BMOD; /*!< Bus Mode Register */ __O uint32_t PLDMND; /*!< Poll Demand Register */ __IO uint32_t DBADDR; /*!< Descriptor List Base Address Register */ __IO uint32_t IDSTS; /*!< Internal DMAC Status Register */ __IO uint32_t IDINTEN; /*!< Internal DMAC Interrupt Enable Register */ __I uint32_t DSCADDR; /*!< Current Host Descriptor Address Register */ __I uint32_t BUFADDR; /*!< Current Buffer Descriptor Address Register */ } LPC_SDMMC_T; /** * @brief External Memory Controller (EMC) register block structure */ #define LPC_EMC_BASE 0x40005000 typedef struct { /*!< EMC Structure */ __IO uint32_t CONTROL; /*!< Controls operation of the memory controller. */ __I uint32_t STATUS; /*!< Provides EMC status information. */ __IO uint32_t CONFIG; /*!< Configures operation of the memory controller. */ __I uint32_t RESERVED0[5]; __IO uint32_t DYNAMICCONTROL; /*!< Controls dynamic memory operation. */ __IO uint32_t DYNAMICREFRESH; /*!< Configures dynamic memory refresh operation. */ __IO uint32_t DYNAMICREADCONFIG; /*!< Configures the dynamic memory read strategy. */ __I uint32_t RESERVED1; __IO uint32_t DYNAMICRP; /*!< Selects the precharge command period. */ __IO uint32_t DYNAMICRAS; /*!< Selects the active to precharge command period. */ __IO uint32_t DYNAMICSREX; /*!< Selects the self-refresh exit time. */ __IO uint32_t DYNAMICAPR; /*!< Selects the last-data-out to active command time. */ __IO uint32_t DYNAMICDAL; /*!< Selects the data-in to active command time. */ __IO uint32_t DYNAMICWR; /*!< Selects the write recovery time. */ __IO uint32_t DYNAMICRC; /*!< Selects the active to active command period. */ __IO uint32_t DYNAMICRFC; /*!< Selects the auto-refresh period. */ __IO uint32_t DYNAMICXSR; /*!< Selects the exit self-refresh to active command time. */ __IO uint32_t DYNAMICRRD; /*!< Selects the active bank A to active bank B latency. */ __IO uint32_t DYNAMICMRD; /*!< Selects the load mode register to active command time. */ __I uint32_t RESERVED2[9]; __IO uint32_t STATICEXTENDEDWAIT; /*!< Selects time for long static memory read and write transfers. */ __I uint32_t RESERVED3[31]; __IO uint32_t DYNAMICCONFIG0; /*!< Selects the configuration information for dynamic memory chip select n. */ __IO uint32_t DYNAMICRASCAS0; /*!< Selects the RAS and CAS latencies for dynamic memory chip select n. */ __I uint32_t RESERVED4[6]; __IO uint32_t DYNAMICCONFIG1; /*!< Selects the configuration information for dynamic memory chip select n. */ __IO uint32_t DYNAMICRASCAS1; /*!< Selects the RAS and CAS latencies for dynamic memory chip select n. */ __I uint32_t RESERVED5[6]; __IO uint32_t DYNAMICCONFIG2; /*!< Selects the configuration information for dynamic memory chip select n. */ __IO uint32_t DYNAMICRASCAS2; /*!< Selects the RAS and CAS latencies for dynamic memory chip select n. */ __I uint32_t RESERVED6[6]; __IO uint32_t DYNAMICCONFIG3; /*!< Selects the configuration information for dynamic memory chip select n. */ __IO uint32_t DYNAMICRASCAS3; /*!< Selects the RAS and CAS latencies for dynamic memory chip select n. */ __I uint32_t RESERVED7[38]; __IO uint32_t STATICCONFIG0; /*!< Selects the memory configuration for static chip select n. */ __IO uint32_t STATICWAITWEN0; /*!< Selects the delay from chip select n to write enable. */ __IO uint32_t STATICWAITOEN0; /*!< Selects the delay from chip select n or address change, whichever is later, to output enable. */ __IO uint32_t STATICWAITRD0; /*!< Selects the delay from chip select n to a read access. */ __IO uint32_t STATICWAITPAG0; /*!< Selects the delay for asynchronous page mode sequential accesses for chip select n. */ __IO uint32_t STATICWAITWR0; /*!< Selects the delay from chip select n to a write access. */ __IO uint32_t STATICWAITTURN0; /*!< Selects bus turnaround cycles */ __I uint32_t RESERVED8; __IO uint32_t STATICCONFIG1; /*!< Selects the memory configuration for static chip select n. */ __IO uint32_t STATICWAITWEN1; /*!< Selects the delay from chip select n to write enable. */ __IO uint32_t STATICWAITOEN1; /*!< Selects the delay from chip select n or address change, whichever is later, to output enable. */ __IO uint32_t STATICWAITRD1; /*!< Selects the delay from chip select n to a read access. */ __IO uint32_t STATICWAITPAG1; /*!< Selects the delay for asynchronous page mode sequential accesses for chip select n. */ __IO uint32_t STATICWAITWR1; /*!< Selects the delay from chip select n to a write access. */ __IO uint32_t STATICWAITTURN1; /*!< Selects bus turnaround cycles */ __I uint32_t RESERVED9; __IO uint32_t STATICCONFIG2; /*!< Selects the memory configuration for static chip select n. */ __IO uint32_t STATICWAITWEN2; /*!< Selects the delay from chip select n to write enable. */ __IO uint32_t STATICWAITOEN2; /*!< Selects the delay from chip select n or address change, whichever is later, to output enable. */ __IO uint32_t STATICWAITRD2; /*!< Selects the delay from chip select n to a read access. */ __IO uint32_t STATICWAITPAG2; /*!< Selects the delay for asynchronous page mode sequential accesses for chip select n. */ __IO uint32_t STATICWAITWR2; /*!< Selects the delay from chip select n to a write access. */ __IO uint32_t STATICWAITTURN2; /*!< Selects bus turnaround cycles */ __I uint32_t RESERVED10; __IO uint32_t STATICCONFIG3; /*!< Selects the memory configuration for static chip select n. */ __IO uint32_t STATICWAITWEN3; /*!< Selects the delay from chip select n to write enable. */ __IO uint32_t STATICWAITOEN3; /*!< Selects the delay from chip select n or address change, whichever is later, to output enable. */ __IO uint32_t STATICWAITRD3; /*!< Selects the delay from chip select n to a read access. */ __IO uint32_t STATICWAITPAG3; /*!< Selects the delay for asynchronous page mode sequential accesses for chip select n. */ __IO uint32_t STATICWAITWR3; /*!< Selects the delay from chip select n to a write access. */ __IO uint32_t STATICWAITTURN3; /*!< Selects bus turnaround cycles */ } LPC_EMC_T; /** * @brief USB High-Speed register block structure */ #define LPC_USB0_BASE 0x40006000 #define LPC_USB1_BASE 0x40007000 typedef struct { /*!< USB Structure */ __I uint32_t RESERVED0[64]; __I uint32_t CAPLENGTH; /*!< Capability register length */ __I uint32_t HCSPARAMS; /*!< Host controller structural parameters */ __I uint32_t HCCPARAMS; /*!< Host controller capability parameters */ __I uint32_t RESERVED1[5]; __I uint32_t DCIVERSION; /*!< Device interface version number */ __I uint32_t RESERVED2[7]; union { __IO uint32_t USBCMD_H; /*!< USB command (host mode) */ __IO uint32_t USBCMD_D; /*!< USB command (device mode) */ }; union { __IO uint32_t USBSTS_H; /*!< USB status (host mode) */ __IO uint32_t USBSTS_D; /*!< USB status (device mode) */ }; union { __IO uint32_t USBINTR_H; /*!< USB interrupt enable (host mode) */ __IO uint32_t USBINTR_D; /*!< USB interrupt enable (device mode) */ }; union { __IO uint32_t FRINDEX_H; /*!< USB frame index (host mode) */ __I uint32_t FRINDEX_D; /*!< USB frame index (device mode) */ }; __I uint32_t RESERVED3; union { __IO uint32_t PERIODICLISTBASE; /*!< Frame list base address */ __IO uint32_t DEVICEADDR; /*!< USB device address */ }; union { __IO uint32_t ASYNCLISTADDR; /*!< Address of endpoint list in memory (host mode) */ __IO uint32_t ENDPOINTLISTADDR; /*!< Address of endpoint list in memory (device mode) */ }; __IO uint32_t TTCTRL; /*!< Asynchronous buffer status for embedded TT (host mode) */ __IO uint32_t BURSTSIZE; /*!< Programmable burst size */ __IO uint32_t TXFILLTUNING; /*!< Host transmit pre-buffer packet tuning (host mode) */ __I uint32_t RESERVED4[2]; __IO uint32_t ULPIVIEWPORT; /*!< ULPI viewport */ __IO uint32_t BINTERVAL; /*!< Length of virtual frame */ __IO uint32_t ENDPTNAK; /*!< Endpoint NAK (device mode) */ __IO uint32_t ENDPTNAKEN; /*!< Endpoint NAK Enable (device mode) */ __I uint32_t RESERVED5; union { __IO uint32_t PORTSC1_H; /*!< Port 1 status/control (host mode) */ __IO uint32_t PORTSC1_D; /*!< Port 1 status/control (device mode) */ }; __I uint32_t RESERVED6[7]; __IO uint32_t OTGSC; /*!< OTG status and control */ union { __IO uint32_t USBMODE_H; /*!< USB mode (host mode) */ __IO uint32_t USBMODE_D; /*!< USB mode (device mode) */ }; __IO uint32_t ENDPTSETUPSTAT; /*!< Endpoint setup status */ __IO uint32_t ENDPTPRIME; /*!< Endpoint initialization */ __IO uint32_t ENDPTFLUSH; /*!< Endpoint de-initialization */ __I uint32_t ENDPTSTAT; /*!< Endpoint status */ __IO uint32_t ENDPTCOMPLETE; /*!< Endpoint complete */ __IO uint32_t ENDPTCTRL[6]; /*!< Endpoint control 0 */ } LPC_USBHS_T; /** * @brief LCD Controller register block structure */ #define LPC_LCD_BASE 0x40008000 typedef struct { /*!< LCD Structure */ __IO uint32_t TIMH; /*!< Horizontal Timing Control register */ __IO uint32_t TIMV; /*!< Vertical Timing Control register */ __IO uint32_t POL; /*!< Clock and Signal Polarity Control register */ __IO uint32_t LE; /*!< Line End Control register */ __IO uint32_t UPBASE; /*!< Upper Panel Frame Base Address register */ __IO uint32_t LPBASE; /*!< Lower Panel Frame Base Address register */ __IO uint32_t CTRL; /*!< LCD Control register */ __IO uint32_t INTMSK; /*!< Interrupt Mask register */ __I uint32_t INTRAW; /*!< Raw Interrupt Status register */ __I uint32_t INTSTAT; /*!< Masked Interrupt Status register */ __O uint32_t INTCLR; /*!< Interrupt Clear register */ __I uint32_t UPCURR; /*!< Upper Panel Current Address Value register */ __I uint32_t LPCURR; /*!< Lower Panel Current Address Value register */ __I uint32_t RESERVED0[115]; __IO uint16_t PAL[256]; /*!< 256x16-bit Color Palette registers */ __I uint32_t RESERVED1[256]; __IO uint32_t CRSR_IMG[256];/*!< Cursor Image registers */ __IO uint32_t CRSR_CTRL; /*!< Cursor Control register */ __IO uint32_t CRSR_CFG; /*!< Cursor Configuration register */ __IO uint32_t CRSR_PAL0; /*!< Cursor Palette register 0 */ __IO uint32_t CRSR_PAL1; /*!< Cursor Palette register 1 */ __IO uint32_t CRSR_XY; /*!< Cursor XY Position register */ __IO uint32_t CRSR_CLIP; /*!< Cursor Clip Position register */ __I uint32_t RESERVED2[2]; __IO uint32_t CRSR_INTMSK; /*!< Cursor Interrupt Mask register */ __O uint32_t CRSR_INTCLR; /*!< Cursor Interrupt Clear register */ __I uint32_t CRSR_INTRAW; /*!< Cursor Raw Interrupt Status register */ __I uint32_t CRSR_INTSTAT;/*!< Cursor Masked Interrupt Status register */ } LPC_LCD_T; /** * @brief EEPROM register block structure */ #define LPC_EEPROM_BASE 0x4000E000 typedef struct { /* EEPROM Structure */ __IO uint32_t CMD; /*!< EEPROM command register */ uint32_t RESERVED0; __IO uint32_t RWSTATE; /*!< EEPROM read wait state register */ __IO uint32_t AUTOPROG; /*!< EEPROM auto programming register */ __IO uint32_t WSTATE; /*!< EEPROM wait state register */ __IO uint32_t CLKDIV; /*!< EEPROM clock divider register */ __IO uint32_t PWRDWN; /*!< EEPROM power-down register */ uint32_t RESERVED2[1007]; __O uint32_t INTENCLR; /*!< EEPROM interrupt enable clear */ __O uint32_t INTENSET; /*!< EEPROM interrupt enable set */ __I uint32_t INTSTAT; /*!< EEPROM interrupt status */ __I uint32_t INTEN; /*!< EEPROM interrupt enable */ __O uint32_t INTSTATCLR; /*!< EEPROM interrupt status clear */ __O uint32_t INTSTATSET; /*!< EEPROM interrupt status set */ } LPC_EEPROM_T; /** * @brief 10/100 MII & RMII Ethernet with timestamping register block structure */ #define LPC_ETHERNET_BASE 0x40010000 typedef struct { /*!< ETHERNET Structure */ __IO uint32_t MAC_CONFIG; /*!< MAC configuration register */ __IO uint32_t MAC_FRAME_FILTER; /*!< MAC frame filter */ __IO uint32_t MAC_HASHTABLE_HIGH; /*!< Hash table high register */ __IO uint32_t MAC_HASHTABLE_LOW; /*!< Hash table low register */ __IO uint32_t MAC_MII_ADDR; /*!< MII address register */ __IO uint32_t MAC_MII_DATA; /*!< MII data register */ __IO uint32_t MAC_FLOW_CTRL; /*!< Flow control register */ __IO uint32_t MAC_VLAN_TAG; /*!< VLAN tag register */ __I uint32_t RESERVED0; __I uint32_t MAC_DEBUG; /*!< Debug register */ __IO uint32_t MAC_RWAKE_FRFLT; /*!< Remote wake-up frame filter */ __IO uint32_t MAC_PMT_CTRL_STAT; /*!< PMT control and status */ __I uint32_t RESERVED1[2]; __I uint32_t MAC_INTR; /*!< Interrupt status register */ __IO uint32_t MAC_INTR_MASK; /*!< Interrupt mask register */ __IO uint32_t MAC_ADDR0_HIGH; /*!< MAC address 0 high register */ __IO uint32_t MAC_ADDR0_LOW; /*!< MAC address 0 low register */ __I uint32_t RESERVED2[430]; __IO uint32_t MAC_TIMESTP_CTRL; /*!< Time stamp control register */ __IO uint32_t SUBSECOND_INCR; /*!< Sub-second increment register */ __I uint32_t SECONDS; /*!< System time seconds register */ __I uint32_t NANOSECONDS; /*!< System time nanoseconds register */ __IO uint32_t SECONDSUPDATE; /*!< System time seconds update register */ __IO uint32_t NANOSECONDSUPDATE; /*!< System time nanoseconds update register */ __IO uint32_t ADDEND; /*!< Time stamp addend register */ __IO uint32_t TARGETSECONDS; /*!< Target time seconds register */ __IO uint32_t TARGETNANOSECONDS; /*!< Target time nanoseconds register */ __IO uint32_t HIGHWORD; /*!< System time higher word seconds register */ __I uint32_t TIMESTAMPSTAT; /*!< Time stamp status register */ __IO uint32_t PPSCTRL; /*!< PPS control register */ __I uint32_t AUXNANOSECONDS; /*!< Auxiliary time stamp nanoseconds register */ __I uint32_t AUXSECONDS; /*!< Auxiliary time stamp seconds register */ __I uint32_t RESERVED3[562]; __IO uint32_t DMA_BUS_MODE; /*!< Bus Mode Register */ __IO uint32_t DMA_TRANS_POLL_DEMAND; /*!< Transmit poll demand register */ __IO uint32_t DMA_REC_POLL_DEMAND; /*!< Receive poll demand register */ __IO uint32_t DMA_REC_DES_ADDR; /*!< Receive descriptor list address register */ __IO uint32_t DMA_TRANS_DES_ADDR; /*!< Transmit descriptor list address register */ __IO uint32_t DMA_STAT; /*!< Status register */ __IO uint32_t DMA_OP_MODE; /*!< Operation mode register */ __IO uint32_t DMA_INT_EN; /*!< Interrupt enable register */ __I uint32_t DMA_MFRM_BUFOF; /*!< Missed frame and buffer overflow register */ __IO uint32_t DMA_REC_INT_WDT; /*!< Receive interrupt watchdog timer register */ __I uint32_t RESERVED4[8]; __I uint32_t DMA_CURHOST_TRANS_DES; /*!< Current host transmit descriptor register */ __I uint32_t DMA_CURHOST_REC_DES; /*!< Current host receive descriptor register */ __I uint32_t DMA_CURHOST_TRANS_BUF; /*!< Current host transmit buffer address register */ __I uint32_t DMA_CURHOST_REC_BUF; /*!< Current host receive buffer address register */ } LPC_ENET_T; /** * @brief Alarm Timer register block structure */ #define LPC_ATIMER_BASE 0x40040000 typedef struct { /*!< ATIMER Structure */ __IO uint32_t DOWNCOUNTER; /*!< Downcounter register */ __IO uint32_t PRESET; /*!< Preset value register */ __I uint32_t RESERVED0[1012]; __O uint32_t CLR_EN; /*!< Interrupt clear enable register */ __O uint32_t SET_EN; /*!< Interrupt set enable register */ __I uint32_t STATUS; /*!< Status register */ __I uint32_t ENABLE; /*!< Enable register */ __O uint32_t CLR_STAT; /*!< Clear register */ __O uint32_t SET_STAT; /*!< Set register */ } LPC_ATIMER_T; /** * @brief Register File register block structure */ #define LPC_REGFILE_BASE 0x40041000 typedef struct { __IO uint32_t REGFILE[64]; /*!< General purpose storage register */ } LPC_REGFILE_T; /** * @brief Power Management Controller register block structure */ #define LPC_PMC_BASE 0x40042000 typedef struct { /*!< PMC Structure */ __IO uint32_t PD0_SLEEP0_HW_ENA; /*!< Hardware sleep event enable register */ __I uint32_t RESERVED0[6]; __IO uint32_t PD0_SLEEP0_MODE; /*!< Sleep power mode register */ } LPC_PMC_T; /** * @brief CREG Register Block */ #define LPC_CREG_BASE 0x40043000 typedef struct { /*!< CREG Structure */ __I uint32_t RESERVED0; __IO uint32_t CREG0; /*!< Chip configuration register 32 kHz oscillator output and BOD control register. */ __I uint32_t RESERVED1[62]; __IO uint32_t MXMEMMAP; /*!< ARM Cortex-M3/M4 memory mapping */ #if defined(CHIP_LPC18XX) __I uint32_t RESERVED2[5]; #else __I uint32_t RESERVED2; __I uint32_t CREG1; /*!< Configuration Register 1 */ __I uint32_t CREG2; /*!< Configuration Register 2 */ __I uint32_t CREG3; /*!< Configuration Register 3 */ __I uint32_t CREG4; /*!< Configuration Register 4 */ #endif __IO uint32_t CREG5; /*!< Chip configuration register 5. Controls JTAG access. */ __IO uint32_t DMAMUX; /*!< DMA muxing control */ __IO uint32_t FLASHCFGA; /*!< Flash accelerator configuration register for flash bank A */ __IO uint32_t FLASHCFGB; /*!< Flash accelerator configuration register for flash bank B */ __IO uint32_t ETBCFG; /*!< ETB RAM configuration */ __IO uint32_t CREG6; /*!< Chip configuration register 6. */ #if defined(CHIP_LPC18XX) __I uint32_t RESERVED4[52]; #else __IO uint32_t M4TXEVENT; /*!< M4 IPC event register */ __I uint32_t RESERVED4[51]; #endif __I uint32_t CHIPID; /*!< Part ID */ #if defined(CHIP_LPC18XX) __I uint32_t RESERVED5[191]; #else __I uint32_t RESERVED5[127]; __IO uint32_t M0TXEVENT; /*!< M0 IPC Event register */ __IO uint32_t M0APPMEMMAP; /*!< ARM Cortex M0 memory mapping */ __I uint32_t RESERVED6[62]; #endif __IO uint32_t USB0FLADJ; /*!< USB0 frame length adjust register */ __I uint32_t RESERVED7[63]; __IO uint32_t USB1FLADJ; /*!< USB1 frame length adjust register */ } LPC_CREG_T; /** * @brief Event Router register structure */ #define LPC_EVRT_BASE 0x40044000 typedef struct { /*!< EVENTROUTER Structure */ __IO uint32_t HILO; /*!< Level configuration register */ __IO uint32_t EDGE; /*!< Edge configuration */ __I uint32_t RESERVED0[1012]; __O uint32_t CLR_EN; /*!< Event clear enable register */ __O uint32_t SET_EN; /*!< Event set enable register */ __I uint32_t STATUS; /*!< Status register */ __I uint32_t ENABLE; /*!< Enable register */ __O uint32_t CLR_STAT; /*!< Clear register */ __O uint32_t SET_STAT; /*!< Set register */ } LPC_EVRT_T; /** * @brief Real Time Clock register block structure */ #define LPC_RTC_BASE 0x40046000 #define RTC_EV_SUPPORT 1 /* Event Monitor/Recorder support */ typedef enum IP_RTC_TIMEINDEX { RTC_TIMETYPE_SECOND, /*!< Second */ RTC_TIMETYPE_MINUTE, /*!< Month */ RTC_TIMETYPE_HOUR, /*!< Hour */ RTC_TIMETYPE_DAYOFMONTH, /*!< Day of month */ RTC_TIMETYPE_DAYOFWEEK, /*!< Day of week */ RTC_TIMETYPE_DAYOFYEAR, /*!< Day of year */ RTC_TIMETYPE_MONTH, /*!< Month */ RTC_TIMETYPE_YEAR, /*!< Year */ RTC_TIMETYPE_LAST } IP_RTC_TIMEINDEX_T; #if RTC_EV_SUPPORT typedef enum LPC_RTC_EV_CHANNEL { RTC_EV_CHANNEL_1 = 0, RTC_EV_CHANNEL_2, RTC_EV_CHANNEL_3, RTC_EV_CHANNEL_NUM, } LPC_RTC_EV_CHANNEL_T; #endif /*RTC_EV_SUPPORT*/ typedef struct { /*!< RTC Structure */ __IO uint32_t ILR; /*!< Interrupt Location Register */ __I uint32_t RESERVED0; __IO uint32_t CCR; /*!< Clock Control Register */ __IO uint32_t CIIR; /*!< Counter Increment Interrupt Register */ __IO uint32_t AMR; /*!< Alarm Mask Register */ __I uint32_t CTIME[3]; /*!< Consolidated Time Register 0,1,2 */ __IO uint32_t TIME[RTC_TIMETYPE_LAST]; /*!< Timer field registers */ __IO uint32_t CALIBRATION; /*!< Calibration Value Register */ __I uint32_t RESERVED1[7]; __IO uint32_t ALRM[RTC_TIMETYPE_LAST]; /*!< Alarm field registers */ #if RTC_EV_SUPPORT __IO uint32_t ERSTATUS; /*!< Event Monitor/Recorder Status register*/ __IO uint32_t ERCONTROL; /*!< Event Monitor/Recorder Control register*/ __I uint32_t ERCOUNTERS; /*!< Event Monitor/Recorder Counters register*/ __I uint32_t RESERVED2; __I uint32_t ERFIRSTSTAMP[RTC_EV_CHANNEL_NUM]; /*!> 6) & 0x3FF)) /*!< Mask for getting the 10 bits ADC data read value */ #define ADC_CR_BITACC(n) ((((n) & 0x7) << 17)) /*!< Number of ADC accuracy bits */ #define ADC_DR_DONE(n) (((n) >> 31)) /*!< Mask for reading the ADC done status */ #define ADC_DR_OVERRUN(n) ((((n) >> 30) & (1UL))) /*!< Mask for reading the ADC overrun status */ #define ADC_CR_CH_SEL(n) ((1UL << (n))) /*!< Selects which of the AD0.0:7 pins is (are) to be sampled and converted */ #define ADC_CR_CLKDIV(n) ((((n) & 0xFF) << 8)) /*!< The APB clock (PCLK) is divided by (this value plus one) to produce the clock for the A/D */ #define ADC_CR_BURST ((1UL << 16)) /*!< Repeated conversions A/D enable bit */ #define ADC_CR_PDN ((1UL << 21)) /*!< ADC convert is operational */ #define ADC_CR_START_MASK ((7UL << 24)) /*!< ADC start mask bits */ #define ADC_CR_START_MODE_SEL(SEL) ((SEL << 24)) /*!< Select Start Mode */ #define ADC_CR_START_NOW ((1UL << 24)) /*!< Start conversion now */ #define ADC_CR_START_CTOUT15 ((2UL << 24)) /*!< Start conversion when the edge selected by bit 27 occurs on CTOUT_15 */ #define ADC_CR_START_CTOUT8 ((3UL << 24)) /*!< Start conversion when the edge selected by bit 27 occurs on CTOUT_8 */ #define ADC_CR_START_ADCTRIG0 ((4UL << 24)) /*!< Start conversion when the edge selected by bit 27 occurs on ADCTRIG0 */ #define ADC_CR_START_ADCTRIG1 ((5UL << 24)) /*!< Start conversion when the edge selected by bit 27 occurs on ADCTRIG1 */ #define ADC_CR_START_MCOA2 ((6UL << 24)) /*!< Start conversion when the edge selected by bit 27 occurs on Motocon PWM output MCOA2 */ #define ADC_CR_EDGE ((1UL << 27)) /*!< Start conversion on a falling edge on the selected CAP/MAT signal */ #define ADC_CONFIG_MASK (ADC_CR_CLKDIV(0xFF) | ADC_CR_BITACC(0x07) | ADC_CR_PDN) /* ADC status register used for IP drivers */ typedef enum IP_ADC_STATUS { ADC_DR_DONE_STAT, /*!< ADC data register staus */ ADC_DR_OVERRUN_STAT,/*!< ADC data overrun staus */ ADC_DR_ADINT_STAT /*!< ADC interrupt status */ } IP_ADC_STATUS_T; /** * @brief GPIO port register block structure */ #define LPC_GPIO_PORT_BASE 0x400F4000 typedef struct { /*!< GPIO_PORT Structure */ __IO uint8_t B[128][32]; /*!< Offset 0x0000: Byte pin registers ports 0 to n; pins PIOn_0 to PIOn_31 */ __IO uint32_t W[32][32]; /*!< Offset 0x1000: Word pin registers port 0 to n */ __IO uint32_t DIR[32]; /*!< Offset 0x2000: Direction registers port n */ __IO uint32_t MASK[32]; /*!< Offset 0x2080: Mask register port n */ __IO uint32_t PIN[32]; /*!< Offset 0x2100: Portpin register port n */ __IO uint32_t MPIN[32]; /*!< Offset 0x2180: Masked port register port n */ __IO uint32_t SET[32]; /*!< Offset 0x2200: Write: Set register for port n Read: output bits for port n */ __O uint32_t CLR[32]; /*!< Offset 0x2280: Clear port n */ __O uint32_t NOT[32]; /*!< Offset 0x2300: Toggle port n */ } LPC_GPIO_T; /* Calculate GPIO offset and port register address from group and pin number */ #define GPIO_OFF(port, pin) ((port << 5) + pin) #define GPIO_REG(port, pin) ((__IO uint32_t *)(LPC_GPIO_PORT_BASE + 0x2000 + GPIO_OFF(port, pin))) /** * @brief SPI register block structure */ #define LPC_SPI_BASE 0x40100000 typedef struct { /*!< SPI Structure */ __IO uint32_t CR; /*!< SPI Control Register. This register controls the operation of the SPI. */ __I uint32_t SR; /*!< SPI Status Register. This register shows the status of the SPI. */ __IO uint32_t DR; /*!< SPI Data Register. This bi-directional register provides the transmit and receive data for the SPI. Transmit data is provided to the SPI0 by writing to this register. Data received by the SPI0 can be read from this register. */ __IO uint32_t CCR; /*!< SPI Clock Counter Register. This register controls the frequency of a master's SCK0. */ __I uint32_t RESERVED0[3]; __IO uint32_t INT; /*!< SPI Interrupt Flag. This register contains the interrupt flag for the SPI interface. */ } LPC_SPI_T; /* SPI CFG Register BitMask */ #define SPI_CR_BITMASK ((uint32_t) 0xFFC) /* Enable of controlling the number of bits per transfer */ #define SPI_CR_BIT_EN ((uint32_t) (1 << 2)) /* Mask of field of bit controlling */ #define SPI_CR_BITS_MASK ((uint32_t) 0xF00) /* Set the number of bits per a transfer */ #define SPI_CR_BITS(n) ((uint32_t) ((n << 8) & 0xF00)) /* n is in range 8-16 */ /* SPI Clock Phase Select*/ #define SPI_CR_CPHA_FIRST ((uint32_t) (0)) /*Capture data on the first edge, Change data on the following edge*/ #define SPI_CR_CPHA_SECOND ((uint32_t) (1 << 3)) /*Change data on the first edge, Capture data on the following edge*/ /* SPI Clock Polarity Select*/ #define SPI_CR_CPOL_LO ((uint32_t) (0)) /* The rest state of the clock (between frames) is low.*/ #define SPI_CR_CPOL_HI ((uint32_t) (1 << 4)) /* The rest state of the clock (between frames) is high.*/ /* SPI Slave Mode Select */ #define SPI_CR_SLAVE_EN ((uint32_t) 0) /* SPI Master Mode Select */ #define SPI_CR_MASTER_EN ((uint32_t) (1 << 5)) /* SPI MSB First mode enable */ #define SPI_CR_MSB_FIRST_EN ((uint32_t) 0) /*Data will be transmitted and received in standard order (MSB first).*/ /* SPI LSB First mode enable */ #define SPI_CR_LSB_FIRST_EN ((uint32_t) (1 << 6)) /*Data will be transmitted and received in reverse order (LSB first).*/ /* SPI interrupt enable */ #define SPI_CR_INT_EN ((uint32_t) (1 << 7)) /* SPI STAT Register BitMask */ #define SPI_SR_BITMASK ((uint32_t) 0xF8) /* Slave abort Flag */ #define SPI_SR_ABRT ((uint32_t) (1 << 3)) /* When 1, this bit indicates that a slave abort has occurred. */ /* Mode fault Flag */ #define SPI_SR_MODF ((uint32_t) (1 << 4)) /* when 1, this bit indicates that a Mode fault error has occurred. */ /* Read overrun flag*/ #define SPI_SR_ROVR ((uint32_t) (1 << 5)) /* When 1, this bit indicates that a read overrun has occurred. */ /* Write collision flag. */ #define SPI_SR_WCOL ((uint32_t) (1 << 6)) /* When 1, this bit indicates that a write collision has occurred.. */ /* SPI transfer complete flag. */ #define SPI_SR_SPIF ((uint32_t) (1 << 7)) /* When 1, this bit indicates when a SPI data transfer is complete.. */ /**SPI error flag */ #define SPI_SR_ERROR (SPI_SR_ABRT | SPI_SR_MODF | SPI_SR_ROVR | SPI_SR_WCOL) /* Enable SPI Test Mode */ #define SPI_TCR_TEST(n) ((uint32_t) ((n & 0x3F) << 1)) /* SPI interrupt flag */ #define SPI_INT_SPIF ((uint32_t) (1 << 0)) /* Receiver Data */ #define SPI_DR_DATA(n) ((uint32_t) ((n) & 0xFFFF)) /* SPI Mode*/ typedef enum LPC_SPI_MODE { SPI_MODE_MASTER = SPI_CR_MASTER_EN, /* Master Mode */ SPI_MODE_SLAVE = SPI_CR_SLAVE_EN, /* Slave Mode */ } LPC_SPI_MODE_T; /* SPI Clock Mode*/ typedef enum LPC_SPI_CLOCK_MODE { SPI_CLOCK_CPHA0_CPOL0 = SPI_CR_CPOL_LO | SPI_CR_CPHA_FIRST, /**< CPHA = 0, CPOL = 0 */ SPI_CLOCK_CPHA0_CPOL1 = SPI_CR_CPOL_HI | SPI_CR_CPHA_FIRST, /**< CPHA = 0, CPOL = 1 */ SPI_CLOCK_CPHA1_CPOL0 = SPI_CR_CPOL_LO | SPI_CR_CPHA_SECOND, /**< CPHA = 1, CPOL = 0 */ SPI_CLOCK_CPHA1_CPOL1 = SPI_CR_CPOL_HI | SPI_CR_CPHA_SECOND, /**< CPHA = 1, CPOL = 1 */ SPI_CLOCK_MODE0 = SPI_CLOCK_CPHA0_CPOL0, /**< alias */ SPI_CLOCK_MODE1 = SPI_CLOCK_CPHA1_CPOL0, /**< alias */ SPI_CLOCK_MODE2 = SPI_CLOCK_CPHA0_CPOL1, /**< alias */ SPI_CLOCK_MODE3 = SPI_CLOCK_CPHA1_CPOL1, /**< alias */ } LPC_SPI_CLOCK_MODE_T; /* SPI Data Order Mode*/ typedef enum LPC_SPI_DATA_ORDER { SPI_DATA_MSB_FIRST = SPI_CR_MSB_FIRST_EN, /* Standard Order */ SPI_DATA_LSB_FIRST = SPI_CR_LSB_FIRST_EN, /* Reverse Order */ } LPC_SPI_DATA_ORDER_T; /** * @brief Serial GPIO register block structure */ #define LPC_SGPIO_BASE 0x40101000 typedef struct { /*!< SGPIO Structure */ __IO uint32_t OUT_MUX_CFG[16]; /*!< Pin multiplexer configurationregisters. */ __IO uint32_t SGPIO_MUX_CFG[16]; /*!< SGPIO multiplexer configuration registers. */ __IO uint32_t SLICE_MUX_CFG[16]; /*!< Slice multiplexer configuration registers. */ __IO uint32_t REG[16]; /*!< Slice data registers. Eachtime COUNT0 reaches 0x0 the register shifts loading bit 31 withdata captured from DIN(n). DOUT(n) is set to REG(0) */ __IO uint32_t REG_SS[16]; /*!< Slice data shadow registers. Each time POSreaches 0x0 the contents of REG_SS is exchanged with the contentof REG */ __IO uint32_t PRESET[16]; /*!< Reload valueof COUNT0, loaded when COUNT0 reaches 0x0 */ __IO uint32_t COUNT[16]; /*!< Down counter, counts down each clock cycle. */ __IO uint32_t POS[16]; /*!< Each time COUNT0 reaches 0x0 */ __IO uint32_t MASK_A; /*!< Mask for pattern match function of slice A */ __IO uint32_t MASK_H; /*!< Mask for pattern match function of slice H */ __IO uint32_t MASK_I; /*!< Mask for pattern match function of slice I */ __IO uint32_t MASK_P; /*!< Mask for pattern match function of slice P */ __I uint32_t GPIO_INREG; /*!< GPIO input status register */ __IO uint32_t GPIO_OUTREG; /*!< GPIO output control register */ __IO uint32_t GPIO_OENREG; /*!< GPIO OE control register */ __IO uint32_t CTRL_ENABLED; /*!< Enables the slice COUNT counter */ __IO uint32_t CTRL_DISABLED; /*!< Disables the slice COUNT counter */ __I uint32_t RESERVED0[823]; __O uint32_t CLR_EN_0; /*!< Shift clock interrupt clear mask */ __O uint32_t SET_EN_0; /*!< Shift clock interrupt set mask */ __I uint32_t ENABLE_0; /*!< Shift clock interrupt enable */ __I uint32_t STATUS_0; /*!< Shift clock interrupt status */ __O uint32_t CTR_STATUS_0; /*!< Shift clock interrupt clear status */ __O uint32_t SET_STATUS_0; /*!< Shift clock interrupt set status */ __I uint32_t RESERVED1[2]; __O uint32_t CLR_EN_1; /*!< Capture clock interrupt clear mask */ __O uint32_t SET_EN_1; /*!< Capture clock interrupt set mask */ __I uint32_t ENABLE_1; /*!< Capture clock interrupt enable */ __I uint32_t STATUS_1; /*!< Capture clock interrupt status */ __O uint32_t CTR_STATUS_1; /*!< Capture clock interrupt clear status */ __O uint32_t SET_STATUS_1; /*!< Capture clock interrupt set status */ __I uint32_t RESERVED2[2]; __O uint32_t CLR_EN_2; /*!< Pattern match interrupt clear mask */ __O uint32_t SET_EN_2; /*!< Pattern match interrupt set mask */ __I uint32_t ENABLE_2; /*!< Pattern match interrupt enable */ __I uint32_t STATUS_2; /*!< Pattern match interrupt status */ __O uint32_t CTR_STATUS_2; /*!< Pattern match interrupt clear status */ __O uint32_t SET_STATUS_2; /*!< Pattern match interrupt set status */ __I uint32_t RESERVED3[2]; __O uint32_t CLR_EN_3; /*!< Input interrupt clear mask */ __O uint32_t SET_EN_3; /*!< Input bit match interrupt set mask */ __I uint32_t ENABLE_3; /*!< Input bit match interrupt enable */ __I uint32_t STATUS_3; /*!< Input bit match interrupt status */ __O uint32_t CTR_STATUS_3; /*!< Input bit match interrupt clear status */ __O uint32_t SET_STATUS_3; /*!< Shift clock interrupt set status */ } LPC_SGPIO_T; /* End of section using anonymous unions */ #if defined(__ARMCC_VERSION) #pragma pop #elif defined(__CWCC__) #pragma pop #elif defined(__IAR_SYSTEMS_ICC__) //#pragma pop // FIXME not usable for IAR #else /* defined(__GNUC__) and others */ /* Leave anonymous unions enabled */ #endif /** * @brief LPC43xx Peripheral register set declarations */ #define LPC_SCT ((LPC_SCT_T *) LPC_SCT_BASE) #define LPC_GPDMA ((LPC_GPDMA_T *) LPC_GPDMA_BASE) #define LPC_SDMMC ((LPC_SDMMC_T *) LPC_SDMMC_BASE) #define LPC_EMC ((LPC_EMC_T *) LPC_EMC_BASE) #define LPC_USB0 ((LPC_USBHS_T *) LPC_USB0_BASE) #define LPC_USB1 ((LPC_USBHS_T *) LPC_USB1_BASE) #define LPC_LCD ((LPC_LCD_T *) LPC_LCD_BASE) #define LPC_EEPROM ((LPC_EEPROM_T *) LPC_EEPROM_BASE) #define LPC_ETHERNET ((LPC_ENET_T *) LPC_ETHERNET_BASE) #define LPC_ATIMER ((LPC_ATIMER_T *) LPC_ATIMER_BASE) #define LPC_REGFILE ((LPC_REGFILE_T *) LPC_REGFILE_BASE) #define LPC_PMC ((LPC_PMC_T *) LPC_PMC_BASE) #define LPC_CREG ((LPC_CREG_T *) LPC_CREG_BASE) #define LPC_EVRT ((LPC_EVRT_T *) LPC_EVRT_BASE) #define LPC_RTC ((LPC_RTC_T *) LPC_RTC_BASE) #define LPC_CGU ((LPC_CGU_T *) LPC_CGU_BASE) #define LPC_CCU1 ((LPC_CCU1_T *) LPC_CCU1_BASE) #define LPC_CCU2 ((LPC_CCU2_T *) LPC_CCU2_BASE) #define LPC_RGU ((LPC_RGU_T *) LPC_RGU_BASE) #define LPC_WWDT ((LPC_WWDT_T *) LPC_WWDT_BASE) #define LPC_USART0 ((LPC_USART_T *) LPC_USART0_BASE) #define LPC_USART2 ((LPC_USART_T *) LPC_USART2_BASE) #define LPC_USART3 ((LPC_USART_T *) LPC_USART3_BASE) #define LPC_UART1 ((LPC_USART_T *) LPC_UART1_BASE) #define LPC_SSP0 ((LPC_SSP_T *) LPC_SSP0_BASE) #define LPC_SSP1 ((LPC_SSP_T *) LPC_SSP1_BASE) #define LPC_TIMER0 ((LPC_TIMER_T *) LPC_TIMER0_BASE) #define LPC_TIMER1 ((LPC_TIMER_T *) LPC_TIMER1_BASE) #define LPC_TIMER2 ((LPC_TIMER_T *) LPC_TIMER2_BASE) #define LPC_TIMER3 ((LPC_TIMER_T *) LPC_TIMER3_BASE) #define LPC_SCU ((LPC_SCU_T *) LPC_SCU_BASE) #define LPC_GPIO_PIN_INT ((LPC_GPIOPININT_T *) LPC_GPIO_PIN_INT_BASE) #define LPC_GPIO_GROUP_INT0 ((IP_GPIOGROUPINT_T *) LPC_GPIO_GROUP_INT0_BASE) #define LPC_GPIO_GROUP_INT1 ((IP_GPIOGROUPINT_T *) LPC_GPIO_GROUP_INT1_BASE) #define LPC_MCPWM ((LPC_MCPWM_T *) LPC_MCPWM_BASE) #define LPC_I2C0 ((LPC_I2C_T *) LPC_I2C0_BASE) #define LPC_I2C1 ((LPC_I2C_T *) LPC_I2C1_BASE) #define LPC_I2S0 ((LPC_I2S_T *) LPC_I2S0_BASE) #define LPC_I2S1 ((LPC_I2S_T *) LPC_I2S1_BASE) #define LPC_C_CAN1 ((LPC_CCAN_T *) LPC_C_CAN1_BASE) #define LPC_RITIMER ((LPC_RITIMER_T *) LPC_RITIMER_BASE) #define LPC_QEI ((LPC_QEI_T *) LPC_QEI_BASE) #define LPC_GIMA ((LPC_GIMA_T *) LPC_GIMA_BASE) #define LPC_DAC ((LPC_DAC_T *) LPC_DAC_BASE) #define LPC_C_CAN0 ((LPC_CCAN_T *) LPC_C_CAN0_BASE) #define LPC_ADC0 ((LPC_ADC_T *) LPC_ADC0_BASE) #define LPC_ADC1 ((LPC_ADC_T *) LPC_ADC1_BASE) #define LPC_GPIO_PORT ((LPC_GPIO_T *) LPC_GPIO_PORT_BASE) #define LPC_SPI ((LPC_SPI_T *) LPC_SPI_BASE) #define LPC_SGPIO ((LPC_SGPIO_T *) LPC_SGPIO_BASE) /** * @} */ #ifdef __cplusplus } #endif #endif /* __LPC43XX_H */