Zephyr Project API
4.1.0
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
silabs-pinctrl-siwx91x.h
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2024 Silicon Laboratories Inc.
3
* SPDX-License-Identifier: Apache-2.0
4
*/
5
6
#ifndef INCLUDE_ZEPHYR_DT_BINDINGS_PINCTRL_SILABS_PINCTRL_SIWX91X_H_
7
#define INCLUDE_ZEPHYR_DT_BINDINGS_PINCTRL_SILABS_PINCTRL_SIWX91X_H_
8
9
#include <
zephyr/dt-bindings/dt-util.h
>
10
11
#if !defined(FIELD_PREP)
12
/* Upstream does not make these macros available to DeviceTree */
13
#define LSB_GET(value) ((value) & -(value))
14
#define FIELD_GET(mask, value) (((value) & (mask)) / LSB_GET(mask))
15
#define FIELD_PREP(mask, value) (((value) * LSB_GET(mask)) & (mask))
16
#endif
17
18
#define SIWX91X_PINCTRL_PORT_MASK 0x0000000FUL
19
#define SIWX91X_PINCTRL_PIN_MASK 0x000000F0UL
20
#define SIWX91X_PINCTRL_ULPPIN_MASK 0x00000F00UL
21
#define SIWX91X_PINCTRL_MODE_MASK 0x0003F000UL
22
#define SIWX91X_PINCTRL_ULPMODE_MASK 0x00FC0000UL
23
#define SIWX91X_PINCTRL_PAD_MASK 0xFF000000UL
24
25
/* Declare an integer representing the pinctrl/gpio state of a signal on SiWx91x.
26
* @param mode HP GPIO mode, 0xFF if HP GPIO mux isn't used
27
* @param ulpmode ULP GPIO mode, 0xFF if ULP GPIO mux isn't used
28
* @param pad HP pad number, 0xFF if HP pad isn't used, 0 if host pad
29
* @param port GPIO port number (0-4)
30
* @param pin HP GPIO pin number, value is unused if mode is 0xFF
31
* @param ulppin ULP GPIO pin number, value is unused if ulpmode is 0xFF
32
*/
33
#define SIWX91X_GPIO(mode, ulpmode, pad, port, pin, ulppin) \
34
(FIELD_PREP(SIWX91X_PINCTRL_PORT_MASK, port) | FIELD_PREP(SIWX91X_PINCTRL_PIN_MASK, pin) | \
35
FIELD_PREP(SIWX91X_PINCTRL_ULPPIN_MASK, ulppin) | \
36
FIELD_PREP(SIWX91X_PINCTRL_MODE_MASK, mode) | \
37
FIELD_PREP(SIWX91X_PINCTRL_ULPMODE_MASK, ulpmode) | \
38
FIELD_PREP(SIWX91X_PINCTRL_PAD_MASK, pad))
39
40
#endif
/* INCLUDE_ZEPHYR_DT_BINDINGS_PINCTRL_SILABS_PINCTRL_SIWX91X_H_ */
dt-util.h
include
zephyr
dt-bindings
pinctrl
silabs-pinctrl-siwx91x.h
Generated on Sun Mar 30 2025 16:03:57 for Zephyr Project API by
1.9.8