diff options
Diffstat (limited to 'lib/chibios-contrib/ext/mcux-sdk/devices/MK65F18/project_template/board.h')
-rw-r--r-- | lib/chibios-contrib/ext/mcux-sdk/devices/MK65F18/project_template/board.h | 193 |
1 files changed, 193 insertions, 0 deletions
diff --git a/lib/chibios-contrib/ext/mcux-sdk/devices/MK65F18/project_template/board.h b/lib/chibios-contrib/ext/mcux-sdk/devices/MK65F18/project_template/board.h new file mode 100644 index 000000000..707cc051f --- /dev/null +++ b/lib/chibios-contrib/ext/mcux-sdk/devices/MK65F18/project_template/board.h | |||
@@ -0,0 +1,193 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2015, Freescale Semiconductor, Inc. | ||
3 | * Copyright 2016-2017 NXP | ||
4 | * All rights reserved. | ||
5 | * | ||
6 | * SPDX-License-Identifier: BSD-3-Clause | ||
7 | */ | ||
8 | |||
9 | #ifndef _BOARD_H_ | ||
10 | #define _BOARD_H_ | ||
11 | |||
12 | #include "clock_config.h" | ||
13 | #include "fsl_gpio.h" | ||
14 | |||
15 | /******************************************************************************* | ||
16 | * Definitions | ||
17 | ******************************************************************************/ | ||
18 | |||
19 | /*! @brief The board name */ | ||
20 | #define BOARD_NAME "TWR-K65F180M" | ||
21 | |||
22 | /*! @brief The UART to use for debug messages. */ | ||
23 | #define BOARD_USE_UART | ||
24 | #define BOARD_DEBUG_UART_TYPE DEBUG_CONSOLE_DEVICE_TYPE_UART | ||
25 | #define BOARD_DEBUG_UART_BASEADDR (uint32_t) UART2 | ||
26 | #define BOARD_DEBUG_UART_INSTANCE 2U | ||
27 | #define BOARD_DEBUG_UART_CLKSRC BUS_CLK | ||
28 | #define BOARD_DEBUG_UART_CLK_FREQ CLOCK_GetBusClkFreq() | ||
29 | #define BOARD_UART_IRQ UART2_RX_TX_IRQn | ||
30 | #define BOARD_UART_IRQ_HANDLER UART2_RX_TX_IRQHandler | ||
31 | |||
32 | #ifndef BOARD_DEBUG_UART_BAUDRATE | ||
33 | #define BOARD_DEBUG_UART_BAUDRATE 115200 | ||
34 | #endif /* BOARD_DEBUG_UART_BAUDRATE */ | ||
35 | |||
36 | /*! @brief The CAN instance used for board */ | ||
37 | #define BOARD_CAN_BASEADDR CAN0 | ||
38 | |||
39 | /*! @brief The i2c instance used for i2c connection by default */ | ||
40 | #define BOARD_I2C_BASEADDR I2C0 | ||
41 | #define BOARD_ACCEL_I2C_BASEADDR I2C0 | ||
42 | |||
43 | /*! @brief The Enet instance used for board. */ | ||
44 | #define BOARD_ENET_BASEADDR ENET | ||
45 | |||
46 | /*! @brief The FlexBus instance used for board.*/ | ||
47 | #define BOARD_FLEXBUS_BASEADDR FB | ||
48 | |||
49 | #define BOARD_TSI_ELECTRODE_CNT 2U | ||
50 | |||
51 | /*! @brief Indexes of the TSI channels for on board electrodes */ | ||
52 | #ifndef BOARD_TSI_ELECTRODE_1 | ||
53 | #define BOARD_TSI_ELECTRODE_1 11U | ||
54 | #endif | ||
55 | #ifndef BOARD_TSI_ELECTRODE_2 | ||
56 | #define BOARD_TSI_ELECTRODE_2 12U | ||
57 | #endif | ||
58 | |||
59 | /*! @brief The SDHC instance/channel used for board */ | ||
60 | #define BOARD_SDHC_BASEADDR SDHC | ||
61 | #define BOARD_SDHC_CD_GPIO_IRQ_HANDLER PORTA_IRQHandler | ||
62 | |||
63 | /*! @brief The CMP instance/channel used for board. */ | ||
64 | #define BOARD_CMP_BASEADDR CMP2 | ||
65 | #define BOARD_CMP_CHANNEL 2U | ||
66 | |||
67 | /*! @brief The i2c instance used for sai demo */ | ||
68 | #define BOARD_SAI_DEMO_I2C_BASEADDR I2C0 | ||
69 | |||
70 | /*! @brief The rtc instance used for rtc_func */ | ||
71 | #define BOARD_RTC_FUNC_BASEADDR RTC | ||
72 | |||
73 | /*! @brief If connected the TWR_MEM, this is spi sd card */ | ||
74 | #ifndef BOARD_SDCARD_CARD_DETECTION_GPIO | ||
75 | #define BOARD_SDCARD_CARD_DETECTION_GPIO GPIOD | ||
76 | #endif | ||
77 | #define BOARD_SDCARD_CARD_DETECTION_GPIO_PORT PORTD | ||
78 | #define SDCARD_CARD_DETECTION_GPIO_PIN 15U | ||
79 | #define SDCARD_CARD_WRITE_PROTECTION_GPIO GPIOC | ||
80 | #define SDCARD_CARD_WRITE_PROTECTION_GPIO_PORT PORTC | ||
81 | #define SDCARD_CARD_WRITE_PROTECTION_GPIO_PIN 13U | ||
82 | #define SDCARD_SPI_HW_BASEADDR SPI1 | ||
83 | #define SDCARD_CARD_INSERTED 0U | ||
84 | |||
85 | #define BOARD_DEMO_I2C_CLKSRC kCLOCK_BusClk | ||
86 | #define BOARD_DEMO_SAI_CLKSRC kCLOCK_CoreSysClk | ||
87 | #define BOARD_DEMO_SAI I2S0 | ||
88 | /* Board led color mapping */ | ||
89 | #define LOGIC_LED_ON 0U | ||
90 | #define LOGIC_LED_OFF 1U | ||
91 | #ifndef BOARD_LED_YELLOW_GPIO | ||
92 | #define BOARD_LED_YELLOW_GPIO GPIOB | ||
93 | #endif | ||
94 | #define BOARD_LED_YELLOW_GPIO_PORT PORTB | ||
95 | #ifndef BOARD_LED_YELLOW_GPIO_PIN | ||
96 | #define BOARD_LED_YELLOW_GPIO_PIN 4U | ||
97 | #endif | ||
98 | #ifndef BOARD_LED_ORANGE_GPIO | ||
99 | #define BOARD_LED_ORANGE_GPIO GPIOB | ||
100 | #endif | ||
101 | #define BOARD_LED_ORANGE_GPIO_PORT PORTB | ||
102 | #ifndef BOARD_LED_ORANGE_GPIO_PIN | ||
103 | #define BOARD_LED_ORANGE_GPIO_PIN 5U | ||
104 | #endif | ||
105 | #ifndef BOARD_LED_GREEN_GPIO | ||
106 | #define BOARD_LED_GREEN_GPIO GPIOA | ||
107 | #endif | ||
108 | #define BOARD_LED_GREEN_GPIO_PORT PORTA | ||
109 | #ifndef BOARD_LED_GREEN_GPIO_PIN | ||
110 | #define BOARD_LED_GREEN_GPIO_PIN 28U | ||
111 | #endif | ||
112 | #ifndef BOARD_LED_BLUE_GPIO | ||
113 | #define BOARD_LED_BLUE_GPIO GPIOA | ||
114 | #endif | ||
115 | #define BOARD_LED_BLUE_GPIO_PORT PORTA | ||
116 | #ifndef BOARD_LED_BLUE_GPIO_PIN | ||
117 | #define BOARD_LED_BLUE_GPIO_PIN 29U | ||
118 | #endif | ||
119 | |||
120 | #define LED_YELLOW_INIT(output) \ | ||
121 | GPIO_PinWrite(BOARD_LED_YELLOW_GPIO, BOARD_LED_YELLOW_GPIO_PIN, output); \ | ||
122 | BOARD_LED_YELLOW_GPIO->PDDR |= (1U << BOARD_LED_YELLOW_GPIO_PIN) /*!< Enable target LED_YELLOW */ | ||
123 | #define LED_YELLOW_ON() \ | ||
124 | GPIO_PortClear(BOARD_LED_YELLOW_GPIO, 1U << BOARD_LED_YELLOW_GPIO_PIN) /*!< Turn on target LED_YELLOW */ | ||
125 | #define LED_YELLOW_OFF() \ | ||
126 | GPIO_PortSet(BOARD_LED_YELLOW_GPIO, 1U << BOARD_LED_YELLOW_GPIO_PIN) /*!< Turn off target LED_YELLOW */ | ||
127 | #define LED_YELLOW_TOGGLE() \ | ||
128 | GPIO_PortToggle(BOARD_LED_YELLOW_GPIO, 1U << BOARD_LED_YELLOW_GPIO_PIN) /*!< Toggle on target LED_YELLOW */ | ||
129 | |||
130 | #define LED_ORANGE_INIT(output) \ | ||
131 | GPIO_PinWrite(BOARD_LED_ORANGE_GPIO, BOARD_LED_ORANGE_GPIO_PIN, output); \ | ||
132 | BOARD_LED_ORANGE_GPIO->PDDR |= (1U << BOARD_LED_ORANGE_GPIO_PIN) /*!< Enable target LED_ORANGE */ | ||
133 | #define LED_ORANGE_ON() \ | ||
134 | GPIO_PortClear(BOARD_LED_ORANGE_GPIO, 1U << BOARD_LED_ORANGE_GPIO_PIN) /*!< Turn on target LED_ORANGE */ | ||
135 | #define LED_ORANGE_OFF() \ | ||
136 | GPIO_PortSet(BOARD_LED_ORANGE_GPIO, 1U << BOARD_LED_ORANGE_GPIO_PIN) /*!< Turn off target LED_ORANGE */ | ||
137 | #define LED_ORANGE_TOGGLE() \ | ||
138 | GPIO_PortToggle(BOARD_LED_ORANGE_GPIO, 1U << BOARD_LED_ORANGE_GPIO_PIN) /*!< Toggle on target LED_ORANGE */ | ||
139 | |||
140 | #define LED_GREEN_INIT(output) \ | ||
141 | GPIO_PinWrite(BOARD_LED_GREEN_GPIO, BOARD_LED_GREEN_GPIO_PIN, output); \ | ||
142 | BOARD_LED_GREEN_GPIO->PDDR |= (1U << BOARD_LED_GREEN_GPIO_PIN) /*!< Enable target LED_GREEN */ | ||
143 | #define LED_GREEN_ON() \ | ||
144 | GPIO_PortClear(BOARD_LED_GREEN_GPIO, 1U << BOARD_LED_GREEN_GPIO_PIN) /*!< Turn on target LED_GREEN */ | ||
145 | #define LED_GREEN_OFF() \ | ||
146 | GPIO_PortSet(BOARD_LED_GREEN_GPIO, 1U << BOARD_LED_GREEN_GPIO_PIN) /*!< Turn off target LED_GREEN */ | ||
147 | #define LED_GREEN_TOGGLE() \ | ||
148 | GPIO_PortToggle(BOARD_LED_GREEN_GPIO, 1U << BOARD_LED_GREEN_GPIO_PIN) /*!< Toggle on target LED_GREEN */ | ||
149 | |||
150 | #define LED_BLUE_INIT(output) \ | ||
151 | GPIO_PinWrite(BOARD_LED_BLUE_GPIO, BOARD_LED_BLUE_GPIO_PIN, output); \ | ||
152 | BOARD_LED_BLUE_GPIO->PDDR |= (1U << BOARD_LED_BLUE_GPIO_PIN) /*!< Enable target LED_BLUE */ | ||
153 | #define LED_BLUE_ON() \ | ||
154 | GPIO_PortClear(BOARD_LED_BLUE_GPIO, 1U << BOARD_LED_BLUE_GPIO_PIN) /*!< Turn on target LED_BLUE */ | ||
155 | #define LED_BLUE_OFF() \ | ||
156 | GPIO_PortSet(BOARD_LED_BLUE_GPIO, 1U << BOARD_LED_BLUE_GPIO_PIN) /*!< Turn off target LED_BLUE */ | ||
157 | #define LED_BLUE_TOGGLE() \ | ||
158 | GPIO_PortToggle(BOARD_LED_BLUE_GPIO, 1U << BOARD_LED_BLUE_GPIO_PIN) /*!< Toggle on target LED_BLUE */ | ||
159 | |||
160 | /*! @brief Define the port interrupt number for the usb id gpio pin */ | ||
161 | #define BOARD_ID_GPIO GPIOE | ||
162 | #define BOARD_ID_PORT PORTE | ||
163 | #define BOARD_ID_GPIO_PIN 10U | ||
164 | #define BOARD_ID_IRQ PORTE_IRQn | ||
165 | |||
166 | /* SDHC base address, clock and card detection pin */ | ||
167 | #define BOARD_SDHC_BASEADDR SDHC | ||
168 | #define BOARD_SDHC_CLKSRC kCLOCK_CoreSysClk | ||
169 | #define BOARD_SDHC_CLK_FREQ CLOCK_GetFreq(kCLOCK_CoreSysClk) | ||
170 | #define BOARD_SDHC_IRQ SDHC_IRQn | ||
171 | #define BOARD_SDHC_CD_GPIO_BASE GPIOA | ||
172 | #ifndef BOARD_SDHC_CD_GPIO_PIN | ||
173 | #define BOARD_SDHC_CD_GPIO_PIN 9U | ||
174 | #endif | ||
175 | #define BOARD_SDHC_CD_PORT_BASE PORTA | ||
176 | #define BOARD_SDHC_CD_PORT_IRQ PORTA_IRQn | ||
177 | #define BOARD_SDHC_CD_PORT_IRQ_HANDLER PORTA_IRQHandler | ||
178 | |||
179 | #if defined(__cplusplus) | ||
180 | extern "C" { | ||
181 | #endif /* __cplusplus */ | ||
182 | |||
183 | /******************************************************************************* | ||
184 | * API | ||
185 | ******************************************************************************/ | ||
186 | |||
187 | void BOARD_InitDebugConsole(void); | ||
188 | |||
189 | #if defined(__cplusplus) | ||
190 | } | ||
191 | #endif /* __cplusplus */ | ||
192 | |||
193 | #endif /* _BOARD_H_ */ | ||