Toggle navigation
Documentation
The friendly Operating System for the Internet of Things
cpu_conf_kinetis.h
Go to the documentation of this file.
1
/*
2
* SPDX-FileCopyrightText: 2017 Eistec AB
3
* SPDX-License-Identifier: LGPL-2.1-only
4
*/
5
6
#pragma once
7
18
#include "cpu_conf_common.h"
19
20
#if (__CORTEX_M < 3)
21
/*
22
* Kinetis Cortex-M0+ devices have bit manipulation engine (BME) which provides
23
* the same functionality (and some more) as the bitband aliased memory found in
24
* Cortex-M3 and up
25
*/
26
#include "
bme.h
"
27
#endif
28
29
#ifdef __cplusplus
30
extern
"C"
31
{
32
#endif
33
38
#define CPU_DEFAULT_IRQ_PRIO (1U)
39
#define CPU_IRQ_NUMOF (NUMBER_OF_INT_VECTORS)
40
#define CPU_FLASH_BASE (0x00000000)
47
#define PIN_MUX_FUNCTION_ANALOG 0
48
#define PIN_MUX_FUNCTION_GPIO 1
55
#define PIN_INTERRUPT_RISING 0b1001
56
#define PIN_INTERRUPT_FALLING 0b1010
57
#define PIN_INTERRUPT_EDGE 0b1011
64
/* Different versions of vendor headers use some variations of register names.
65
* This section aims to eliminate these differences in the few places where it
66
* matters for the RIOT driver implementations.
67
*/
68
#if !defined(MCG_C2_RANGE0) && defined(MCG_C2_RANGE)
69
#define MCG_C2_RANGE0(x) MCG_C2_RANGE(x)
70
#endif
71
#if !defined(MCG_C2_RANGE0_MASK) && defined(MCG_C2_RANGE_MASK)
72
#define MCG_C2_RANGE0_MASK MCG_C2_RANGE_MASK
73
#endif
74
#if !defined(MCG_C7_OSCSEL) && defined(MCG_C7_OSCSEL_SHIFT)
75
#define MCG_C7_OSCSEL(x) (((uint32_t)(x) << MCG_C7_OSCSEL_SHIFT) & MCG_C7_OSCSEL_MASK)
76
#endif
77
#if !defined(OSC0) && defined(OSC)
78
#define OSC0 OSC
79
#endif
80
#if !defined(SIM_SOPT2_LPUART0SRC_MASK) && defined(SIM_SOPT2_LPUARTSRC_MASK)
81
#define SIM_SOPT2_LPUART0SRC_MASK SIM_SOPT2_LPUARTSRC_MASK
82
#define SIM_SOPT2_LPUART0SRC_SHIFT SIM_SOPT2_LPUARTSRC_SHIFT
83
#define SIM_SOPT2_LPUART0SRC SIM_SOPT2_LPUARTSRC
84
#endif
85
#if !defined(SIM_SCGC5_LPTMR_SHIFT) && defined(SIM_SCGC5_LPTIMER_SHIFT)
86
#define SIM_SCGC5_LPTMR_SHIFT SIM_SCGC5_LPTIMER_SHIFT
87
#endif
88
#if !defined(SIM_SCGC5_LPTMR_MASK) && defined(SIM_SCGC5_LPTIMER_MASK)
89
#define SIM_SCGC5_LPTMR_MASK SIM_SCGC5_LPTIMER_MASK
90
#endif
91
#if !defined(GPIOA_BASE) && defined(PTA_BASE)
92
#define GPIOA_BASE PTA_BASE
93
#define GPIOB_BASE PTB_BASE
94
#define GPIOC_BASE PTC_BASE
95
#define GPIOD_BASE PTD_BASE
96
#define GPIOE_BASE PTE_BASE
97
#define GPIOF_BASE PTF_BASE
98
#define GPIOG_BASE PTG_BASE
99
#endif
100
#if !defined(GPIOA) && defined(PTA)
101
#define GPIOA PTA
102
#define GPIOB PTB
103
#define GPIOC PTC
104
#define GPIOD PTD
105
#define GPIOE PTE
106
#define GPIOF PTF
107
#define GPIOG PTG
108
#endif
115
#ifdef SIM_SCGC5_LPTMR_SHIFT
117
#define LPTMR_CLKEN() (bit_set32(&SIM->SCGC5, SIM_SCGC5_LPTMR_SHIFT))
118
#endif
119
#if defined(SIM_SCGC6_PIT_SHIFT)
121
#define PIT_CLKEN() (bit_set32(&SIM->SCGC6, SIM_SCGC6_PIT_SHIFT))
122
#elif defined(SIM_SCGC_PIT_SHIFT)
123
#define PIT_CLKEN() (bit_set32(&SIM->SCGC, SIM_SCGC_PIT_SHIFT))
124
#endif
125
#ifdef SIM_SCGC6_RTC_SHIFT
127
#define RTC_CLKEN() (bit_set32(&SIM->SCGC6, SIM_SCGC6_RTC_SHIFT))
128
#endif
135
#ifdef SIM_SCGC4_I2C0_SHIFT
137
#define I2C0_CLKEN() (bit_set32(&SIM->SCGC4, SIM_SCGC4_I2C0_SHIFT))
138
#endif
139
#ifdef SIM_SCGC4_I2C1_SHIFT
141
#define I2C1_CLKEN() (bit_set32(&SIM->SCGC4, SIM_SCGC4_I2C1_SHIFT))
142
#endif
143
#ifdef SIM_SCGC1_I2C2_SHIFT
145
#define I2C2_CLKEN() (bit_set32(&SIM->SCGC1, SIM_SCGC1_I2C2_SHIFT))
146
#endif
153
#if !defined(HWRNG_CLK_REG) && !defined(HWRNG_CLK_REG_SHIFT)
154
#if defined(SIM_SCGC3_RNGA_SHIFT)
155
#define HWRNG_CLK_REG SIM->SCGC3
156
#define HWRNG_CLK_REG_SHIFT SIM_SCGC3_RNGA_SHIFT
157
#elif defined(SIM_SCGC6_RNGA_SHIFT)
158
#define HWRNG_CLK_REG SIM->SCGC6
159
#define HWRNG_CLK_REG_SHIFT SIM_SCGC6_RNGA_SHIFT
160
#endif
161
#endif
162
#if defined(RNG)
163
#define KINETIS_RNGA RNG
164
#define HWRNG_CLKEN() (bit_set32(&HWRNG_CLK_REG, HWRNG_CLK_REG_SHIFT))
165
#define HWRNG_CLKDIS() (bit_clear32(&HWRNG_CLK_REG, HWRNG_CLK_REG_SHIFT))
166
#endif
/* KINETIS_RNGA */
173
#if defined(MK20D7_H_)
174
#define LLWU_IRQn LLW_IRQn
175
#define LPTMR0_IRQn LPTimer_IRQn
176
#define PIT_TCTRL_CHN_MASK (0x4u)
177
#define PIT_TCTRL_CHN_SHIFT (2)
178
#define PORT_IRQS { PORTA_IRQn, PORTB_IRQn, PORTC_IRQn, PORTD_IRQn, PORTE_IRQn }
179
#endif
/* MK20D7_H_ */
182
#ifdef __cplusplus
183
}
184
#endif
185
bme.h
Macro definitions for the Kinetis Bit Manipulation Engine (BME)
Generated on Fri Sep 26 2025 19:45:32 by
1.9.1