Zephyr API Documentation 3.7.99
A Scalable Open Source RTOS
|
Pin Controller Interface . More...
Topics | |
Dynamic Pin Control | |
Data Structures | |
struct | pinctrl_state |
Pin control state configuration. More... | |
struct | pinctrl_dev_config |
Pin controller configuration for a given device. More... | |
Macros | |
#define | PINCTRL_REG_NONE 0U |
Utility macro to indicate no register is used. | |
#define | PINCTRL_DT_DEV_CONFIG_DECLARE(node_id) |
Declare pin control configuration for a given node identifier. | |
#define | PINCTRL_DT_DEFINE(node_id) |
Define all pin control information for the given node identifier. | |
#define | PINCTRL_DT_INST_DEFINE(inst) |
Define all pin control information for the given compatible index. | |
#define | PINCTRL_DT_DEV_CONFIG_GET(node_id) |
Obtain a reference to the pin control configuration given a node identifier. | |
#define | PINCTRL_DT_INST_DEV_CONFIG_GET(inst) |
Obtain a reference to the pin control configuration given current compatible instance number. | |
Functions | |
int | pinctrl_lookup_state (const struct pinctrl_dev_config *config, uint8_t id, const struct pinctrl_state **state) |
Find the state configuration for the given state id. | |
int | pinctrl_configure_pins (const pinctrl_soc_pin_t *pins, uint8_t pin_cnt, uintptr_t reg) |
Configure a set of pins. | |
static int | pinctrl_apply_state_direct (const struct pinctrl_dev_config *config, const struct pinctrl_state *state) |
Apply a state directly from the provided state configuration. | |
static int | pinctrl_apply_state (const struct pinctrl_dev_config *config, uint8_t id) |
Apply a state from the given device configuration. | |
Pin control states | |
#define | PINCTRL_STATE_DEFAULT 0U |
Default state (state used when the device is in operational state). | |
#define | PINCTRL_STATE_SLEEP 1U |
Sleep state (state used when the device is in low power mode). | |
#define | PINCTRL_STATE_PRIV_START 2U |
This and higher values refer to custom private states. | |
Pin Controller Interface .
#define PINCTRL_DT_DEFINE | ( | node_id | ) |
#include <zephyr/drivers/pinctrl.h>
Define all pin control information for the given node identifier.
This helper macro should be called together with device definition. It defines and initializes the pin control configuration for the device represented by node_id. Each pin control state (pinctrl-0, ..., pinctrl-N) is also defined and initialized. Note that states marked to be skipped will not be defined (refer to Z_PINCTRL_SKIP_STATE for more details).
node_id | Node identifier. |
#define PINCTRL_DT_DEV_CONFIG_DECLARE | ( | node_id | ) |
#include <zephyr/drivers/pinctrl.h>
Declare pin control configuration for a given node identifier.
This macro should be used by tests or applications using runtime pin control to declare the pin control configuration for a device. PINCTRL_DT_DEV_CONFIG_GET can later be used to obtain a reference to such configuration.
Only available if CONFIG_PINCTRL_NON_STATIC
is selected.
node_id | Node identifier. |
#define PINCTRL_DT_DEV_CONFIG_GET | ( | node_id | ) |
#include <zephyr/drivers/pinctrl.h>
Obtain a reference to the pin control configuration given a node identifier.
node_id | Node identifier. |
#define PINCTRL_DT_INST_DEFINE | ( | inst | ) |
#include <zephyr/drivers/pinctrl.h>
Define all pin control information for the given compatible index.
inst | Instance number. |
#define PINCTRL_DT_INST_DEV_CONFIG_GET | ( | inst | ) |
#include <zephyr/drivers/pinctrl.h>
Obtain a reference to the pin control configuration given current compatible instance number.
inst | Instance number. |
#define PINCTRL_REG_NONE 0U |
#include <zephyr/drivers/pinctrl.h>
Utility macro to indicate no register is used.
#define PINCTRL_STATE_DEFAULT 0U |
#include <zephyr/drivers/pinctrl.h>
Default state (state used when the device is in operational state).
#define PINCTRL_STATE_PRIV_START 2U |
#include <zephyr/drivers/pinctrl.h>
This and higher values refer to custom private states.
#define PINCTRL_STATE_SLEEP 1U |
#include <zephyr/drivers/pinctrl.h>
Sleep state (state used when the device is in low power mode).
|
inlinestatic |
#include <zephyr/drivers/pinctrl.h>
Apply a state from the given device configuration.
config | Pin control configuration. |
id | Id of the state to be applied (see PINCTRL_STATES). |
0 | If succeeded. |
-ENOENT | If given state id does not exist. |
-errno | Negative errno for other failures. |
|
inlinestatic |
#include <zephyr/drivers/pinctrl.h>
Apply a state directly from the provided state configuration.
config | Pin control configuration. |
state | State. |
0 | If succeeded |
-errno | Negative errno for other failures. |
int pinctrl_configure_pins | ( | const pinctrl_soc_pin_t * | pins, |
uint8_t | pin_cnt, | ||
uintptr_t | reg ) |
#include <zephyr/drivers/pinctrl.h>
Configure a set of pins.
This function will configure the necessary hardware blocks to make the configuration immediately effective.
pins | List of pins to be configured. |
pin_cnt | Number of pins. |
reg | Device register (optional, use PINCTRL_REG_NONE if not used). |
0 | If succeeded |
-errno | Negative errno for other failures. |
int pinctrl_lookup_state | ( | const struct pinctrl_dev_config * | config, |
uint8_t | id, | ||
const struct pinctrl_state ** | state ) |
#include <zephyr/drivers/pinctrl.h>
Find the state configuration for the given state id.
config | Pin controller configuration. |
id | Pin controller state id (see PINCTRL_STATES). |
state | Found state. |
0 | If state has been found. |
-ENOENT | If the state has not been found. |