aboutsummaryrefslogtreecommitdiff
path: root/lib/chibios-contrib/ext/mcux-sdk/boards/lpcxpresso54s018m/project_template/board.h
diff options
context:
space:
mode:
Diffstat (limited to 'lib/chibios-contrib/ext/mcux-sdk/boards/lpcxpresso54s018m/project_template/board.h')
-rw-r--r--lib/chibios-contrib/ext/mcux-sdk/boards/lpcxpresso54s018m/project_template/board.h245
1 files changed, 245 insertions, 0 deletions
diff --git a/lib/chibios-contrib/ext/mcux-sdk/boards/lpcxpresso54s018m/project_template/board.h b/lib/chibios-contrib/ext/mcux-sdk/boards/lpcxpresso54s018m/project_template/board.h
new file mode 100644
index 000000000..197f3889b
--- /dev/null
+++ b/lib/chibios-contrib/ext/mcux-sdk/boards/lpcxpresso54s018m/project_template/board.h
@@ -0,0 +1,245 @@
1/*
2 * Copyright (c) 2016, Freescale Semiconductor, Inc.
3 * Copyright 2016-2018 NXP
4 * All rights reserved.
5 *
6 *
7 * SPDX-License-Identifier: BSD-3-Clause
8 */
9
10#ifndef _BOARD_H_
11#define _BOARD_H_
12
13#include "clock_config.h"
14#include "fsl_common.h"
15#include "fsl_gpio.h"
16
17/*******************************************************************************
18 * Definitions
19 ******************************************************************************/
20/*! @brief The board name */
21#define BOARD_NAME "LPCXPRESSO54S018"
22
23#define BOARD_EXTCLKINRATE (0)
24
25/*! @brief The UART to use for debug messages. */
26/* TODO: rename UART to USART */
27#define BOARD_DEBUG_UART_TYPE kSerialPort_Uart
28#define BOARD_DEBUG_UART_BASEADDR (uint32_t) USART0
29#define BOARD_DEBUG_UART_INSTANCE 0U
30#define BOARD_DEBUG_UART_CLK_FREQ CLOCK_GetFlexCommClkFreq(0U)
31#define BOARD_DEBUG_UART_CLK_ATTACH kFRO12M_to_FLEXCOMM0
32#define BOARD_DEBUG_UART_RST kFC0_RST_SHIFT_RSTn
33#define BOARD_UART_IRQ_HANDLER FLEXCOMM0_IRQHandler
34#define BOARD_UART_IRQ FLEXCOMM0_IRQn
35/* TODO: obsolete */
36#define BOARD_DEBUG_SPI_CLK_FREQ 12000000
37
38#define BOARD_ACCEL_I2C_BASEADDR I2C2
39#define BOARD_ACCEL_I2C_CLOCK_FREQ 12000000
40
41#define BOARD_CODEC_I2C_BASEADDR I2C2
42#define BOARD_CODEC_I2C_INSTANCE 2U
43#define BOARD_CODEC_I2C_CLOCK_FREQ 12000000
44
45#ifndef BOARD_DEBUG_UART_BAUDRATE
46#define BOARD_DEBUG_UART_BAUDRATE 115200
47#endif /* BOARD_DEBUG_UART_BAUDRATE */
48
49/*! @brief The ENET PHY address. */
50#define BOARD_ENET0_PHY_ADDRESS (0x00U) /* Phy address of enet port 0. */
51
52#ifndef BOARD_LED1_GPIO
53#define BOARD_LED1_GPIO GPIO
54#endif
55#define BOARD_LED1_GPIO_PORT 3U
56#ifndef BOARD_LED1_GPIO_PIN
57#define BOARD_LED1_GPIO_PIN 14U
58#endif
59#ifndef BOARD_LED2_GPIO
60#define BOARD_LED2_GPIO GPIO
61#endif
62#define BOARD_LED2_GPIO_PORT 3U
63#ifndef BOARD_LED2_GPIO_PIN
64#define BOARD_LED2_GPIO_PIN 3U
65#endif
66#ifndef BOARD_LED3_GPIO
67#define BOARD_LED3_GPIO GPIO
68#endif
69#define BOARD_LED3_GPIO_PORT 2U
70#ifndef BOARD_LED3_GPIO_PIN
71#define BOARD_LED3_GPIO_PIN 2U
72#endif
73
74#ifndef BOARD_SW1_GPIO
75#define BOARD_SW1_GPIO GPIO
76#endif
77#define BOARD_SW1_GPIO_PORT 0U
78#ifndef BOARD_SW1_GPIO_PIN
79#define BOARD_SW1_GPIO_PIN 4U
80#endif
81#define BOARD_SW1_NAME "SW1"
82#define BOARD_SW3_IRQ PIN_INT0_IRQn
83#define BOARD_SW3_IRQ_HANDLER PIN_INT0_IRQHandler
84
85#ifndef BOARD_SW2_GPIO
86#define BOARD_SW2_GPIO GPIO
87#endif
88#define BOARD_SW2_GPIO_PORT 0U
89#ifndef BOARD_SW2_GPIO_PIN
90#define BOARD_SW2_GPIO_PIN 6U
91#endif
92#define BOARD_SW2_NAME "SW2"
93#define BOARD_SW2_IRQ PIN_INT0_IRQn
94#define BOARD_SW2_IRQ_HANDLER PIN_INT0_IRQHandler
95
96#ifndef BOARD_SW3_GPIO
97#define BOARD_SW3_GPIO GPIO
98#endif
99#define BOARD_SW3_GPIO_PORT 0U
100#ifndef BOARD_SW3_GPIO_PIN
101#define BOARD_SW3_GPIO_PIN 5U
102#endif
103#define BOARD_SW3_NAME "SW3"
104#define BOARD_SW3_IRQ PIN_INT0_IRQn
105#define BOARD_SW3_IRQ_HANDLER PIN_INT0_IRQHandler
106#define BOARD_SW3_GPIO_PININT_INDEX 0
107
108#ifndef BOARD_SW4_GPIO
109#define BOARD_SW4_GPIO GPIO
110#endif
111#ifndef BOARD_SW4_GPIO_PORT
112#define BOARD_SW4_GPIO_PORT 0U
113#endif
114#ifndef BOARD_SW4_GPIO_PIN
115#define BOARD_SW4_GPIO_PIN 4U
116#endif
117#define BOARD_SW4_NAME "SW4"
118#define BOARD_SW4_IRQ PIN_INT0_IRQn
119#define BOARD_SW4_IRQ_HANDLER PIN_INT0_IRQHandler
120#define BOARD_SW4_GPIO_PININT_INDEX 0
121
122#ifndef BOARD_SW5_GPIO
123#define BOARD_SW5_GPIO GPIO
124#endif
125#ifndef BOARD_SW5_GPIO_PORT
126#define BOARD_SW5_GPIO_PORT 1U
127#endif
128#ifndef BOARD_SW5_GPIO_PIN
129#define BOARD_SW5_GPIO_PIN 1U
130#endif
131#define BOARD_SW5_NAME "SW5"
132#define BOARD_SW5_IRQ PIN_INT1_IRQn
133#define BOARD_SW5_IRQ_HANDLER PIN_INT1_IRQHandler
134#define BOARD_SW5_GPIO_PININT_INDEX 0
135
136#define BOARD_ARDUINO_INT_IRQ (GINT0_IRQn)
137#define BOARD_ARDUINO_I2C_IRQ (FLEXCOMM2_IRQn)
138#define BOARD_ARDUINO_I2C_INDEX (2)
139
140/* Board led color mapping */
141#define LOGIC_LED_ON 0U
142#define LOGIC_LED_OFF 1U
143
144#define LED1_INIT(output) \
145 GPIO_PinInit(BOARD_LED1_GPIO, BOARD_LED1_GPIO_PORT, BOARD_LED1_GPIO_PIN, \
146 &(gpio_pin_config_t){kGPIO_DigitalOutput, (output)}) /*!< Enable target LED1 */
147#define LED1_ON() \
148 GPIO_PortClear(BOARD_LED1_GPIO, BOARD_LED1_GPIO_PORT, 1U << BOARD_LED1_GPIO_PIN) /*!< Turn on target LED1 */
149#define LED1_OFF() \
150 GPIO_PortSet(BOARD_LED1_GPIO, BOARD_LED1_GPIO_PORT, 1U << BOARD_LED1_GPIO_PIN) /*!< Turn off target LED1 */
151#define LED1_TOGGLE() \
152 GPIO_PortToggle(BOARD_LED1_GPIO, BOARD_LED1_GPIO_PORT, 1U << BOARD_LED1_GPIO_PIN) /*!< Toggle on target LED1 */
153#define LED2_INIT(output) \
154 GPIO_PinInit(BOARD_LED2_GPIO, BOARD_LED2_GPIO_PORT, BOARD_LED2_GPIO_PIN, \
155 &(gpio_pin_config_t){kGPIO_DigitalOutput, (output)}) /*!< Enable target LED2 */
156#define LED2_ON() \
157 GPIO_PortClear(BOARD_LED2_GPIO, BOARD_LED2_GPIO_PORT, 1U << BOARD_LED2_GPIO_PIN) /*!< Turn on target LED2 */
158#define LED2_OFF() \
159 GPIO_PortSet(BOARD_LED2_GPIO, BOARD_LED2_GPIO_PORT, 1U << BOARD_LED2_GPIO_PIN) /*!< Turn off target LED2 */
160#define LED2_TOGGLE() \
161 GPIO_PortToggle(BOARD_LED2_GPIO, BOARD_LED2_GPIO_PORT, 1U << BOARD_LED2_GPIO_PIN) /*!< Toggle on target LED2 */
162
163#define LED3_INIT(output) \
164 GPIO_PinInit(BOARD_LED3_GPIO, BOARD_LED3_GPIO_PORT, BOARD_LED3_GPIO_PIN, \
165 &(gpio_pin_config_t){kGPIO_DigitalOutput, (output)}) /*!< Enable target LED3 */
166#define LED3_ON() \
167 GPIO_PortClear(BOARD_LED3_GPIO, BOARD_LED3_GPIO_PORT, 1U << BOARD_LED3_GPIO_PIN) /*!< Turn on target LED3 */
168#define LED3_OFF() \
169 GPIO_PortSet(BOARD_LED3_GPIO, BOARD_LED3_GPIO_PORT, 1U << BOARD_LED3_GPIO_PIN) /*!< Turn off target LED3 */
170#define LED3_TOGGLE() \
171 GPIO_PortToggle(BOARD_LED3_GPIO, BOARD_LED3_GPIO_PORT, 1U << BOARD_LED3_GPIO_PIN) /*!< Toggle on target LED3 */
172
173/*! @brief The WIFI-QCA shield pin. */
174#define BOARD_INITGT202SHIELD_PWRON_GPIO GPIO /*!< GPIO device name: GPIO */
175#define BOARD_INITGT202SHIELD_PWRON_PORT 4U /*!< PORT device index: 4 */
176#define BOARD_INITGT202SHIELD_PWRON_GPIO_PIN 7U /*!< PIO4 pin index: 7 */
177#define BOARD_INITGT202SHIELD_PWRON_PIN_NAME PIO4_7 /*!< Pin name */
178#define BOARD_INITGT202SHIELD_PWRON_LABEL "PWRON" /*!< Label */
179#define BOARD_INITGT202SHIELD_PWRON_NAME "PWRON" /*!< Identifier name */
180#define BOARD_INITGT202SHIELD_PWRON_DIRECTION kGPIO_DigitalOutput /*!< Direction */
181
182#define BOARD_INITGT202SHIELD_IRQ_GPIO GPIO /*!< GPIO device name: GPIO */
183#define BOARD_INITGT202SHIELD_IRQ_PORT 1U /*!< PORT device index: 1 */
184#define BOARD_INITGT202SHIELD_IRQ_GPIO_PIN 22U /*!< PIO1 pin index: 22 */
185#define BOARD_INITGT202SHIELD_IRQ_PIN_NAME PIO1_22 /*!< Pin name */
186#define BOARD_INITGT202SHIELD_IRQ_LABEL "IRQ" /*!< Label */
187#define BOARD_INITGT202SHIELD_IRQ_NAME "IRQ" /*!< Identifier name */
188#define BOARD_INITGT202SHIELD_IRQ_DIRECTION kGPIO_DigitalInput /*!< Direction */
189
190/* LCD panel. */
191#define BOARD_LCD_BL_GPIO 3
192#define BOARD_LCD_BL_PIN 31
193#define BOARD_TOUCH_PANEL_RST_GPIO 2
194#define BOARD_TOUCH_PANEL_RST_PIN 27
195
196/* Serial MWM WIFI */
197#define BOARD_SERIAL_MWM_PORT_CLK_FREQ CLOCK_GetFlexCommClkFreq(4)
198#define BOARD_SERIAL_MWM_PORT USART4
199#define BOARD_SERIAL_MWM_PORT_IRQn FLEXCOMM4_IRQn
200#define BOARD_SERIAL_MWM_RST_GPIO GPIO
201#define BOARD_SERIAL_MWM_RST_PORT 1
202#define BOARD_SERIAL_MWM_RST_PIN 0
203#define BOARD_SERIAL_MWM_RST_WRITE(output) \
204 GPIO_PinWrite(BOARD_SERIAL_MWM_RST_GPIO, BOARD_SERIAL_MWM_RST_PORT, BOARD_SERIAL_MWM_RST_PIN, output)
205
206#if defined(__cplusplus)
207extern "C" {
208#endif /* __cplusplus */
209
210/*******************************************************************************
211 * API
212 ******************************************************************************/
213
214status_t BOARD_InitDebugConsole(void);
215void BOARD_InitSDRAM(void);
216#if defined(SDK_I2C_BASED_COMPONENT_USED) && SDK_I2C_BASED_COMPONENT_USED
217void BOARD_I2C_Init(I2C_Type *base, uint32_t clkSrc_Hz);
218status_t BOARD_I2C_Send(I2C_Type *base,
219 uint8_t deviceAddress,
220 uint32_t subAddress,
221 uint8_t subaddressSize,
222 uint8_t *txBuff,
223 uint8_t txBuffSize);
224status_t BOARD_I2C_Receive(I2C_Type *base,
225 uint8_t deviceAddress,
226 uint32_t subAddress,
227 uint8_t subaddressSize,
228 uint8_t *rxBuff,
229 uint8_t rxBuffSize);
230void BOARD_Accel_I2C_Init(void);
231status_t BOARD_Accel_I2C_Send(uint8_t deviceAddress, uint32_t subAddress, uint8_t subaddressSize, uint32_t txBuff);
232status_t BOARD_Accel_I2C_Receive(
233 uint8_t deviceAddress, uint32_t subAddress, uint8_t subaddressSize, uint8_t *rxBuff, uint8_t rxBuffSize);
234void BOARD_Codec_I2C_Init(void);
235status_t BOARD_Codec_I2C_Send(
236 uint8_t deviceAddress, uint32_t subAddress, uint8_t subAddressSize, const uint8_t *txBuff, uint8_t txBuffSize);
237status_t BOARD_Codec_I2C_Receive(
238 uint8_t deviceAddress, uint32_t subAddress, uint8_t subAddressSize, uint8_t *rxBuff, uint8_t rxBuffSize);
239#endif /* SDK_I2C_BASED_COMPONENT_USED */
240
241#if defined(__cplusplus)
242}
243#endif /* __cplusplus */
244
245#endif /* _BOARD_H_ */