34 # define KINETIS_HAVE_PCR
38 # define KINETIS_HAVE_PINSEL
41 #ifdef ADC_CFG1_MODE_MASK
42 # define KINETIS_HAVE_ADC_K
45 #ifdef SPI_CTAR_CPHA_MASK
46 # define KINETIS_HAVE_MK_SPI
49 #ifdef LPTMR_CSR_TEN_MASK
50 # define KINETIS_HAVE_LPTMR
64 #define GPIO_UNDEF (0xffff)
69 #define GPIO_PIN(x, y) (((x + 1) << 12) | (x << 6) | y)
71 #ifdef SIM_UIDH_UID_MASK
76 #define CPUID_ADDR (&SIM->UIDH)
81 #define CPUID_LEN (16U)
87 #define CPUID_ADDR (&SIM->UIDMH)
91 #define CPUID_LEN (12U)
103 #define GPIO_MODE(pu, pe, od, out) (pu | (pe << 1) | (od << 5) | (out << 7))
111 #define SPI_HWCS(x) (x)
116 #define SPI_HWCS_NUMOF (5)
122 #define PERIPH_SPI_NEEDS_TRANSFER_BYTE 1
123 #define PERIPH_SPI_NEEDS_TRANSFER_REG 1
124 #define PERIPH_SPI_NEEDS_TRANSFER_REGS 1
130 #define PERIPH_TIMER_PROVIDES_SET
136 #define PM_NUM_MODES (3U)
143 #if MODULE_PM_LAYERED
148 #define PM_BLOCK(x) pm_block(x)
152 #define PM_UNBLOCK(x) pm_unblock(x)
156 #define PM_UNBLOCK(x)
167 #define RTT_FREQUENCY (1)
168 #define RTT_MAX_VALUE (0xffffffff)
177 #define HAVE_GPIO_MODE_T
189 #ifdef KINETIS_HAVE_PCR
196 GPIO_AF_ANALOG = PORT_PCR_MUX(0),
197 GPIO_AF_GPIO = PORT_PCR_MUX(1),
198 GPIO_AF_2 = PORT_PCR_MUX(2),
199 GPIO_AF_3 = PORT_PCR_MUX(3),
200 GPIO_AF_4 = PORT_PCR_MUX(4),
201 GPIO_AF_5 = PORT_PCR_MUX(5),
202 GPIO_AF_6 = PORT_PCR_MUX(6),
203 GPIO_AF_7 = PORT_PCR_MUX(7),
204 #ifdef PORT_PCR_ODE_MASK
205 GPIO_PCR_OD = (PORT_PCR_ODE_MASK),
207 GPIO_PCR_PD = (PORT_PCR_PE_MASK),
208 GPIO_PCR_PU = (PORT_PCR_PE_MASK | PORT_PCR_PS_MASK)
217 #ifdef KINETIS_HAVE_PCR
218 #define HAVE_GPIO_FLANK_T
249 #define HAVE_ADC_RES_T
250 #ifdef KINETIS_HAVE_ADC_K
262 #if defined(FTM_CnSC_MSB_MASK)
266 #define PWM_CHAN_MAX (4U)
272 #define HAVE_PWM_MODE_T
274 PWM_LEFT = (FTM_CnSC_MSB_MASK | FTM_CnSC_ELSB_MASK),
275 PWM_RIGHT = (FTM_CnSC_MSB_MASK | FTM_CnSC_ELSA_MASK),
288 #if defined(UART_C1_M_MASK) || DOXYGEN
292 #elif defined(LPUART_CTRL_M_MASK)
297 #
if defined(UART_C1_M_MASK) || DOXYGEN
299 #elif defined(LPUART_CTRL_M_MASK)
301 UART_MODE_8O1 = (LPUART_CTRL_M_MASK | LPUART_CTRL_PE_MASK | LPUART_CTRL_PT_MASK),
311 #ifdef KINETIS_HAVE_MK_SPI
312 #define HAVE_SPI_MODE_T
314 #if defined(SPI_CTAR_CPHA_MASK)
318 SPI_MODE_3 = (SPI_CTAR_CPOL_MASK | SPI_CTAR_CPHA_MASK)
319 #elif defined(SPI_C1_CPHA_MASK)
323 SPI_MODE_3 = (SPI_C1_CPOL_MASK | SPI_C1_CPHA_MASK)
362 #define ADC_AVG_NONE (0)
366 #define ADC_AVG_MAX (ADC_SC3_AVGE_MASK | ADC_SC3_AVGS(3))
368 #if defined(DAC0_BASE) && (DAC0_BASE != This_symbol_has_been_deprecated)
374 volatile uint32_t *scgc_addr;
389 #ifdef KINETIS_HAVE_LPTMR
405 #ifdef FTM_CnSC_MSB_MASK
418 #ifdef KINETIS_HAVE_PINSEL
419 volatile uint32_t *pinsel;
420 uint32_t pinsel_mask;
427 #define HAVE_I2C_SPEED_T
440 #define PERIPH_I2C_NEED_READ_REG
441 #define PERIPH_I2C_NEED_READ_REGS
442 #define PERIPH_I2C_NEED_WRITE_REG
443 #define PERIPH_I2C_NEED_WRITE_REGS
470 #ifdef KINETIS_HAVE_PCR
473 #ifdef KINETIS_HAVE_PINSEL
474 volatile uint32_t *pinsel;
475 uint32_t pinsel_mask;
486 #ifdef KINETIS_HAVE_LPTMR
496 #define TIMER_PIT_DEV(x) (TIMER_DEV(0 + (x)))
497 #ifdef KINETIS_HAVE_LPTMR
499 #define TIMER_LPTMR_DEV(x) (TIMER_DEV(PIT_NUMOF + (x)))
519 #ifdef KINETIS_HAVE_PCR
523 #ifdef KINETIS_HAVE_PINSEL
524 volatile uint32_t *pinsel;
525 uint32_t pinsel_mask;
535 #if !defined(KINETIS_HAVE_PLL) && defined(MODULE_PERIPH_MCG) \
536 && defined(MCG_C6_PLLS_MASK) || DOXYGEN
540 #define KINETIS_HAVE_PLL 1
542 #define KINETIS_HAVE_PLL 0
545 #ifdef MODULE_PERIPH_MCG_LITE
549 typedef enum kinetis_mcg_mode {
550 KINETIS_MCG_MODE_LIRC8M = 0,
551 KINETIS_MCG_MODE_HIRC = 1,
552 KINETIS_MCG_MODE_EXT = 2,
553 KINETIS_MCG_MODE_LIRC2M = 3,
554 KINETIS_MCG_MODE_NUMOF,
555 } kinetis_mcg_mode_t;
558 #ifdef MODULE_PERIPH_MCG
562 typedef enum kinetis_mcg_mode {
563 KINETIS_MCG_MODE_FEI = 0,
564 KINETIS_MCG_MODE_FEE = 1,
565 KINETIS_MCG_MODE_FBI = 2,
566 KINETIS_MCG_MODE_FBE = 3,
567 KINETIS_MCG_MODE_BLPI = 4,
568 KINETIS_MCG_MODE_BLPE = 5,
570 KINETIS_MCG_MODE_PBE = 6,
571 KINETIS_MCG_MODE_PEE = 7,
573 KINETIS_MCG_MODE_NUMOF,
574 } kinetis_mcg_mode_t;
581 KINETIS_MCG_FLL_FACTOR_640 = (MCG_C4_DRST_DRS(0)),
583 KINETIS_MCG_FLL_FACTOR_732 = (MCG_C4_DRST_DRS(0) | MCG_C4_DMX32_MASK),
585 KINETIS_MCG_FLL_FACTOR_1280 = (MCG_C4_DRST_DRS(1)),
587 KINETIS_MCG_FLL_FACTOR_1464 = (MCG_C4_DRST_DRS(1) | MCG_C4_DMX32_MASK),
589 KINETIS_MCG_FLL_FACTOR_1920 = (MCG_C4_DRST_DRS(2)),
591 KINETIS_MCG_FLL_FACTOR_2197 = (MCG_C4_DRST_DRS(2) | MCG_C4_DMX32_MASK),
593 KINETIS_MCG_FLL_FACTOR_2560 = (MCG_C4_DRST_DRS(3)),
595 KINETIS_MCG_FLL_FACTOR_2929 = (MCG_C4_DRST_DRS(3) | MCG_C4_DMX32_MASK),
599 #if defined(MODULE_PERIPH_MCG) || defined(MODULE_PERIPH_MCG_LITE)
605 KINETIS_MCG_ERC_RANGE_LOW = MCG_C2_RANGE0(0),
606 KINETIS_MCG_ERC_RANGE_HIGH = MCG_C2_RANGE0(1),
607 KINETIS_MCG_ERC_RANGE_VERY_HIGH = MCG_C2_RANGE0(2),
608 } kinetis_mcg_erc_range_t;
625 KINETIS_CLOCK_OSC0_EN = (1 << 0),
634 KINETIS_CLOCK_RTCOSC_EN = (1 << 1),
651 KINETIS_CLOCK_USE_FAST_IRC = (1 << 2),
660 KINETIS_CLOCK_MCGIRCLK_EN = (1 << 3),
671 KINETIS_CLOCK_MCGIRCLK_STOP_EN = (1 << 4),
682 KINETIS_CLOCK_MCGPCLK_EN = (1 << 5),
683 } kinetis_clock_flags_t;
730 unsigned int clock_flags;
736 kinetis_mcg_mode_t default_mode;
742 kinetis_mcg_erc_range_t erc_range;
754 #ifdef MODULE_PERIPH_MCG
778 #ifdef MODULE_PERIPH_MCG_LITE
808 kinetis_mcg_fll_t fll_factor_fei;
815 kinetis_mcg_fll_t fll_factor_fee;