diff options
Diffstat (limited to 'lib/chibios-contrib/ext/mcux-sdk/boards/evkmimxrt1060/board.h')
-rw-r--r-- | lib/chibios-contrib/ext/mcux-sdk/boards/evkmimxrt1060/board.h | 220 |
1 files changed, 220 insertions, 0 deletions
diff --git a/lib/chibios-contrib/ext/mcux-sdk/boards/evkmimxrt1060/board.h b/lib/chibios-contrib/ext/mcux-sdk/boards/evkmimxrt1060/board.h new file mode 100644 index 000000000..af781e3de --- /dev/null +++ b/lib/chibios-contrib/ext/mcux-sdk/boards/evkmimxrt1060/board.h | |||
@@ -0,0 +1,220 @@ | |||
1 | /* | ||
2 | * Copyright 2018-2019 NXP | ||
3 | * All rights reserved. | ||
4 | * | ||
5 | * SPDX-License-Identifier: BSD-3-Clause | ||
6 | */ | ||
7 | |||
8 | #ifndef _BOARD_H_ | ||
9 | #define _BOARD_H_ | ||
10 | |||
11 | #include "clock_config.h" | ||
12 | #include "fsl_common.h" | ||
13 | #include "fsl_gpio.h" | ||
14 | #include "fsl_clock.h" | ||
15 | |||
16 | /******************************************************************************* | ||
17 | * Definitions | ||
18 | ******************************************************************************/ | ||
19 | /*! @brief The board name */ | ||
20 | #define BOARD_NAME "MIMXRT1060-EVK" | ||
21 | |||
22 | /* The UART to use for debug messages. */ | ||
23 | #define BOARD_DEBUG_UART_TYPE kSerialPort_Uart | ||
24 | #define BOARD_DEBUG_UART_BASEADDR (uint32_t) LPUART1 | ||
25 | #define BOARD_DEBUG_UART_INSTANCE 1U | ||
26 | |||
27 | #define BOARD_DEBUG_UART_CLK_FREQ BOARD_DebugConsoleSrcFreq() | ||
28 | |||
29 | #define BOARD_UART_IRQ LPUART1_IRQn | ||
30 | #define BOARD_UART_IRQ_HANDLER LPUART1_IRQHandler | ||
31 | |||
32 | #ifndef BOARD_DEBUG_UART_BAUDRATE | ||
33 | #define BOARD_DEBUG_UART_BAUDRATE (115200U) | ||
34 | #endif /* BOARD_DEBUG_UART_BAUDRATE */ | ||
35 | |||
36 | /*! @brief The USER_LED used for board */ | ||
37 | #define LOGIC_LED_ON (0U) | ||
38 | #define LOGIC_LED_OFF (1U) | ||
39 | #ifndef BOARD_USER_LED_GPIO | ||
40 | #define BOARD_USER_LED_GPIO GPIO1 | ||
41 | #endif | ||
42 | #ifndef BOARD_USER_LED_GPIO_PIN | ||
43 | #define BOARD_USER_LED_GPIO_PIN (9U) | ||
44 | #endif | ||
45 | |||
46 | #define USER_LED_INIT(output) \ | ||
47 | GPIO_PinWrite(BOARD_USER_LED_GPIO, BOARD_USER_LED_GPIO_PIN, output); \ | ||
48 | BOARD_USER_LED_GPIO->GDIR |= (1U << BOARD_USER_LED_GPIO_PIN) /*!< Enable target USER_LED */ | ||
49 | #define USER_LED_ON() \ | ||
50 | GPIO_PortClear(BOARD_USER_LED_GPIO, 1U << BOARD_USER_LED_GPIO_PIN) /*!< Turn off target USER_LED */ | ||
51 | #define USER_LED_OFF() GPIO_PortSet(BOARD_USER_LED_GPIO, 1U << BOARD_USER_LED_GPIO_PIN) /*!<Turn on target USER_LED*/ | ||
52 | #define USER_LED_TOGGLE() \ | ||
53 | GPIO_PinWrite(BOARD_USER_LED_GPIO, BOARD_USER_LED_GPIO_PIN, \ | ||
54 | 0x1 ^ GPIO_PinRead(BOARD_USER_LED_GPIO, BOARD_USER_LED_GPIO_PIN)) /*!< Toggle target USER_LED */ | ||
55 | |||
56 | /*! @brief Define the port interrupt number for the board switches */ | ||
57 | #ifndef BOARD_USER_BUTTON_GPIO | ||
58 | #define BOARD_USER_BUTTON_GPIO GPIO5 | ||
59 | #endif | ||
60 | #ifndef BOARD_USER_BUTTON_GPIO_PIN | ||
61 | #define BOARD_USER_BUTTON_GPIO_PIN (0U) | ||
62 | #endif | ||
63 | #define BOARD_USER_BUTTON_IRQ GPIO5_Combined_0_15_IRQn | ||
64 | #define BOARD_USER_BUTTON_IRQ_HANDLER GPIO5_Combined_0_15_IRQHandler | ||
65 | #define BOARD_USER_BUTTON_NAME "SW8" | ||
66 | |||
67 | /*! @brief The board flash size */ | ||
68 | #define BOARD_FLASH_SIZE (0x800000U) | ||
69 | |||
70 | /*! @brief The ENET PHY address. */ | ||
71 | #define BOARD_ENET0_PHY_ADDRESS (0x02U) /* Phy address of enet port 0. */ | ||
72 | |||
73 | /* USB PHY condfiguration */ | ||
74 | #define BOARD_USB_PHY_D_CAL (0x0CU) | ||
75 | #define BOARD_USB_PHY_TXCAL45DP (0x06U) | ||
76 | #define BOARD_USB_PHY_TXCAL45DM (0x06U) | ||
77 | |||
78 | #define BOARD_ARDUINO_INT_IRQ (GPIO1_INT3_IRQn) | ||
79 | #define BOARD_ARDUINO_I2C_IRQ (LPI2C1_IRQn) | ||
80 | #define BOARD_ARDUINO_I2C_INDEX (1) | ||
81 | |||
82 | /*! @brief The WIFI-QCA shield pin. */ | ||
83 | #define BOARD_INITGT202SHIELD_PWRON_GPIO GPIO1 /*!< GPIO device name: GPIO */ | ||
84 | #define BOARD_INITGT202SHIELD_PWRON_PORT 1U /*!< PORT device index: 1 */ | ||
85 | #define BOARD_INITGT202SHIELD_PWRON_GPIO_PIN 3U /*!< PIO4 pin index: 3 */ | ||
86 | #define BOARD_INITGT202SHIELD_PWRON_PIN_NAME GPIO1_3 /*!< Pin name */ | ||
87 | #define BOARD_INITGT202SHIELD_PWRON_LABEL "PWRON" /*!< Label */ | ||
88 | #define BOARD_INITGT202SHIELD_PWRON_NAME "PWRON" /*!< Identifier name */ | ||
89 | #define BOARD_INITGT202SHIELD_PWRON_DIRECTION kGPIO_DigitalOutput /*!< Direction */ | ||
90 | |||
91 | #define BOARD_INITGT202SHIELD_IRQ_GPIO GPIO1 /*!< GPIO device name: GPIO */ | ||
92 | #define BOARD_INITGT202SHIELD_IRQ_PORT 1U /*!< PORT device index: 1 */ | ||
93 | #define BOARD_INITGT202SHIELD_IRQ_GPIO_PIN 19U /*!< PIO1 pin index: 19 */ | ||
94 | #define BOARD_INITGT202SHIELD_IRQ_PIN_NAME GPIO1_19 /*!< Pin name */ | ||
95 | #define BOARD_INITGT202SHIELD_IRQ_LABEL "IRQ" /*!< Label */ | ||
96 | #define BOARD_INITGT202SHIELD_IRQ_NAME "IRQ" /*!< Identifier name */ | ||
97 | #define BOARD_INITGT202SHIELD_IRQ_DIRECTION kGPIO_DigitalInput /*!< Direction */ | ||
98 | |||
99 | #define BOARD_INITSILEX2401SHIELD_PWRON_GPIO GPIO1 /*!< GPIO device name: GPIO */ | ||
100 | #define BOARD_INITSILEX2401SHIELD_PWRON_PORT 1U /*!< PORT device index: 1 */ | ||
101 | #define BOARD_INITSILEX2401SHIELD_PWRON_GPIO_PIN 9U /*!< PIO4 pin index: 9 */ | ||
102 | #define BOARD_INITSILEX2401SHIELD_PWRON_PIN_NAME GPIO1_9 /*!< Pin name */ | ||
103 | #define BOARD_INITSILEX2401SHIELD_PWRON_LABEL "PWRON" /*!< Label */ | ||
104 | #define BOARD_INITSILEX2401SHIELD_PWRON_NAME "PWRON" /*!< Identifier name */ | ||
105 | #define BOARD_INITSILEX2401SHIELD_PWRON_DIRECTION kGPIO_DigitalOutput /*!< Direction */ | ||
106 | |||
107 | #define BOARD_INITSILEX2401SHIELD_IRQ_GPIO GPIO1 /*!< GPIO device name: GPIO */ | ||
108 | #define BOARD_INITSILEX2401SHIELD_IRQ_PORT 1U /*!< PORT device index: 1 */ | ||
109 | #define BOARD_INITSILEX2401SHIELD_IRQ_GPIO_PIN 11U /*!< PIO1 pin index: 11 */ | ||
110 | #define BOARD_INITSILEX2401SHIELD_IRQ_PIN_NAME GPIO1_11 /*!< Pin name */ | ||
111 | #define BOARD_INITSILEX2401SHIELD_IRQ_LABEL "IRQ" /*!< Label */ | ||
112 | #define BOARD_INITSILEX2401SHIELD_IRQ_NAME "IRQ" /*!< Identifier name */ | ||
113 | #define BOARD_INITSILEX2401SHIELD_IRQ_DIRECTION kGPIO_DigitalInput /*!< Direction */ | ||
114 | |||
115 | /* @Brief Board accelerator sensor configuration */ | ||
116 | #define BOARD_ACCEL_I2C_BASEADDR LPI2C1 | ||
117 | /* Select USB1 PLL (480 MHz) as LPI2C's clock source */ | ||
118 | #define BOARD_ACCEL_I2C_CLOCK_SOURCE_SELECT (0U) | ||
119 | /* Clock divider for LPI2C clock source */ | ||
120 | #define BOARD_ACCEL_I2C_CLOCK_SOURCE_DIVIDER (5U) | ||
121 | #define BOARD_ACCEL_I2C_CLOCK_FREQ (CLOCK_GetFreq(kCLOCK_Usb1PllClk) / 8 / (BOARD_ACCEL_I2C_CLOCK_SOURCE_DIVIDER + 1U)) | ||
122 | |||
123 | #define BOARD_CODEC_I2C_BASEADDR LPI2C1 | ||
124 | #define BOARD_CODEC_I2C_INSTANCE 1U | ||
125 | #define BOARD_CODEC_I2C_CLOCK_SOURCE_SELECT (0U) | ||
126 | #define BOARD_CODEC_I2C_CLOCK_SOURCE_DIVIDER (5U) | ||
127 | #define BOARD_CODEC_I2C_CLOCK_FREQ (10000000U) | ||
128 | |||
129 | /* @Brief Board CAMERA configuration */ | ||
130 | #define BOARD_CAMERA_I2C_BASEADDR LPI2C1 | ||
131 | #define BOARD_CAMERA_I2C_CLOCK_SOURCE_DIVIDER (5U) | ||
132 | #define BOARD_CAMERA_I2C_CLOCK_SOURCE_SELECT (0U) /* Select USB1 PLL (480 MHz) as LPI2C's clock source */ | ||
133 | #define BOARD_CAMERA_I2C_CLOCK_FREQ \ | ||
134 | (CLOCK_GetFreq(kCLOCK_Usb1PllClk) / 8 / (BOARD_CAMERA_I2C_CLOCK_SOURCE_DIVIDER + 1U)) | ||
135 | |||
136 | #define BOARD_CAMERA_I2C_SCL_GPIO GPIO1 | ||
137 | #define BOARD_CAMERA_I2C_SCL_PIN 16 | ||
138 | #define BOARD_CAMERA_I2C_SDA_GPIO GPIO1 | ||
139 | #define BOARD_CAMERA_I2C_SDA_PIN 17 | ||
140 | #define BOARD_CAMERA_PWDN_GPIO GPIO1 | ||
141 | #define BOARD_CAMERA_PWDN_PIN 4 | ||
142 | |||
143 | /* @Brief Board Bluetooth HCI UART configuration */ | ||
144 | #define BOARD_BT_UART_BASEADDR LPUART3 | ||
145 | #define BOARD_BT_UART_INSTANCE 3 | ||
146 | #define BOARD_BT_UART_BAUDRATE 3000000 | ||
147 | #define BOARD_BT_UART_CLK_FREQ BOARD_DebugConsoleSrcFreq() | ||
148 | #define BOARD_BT_UART_IRQ LPUART3_IRQn | ||
149 | #define BOARD_BT_UART_IRQ_HANDLER LPUART3_IRQHandler | ||
150 | |||
151 | /*! @brief board has sdcard */ | ||
152 | #define BOARD_HAS_SDCARD (1U) | ||
153 | |||
154 | #if defined(__cplusplus) | ||
155 | extern "C" { | ||
156 | #endif /* __cplusplus */ | ||
157 | |||
158 | /******************************************************************************* | ||
159 | * API | ||
160 | ******************************************************************************/ | ||
161 | uint32_t BOARD_DebugConsoleSrcFreq(void); | ||
162 | |||
163 | void BOARD_InitDebugConsole(void); | ||
164 | |||
165 | void BOARD_ConfigMPU(void); | ||
166 | #if defined(SDK_I2C_BASED_COMPONENT_USED) && SDK_I2C_BASED_COMPONENT_USED | ||
167 | void BOARD_LPI2C_Init(LPI2C_Type *base, uint32_t clkSrc_Hz); | ||
168 | status_t BOARD_LPI2C_Send(LPI2C_Type *base, | ||
169 | uint8_t deviceAddress, | ||
170 | uint32_t subAddress, | ||
171 | uint8_t subaddressSize, | ||
172 | uint8_t *txBuff, | ||
173 | uint8_t txBuffSize); | ||
174 | status_t BOARD_LPI2C_Receive(LPI2C_Type *base, | ||
175 | uint8_t deviceAddress, | ||
176 | uint32_t subAddress, | ||
177 | uint8_t subaddressSize, | ||
178 | uint8_t *rxBuff, | ||
179 | uint8_t rxBuffSize); | ||
180 | status_t BOARD_LPI2C_SendSCCB(LPI2C_Type *base, | ||
181 | uint8_t deviceAddress, | ||
182 | uint32_t subAddress, | ||
183 | uint8_t subaddressSize, | ||
184 | uint8_t *txBuff, | ||
185 | uint8_t txBuffSize); | ||
186 | status_t BOARD_LPI2C_ReceiveSCCB(LPI2C_Type *base, | ||
187 | uint8_t deviceAddress, | ||
188 | uint32_t subAddress, | ||
189 | uint8_t subaddressSize, | ||
190 | uint8_t *rxBuff, | ||
191 | uint8_t rxBuffSize); | ||
192 | void BOARD_Accel_I2C_Init(void); | ||
193 | status_t BOARD_Accel_I2C_Send(uint8_t deviceAddress, uint32_t subAddress, uint8_t subaddressSize, uint32_t txBuff); | ||
194 | status_t BOARD_Accel_I2C_Receive( | ||
195 | uint8_t deviceAddress, uint32_t subAddress, uint8_t subaddressSize, uint8_t *rxBuff, uint8_t rxBuffSize); | ||
196 | void BOARD_Codec_I2C_Init(void); | ||
197 | status_t BOARD_Codec_I2C_Send( | ||
198 | uint8_t deviceAddress, uint32_t subAddress, uint8_t subAddressSize, const uint8_t *txBuff, uint8_t txBuffSize); | ||
199 | status_t BOARD_Codec_I2C_Receive( | ||
200 | uint8_t deviceAddress, uint32_t subAddress, uint8_t subAddressSize, uint8_t *rxBuff, uint8_t rxBuffSize); | ||
201 | void BOARD_Camera_I2C_Init(void); | ||
202 | status_t BOARD_Camera_I2C_Send( | ||
203 | uint8_t deviceAddress, uint32_t subAddress, uint8_t subAddressSize, const uint8_t *txBuff, uint8_t txBuffSize); | ||
204 | status_t BOARD_Camera_I2C_Receive( | ||
205 | uint8_t deviceAddress, uint32_t subAddress, uint8_t subAddressSize, uint8_t *rxBuff, uint8_t rxBuffSize); | ||
206 | |||
207 | status_t BOARD_Camera_I2C_SendSCCB( | ||
208 | uint8_t deviceAddress, uint32_t subAddress, uint8_t subAddressSize, const uint8_t *txBuff, uint8_t txBuffSize); | ||
209 | status_t BOARD_Camera_I2C_ReceiveSCCB( | ||
210 | uint8_t deviceAddress, uint32_t subAddress, uint8_t subAddressSize, uint8_t *rxBuff, uint8_t rxBuffSize); | ||
211 | #endif /* SDK_I2C_BASED_COMPONENT_USED */ | ||
212 | |||
213 | void BOARD_SD_Pin_Config(uint32_t speed, uint32_t strength); | ||
214 | void BOARD_MMC_Pin_Config(uint32_t speed, uint32_t strength); | ||
215 | |||
216 | #if defined(__cplusplus) | ||
217 | } | ||
218 | #endif /* __cplusplus */ | ||
219 | |||
220 | #endif /* _BOARD_H_ */ | ||