/* ** ################################################################### ** Compilers: ARM Compiler ** Freescale C/C++ for Embedded ARM ** GNU C Compiler ** IAR ANSI C/C++ Compiler for ARM ** ** Reference manuals: K20P64M50SF0RM Rev. 1, Oct 2011 ** K20P32M50SF0RM Rev. 1, Oct 2011 ** K20P48M50SF0RM Rev. 1, Oct 2011 ** ** Version: rev. 1.0, 2011-12-15 ** ** Abstract: ** CMSIS Peripheral Access Layer for MK20D5 ** ** Copyright: 1997 - 2011 Freescale Semiconductor, Inc. All Rights Reserved. ** ** http: www.freescale.com ** mail: support@freescale.com ** ** Revisions: ** - rev. 1.0 (2011-12-15) ** Initial version ** ** ################################################################### */ /** * @file MK20D5.h * @version 1.0 * @date 2011-12-15 * @brief CMSIS Peripheral Access Layer for MK20D5 * * CMSIS Peripheral Access Layer for MK20D5 */ #if !defined(MK20D5_H_) #define MK20D5_H_ /**< Symbol preventing repeated inclusion */ /** Memory map major version (memory maps with equal major version number are * compatible) */ #define MCU_MEM_MAP_VERSION 0x0100u /** Memory map minor version */ #define MCU_MEM_MAP_VERSION_MINOR 0x0000u /** * @brief Macro to access a single bit of a peripheral register (bit band region * 0x40000000 to 0x400FFFFF) using the bit-band alias region access. * @param Reg Register to access. * @param Bit Bit number to access. * @return Value of the targeted bit in the bit band region. */ #define BITBAND_REG(Reg,Bit) (*((uint32_t volatile*)(0x42000000u + (32u*((uint32_t)&(Reg) - (uint32_t)0x40000000u)) + (4u*((uint32_t)(Bit)))))) /* ---------------------------------------------------------------------------- -- Interrupt vector numbers ---------------------------------------------------------------------------- */ /** * @addtogroup Interrupt_vector_numbers Interrupt vector numbers * @{ */ /** Interrupt Number Definitions */ typedef enum IRQn { /* Core interrupts */ NonMaskableInt_IRQn = -14, /**< Non Maskable Interrupt */ MemoryManagement_IRQn = -12, /**< Cortex-M4 Memory Management Interrupt */ BusFault_IRQn = -11, /**< Cortex-M4 Bus Fault Interrupt */ UsageFault_IRQn = -10, /**< Cortex-M4 Usage Fault Interrupt */ SVCall_IRQn = -5, /**< Cortex-M4 SV Call Interrupt */ DebugMonitor_IRQn = -4, /**< Cortex-M4 Debug Monitor Interrupt */ PendSV_IRQn = -2, /**< Cortex-M4 Pend SV Interrupt */ SysTick_IRQn = -1, /**< Cortex-M4 System Tick Interrupt */ /* Device specific interrupts */ DMA0_IRQn = 0, /**< DMA channel 0 transfer complete interrupt */ DMA1_IRQn = 1, /**< DMA channel 1 transfer complete interrupt */ DMA2_IRQn = 2, /**< DMA channel 2 transfer complete interrupt */ DMA3_IRQn = 3, /**< DMA channel 3 transfer complete interrupt */ DMA_Error_IRQn = 4, /**< DMA error interrupt */ Reserved21_IRQn = 5, /**< Reserved interrupt 21 */ FTFL_IRQn = 6, /**< FTFL interrupt */ Read_Collision_IRQn = 7, /**< Read collision interrupt */ LVD_LVW_IRQn = 8, /**< Low Voltage Detect, Low Voltage Warning */ LLW_IRQn = 9, /**< Low Leakage Wakeup */ Watchdog_IRQn = 10, /**< WDOG interrupt */ I2C0_IRQn = 11, /**< I2C0 interrupt */ SPI0_IRQn = 12, /**< SPI0 interrupt */ I2S0_Tx_IRQn = 13, /**< I2S0 transmit interrupt */ I2S0_Rx_IRQn = 14, /**< I2S0 receive interrupt */ UART0_LON_IRQn = 15, /**< UART0 LON interrupt */ UART0_RX_TX_IRQn = 16, /**< UART0 receive/transmit interrupt */ UART0_ERR_IRQn = 17, /**< UART0 error interrupt */ UART1_RX_TX_IRQn = 18, /**< UART1 receive/transmit interrupt */ UART1_ERR_IRQn = 19, /**< UART1 error interrupt */ UART2_RX_TX_IRQn = 20, /**< UART2 receive/transmit interrupt */ UART2_ERR_IRQn = 21, /**< UART2 error interrupt */ ADC0_IRQn = 22, /**< ADC0 interrupt */ CMP0_IRQn = 23, /**< CMP0 interrupt */ CMP1_IRQn = 24, /**< CMP1 interrupt */ FTM0_IRQn = 25, /**< FTM0 fault, overflow and channels interrupt */ FTM1_IRQn = 26, /**< FTM1 fault, overflow and channels interrupt */ CMT_IRQn = 27, /**< CMT interrupt */ RTC_IRQn = 28, /**< RTC interrupt */ RTC_Seconds_IRQn = 29, /**< RTC seconds interrupt */ PIT0_IRQn = 30, /**< PIT timer channel 0 interrupt */ PIT1_IRQn = 31, /**< PIT timer channel 1 interrupt */ PIT2_IRQn = 32, /**< PIT timer channel 2 interrupt */ PIT3_IRQn = 33, /**< PIT timer channel 3 interrupt */ PDB0_IRQn = 34, /**< PDB0 interrupt */ USB0_IRQn = 35, /**< USB0 interrupt */ USBDCD_IRQn = 36, /**< USBDCD interrupt */ TSI0_IRQn = 37, /**< TSI0 interrupt */ MCG_IRQn = 38, /**< MCG interrupt */ LPTimer_IRQn = 39, /**< LPTimer interrupt */ PORTA_IRQn = 40, /**< Port A interrupt */ PORTB_IRQn = 41, /**< Port B interrupt */ PORTC_IRQn = 42, /**< Port C interrupt */ PORTD_IRQn = 43, /**< Port D interrupt */ PORTE_IRQn = 44, /**< Port E interrupt */ SWI_IRQn = 45 /**< Software interrupt */ } IRQn_Type; /** * @} */ /* end of group Interrupt_vector_numbers */ /* ---------------------------------------------------------------------------- -- Cortex M4 Core Configuration ---------------------------------------------------------------------------- */ /** * @addtogroup Cortex_Core_Configuration Cortex M4 Core Configuration * @{ */ #define __MPU_PRESENT 0 /**< Defines if an MPU is present or not */ #define __NVIC_PRIO_BITS 4 /**< Number of priority bits implemented in the NVIC */ #define __Vendor_SysTickConfig 0 /**< Vendor specific implementation of SysTickConfig is defined */ #include "core_cm4.h" /* Core Peripheral Access Layer */ #include "system_MK20D5.h" /* Device specific configuration file */ /** * @} */ /* end of group Cortex_Core_Configuration */ /* ---------------------------------------------------------------------------- -- Device Peripheral Access Layer ---------------------------------------------------------------------------- */ /** * @addtogroup Peripheral_access_layer Device Peripheral Access Layer * @{ */ /* ** Start of section using anonymous unions */ #if defined(__ARMCC_VERSION) #pragma push #pragma anon_unions #elif defined(__CWCC__) #pragma push #pragma cpp_extensions on #elif defined(__GNUC__) /* anonymous unions are enabled by default */ #elif defined(__IAR_SYSTEMS_ICC__) #pragma language=extended #else #error Not supported compiler type #endif /* ---------------------------------------------------------------------------- -- ADC Peripheral Access Layer ---------------------------------------------------------------------------- */ /** * @addtogroup ADC_Peripheral_Access_Layer ADC Peripheral Access Layer * @{ */ /** ADC - Register Layout Typedef */ typedef struct { __IO uint32_t SC1[2]; /**< ADC status and control registers 1, array offset: 0x0, array step: 0x4 */ __IO uint32_t CFG1; /**< ADC configuration register 1, offset: 0x8 */ __IO uint32_t CFG2; /**< Configuration register 2, offset: 0xC */ __I uint32_t R[2]; /**< ADC data result register, array offset: 0x10, array step: 0x4 */ __IO uint32_t CV1; /**< Compare value registers, offset: 0x18 */ __IO uint32_t CV2; /**< Compare value registers, offset: 0x1C */ __IO uint32_t SC2; /**< Status and control register 2, offset: 0x20 */ __IO uint32_t SC3; /**< Status and control register 3, offset: 0x24 */ __IO uint32_t OFS; /**< ADC offset correction register, offset: 0x28 */ __IO uint32_t PG; /**< ADC plus-side gain register, offset: 0x2C */ __IO uint32_t MG; /**< ADC minus-side gain register, offset: 0x30 */ __IO uint32_t CLPD; /**< ADC plus-side general calibration value register, offset: 0x34 */ __IO uint32_t CLPS; /**< ADC plus-side general calibration value register, offset: 0x38 */ __IO uint32_t CLP4; /**< ADC plus-side general calibration value register, offset: 0x3C */ __IO uint32_t CLP3; /**< ADC plus-side general calibration value register, offset: 0x40 */ __IO uint32_t CLP2; /**< ADC plus-side general calibration value register, offset: 0x44 */ __IO uint32_t CLP1; /**< ADC plus-side general calibration value register, offset: 0x48 */ __IO uint32_t CLP0; /**< ADC plus-side general calibration value register, offset: 0x4C */ uint8_t RESERVED_0[4]; __IO uint32_t CLMD; /**< ADC minus-side general calibration value register, offset: 0x54 */ __IO uint32_t CLMS; /**< ADC minus-side general calibration value register, offset: 0x58 */ __IO uint32_t CLM4; /**< ADC minus-side general calibration value register, offset: 0x5C */ __IO uint32_t CLM3; /**< ADC minus-side general calibration value register, offset: 0x60 */ __IO uint32_t CLM2; /**< ADC minus-side general calibration value register, offset: 0x64 */ __IO uint32_t CLM1; /**< ADC minus-side general calibration value register, offset: 0x68 */ __IO uint32_t CLM0; /**< ADC minus-side general calibration value register, offset: 0x6C */ } ADC_Type; /* ---------------------------------------------------------------------------- -- ADC Register Masks ---------------------------------------------------------------------------- */ /** * @addtogroup ADC_Register_Masks ADC Register Masks * @{ */ /* SC1 Bit Fields */ #define ADC_SC1_ADCH_MASK 0x1Fu #define ADC_SC1_ADCH_SHIFT 0 #define ADC_SC1_ADCH(x) (((uint32_t)(((uint32_t)(x))<