Zephyr API Documentation 4.2.99
A Scalable Open Source RTOS
 4.2.99
ene-kb106x-pinctrl.h
Go to the documentation of this file.
1/*
2 * Copyright (c) ENE Technology Inc.
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6
7#ifndef ZEPHYR_INCLUDE_DT_BINDINGS_PINCTRL_ENE_KB106X_PINCTRL_H_
8#define ZEPHYR_INCLUDE_DT_BINDINGS_PINCTRL_ENE_KB106X_PINCTRL_H_
9
11
12#define PINMUX_FUNC_GPIO 0x00
13#define PINMUX_FUNC_A 0x00
14#define PINMUX_FUNC_B 0x01
15#define PINMUX_FUNC_C 0x02
16#define PINMUX_FUNC_D 0x03
17#define PINMUX_FUNC_MAX 0x04
18
19#define ENE_KB106X_NO_PUD_POS 12
20#define ENE_KB106X_PD_POS 13
21#define ENE_KB106X_PU_POS 14
22#define ENE_KB106X_PUSH_PULL_POS 15
23#define ENE_KB106X_OPEN_DRAIN_POS 16
24#define ENE_KB106X_OUT_DIS_POS 17
25#define ENE_KB106X_OUT_EN_POS 18
26#define ENE_KB106X_OUT_HI_POS 19
27#define ENE_KB106X_OUT_LO_POS 20
28#define ENE_KB106X_PIN_LOW_POWER_POS 21
29#define ENE_KB106X_IN_DIS_POS 22
30#define ENE_KB106X_IN_EN_POS 23
31#define ENE_KB106X_DRIVING_POS 31
32
33#define ENE_KB106X_PINMUX_PORT_POS 5
34#define ENE_KB106X_PINMUX_PORT_MSK 0x7
35#define ENE_KB106X_PINMUX_PIN_POS 0
36#define ENE_KB106X_PINMUX_PIN_MSK 0x1f
37#define ENE_KB106X_PINMUX_FUNC_POS 8
38#define ENE_KB106X_PINMUX_FUNC_MSK 0xf
39
40#define ENE_KB106X_EXTENDED_BANK 0x80
41
42/*
43 * f is function number
44 * b[7:5] = pin bank
45 * b[4:0] = pin position in bank
46 * b[11:8] = function
47 */
48#define ENE_KB106X_PINMUX(n, f) \
49 (((((n) >> 5) & ENE_KB106X_PINMUX_PORT_MSK) << ENE_KB106X_PINMUX_PORT_POS) | \
50 (((n) & ENE_KB106X_PINMUX_PIN_MSK) << ENE_KB106X_PINMUX_PIN_POS) | \
51 (((f) & ENE_KB106X_PINMUX_FUNC_MSK) << ENE_KB106X_PINMUX_FUNC_POS))
52
53#endif /* ZEPHYR_INCLUDE_DT_BINDINGS_PINCTRL_ENE_KB106X_PINCTRL_H_ */