summaryrefslogtreecommitdiff
path: root/bsp/rdk/s100/drivers/drv_pinmux.h
blob: e3dc3cd79aca264b839f223a2785c050bd6ecaf2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#ifndef DRV_PINMUX_H__
#define DRV_PINMUX_H__

#include <rtthread.h>

/*
 * Shared S100 pinctrl helpers.
 *
 * GPIO, UART, SPI and other MCU-side drivers can reuse this layer to switch
 * mux function and electrical attributes without duplicating pin register
 * knowledge in every peripheral driver.
 */
typedef rt_uint8_t s100_pin_t;

typedef enum
{
    S100_PIN_PULL_NONE = 0,
    S100_PIN_PULL_DOWN,
    S100_PIN_PULL_UP,
} s100_pin_pull_t;

typedef enum
{
    S100_PIN_FUNC0 = 0,
    S100_PIN_FUNC1,
    S100_PIN_FUNC2,
    S100_PIN_FUNC_GPIO,
} s100_pin_function_t;

#define S100_GPIO_PIN_COUNT 88U

/* Returns RT_FALSE for reserved/unsupported pins, including the SDK blacklist. */
rt_bool_t s100_pin_is_valid(s100_pin_t pin);
rt_err_t s100_pin_set_function(s100_pin_t pin, s100_pin_function_t function);
rt_err_t s100_pin_set_pull(s100_pin_t pin, s100_pin_pull_t pull);

#endif