Zephyr API Documentation  3.7.0-rc3
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
pinctrl.h File Reference

Public APIs for pin control drivers. More...

#include <errno.h>
#include <zephyr/device.h>
#include <zephyr/devicetree.h>
#include <zephyr/devicetree/pinctrl.h>
#include <pinctrl_soc.h>
#include <zephyr/sys/util.h>

Go to the source code of this file.

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)   PINCTRL_DT_DEFINE(DT_DRV_INST(inst))
 Define all pin control information for the given compatible index.
 
#define PINCTRL_DT_DEV_CONFIG_GET(node_id)   &Z_PINCTRL_DEV_CONFIG_NAME(node_id)
 Obtain a reference to the pin control configuration given a node identifier.
 
#define PINCTRL_DT_INST_DEV_CONFIG_GET(inst)    PINCTRL_DT_DEV_CONFIG_GET(DT_DRV_INST(inst))
 Obtain a reference to the pin control configuration given current compatible instance number.
 
#define PINCTRL_DT_STATE_PINS_DEFINE(node_id, prop)
 Helper macro to define the pins of a pin control state from Devicetree.
 
#define PINCTRL_DT_STATE_INIT(prop, state)
 Utility macro to initialize a pin control state.
 
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.
 

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.
 
int pinctrl_update_states (struct pinctrl_dev_config *config, const struct pinctrl_state *states, uint8_t state_cnt)
 Update states with a new set.
 

Detailed Description

Public APIs for pin control drivers.