From 5cbdfb9bba1371043092756c6f4a46a77d9d318e Mon Sep 17 00:00:00 2001 From: utzig Date: Tue, 2 Sep 2014 21:28:01 +0000 Subject: [KINETIS] Fix timer registers for K2x git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@7238 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- os/ext/CMSIS/KINETIS/mk20d5.h | 458 +++++++++++++++++++++++++++++++++++++++--- 1 file changed, 432 insertions(+), 26 deletions(-) diff --git a/os/ext/CMSIS/KINETIS/mk20d5.h b/os/ext/CMSIS/KINETIS/mk20d5.h index a267ca9dc..9eb68346b 100644 --- a/os/ext/CMSIS/KINETIS/mk20d5.h +++ b/os/ext/CMSIS/KINETIS/mk20d5.h @@ -202,26 +202,34 @@ typedef struct typedef struct { - __IO uint32_t SC; - __IO uint32_t CNT; - __IO uint32_t MOD; - __IO uint32_t C0SC; - __IO uint32_t C0V; - __IO uint32_t C1SC; - __IO uint32_t C1V; - __IO uint32_t C2SC; - __IO uint32_t C2V; - __IO uint32_t C3SC; - __IO uint32_t C3V; - __IO uint32_t C4SC; - __IO uint32_t C4V; - __IO uint32_t C5SC; - __IO uint32_t C5V; - uint32_t RESERVED0[5]; - __IO uint32_t STATUS; - uint32_t RESERVED1[12]; - __IO uint32_t CONF; -} TPM_TypeDef; + __IO uint32_t SC; /* Status and Control */ + __IO uint32_t CNT; /* Counter */ + __IO uint32_t MOD; /* Modulo */ + struct FTM_Channel { + __IO uint32_t CnSC; /* Channel Status and Control */ + __IO uint32_t CnV; /* Channel Value */ + } CHANNEL[8]; + __IO uint32_t CNTIN; /* Counter Initial Value */ + __IO uint32_t STATUS; /* Capture and Compare Status */ + __IO uint32_t MODE; /* Features Mode Selection */ + __IO uint32_t SYNC; /* Synchronization */ + __IO uint32_t OUTINIT; /* Initial State for Channels Output */ + __IO uint32_t OUTMASK; /* Output Mask */ + __IO uint32_t COMBINE; /* Function for Linked Channels */ + __IO uint32_t DEADTIME; /* Deadtime Insertion Control */ + __IO uint32_t EXTTRIG; /* FTM External Trigger */ + __IO uint32_t POL; /* Channels Polarity */ + __IO uint32_t FMS; /* Fault Mode Status */ + __IO uint32_t FILTER; /* Input Capture Filter Control */ + __IO uint32_t FLTCTRL; /* Fault Control */ + __IO uint32_t QDCTRL; /* Quadrature Decode Control and Status */ + __IO uint32_t CONF; /* Configuration */ + __IO uint32_t FTLPOL; /* FTM Fault Input Polarity */ + __IO uint32_t SYNCONF; /* Synchronization Configuration */ + __IO uint32_t INVCTRL; /* FTM Inverting Control */ + __IO uint32_t SWOCTRL; /* FTM Software Output Control */ + __IO uint32_t PWMLOAD; /* FTM PWM Load */ +} FTM_TypeDef; typedef struct { @@ -485,9 +493,8 @@ typedef struct { #define DMA_BASE ((uint32_t)0x40008100) #define DMAMUX_BASE ((uint32_t)0x40021000) #define SPI0_BASE ((uint32_t)0x4002C000) -#define TPM0_BASE ((uint32_t)0x40038000) -#define TPM1_BASE ((uint32_t)0x40039000) -#define TPM2_BASE ((uint32_t)0x4003A000) +#define FTM0_BASE ((uint32_t)0x40038000) +#define FTM1_BASE ((uint32_t)0x40039000) #define ADC0_BASE ((uint32_t)0x4003B000) #define LPTMR0_BASE ((uint32_t)0x40040000) #define TSI0_BASE ((uint32_t)0x40045000) @@ -517,9 +524,8 @@ typedef struct { /****************************************************************/ #define DMA ((DMA_TypeDef *) DMA_BASE) #define DMAMUX ((DMAMUX_TypeDef *) DMAMUX_BASE) -#define TPM0 ((TPM_TypeDef *) TPM0_BASE) -#define TPM1 ((TPM_TypeDef *) TPM1_BASE) -#define TPM2 ((TPM_TypeDef *) TPM2_BASE) +#define FTM0 ((FTM_TypeDef *) FTM0_BASE) +#define FTM1 ((FTM_TypeDef *) FTM1_BASE) #define ADC0 ((ADC_TypeDef *) ADC0_BASE) #define LPTMR0 ((LPTMR_TypeDef *) LPTMR0_BASE) #define TSI0 ((TSI_TypeDef *) TSI0_BASE) @@ -855,6 +861,406 @@ typedef struct { #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) */ +/****************************************************************/ +/* */ +/* FlexTimer Module (FTM) */ +/* */ +/****************************************************************/ + +/* SC Bit Fields */ +#define FTM_SC_PS_MASK 0x7u +#define FTM_SC_PS_SHIFT 0 +#define FTM_SC_PS(x) (((uint32_t)(((uint32_t)(x))<