/* * Copyright (C) 2013-2016 Fabio Utzig, http://fabioutzig.com * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ #ifndef _KL2xZ_H_ #define _KL2xZ_H_ /* * Include the correct MCU specific header */ #if defined(KL25) /* MKL25Z* MCUs */ #include "kl25z.h" #elif defined(KL26) /* MKL26Z* MCUs */ #include "kl26z.h" #elif defined(KL27Zxxx) /* MKL25Z128* and MKL27Z256* MCUs */ #include "kl27zxxx.h" #elif defined(KL27Zxx) /* MKL25Z32* and MKL27Z64* MCUs */ #include "kl27zxx.h" #else #error Please select a supported target MCU in your board.h #endif /* * ============================================================== * ---------- Interrupt Number Definition ----------------------- * ============================================================== */ /* Device dependent */ /* * ========================================================================== * ----------- Processor and Core Peripheral Section ------------------------ * ========================================================================== */ typedef struct { __IO uint32_t SOPT1; __IO uint32_t SOPT1CFG; uint32_t RESERVED0[1023]; __IO uint32_t SOPT2; __I uint32_t RESERVED1[1]; __IO uint32_t SOPT4; __IO uint32_t SOPT5; uint32_t RESERVED2[1]; __IO uint32_t SOPT7; uint32_t RESERVED3[2]; __IO uint32_t SDID; uint32_t RESERVED4[3]; __IO uint32_t SCGC4; __IO uint32_t SCGC5; __IO uint32_t SCGC6; __IO uint32_t SCGC7; __IO uint32_t CLKDIV1; uint32_t RESERVED5[1]; __IO uint32_t FCFG1; __IO uint32_t FCFG2; uint32_t RESERVED6[1]; __IO uint32_t UIDMH; __IO uint32_t UIDML; __IO uint32_t UIDL; uint32_t RESERVED7[39]; __IO uint32_t COPC; __IO uint32_t SRVCOP; } SIM_TypeDef; typedef struct { __IO uint8_t PE1; __IO uint8_t PE2; __IO uint8_t PE3; __IO uint8_t PE4; __IO uint8_t ME; __IO uint8_t F1; __IO uint8_t F2; __I uint8_t F3; __IO uint8_t FILT1; __IO uint8_t FILT2; } LLWU_TypeDef; typedef struct { __IO uint32_t PCR[32]; __IO uint32_t GPCLR; __IO uint32_t GPCHR; uint32_t RESERVED0[6]; __IO uint32_t ISFR; } PORT_TypeDef; /* Device dependent MCG_TypeDef; */ typedef struct { __IO uint8_t CR; } OSC_TypeDef; typedef struct { __IO uint32_t SAR; __IO uint32_t DAR; __IO uint32_t DSR_BCR; __IO uint32_t DCR; } DMAChannel_TypeDef; typedef struct { DMAChannel_TypeDef ch[4]; } DMA_TypeDef; typedef struct { __IO uint8_t CHCFG[4]; } DMAMUX_TypeDef; typedef struct { __IO uint32_t MCR; /* PIT Module Control Register */ __I uint32_t LTMR64H; /* PIT Module Control Register */ __I uint32_t LTMR64L; /* PIT Lower Lifetime Timer Register */ uint8_t RESERVED0[244]; struct PIT_CHANNEL { __IO uint32_t LDVAL; /* Timer Load Value Register */ __I uint32_t CVAL; /* Current Timer Value Register */ __IO uint32_t TCTRL; /* Timer Control Register */ __IO uint32_t TFLG; /* Timer Flag Register */ } CHANNEL[2]; } PIT_TypeDef; /* Device dependent TPM_TypeDef; */ typedef struct { __IO uint32_t SC1A; // ADC Status and Control Registers 1 __IO uint32_t SC1B; // ADC Status and Control Registers 1 __IO uint32_t CFG1; // ADC Configuration Register 1 __IO uint32_t CFG2; // ADC Configuration Register 2 __I uint32_t RA; // ADC Data Result Register __I uint32_t RB; // ADC Data Result Register __IO uint32_t CV1; // Compare Value Registers __IO uint32_t CV2; // Compare Value Registers __IO uint32_t SC2; // Status and Control Register 2 __IO uint32_t SC3; // Status and Control Register 3 __IO uint32_t OFS; // ADC Offset Correction Register __IO uint32_t PG; // ADC Plus-Side Gain Register __IO uint32_t MG; // ADC Minus-Side Gain Register __IO uint32_t CLPD; // ADC Plus-Side General Calibration Value Register __IO uint32_t CLPS; // ADC Plus-Side General Calibration Value Register __IO uint32_t CLP4; // ADC Plus-Side General Calibration Value Register __IO uint32_t CLP3; // ADC Plus-Side General Calibration Value Register __IO uint32_t CLP2; // ADC Plus-Side General Calibration Value Register __IO uint32_t CLP1; // ADC Plus-Side General Calibration Value Register __IO uint32_t CLP0; // ADC Plus-Side General Calibration Value Register uint32_t RESERVED0[1]; // ADC Minus-Side General Calibration Value Register __IO uint32_t CLMD; // ADC Minus-Side General Calibration Value Register __IO uint32_t CLMS; // ADC Minus-Side General Calibration Value Register __IO uint32_t CLM4; // ADC Minus-Side General Calibration Value Register __IO uint32_t CLM3; // ADC Minus-Side General Calibration Value Register __IO uint32_t CLM2; // ADC Minus-Side General Calibration Value Register __IO uint32_t CLM1; // ADC Minus-Side General Calibration Value Register __IO uint32_t CLM0; // ADC Minus-Side General Calibration Value Register } ADC_TypeDef; typedef struct { __IO uint32_t CSR; __IO uint32_t PSR; __IO uint32_t CMR; __I uint32_t CNR; } LPTMR_TypeDef; /* Device dependent (TSI or FlexIO) TSI_TypeDef; */ typedef struct { __IO uint32_t PDOR; __IO uint32_t PSOR; __IO uint32_t PCOR; __IO uint32_t PTOR; __IO uint32_t PDIR; __IO uint32_t PDDR; } GPIO_TypeDef; /* Device dependent SPI_TypeDef; */ /* Device dependent I2C_TypeDef; */ /* Device dependent UART_TypeDef; */ /* Device dependent LPUART_Typedef; */ typedef struct { __IO uint8_t LVDSC1; __IO uint8_t LVDSC2; __IO uint8_t REGSC; } PMC_TypeDef; /* Device dependent USBOTG_TypeDef; */ /* Device dependent RCM_TypeDef; */ typedef struct { __IO uint8_t PMPROT; __IO uint8_t PMCTRL; __IO uint8_t STOPCTRL; __I uint8_t PMSTAT; } SMC_TypeDef; typedef struct { struct { __IO uint8_t DATL; __IO uint8_t DATH; } DAT[2]; uint8_t RESERVED0[28]; __IO uint8_t SR; __IO uint8_t C0; __IO uint8_t C1; __IO uint8_t C2; } DAC_TypeDef; typedef struct { __IO uint32_t TSR; __IO uint32_t TPR; __IO uint32_t TAR; __IO uint32_t TCR; __IO uint32_t CR; __IO uint32_t SR; __IO uint32_t LR; __IO uint32_t IER; } RTC_TypeDef; typedef struct { __IO uint8_t CR0; __IO uint8_t CR1; __IO uint8_t FPR; __IO uint8_t SCR; __IO uint8_t DACCR; __IO uint8_t MUXCR; } CMP_TypeDef; typedef struct { __IO uint8_t FSTAT; __IO uint8_t FCNFG; __I uint8_t FSEC; __I uint8_t FOPT; __IO uint8_t FCCOB3; __IO uint8_t FCCOB2; __IO uint8_t FCCOB1; __IO uint8_t FCCOB0; __IO uint8_t FCCOB7; __IO uint8_t FCCOB6; __IO uint8_t FCCOB5; __IO uint8_t FCCOB4; __IO uint8_t FCCOBB; __IO uint8_t FCCOBA; __IO uint8_t FCCOB9; __IO uint8_t FCCOB8; __IO uint8_t FPROT3; __IO uint8_t FPROT2; __IO uint8_t FPROT1; __IO uint8_t FPROT0; } FTFA_TypeDef; typedef struct { uint32_t RESERVED0[2]; __I uint16_t PLASC; // 0x08 __I uint16_t PLAMC; // 0x0A __IO uint32_t PLACR; // 0x0C uint32_t RESERVED1[12]; __IO uint32_t CPO; // 0x40 } MCM_TypeDef; /****************************************************************/ /* Peripheral memory map */ /****************************************************************/ /* Device dependent */ /****************************************************************/ /* Peripheral declaration */ /****************************************************************/ /* Device dependent */ /****************************************************************/ /* Peripheral Registers Bits Definition */ /****************************************************************/ /****************************************************************/ /* */ /* System Integration Module (SIM) */ /* */ /****************************************************************/ /* Device dependent */ /****************************************************************/ /* */ /* Low-Leakage Wakeup Unit (LLWU) */ /* */ /****************************************************************/ /********** Bits definition for LLWU_PE1 register *************/ #define LLWU_PE1_WUPE3_SHIFT 6 /*!< Wakeup Pin Enable for LLWU_P3 (shift) */ #define LLWU_PE1_WUPE3_MASK ((uint8_t)((uint8_t)0x03 << LLWU_PE1_WUPE3_SHIFT)) /*!< Wakeup Pin Enable for LLWU_P3 (mask) */ #define LLWU_PE1_WUPE3(x) ((uint8_t)(((uint8_t)(x) << LLWU_PE1_WUPE3_SHIFT) & LLWU_PE1_WUPE3_MASK)) /*!< Wakeup Pin Enable for LLWU_P3 */ #define LLWU_PE1_WUPE2_SHIFT 4 /*!< Wakeup Pin Enable for LLWU_P2 (shift) */ #define LLWU_PE1_WUPE2_MASK ((uint8_t)((uint8_t)0x03 << LLWU_PE1_WUPE2_SHIFT)) /*!< Wakeup Pin Enable for LLWU_P2 (mask) */ #define LLWU_PE1_WUPE2(x) ((uint8_t)(((uint8_t)(x) << LLWU_PE1_WUPE2_SHIFT) & LLWU_PE1_WUPE2_MASK)) /*!< Wakeup Pin Enable for LLWU_P2 */ #define LLWU_PE1_WUPE1_SHIFT 2 /*!< Wakeup Pin Enable for LLWU_P1 (shift) */ #define LLWU_PE1_WUPE1_MASK ((uint8_t)((uint8_t)0x03 << LLWU_PE1_WUPE1_SHIFT)) /*!< Wakeup Pin Enable for LLWU_P1 (mask) */ #define LLWU_PE1_WUPE1(x) ((uint8_t)(((uint8_t)(x) << LLWU_PE1_WUPE1_SHIFT) & LLWU_PE1_WUPE1_MASK)) /*!< Wakeup Pin Enable for LLWU_P1 */ #define LLWU_PE1_WUPE0_SHIFT 0 /*!< Wakeup Pin Enable for LLWU_P0 (shift) */ #define LLWU_PE1_WUPE0_MASK ((uint8_t)((uint8_t)0x03 << LLWU_PE1_WUPE0_SHIFT)) /*!< Wakeup Pin Enable for LLWU_P0 (mask) */ #define LLWU_PE1_WUPE0(x) ((uint8_t)(((uint8_t)(x) << LLWU_PE1_WUPE0_SHIFT) & LLWU_PE1_WUPE0_MASK)) /*!< Wakeup Pin Enable for LLWU_P0 */ /********** Bits definition for LLWU_PE2 register *************/ #define LLWU_PE2_WUPE7_SHIFT 6 /*!< Wakeup Pin Enable for LLWU_P7 (shift) */ #define LLWU_PE2_WUPE7_MASK ((uint8_t)((uint8_t)0x03 << LLWU_PE2_WUPE7_SHIFT)) /*!< Wakeup Pin Enable for LLWU_P7 (mask) */ #define LLWU_PE2_WUPE7(x) ((uint8_t)(((uint8_t)(x) << LLWU_PE2_WUPE7_SHIFT) & LLWU_PE2_WUPE7_MASK)) /*!< Wakeup Pin Enable for LLWU_P7 */ #define LLWU_PE2_WUPE6_SHIFT 4 /*!< Wakeup Pin Enable for LLWU_P6 (shift) */ #define LLWU_PE2_WUPE6_MASK ((uint8_t)((uint8_t)0x03 << LLWU_PE2_WUPE6_SHIFT)) /*!< Wakeup Pin Enable for LLWU_P6 (mask) */ #define LLWU_PE2_WUPE6(x) ((uint8_t)(((uint8_t)(x) << LLWU_PE2_WUPE6_SHIFT) & LLWU_PE2_WUPE6_MASK)) /*!< Wakeup Pin Enable for LLWU_P6 */ #define LLWU_PE2_WUPE5_SHIFT 2 /*!< Wakeup Pin Enable for LLWU_P5 (shift) */ #define LLWU_PE2_WUPE5_MASK ((uint8_t)((uint8_t)0x03 << LLWU_PE2_WUPE5_SHIFT)) /*!< Wakeup Pin Enable for LLWU_P5 (mask) */ #define LLWU_PE2_WUPE5(x) ((uint8_t)(((uint8_t)(x) << LLWU_PE2_WUPE5_SHIFT) & LLWU_PE2_WUPE5_MASK)) /*!< Wakeup Pin Enable for LLWU_P5 */ #define LLWU_PE2_WUPE4_SHIFT 0 /*!< Wakeup Pin Enable for LLWU_P4 (shift) */ #define LLWU_PE2_WUPE4_MASK ((uint8_t)((uint8_t)0x03 << LLWU_PE2_WUPE4_SHIFT)) /*!< Wakeup Pin Enable for LLWU_P4 (mask) */ #define LLWU_PE2_WUPE4(x) ((uint8_t)(((uint8_t)(x) << LLWU_PE2_WUPE4_SHIFT) & LLWU_PE2_WUPE4_MASK)) /*!< Wakeup Pin Enable for LLWU_P4 */ /********** Bits definition for LLWU_PE3 register *************/ #define LLWU_PE3_WUPE11_SHIFT 6 /*!< Wakeup Pin Enable for LLWU_P11 (shift) */ #define LLWU_PE3_WUPE11_MASK ((uint8_t)((uint8_t)0x03 << LLWU_PE3_WUPE11_SHIFT)) /*!< Wakeup Pin Enable for LLWU_P11 (mask) */ #define LLWU_PE3_WUPE11(x) ((uint8_t)(((uint8_t)(x) << LLWU_PE3_WUPE11_SHIFT) & LLWU_PE3_WUPE11_MASK)) /*!< Wakeup Pin Enable for LLWU_P11 */ #define LLWU_PE3_WUPE10_SHIFT 4 /*!< Wakeup Pin Enable for LLWU_P10 (shift) */ #define LLWU_PE3_WUPE10_MASK ((uint8_t)((uint8_t)0x03 << LLWU_PE3_WUPE10_SHIFT)) /*!< Wakeup Pin Enable for LLWU_P10 (mask) */ #define LLWU_PE3_WUPE10(x) ((uint8_t)(((uint8_t)(x) << LLWU_PE3_WUPE10_SHIFT) & LLWU_PE3_WUPE10_MASK)) /*!< Wakeup Pin Enable for LLWU_P10 */ #define LLWU_PE3_WUPE13_SHIFT 2 /*!< Wakeup Pin Enable for LLWU_P9 (shift) */ #define LLWU_PE3_WUPE13_MASK ((uint8_t)((uint8_t)0x03 << LLWU_PE3_WUPE13_SHIFT)) /*!< Wakeup Pin Enable for LLWU_P9 (mask) */ #define LLWU_PE3_WUPE13(x) ((uint8_t)(((uint8_t)(x) << LLWU_PE3_WUPE13_SHIFT) & LLWU_PE3_WUPE13_MASK)) /*!< Wakeup Pin Enable for LLWU_P9 */ #define LLWU_PE3_WUPE8_SHIFT 0 /*!< Wakeup Pin Enable for LLWU_P8 (shift) */ #define LLWU_PE3_WUPE8_MASK ((uint8_t)((uint8_t)0x03 << LLWU_PE3_WUPE8_SHIFT)) /*!< Wakeup Pin Enable for LLWU_P8 (mask) */ #define LLWU_PE3_WUPE8(x) ((uint8_t)(((uint8_t)(x) << LLWU_PE3_WUPE8_SHIFT) & LLWU_PE3_WUPE8_MASK)) /*!< Wakeup Pin Enable for LLWU_P8 */ /********** Bits definition for LLWU_PE4 register *************/ #define LLWU_PE4_WUPE15_SHIFT 6 /*!< Wakeup Pin Enable for LLWU_P15 (shift) */ #define LLWU_PE4_WUPE15_MASK ((uint8_t)((uint8_t)0x03 << LLWU_PE4_WUPE15_SHIFT)) /*!< Wakeup Pin Enable for LLWU_P15 (mask) */ #define LLWU_PE4_WUPE15(x) ((uint8_t)(((uint8_t)(x) << LLWU_PE4_WUPE15_SHIFT) & LLWU_PE4_WUPE15_MASK)) /*!< Wakeup Pin Enable for LLWU_P15 */ #define LLWU_PE4_WUPE14_SHIFT 4 /*!< Wakeup Pin Enable for LLWU_P14 (shift) */ #define LLWU_PE4_WUPE14_MASK ((uint8_t)((uint8_t)0x03 << LLWU_PE4_WUPE14_SHIFT)) /*!< Wakeup Pin Enable for LLWU_P14 (mask) */ #define LLWU_PE4_WUPE14(x) ((uint8_t)(((uint8_t)(x) << LLWU_PE4_WUPE14_SHIFT) & LLWU_PE4_WUPE14_MASK)) /*!< Wakeup Pin Enable for LLWU_P14 */ #define LLWU_PE4_WUPE13_SHIFT 2 /*!< Wakeup Pin Enable for LLWU_P13 (shift) */ #define LLWU_PE4_WUPE13_MASK ((uint8_t)((uint8_t)0x03 << LLWU_PE4_WUPE13_SHIFT)) /*!< Wakeup Pin Enable for LLWU_P13 (mask) */ #define LLWU_PE4_WUPE13(x) ((uint8_t)(((uint8_t)(x) << LLWU_PE4_WUPE13_SHIFT) & LLWU_PE4_WUPE13_MASK)) /*!< Wakeup Pin Enable for LLWU_P13 */ #define LLWU_PE4_WUPE12_SHIFT 0 /*!< Wakeup Pin Enable for LLWU_P12 (shift) */ #define LLWU_PE4_WUPE12_MASK ((uint8_t)((uint8_t)0x03 << LLWU_PE4_WUPE12_SHIFT)) /*!< Wakeup Pin Enable for LLWU_P12 (mask) */ #define LLWU_PE4_WUPE12(x) ((uint8_t)(((uint8_t)(x) << LLWU_PE4_WUPE12_SHIFT) & LLWU_PE4_WUPE12_MASK)) /*!< Wakeup Pin Enable for LLWU_P12 */ /********** Bits definition for LLWU_ME register *************/ #define LLWU_ME_WUME7 ((uint8_t)((uint8_t)1 << 7)) /*!< Wakeup Module Enable for Module 7 */ #define LLWU_ME_WUME6 ((uint8_t)((uint8_t)1 << 6)) /*!< Wakeup Module Enable for Module 6 */ #define LLWU_ME_WUME5 ((uint8_t)((uint8_t)1 << 5)) /*!< Wakeup Module Enable for Module 5 */ #define LLWU_ME_WUME4 ((uint8_t)((uint8_t)1 << 4)) /*!< Wakeup Module Enable for Module 4 */ #define LLWU_ME_WUME3 ((uint8_t)((uint8_t)1 << 3)) /*!< Wakeup Module Enable for Module 3 */ #define LLWU_ME_WUME2 ((uint8_t)((uint8_t)1 << 2)) /*!< Wakeup Module Enable for Module 2 */ #define LLWU_ME_WUME1 ((uint8_t)((uint8_t)1 << 1)) /*!< Wakeup Module Enable for Module 1 */ #define LLWU_ME_WUME0 ((uint8_t)((uint8_t)1 << 0)) /*!< Wakeup Module Enable for Module 0 */ /********** Bits definition for LLWU_F1 register *************/ #define LLWU_F1_WUF7 ((uint8_t)((uint8_t)1 << 7)) /*!< Wakeup Flag for LLWU_P7 */ #define LLWU_F1_WUF6 ((uint8_t)((uint8_t)1 << 6)) /*!< Wakeup Flag for LLWU_P6 */ #define LLWU_F1_WUF5 ((uint8_t)((uint8_t)1 << 5)) /*!< Wakeup Flag for LLWU_P5 */ #define LLWU_F1_WUF4 ((uint8_t)((uint8_t)1 << 4)) /*!< Wakeup Flag for LLWU_P4 */ #define LLWU_F1_WUF3 ((uint8_t)((uint8_t)1 << 3)) /*!< Wakeup Flag for LLWU_P3 */ #define LLWU_F1_WUF2 ((uint8_t)((uint8_t)1 << 2)) /*!< Wakeup Flag for LLWU_P2 */ #define LLWU_F1_WUF1 ((uint8_t)((uint8_t)1 << 1)) /*!< Wakeup Flag for LLWU_P1 */ #define LLWU_F1_WUF0 ((uint8_t)((uint8_t)1 << 0)) /*!< Wakeup Flag for LLWU_P0 */ /********** Bits definition for LLWU_F2 register *************/ #define LLWU_F2_WUF15 ((uint8_t)((uint8_t)1 << 7)) /*!< Wakeup Flag for LLWU_P15 */ #define LLWU_F2_WUF14 ((uint8_t)((uint8_t)1 << 6)) /*!< Wakeup Flag for LLWU_P14 */ #define LLWU_F2_WUF13 ((uint8_t)((uint8_t)1 << 5)) /*!< Wakeup Flag for LLWU_P13 */ #define LLWU_F2_WUF12 ((uint8_t)((uint8_t)1 << 4)) /*!< Wakeup Flag for LLWU_P12 */ #define LLWU_F2_WUF11 ((uint8_t)((uint8_t)1 << 3)) /*!< Wakeup Flag for LLWU_P11 */ #define LLWU_F2_WUF10 ((uint8_t)((uint8_t)1 << 2)) /*!< Wakeup Flag for LLWU_P10 */ #define LLWU_F2_WUF9 ((uint8_t)((uint8_t)1 << 1)) /*!< Wakeup Flag for LLWU_P9 */ #define LLWU_F2_WUF8 ((uint8_t)((uint8_t)1 << 0)) /*!< Wakeup Flag for LLWU_P8 */ /********** Bits definition for LLWU_F3 register *************/ #define LLWU_F3_MWUF7 ((uint8_t)((uint8_t)1 << 7)) /*!< Wakeup Flag for Module 7 */ #define LLWU_F3_MWUF6 ((uint8_t)((uint8_t)1 << 6)) /*!< Wakeup Flag for Module 6 */ #define LLWU_F3_MWUF5 ((uint8_t)((uint8_t)1 << 5)) /*!< Wakeup Flag for Module 5 */ #define LLWU_F3_MWUF4 ((uint8_t)((uint8_t)1 << 4)) /*!< Wakeup Flag for Module 4 */ #define LLWU_F3_MWUF3 ((uint8_t)((uint8_t)1 << 3)) /*!< Wakeup Flag for Module 3 */ #define LLWU_F3_MWUF2 ((uint8_t)((uint8_t)1 << 2)) /*!< Wakeup Flag for Module 2 */ #define LLWU_F3_MWUF1 ((uint8_t)((uint8_t)1 << 1)) /*!< Wakeup Flag for Module 1 */ #define LLWU_F3_MWUF0 ((uint8_t)((uint8_t)1 << 0)) /*!< Wakeup Flag for Module 0 */ /********** Bits definition for LLWU_FILT1 register *************/ #define LLWU_FILT1_FILTF ((uint8_t)((uint8_t)1 << 7)) /*!< Filter Detect Flag */ #define LLWU_FILT1_FILTE_SHIFT 5 /*!< Digital Filter on External Pin (shift) */ #define LLWU_FILT1_FILTE_MASK ((uint8_t)((uint8_t)0x03 << LLWU_FILT1_FILTE_SHIFT)) /*!< Digital Filter on External Pin (mask) */ #define LLWU_FILT1_FILTE(x) ((uint8_t)(((uint8_t)(x) << LLWU_FILT1_FILTE_SHIFT) & LLWU_FILT1_FILTE_MASK)) /*!< Digital Filter on External Pin */ #define LLWU_FILT1_FILTE_DISABLED LLWU_FILT1_FILTE(0) /*!< Filter disabled */ #define LLWU_FILT1_FILTE_POSEDGE LLWU_FILT1_FILTE(1) /*!< Filter posedge detect enabled */ #define LLWU_FILT1_FILTE_NEGEDGE LLWU_FILT1_FILTE(2) /*!< Filter negedge detect enabled */ #define LLWU_FILT1_FILTE_ANYEDGE LLWU_FILT1_FILTE(3) /*!< Filter any edge detect enabled */ #define LLWU_FILT1_FILTSEL_SHIFT 0 /*!< Filter Pin Select (LLWU_P0 ... LLWU_P15) (shift) */ #define LLWU_FILT1_FILTSEL_MASK ((uint8_t)((uint8_t)0x0F << LLWU_FILT1_FILTSEL_SHIFT)) /*!< Filter Pin Select (LLWU_P0 ... LLWU_P15) (mask) */ #define LLWU_FILT1_FILTSEL(x) ((uint8_t)(((uint8_t)(x) << LLWU_FILT1_FILTSEL_SHIFT) & LLWU_FILT1_FILTSEL_MASK)) /*!< Filter Pin Select (LLWU_P0 ... LLWU_P15) */ /********** Bits definition for LLWU_FILT2 register *************/ #define LLWU_FILT2_FILTF ((uint8_t)((uint8_t)1 << 7)) /*!< Filter Detect Flag */ #define LLWU_FILT2_FILTE_SHIFT 5 /*!< Digital Filter on External Pin (shift) */ #define LLWU_FILT2_FILTE_MASK ((uint8_t)((uint8_t)0x03 << LLWU_FILT2_FILTE_SHIFT)) /*!< Digital Filter on External Pin (mask) */ #define LLWU_FILT2_FILTE(x) ((uint8_t)(((uint8_t)(x) << LLWU_FILT2_FILTE_SHIFT) & LLWU_FILT2_FILTE_MASK)) /*!< Digital Filter on External Pin */ #define LLWU_FILT2_FILTE_DISABLED LLWU_FILT2_FILTE(0) /*!< Filter disabled */ #define LLWU_FILT2_FILTE_POSEDGE LLWU_FILT2_FILTE(1) /*!< Filter posedge detect enabled */ #define LLWU_FILT2_FILTE_NEGEDGE LLWU_FILT2_FILTE(2) /*!< Filter negedge detect enabled */ #define LLWU_FILT2_FILTE_ANYEDGE LLWU_FILT2_FILTE(3) /*!< Filter any edge detect enabled */ #define LLWU_FILT2_FILTSEL_SHIFT 0 /*!< Filter Pin Select (LLWU_P0 ... LLWU_P15) (shift) */ #define LLWU_FILT2_FILTSEL_MASK ((uint8_t)((uint8_t)0x0F << LLWU_FILT2_FILTSEL_SHIFT)) /*!< Filter Pin Select (LLWU_P0 ... LLWU_P15) (mask) */ #define LLWU_FILT2_FILTSEL(x) ((uint8_t)(((uint8_t)(x) << LLWU_FILT2_FILTSEL_SHIFT) & LLWU_FILT2_FILTSEL_MASK)) /*!< Filter Pin Select (LLWU_P0 ... LLWU_P15) */ /****************************************************************/ /* */ /* Port Control and interrupts (PORT) */ /* */ /****************************************************************/ /******** Bits definition for PORTx_PCRn register *************/ #define PORTx_PCRn_ISF ((uint32_t)0x01000000) /*!< Interrupt Status Flag */ #define PORTx_PCRn_IRQC_SHIFT 16 #define PORTx_PCRn_IRQC_MASK ((uint32_t)0x000F0000) /*!< Interrupt Configuration */ #define PORTx_PCRn_IRQC(x) ((uint32_t)(((uint32_t)(x) << PORTx_PCRn_IRQC_SHIFT) & PORTx_PCRn_IRQC_MASK)) #define PORTx_PCRn_MUX_SHIFT 8 /*!< Pin Mux Control (shift) */ #define PORTx_PCRn_MUX_MASK ((uint32_t)0x00000700) /*!< Pin Mux Control (mask) */ #define PORTx_PCRn_MUX(x) ((uint32_t)(((uint32_t)(x) << PORTx_PCRn_MUX_SHIFT) & PORTx_PCRn_MUX_MASK)) /*!< Pin Mux Control */ #define PORTx_PCRn_DSE ((uint32_t)0x00000040) /*!< Drive Strength Enable */ #define PORTx_PCRn_PFE ((uint32_t)0x00000010) /*!< Passive Filter Enable */ #define PORTx_PCRn_SRE ((uint32_t)0x00000004) /*!< Slew Rate Enable */ #define PORTx_PCRn_PE ((uint32_t)0x00000002) /*!< Pull Enable */ #define PORTx_PCRn_PS ((uint32_t)0x00000001) /*!< Pull Select */ /****************************************************************/ /* */ /* Oscillator (OSC) */ /* */ /****************************************************************/ /*********** Bits definition for OSC_CR register **************/ #define OSC_CR_ERCLKEN ((uint8_t)0x80) /*!< External Reference Enable */ #define OSC_CR_EREFSTEN ((uint8_t)0x20) /*!< External Reference Stop Enable */ #define OSC_CR_SC2P ((uint8_t)0x08) /*!< Oscillator 2pF Capacitor Load Configure */ #define OSC_CR_SC4P ((uint8_t)0x04) /*!< Oscillator 4pF Capacitor Load Configure */ #define OSC_CR_SC8P ((uint8_t)0x02) /*!< Oscillator 8pF Capacitor Load Configure */ #define OSC_CR_SC16P ((uint8_t)0x01) /*!< Oscillator 16pF Capacitor Load Configure */ /****************************************************************/ /* */ /* Direct Memory Access (DMA) */ /* */ /****************************************************************/ /*********** Bits definition for DMA_BCRn register ************/ #define DMA_DSR_BCRn_CE ((uint32_t)((uint32_t)1 << 30)) /*!< Configuration Error */ #define DMA_DSR_BCRn_BES ((uint32_t)((uint32_t)1 << 29)) /*!< Bus Error on Source */ #define DMA_DSR_BCRn_BED ((uint32_t)((uint32_t)1 << 28)) /*!< Bus Error on Destination */ #define DMA_DSR_BCRn_REQ ((uint32_t)((uint32_t)1 << 26)) /*!< Request */ #define DMA_DSR_BCRn_BSY ((uint32_t)((uint32_t)1 << 25)) /*!< Busy */ #define DMA_DSR_BCRn_DONE ((uint32_t)((uint32_t)1 << 24)) /*!< Transactions done */ #define DMA_DSR_BCRn_BCR_SHIFT 0 /*!< Bytes yet to be transferred for block (shift) */ #define DMA_DSR_BCRn_BCR_MASK ((uint32_t)((uint32_t)0x00FFFFFF << DMA_DSR_BCRn_BCR_SHIFT)) /*!< Bytes yet to be transferred for block (mask) */ #define DMA_DSR_BCRn_BCR(x) ((uint32_t)(((uint32_t)(x) << DMA_DSR_BCRn_BCR_SHIFT) & DMA_DSR_BCRn_BCR_MASK)) /*!< Bytes yet to be transferred for block */ /*********** Bits definition for DMA_DCRn register ************/ #define DMA_DCRn_EINT ((uint32_t)((uint32_t)1 << 31)) /*!< Enable interrupt on completion of transfer */ #define DMA_DCRn_ERQ ((uint32_t)((uint32_t)1 << 30)) /*!< Enable peripheral request */ #define DMA_DCRn_CS ((uint32_t)((uint32_t)1 << 29)) /*!< Cycle steal */ #define DMA_DCRn_AA ((uint32_t)((uint32_t)1 << 28)) /*!< Auto-align */ #define DMA_DCRn_EADREQ ((uint32_t)((uint32_t)1 << 23)) /*!< Enable asynchronous DMA requests */ #define DMA_DCRn_SINC ((uint32_t)((uint32_t)1 << 22)) /*!< Source increment */ #define DMA_DCRn_SSIZE_SHIFT 20 /*!< Source size (shift) */ #define DMA_DCRn_SSIZE_MASK ((uint32_t)((uint32_t)0x03 << DMA_DCRn_SSIZE_SHIFT)) /*!< Source size (mask) */ #define DMA_DCRn_SSIZE(x) ((uint32_t)(((uint32_t)(x) << DMA_DCRn_SSIZE_SHIFT) & DMA_DCRn_SSIZE_MASK)) /*!< Source size */ #define DMA_DCRn_DINC ((uint32_t)((uint32_t)1 << 19)) /*!< Destination increment */ #define DMA_DCRn_DSIZE_SHIFT 17 /*!< Destination size (shift) */ #define DMA_DCRn_DSIZE_MASK ((uint32_t)((uint32_t)0x03 << DMA_DCRn_DSIZE_SHIFT)) /*!< Destination size (mask) */ #define DMA_DCRn_DSIZE(x) ((uint32_t)(((uint32_t)(x) << DMA_DCRn_DSIZE_SHIFT) & DMA_DCRn_DSIZE_MASK)) /*!< Destination size */ #define DMA_DCRn_START ((uint32_t)((uint32_t)1 << 16)) /*!< Start transfer */ #define DMA_DCRn_SMOD_SHIFT 12 /*!< Source address modulo (shift) */ #define DMA_DCRn_SMOD_MASK ((uint32_t)((uint32_t)0x0F << DMA_DCRn_SMOD_SHIFT)) /*!< Source address modulo (mask) */ #define DMA_DCRn_SMOD(x) ((uint32_t)(((uint32_t)(x) << DMA_DCRn_SMOD_SHIFT) & DMA_DCRn_SMOD_MASK)) /*!< Source address modulo */ #define DMA_DCRn_DMOD_SHIFT 8 /*!< Destination address modulo (shift) */ #define DMA_DCRn_DMOD_MASK ((uint32_t)0x0F << DMA_DCRn_DMOD_SHIFT) /*!< Destination address modulo (mask) */ #define DMA_DCRn_DMOD(x) ((uint32_t)(((uint32_t)(x) << DMA_DCRn_DMOD_SHIFT) & DMA_DCRn_DMOD_MASK)) /*!< Destination address modulo */ #define DMA_DCRn_D_REQ ((uint32_t)((uint32_t)1 << 7)) /*!< Disable request */ #define DMA_DCRn_LINKCC_SHIFT 4 /*!< Link channel control (shift) */ #define DMA_DCRn_LINKCC_MASK ((uint32_t)((uint32_t)0x03 << DMA_DCRn_LINKCC_SHIFT)) /*!< Link channel control (mask) */ #define DMA_DCRn_LINKCC(x) ((uint32_t)(((uint32_t)(x) << DMA_DCRn_LINKCC_SHIFT) & DMA_DCRn_LINKCC_MASK)) /*!< Link channel control */ #define DMA_DCRn_LCH1_SHIFT 2 /*!< Link channel 1 (shift) */ #define DMA_DCRn_LCH1_MASK ((uint32_t)((uint32_t)0x03 << DMA_DCRn_LCH1_SHIFT)) /*!< Link channel 1 (mask) */ #define DMA_DCRn_LCH1(x) ((uint32_t)(((uint32_t)(x) << DMA_DCRn_LCH1_SHIFT) & DMA_DCRn_LCH1_MASK)) /*!< Link channel 1 */ #define DMA_DCRn_LCH2_SHIFT 0 /*!< Link channel 2 (shift) */ #define DMA_DCRn_LCH2_MASK ((uint32_t)((uint32_t)0x03 << DMA_DCRn_LCH2_SHIFT)) /*!< Link channel 2 (mask) */ #define DMA_DCRn_LCH2(x) ((uint32_t)(((uint32_t)(x) << DMA_DCRn_LCH2_SHIFT) & DMA_DCRn_LCH2_MASK)) /*!< Link channel 2 */ /****************************************************************/ /* */ /* Direct Memory Access Multiplexer (DMAMUX) */ /* */ /****************************************************************/ /******** Bits definition for DMAMUX_CHCFGn register **********/ #define DMAMUX_CHCFGn_ENBL ((uint8_t)((uint8_t)1 << 7)) /*!< DMA Channel Enable */ #define DMAMUX_CHCFGn_TRIG ((uint8_t)((uint8_t)1 << 6)) /*!< DMA Channel Trigger Enable */ #define DMAMUX_CHCFGn_SOURCE_SHIFT 0 /*!< DMA Channel Source (Slot) (shift) */ #define DMAMUX_CHCFGn_SOURCE_MASK ((uint8_t)((uint8_t)0x3F << DMAMUX_CHCFGn_SOURCE_SHIFT)) /*!< DMA Channel Source (Slot) (mask) */ #define DMAMUX_CHCFGn_SOURCE(x) ((uint8_t)(((uint8_t)(x) << DMAMUX_CHCFGn_SOURCE_SHIFT) & DMAMUX_CHCFGn_SOURCE_MASK)) /*!< DMA Channel Source (Slot) */ /****************************************************************/ /* */ /* Periodic Interrupt Timer (PIT) */ /* */ /****************************************************************/ /*********** Bits definition for PIT_MCR register *************/ #define PIT_MCR_MDIS ((uint32_t)((uint32_t)1 << 1)) /*!< Module Disable */ #define PIT_MCR_FRZ ((uint32_t)((uint32_t)1 << 0)) /*!< Freeze */ /********** Bits definition for PIT_LDVALn register ***********/ #define PIT_LDVALn_TSV_SHIFT 0 /*!< Timer Start Value */ #define PIT_LDVALn_TSV_MASK ((uint32_t)((uint32_t)0xFFFFFFFF << PIT_LDVALn_TSV_SHIFT)) #define PIT_LDVALn_TSV(x) (((uint32_t)(((uint32_t)(x))<