Fix for x86_64 build fail
[platform/upstream/connectedhomeip.git] / examples / platform / efr32 / efr32mg12 / BRD4163A / hal-config.h
1 /*
2  *
3  *    Copyright (c) 2020 Project CHIP Authors
4  *    All rights reserved.
5  *
6  *    Licensed under the Apache License, Version 2.0 (the "License");
7  *    you may not use this file except in compliance with the License.
8  *    You may obtain a copy of the License at
9  *
10  *        http://www.apache.org/licenses/LICENSE-2.0
11  *
12  *    Unless required by applicable law or agreed to in writing, software
13  *    distributed under the License is distributed on an "AS IS" BASIS,
14  *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  *    See the License for the specific language governing permissions and
16  *    limitations under the License.
17  */
18 /*******************************************************************************
19  * @file
20  * @brief hal-config.h
21  *******************************************************************************
22  * # License
23  * <b>Copyright 2018 Silicon Laboratories Inc. www.silabs.com</b>
24  *******************************************************************************
25  *
26  * The licensor of this software is Silicon Laboratories Inc. Your use of this
27  * software is governed by the terms of Silicon Labs Master Software License
28  * Agreement (MSLA) available at
29  * www.silabs.com/about-us/legal/master-software-license-agreement. This
30  * software is distributed to you in Source Code format and is governed by the
31  * sections of the MSLA applicable to Source Code.
32  *
33  ******************************************************************************/
34
35 #pragma once
36
37 #include "board_features.h"
38 #include "em_device.h"
39 #include "hal-config-app-common.h"
40 #include "hal-config-types.h"
41
42 #define HAL_BUTTON_COUNT (2U)
43 #define HAL_BUTTON_ENABLE                                                                                                          \
44     {                                                                                                                              \
45         0, 1                                                                                                                       \
46     }
47
48 #define HAL_CLK_HFCLK_SOURCE (HAL_CLK_HFCLK_SOURCE_HFXO)
49 #define HAL_CLK_LFACLK_SOURCE (HAL_CLK_LFCLK_SOURCE_LFRCO)
50 #define HAL_CLK_LFBCLK_SOURCE (HAL_CLK_LFCLK_SOURCE_LFRCO)
51 #define HAL_CLK_LFECLK_SOURCE (HAL_CLK_LFCLK_SOURCE_LFRCO)
52 #define HAL_CLK_HFXO_AUTOSTART (HAL_CLK_HFXO_AUTOSTART_NONE)
53
54 #define HAL_DCDC_BYPASS (0)
55
56 #define HAL_LED_COUNT (2U)
57 #define HAL_LED_ENABLE                                                                                                             \
58     {                                                                                                                              \
59         0, 1                                                                                                                       \
60     }
61
62 #define HAL_PA_ENABLE (1)
63
64 #define HAL_PTI_ENABLE (1)
65 #define HAL_PTI_MODE (HAL_PTI_MODE_UART)
66
67 #define HAL_SERIAL_RXWAKE_ENABLE (0)
68 #define HAL_SERIAL_IDLE_WAKE_ENABLE (1)
69 #define HAL_SERIAL_LEUART0_ENABLE (0)
70 #define HAL_SERIAL_USART0_ENABLE (0)
71 #define HAL_SERIAL_USART1_ENABLE (0)
72 #define HAL_SERIAL_USART2_ENABLE (0)
73 #define HAL_SERIAL_USART3_ENABLE (0)
74
75 #define HAL_SERIAL_APP_BAUD_RATE (115200UL)
76 #define HAL_SERIAL_APP_FLOW_CONTROL (HAL_USART_FLOW_CONTROL_NONE)
77 #define HAL_SERIAL_APP_RXSTOP (16UL)
78 #define HAL_SERIAL_APP_RXSTART (16UL)
79 #define HAL_SERIAL_APP_TX_QUEUE_SIZE (128UL)
80 #define HAL_SERIAL_APP_RX_QUEUE_SIZE (128UL)
81
82 #define HAL_SPIDISPLAY_ENABLE (1)
83
84 #define HAL_SPIDISPLAY_EXTMODE_EXTCOMIN (1)
85 #define HAL_SPIDISPLAY_EXTMODE_SPI (0)
86 #define HAL_SPIDISPLAY_EXTCOMIN_USE_CALLBACK (1)
87 #define HAL_SPIDISPLAY_EXTCOMIN_CALLBACK rtcIntCallbackRegister
88 #define HAL_SPIDISPLAY_EXTCOMIN_USE_PRS (0)
89
90 #define HAL_SPIDISPLAY_FREQUENCY (1000000UL)
91
92 #define HAL_USART0_ENABLE (1)
93
94 #define HAL_USART0_BAUD_RATE (115200UL)
95 #define HAL_USART0_FLOW_CONTROL (HAL_USART_FLOW_CONTROL_NONE)
96 #define HAL_USART0_RXSTOP (16UL)
97 #define HAL_USART0_RXSTART (16UL)
98 #define HAL_USART0_TX_QUEUE_SIZE (128UL)
99 #define HAL_USART0_RX_QUEUE_SIZE (128UL)
100
101 #define HAL_USART1_ENABLE (1)
102 #define HAL_USART1_FREQUENCY (1000000UL)
103
104 #ifndef HAL_VCOM_ENABLE
105 #define HAL_VCOM_ENABLE (1)
106 #endif
107
108 // $[BTL_BUTTON]
109
110 #define BSP_BTL_BUTTON_PIN (6U)
111 #define BSP_BTL_BUTTON_PORT (gpioPortF)
112
113 // [BTL_BUTTON]$
114
115 // $[BUTTON]
116 #define BSP_BUTTON_PRESENT (1)
117
118 #define BSP_BUTTON0_PIN (6U)
119 #define BSP_BUTTON0_PORT (gpioPortF)
120
121 #define BSP_BUTTON1_PIN (7U)
122 #define BSP_BUTTON1_PORT (gpioPortF)
123
124 #define BSP_BUTTON_COUNT (2U)
125 #define BSP_BUTTON_INIT                                                                                                            \
126     {                                                                                                                              \
127         { BSP_BUTTON0_PORT, BSP_BUTTON0_PIN }, { BSP_BUTTON1_PORT, BSP_BUTTON1_PIN }                                               \
128     }
129 #define BSP_BUTTON_GPIO_DOUT (HAL_GPIO_DOUT_LOW)
130 #define BSP_BUTTON_GPIO_MODE (HAL_GPIO_MODE_INPUT)
131 // [BUTTON]$
132
133 // $[CMU]
134 #define BSP_CLK_HFXO_PRESENT (1)
135 #define BSP_CLK_HFXO_FREQ (38400000UL)
136 #define BSP_CLK_HFXO_INIT CMU_HFXOINIT_DEFAULT
137 #define BSP_CLK_HFXO_CTUNE (331)
138 #define BSP_CLK_LFXO_PRESENT (1)
139 #define BSP_CLK_LFXO_INIT CMU_LFXOINIT_DEFAULT
140 #define BSP_CLK_LFXO_FREQ (32768U)
141 #define BSP_CLK_LFXO_CTUNE (32U)
142 // [CMU]$
143
144 // $[DCDC]
145 #define BSP_DCDC_PRESENT (1)
146
147 #define BSP_DCDC_INIT EMU_DCDCINIT_DEFAULT
148 // [DCDC]$
149
150 // $[EXTFLASH]
151 #define BSP_EXTFLASH_CS_PIN (4U)
152 #define BSP_EXTFLASH_CS_PORT (gpioPortA)
153
154 #define BSP_EXTFLASH_INTERNAL (0)
155 #define BSP_EXTFLASH_USART (HAL_SPI_PORT_USART1)
156 #define BSP_EXTFLASH_MOSI_PIN (6U)
157 #define BSP_EXTFLASH_MOSI_PORT (gpioPortC)
158 #define BSP_EXTFLASH_MOSI_LOC (11U)
159
160 #define BSP_EXTFLASH_MISO_PIN (7U)
161 #define BSP_EXTFLASH_MISO_PORT (gpioPortC)
162 #define BSP_EXTFLASH_MISO_LOC (11U)
163
164 #define BSP_EXTFLASH_CLK_PIN (8U)
165 #define BSP_EXTFLASH_CLK_PORT (gpioPortC)
166 #define BSP_EXTFLASH_CLK_LOC (11U)
167
168 // [EXTFLASH]$
169
170 // $[GPIO]
171 #define PORTIO_GPIO_SWV_PIN (2U)
172 #define PORTIO_GPIO_SWV_PORT (gpioPortF)
173 #define PORTIO_GPIO_SWV_LOC (0U)
174
175 #define BSP_TRACE_SWO_PIN (2U)
176 #define BSP_TRACE_SWO_PORT (gpioPortF)
177 #define BSP_TRACE_SWO_LOC (0U)
178
179 // [GPIO]$
180
181 // $[I2C0]
182 #define PORTIO_I2C0_SCL_PIN (10U)
183 #define PORTIO_I2C0_SCL_PORT (gpioPortC)
184 #define PORTIO_I2C0_SCL_LOC (14U)
185
186 #define PORTIO_I2C0_SDA_PIN (11U)
187 #define PORTIO_I2C0_SDA_PORT (gpioPortC)
188 #define PORTIO_I2C0_SDA_LOC (16U)
189
190 #define BSP_I2C0_SCL_PIN (10U)
191 #define BSP_I2C0_SCL_PORT (gpioPortC)
192 #define BSP_I2C0_SCL_LOC (14U)
193
194 #define BSP_I2C0_SDA_PIN (11U)
195 #define BSP_I2C0_SDA_PORT (gpioPortC)
196 #define BSP_I2C0_SDA_LOC (16U)
197
198 // [I2C0]$
199
200 // $[I2CSENSOR]
201
202 #define BSP_I2CSENSOR_ENABLE_PIN (10U)
203 #define BSP_I2CSENSOR_ENABLE_PORT (gpioPortB)
204
205 #define BSP_I2CSENSOR_PERIPHERAL (HAL_I2C_PORT_I2C0)
206 #define BSP_I2CSENSOR_SCL_PIN (10U)
207 #define BSP_I2CSENSOR_SCL_PORT (gpioPortC)
208 #define BSP_I2CSENSOR_SCL_LOC (14U)
209
210 #define BSP_I2CSENSOR_SDA_PIN (11U)
211 #define BSP_I2CSENSOR_SDA_PORT (gpioPortC)
212 #define BSP_I2CSENSOR_SDA_LOC (16U)
213
214 // [I2CSENSOR]$
215
216 // $[LED]
217 #define BSP_LED_PRESENT (1)
218
219 #define BSP_LED0_PIN (4U)
220 #define BSP_LED0_PORT (gpioPortF)
221
222 #define BSP_LED1_PIN (5U)
223 #define BSP_LED1_PORT (gpioPortF)
224
225 #define BSP_LED_COUNT (2U)
226 #define BSP_LED_INIT                                                                                                               \
227     {                                                                                                                              \
228         { BSP_LED0_PORT, BSP_LED0_PIN }, { BSP_LED1_PORT, BSP_LED1_PIN }                                                           \
229     }
230 #define BSP_LED_POLARITY (1)
231 // [LED]$
232
233 // $[PA]
234
235 #define BSP_PA_VOLTAGE (1800U)
236 // [PA]$
237
238 // $[PRS]
239 #define PORTIO_PRS_CH4_PIN (13U)
240 #define PORTIO_PRS_CH4_PORT (gpioPortD)
241 #define PORTIO_PRS_CH4_LOC (4U)
242
243 // [PRS]$
244
245 // $[PTI]
246 #define PORTIO_PTI_DFRAME_PIN (13U)
247 #define PORTIO_PTI_DFRAME_PORT (gpioPortB)
248 #define PORTIO_PTI_DFRAME_LOC (6U)
249
250 #define PORTIO_PTI_DOUT_PIN (12U)
251 #define PORTIO_PTI_DOUT_PORT (gpioPortB)
252 #define PORTIO_PTI_DOUT_LOC (6U)
253
254 #define BSP_PTI_DFRAME_PIN (13U)
255 #define BSP_PTI_DFRAME_PORT (gpioPortB)
256 #define BSP_PTI_DFRAME_LOC (6U)
257
258 #define BSP_PTI_DOUT_PIN (12U)
259 #define BSP_PTI_DOUT_PORT (gpioPortB)
260 #define BSP_PTI_DOUT_LOC (6U)
261
262 // [PTI]$
263
264 // $[SERIAL]
265 #define BSP_SERIAL_APP_TX_PIN (0U)
266 #define BSP_SERIAL_APP_TX_PORT (gpioPortA)
267 #define BSP_SERIAL_APP_TX_LOC (0U)
268
269 #define BSP_SERIAL_APP_RX_PIN (1U)
270 #define BSP_SERIAL_APP_RX_PORT (gpioPortA)
271 #define BSP_SERIAL_APP_RX_LOC (0U)
272
273 #define BSP_SERIAL_APP_CTS_PIN (2U)
274 #define BSP_SERIAL_APP_CTS_PORT (gpioPortA)
275 #define BSP_SERIAL_APP_CTS_LOC (30U)
276
277 #define BSP_SERIAL_APP_RTS_PIN (3U)
278 #define BSP_SERIAL_APP_RTS_PORT (gpioPortA)
279 #define BSP_SERIAL_APP_RTS_LOC (30U)
280
281 // [SERIAL]$
282
283 // $[SPIDISPLAY]
284
285 #define BSP_SPIDISPLAY_CS_PIN (14U)
286 #define BSP_SPIDISPLAY_CS_PORT (gpioPortD)
287
288 #define BSP_SPIDISPLAY_ENABLE_PIN (15U)
289 #define BSP_SPIDISPLAY_ENABLE_PORT (gpioPortD)
290
291 #define BSP_SPIDISPLAY_EXTCOMIN_PIN (13U)
292 #define BSP_SPIDISPLAY_EXTCOMIN_PORT (gpioPortD)
293 #define BSP_SPIDISPLAY_EXTCOMIN_LOC (4U)
294
295 #define BSP_SPIDISPLAY_DISPLAY (HAL_DISPLAY_SHARP_LS013B7DH03)
296 #define BSP_SPIDISPLAY_USART (HAL_SPI_PORT_USART1)
297 #define BSP_SPIDISPLAY_EXTCOMIN_CHANNEL (4)
298 #define BSP_SPIDISPLAY_MOSI_PIN (6U)
299 #define BSP_SPIDISPLAY_MOSI_PORT (gpioPortC)
300 #define BSP_SPIDISPLAY_MOSI_LOC (11U)
301
302 #define BSP_SPIDISPLAY_MISO_PIN (7U)
303 #define BSP_SPIDISPLAY_MISO_PORT (gpioPortC)
304 #define BSP_SPIDISPLAY_MISO_LOC (11U)
305
306 #define BSP_SPIDISPLAY_CLK_PIN (8U)
307 #define BSP_SPIDISPLAY_CLK_PORT (gpioPortC)
308 #define BSP_SPIDISPLAY_CLK_LOC (11U)
309
310 // [SPIDISPLAY]$
311
312 // $[SPINCP]
313 #define BSP_SPINCP_NHOSTINT_PIN (10U)
314 #define BSP_SPINCP_NHOSTINT_PORT (gpioPortD)
315
316 #define BSP_SPINCP_NWAKE_PIN (11U)
317 #define BSP_SPINCP_NWAKE_PORT (gpioPortD)
318
319 #define BSP_SPINCP_USART_PORT (HAL_SPI_PORT_USART2)
320 #define BSP_SPINCP_MOSI_PIN (6U)
321 #define BSP_SPINCP_MOSI_PORT (gpioPortA)
322 #define BSP_SPINCP_MOSI_LOC (1U)
323
324 #define BSP_SPINCP_MISO_PIN (7U)
325 #define BSP_SPINCP_MISO_PORT (gpioPortA)
326 #define BSP_SPINCP_MISO_LOC (1U)
327
328 #define BSP_SPINCP_CLK_PIN (8U)
329 #define BSP_SPINCP_CLK_PORT (gpioPortA)
330 #define BSP_SPINCP_CLK_LOC (1U)
331
332 #define BSP_SPINCP_CS_PIN (9U)
333 #define BSP_SPINCP_CS_PORT (gpioPortA)
334 #define BSP_SPINCP_CS_LOC (1U)
335
336 // [SPINCP]$
337
338 // $[UARTNCP]
339 #define BSP_UARTNCP_USART_PORT (HAL_SERIAL_PORT_USART0)
340 #define BSP_UARTNCP_TX_PIN (0U)
341 #define BSP_UARTNCP_TX_PORT (gpioPortA)
342 #define BSP_UARTNCP_TX_LOC (0U)
343
344 #define BSP_UARTNCP_RX_PIN (1U)
345 #define BSP_UARTNCP_RX_PORT (gpioPortA)
346 #define BSP_UARTNCP_RX_LOC (0U)
347
348 #define BSP_UARTNCP_CTS_PIN (2U)
349 #define BSP_UARTNCP_CTS_PORT (gpioPortA)
350 #define BSP_UARTNCP_CTS_LOC (30U)
351
352 #define BSP_UARTNCP_RTS_PIN (3U)
353 #define BSP_UARTNCP_RTS_PORT (gpioPortA)
354 #define BSP_UARTNCP_RTS_LOC (30U)
355
356 // [UARTNCP]$
357
358 // $[USART0]
359 #define PORTIO_USART0_CTS_PIN (2U)
360 #define PORTIO_USART0_CTS_PORT (gpioPortA)
361 #define PORTIO_USART0_CTS_LOC (30U)
362
363 #define PORTIO_USART0_RTS_PIN (3U)
364 #define PORTIO_USART0_RTS_PORT (gpioPortA)
365 #define PORTIO_USART0_RTS_LOC (30U)
366
367 #define PORTIO_USART0_RX_PIN (1U)
368 #define PORTIO_USART0_RX_PORT (gpioPortA)
369 #define PORTIO_USART0_RX_LOC (0U)
370
371 #define PORTIO_USART0_TX_PIN (0U)
372 #define PORTIO_USART0_TX_PORT (gpioPortA)
373 #define PORTIO_USART0_TX_LOC (0U)
374
375 #define BSP_USART0_TX_PIN (0U)
376 #define BSP_USART0_TX_PORT (gpioPortA)
377 #define BSP_USART0_TX_LOC (0U)
378
379 #define BSP_USART0_RX_PIN (1U)
380 #define BSP_USART0_RX_PORT (gpioPortA)
381 #define BSP_USART0_RX_LOC (0U)
382
383 #define BSP_USART0_CTS_PIN (2U)
384 #define BSP_USART0_CTS_PORT (gpioPortA)
385 #define BSP_USART0_CTS_LOC (30U)
386
387 #define BSP_USART0_RTS_PIN (3U)
388 #define BSP_USART0_RTS_PORT (gpioPortA)
389 #define BSP_USART0_RTS_LOC (30U)
390
391 // [USART0]$
392
393 // $[USART1]
394 #define PORTIO_USART1_CLK_PIN (8U)
395 #define PORTIO_USART1_CLK_PORT (gpioPortC)
396 #define PORTIO_USART1_CLK_LOC (11U)
397
398 #define PORTIO_USART1_CS_PIN (9U)
399 #define PORTIO_USART1_CS_PORT (gpioPortC)
400 #define PORTIO_USART1_CS_LOC (11U)
401
402 #define PORTIO_USART1_RX_PIN (7U)
403 #define PORTIO_USART1_RX_PORT (gpioPortC)
404 #define PORTIO_USART1_RX_LOC (11U)
405
406 #define PORTIO_USART1_TX_PIN (6U)
407 #define PORTIO_USART1_TX_PORT (gpioPortC)
408 #define PORTIO_USART1_TX_LOC (11U)
409
410 #define BSP_USART1_MOSI_PIN (6U)
411 #define BSP_USART1_MOSI_PORT (gpioPortC)
412 #define BSP_USART1_MOSI_LOC (11U)
413
414 #define BSP_USART1_MISO_PIN (7U)
415 #define BSP_USART1_MISO_PORT (gpioPortC)
416 #define BSP_USART1_MISO_LOC (11U)
417
418 #define BSP_USART1_CLK_PIN (8U)
419 #define BSP_USART1_CLK_PORT (gpioPortC)
420 #define BSP_USART1_CLK_LOC (11U)
421
422 #define BSP_USART1_CS_PIN (9U)
423 #define BSP_USART1_CS_PORT (gpioPortC)
424 #define BSP_USART1_CS_LOC (11U)
425
426 // [USART1]$
427
428 // $[USART2]
429 #define PORTIO_USART2_CLK_PIN (8U)
430 #define PORTIO_USART2_CLK_PORT (gpioPortA)
431 #define PORTIO_USART2_CLK_LOC (1U)
432
433 #define PORTIO_USART2_CS_PIN (9U)
434 #define PORTIO_USART2_CS_PORT (gpioPortA)
435 #define PORTIO_USART2_CS_LOC (1U)
436
437 #define PORTIO_USART2_RX_PIN (7U)
438 #define PORTIO_USART2_RX_PORT (gpioPortA)
439 #define PORTIO_USART2_RX_LOC (1U)
440
441 #define PORTIO_USART2_TX_PIN (6U)
442 #define PORTIO_USART2_TX_PORT (gpioPortA)
443 #define PORTIO_USART2_TX_LOC (1U)
444
445 #define BSP_USART2_MOSI_PIN (6U)
446 #define BSP_USART2_MOSI_PORT (gpioPortA)
447 #define BSP_USART2_MOSI_LOC (1U)
448
449 #define BSP_USART2_MISO_PIN (7U)
450 #define BSP_USART2_MISO_PORT (gpioPortA)
451 #define BSP_USART2_MISO_LOC (1U)
452
453 #define BSP_USART2_CLK_PIN (8U)
454 #define BSP_USART2_CLK_PORT (gpioPortA)
455 #define BSP_USART2_CLK_LOC (1U)
456
457 #define BSP_USART2_CS_PIN (9U)
458 #define BSP_USART2_CS_PORT (gpioPortA)
459 #define BSP_USART2_CS_LOC (1U)
460
461 // [USART2]$
462
463 // $[USART3]
464 #define PORTIO_USART3_CTS_PIN (8U)
465 #define PORTIO_USART3_CTS_PORT (gpioPortD)
466 #define PORTIO_USART3_CTS_LOC (28U)
467
468 #define PORTIO_USART3_RTS_PIN (9U)
469 #define PORTIO_USART3_RTS_PORT (gpioPortD)
470 #define PORTIO_USART3_RTS_LOC (28U)
471
472 #define PORTIO_USART3_RX_PIN (7U)
473 #define PORTIO_USART3_RX_PORT (gpioPortB)
474 #define PORTIO_USART3_RX_LOC (10U)
475
476 #define PORTIO_USART3_TX_PIN (6U)
477 #define PORTIO_USART3_TX_PORT (gpioPortB)
478 #define PORTIO_USART3_TX_LOC (10U)
479
480 #define BSP_USART3_TX_PIN (6U)
481 #define BSP_USART3_TX_PORT (gpioPortB)
482 #define BSP_USART3_TX_LOC (10U)
483
484 #define BSP_USART3_RX_PIN (7U)
485 #define BSP_USART3_RX_PORT (gpioPortB)
486 #define BSP_USART3_RX_LOC (10U)
487
488 #define BSP_USART3_CTS_PIN (8U)
489 #define BSP_USART3_CTS_PORT (gpioPortD)
490 #define BSP_USART3_CTS_LOC (28U)
491
492 #define BSP_USART3_RTS_PIN (9U)
493 #define BSP_USART3_RTS_PORT (gpioPortD)
494 #define BSP_USART3_RTS_LOC (28U)
495
496 // [USART3]$
497
498 // $[VCOM]
499
500 #define BSP_VCOM_ENABLE_PIN (5U)
501 #define BSP_VCOM_ENABLE_PORT (gpioPortA)
502
503 // [VCOM]$
504
505 #if defined(_SILICON_LABS_MODULE)
506 #include "sl_module.h"
507 #endif