Zephyr Project API 4.2.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
gecko-pinctrl-s1.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2023 Silicon Labs
3 * SPDX-License-Identifier: Apache-2.0
4 */
5
6#ifndef ZEPHYR_INCLUDE_DT_BINDINGS_PINCTRL_GECKO_PINCTRL_S1_H_
7#define ZEPHYR_INCLUDE_DT_BINDINGS_PINCTRL_GECKO_PINCTRL_S1_H_
8
9
10#define GECKO_PORT_A 0
11#define GECKO_PORT_B 1
12#define GECKO_PORT_C 2
13#define GECKO_PORT_D 3
14#define GECKO_PORT_E 4
15#define GECKO_PORT_F 5
16#define GECKO_PORT_G 6
17#define GECKO_PORT_H 7
18#define GECKO_PORT_I 8
19#define GECKO_PORT_J 9
20#define GECKO_PORT_K 10
21
22#define GECKO_PIN(n) (n)
23#define GECKO_LOCATION(n) (n)
24
25/*
26 * The whole GECKO_pin configuration information is encoded in a 32-bit bitfield
27 * organized as follows:
28 *
29 * - 31..24: Pin function.
30 * - 23..16: Reserved.
31 * - 15..8: Port for UART_RX/UART_TX functions.
32 * - 7..0: Pin number for UART_RX/UART_TX functions.
33 * - 15..8: Reserved for UART_LOC function.
34 * - 7..0: Loc for UART_LOC function.
35 */
36
43#define GECKO_FUN_POS 24U
45#define GECKO_FUN_MSK 0xFFU
46
48#define GECKO_PIN_POS 0U
50#define GECKO_PIN_MSK 0xFFU
51
53#define GECKO_PORT_POS 8U
55#define GECKO_PORT_MSK 0xFFU
56
58#define GECKO_LOC_POS 0U
60#define GECKO_LOC_MSK 0xFFU
61
70#define GECKO_FUN_UART_TX 0U
72#define GECKO_FUN_UART_RX 1U
74#define GECKO_FUN_UART_RTS 2U
76#define GECKO_FUN_UART_CTS 3U
78#define GECKO_FUN_UART_RX_LOC 4U
80#define GECKO_FUN_UART_TX_LOC 5U
82#define GECKO_FUN_UART_RTS_LOC 6U
84#define GECKO_FUN_UART_CTS_LOC 7U
85
86#define GECKO_FUN_SPIM_MISO 8U
87#define GECKO_FUN_SPIM_MOSI 9U
88#define GECKO_FUN_SPIM_CS 10U
89#define GECKO_FUN_SPIM_SCK 11U
90
91#define GECKO_FUN_LEUART_RX_LOC 12U
92#define GECKO_FUN_LEUART_TX_LOC 13U
93
94#define GECKO_FUN_SPIS_MISO 14U
95#define GECKO_FUN_SPIS_MOSI 15U
96#define GECKO_FUN_SPIS_CS 16U
97#define GECKO_FUN_SPIS_SCK 17U
98
99#define GECKO_FUN_SPI_MISO_LOC 18U
100#define GECKO_FUN_SPI_MOSI_LOC 19U
101#define GECKO_FUN_SPI_CS_LOC 20U
102#define GECKO_FUN_SPI_SCK_LOC 21U
103
104#define GECKO_FUN_I2C_SDA 22U
105#define GECKO_FUN_I2C_SCL 23U
106#define GECKO_FUN_I2C_SDA_LOC 24U
107#define GECKO_FUN_I2C_SCL_LOC 25U
108
109
119#define GECKO_PSEL(fun, port, pin) \
120 (((GECKO_PORT_##port & GECKO_PORT_MSK) << GECKO_PORT_POS) | \
121 ((GECKO_PIN(##pin##) & GECKO_PIN_MSK) << GECKO_PIN_POS) | \
122 ((GECKO_FUN_##fun & GECKO_FUN_MSK) << GECKO_FUN_POS))
123
130#define GECKO_LOC(fun, loc) \
131 (((GECKO_LOCATION(##loc##) & GECKO_LOC_MSK) << GECKO_LOC_POS) | \
132 ((GECKO_FUN_##fun##_LOC & GECKO_FUN_MSK) << GECKO_FUN_POS))
133
134#endif /* ZEPHYR_INCLUDE_DT_BINDINGS_PINCTRL_GECKO_PINCTRL_S1_H_ */