Software APIs
pinmux.h
1 // Copyright lowRISC contributors (OpenTitan project).
2 // Licensed under the Apache License, Version 2.0, see LICENSE for details.
3 // SPDX-License-Identifier: Apache-2.0
4 
5 #ifndef OPENTITAN_SW_DEVICE_SILICON_CREATOR_LIB_DRIVERS_PINMUX_H_
6 #define OPENTITAN_SW_DEVICE_SILICON_CREATOR_LIB_DRIVERS_PINMUX_H_
7 
8 #include <stdint.h>
9 
10 #ifdef __cplusplus
11 extern "C" {
12 #endif
13 
14 /**
15  * Driver for the Pin Multiplexer (pinmux).
16  *
17  * The pinmux connects peripheral input and output signals to the Padring
18  * MIO pad input and output signals.
19  */
20 
21 /**
22  * Initialize the pinmux with the configuration required for the ROM.
23  */
24 void pinmux_init(void);
25 
26 /**
27  * Initialize the pinmux with output UART0 only.
28  */
29 void pinmux_init_uart0_tx(void);
30 
31 /**
32  * Read the SW_STRAP value.
33  *
34  * The straping value is encoded with two bits per pin and encodes the
35  * strength of the external pull resistors in the returned value.
36  *
37  * Each 2-bit field encodes the following values:
38  * - 0: Strong pull down
39  * - 1: Weak pull down
40  * - 2: Weak pull up
41  * - 3: Strong pull up
42  *
43  * The values of the 3 strapping pins are concatenated together, yielding a
44  * 6-bit strapping value.
45  *
46  * @return The strapping value 0-63.
47  */
48 uint32_t pinmux_read_straps(void);
49 
50 #ifdef __cplusplus
51 }
52 #endif
53 
54 #endif // OPENTITAN_SW_DEVICE_SILICON_CREATOR_LIB_DRIVERS_PINMUX_H_