DPDK 26.11.0
Typedefs | Enumerations | Functions
rte_pmd_cnxk_gpio.h File Reference
#include <linux/gpio.h>
#include <linux/version.h>
#include <rte_malloc.h>
#include <rte_memcpy.h>
#include <rte_rawdev.h>

Go to the source code of this file.

Typedefs

typedef void(* cnxk_gpio_irq_handler_t) (int gpio, void *data)
 
typedef void(* cnxk_gpio_irq_handler2_t) (struct gpio_v2_line_event *event, void *data)
 

Enumerations

enum  cnxk_gpio_msg_type {
  CNXK_GPIO_MSG_TYPE_SET_PIN_VALUE , CNXK_GPIO_MSG_TYPE_SET_PIN_EDGE , CNXK_GPIO_MSG_TYPE_SET_PIN_DIR , CNXK_GPIO_MSG_TYPE_SET_PIN_ACTIVE_LOW ,
  CNXK_GPIO_MSG_TYPE_GET_PIN_VALUE , CNXK_GPIO_MSG_TYPE_GET_PIN_EDGE , CNXK_GPIO_MSG_TYPE_GET_PIN_DIR , CNXK_GPIO_MSG_TYPE_GET_PIN_ACTIVE_LOW ,
  CNXK_GPIO_MSG_TYPE_REGISTER_IRQ , CNXK_GPIO_MSG_TYPE_REGISTER_IRQ2 , CNXK_GPIO_MSG_TYPE_UNREGISTER_IRQ
}
 
enum  cnxk_gpio_pin_edge { CNXK_GPIO_PIN_EDGE_NONE , CNXK_GPIO_PIN_EDGE_FALLING , CNXK_GPIO_PIN_EDGE_RISING , CNXK_GPIO_PIN_EDGE_BOTH }
 
enum  cnxk_gpio_pin_dir { CNXK_GPIO_PIN_DIR_IN , CNXK_GPIO_PIN_DIR_OUT , CNXK_GPIO_PIN_DIR_HIGH , CNXK_GPIO_PIN_DIR_LOW }
 

Functions

static __rte_always_inline int rte_pmd_gpio_set_pin_value (uint16_t dev_id, int gpio, int val)
 
static __rte_always_inline int rte_pmd_gpio_set_pin_edge (uint16_t dev_id, int gpio, enum cnxk_gpio_pin_edge edge)
 
static __rte_always_inline int rte_pmd_gpio_set_pin_dir (uint16_t dev_id, int gpio, enum cnxk_gpio_pin_dir dir)
 
static __rte_always_inline int rte_pmd_gpio_set_pin_active_low (uint16_t dev_id, int gpio, int val)
 
static __rte_always_inline int rte_pmd_gpio_get_pin_value (uint16_t dev_id, int gpio, int *val)
 
static __rte_always_inline int rte_pmd_gpio_get_pin_edge (uint16_t dev_id, int gpio, enum cnxk_gpio_pin_edge *edge)
 
static __rte_always_inline int rte_pmd_gpio_get_pin_dir (uint16_t dev_id, int gpio, enum cnxk_gpio_pin_dir *dir)
 
static __rte_always_inline int rte_pmd_gpio_get_pin_active_low (uint16_t dev_id, int gpio, int *val)
 
static __rte_always_inline int rte_pmd_gpio_register_irq (uint16_t dev_id, int gpio, int cpu, cnxk_gpio_irq_handler_t handler, void *data)
 
static __rte_always_inline int rte_pmd_gpio_register_irq2 (uint16_t dev_id, int gpio, cnxk_gpio_irq_handler2_t handler, void *data)
 
static __rte_always_inline int rte_pmd_gpio_unregister_irq (uint16_t dev_id, int gpio)
 
static __rte_always_inline int rte_pmd_gpio_enable_interrupt (uint16_t dev_id, int gpio, enum cnxk_gpio_pin_edge edge)
 
static __rte_always_inline int rte_pmd_gpio_disable_interrupt (uint16_t dev_id, int gpio)
 

Detailed Description

Marvell GPIO PMD specific structures and interface

This API allows applications to manage GPIOs in user space along with installing interrupt handlers for low latency signal processing.

Definition in file rte_pmd_cnxk_gpio.h.

Typedef Documentation

◆ cnxk_gpio_irq_handler_t

typedef void(* cnxk_gpio_irq_handler_t) (int gpio, void *data)

GPIO interrupt handler (deprecated)

Parameters
gpioZero-based GPIO number
dataCookie passed to interrupt handler

Definition at line 100 of file rte_pmd_cnxk_gpio.h.

◆ cnxk_gpio_irq_handler2_t

typedef void(* cnxk_gpio_irq_handler2_t) (struct gpio_v2_line_event *event, void *data)

GPIO interrupt handler

Parameters
eventPointer to gpio event data
dataCookie passed to interrupt handler

Definition at line 119 of file rte_pmd_cnxk_gpio.h.

Enumeration Type Documentation

◆ cnxk_gpio_msg_type

Available message types

Enumerator
CNXK_GPIO_MSG_TYPE_SET_PIN_VALUE 

Type used to set output value

CNXK_GPIO_MSG_TYPE_SET_PIN_EDGE 

Type used to set edge

CNXK_GPIO_MSG_TYPE_SET_PIN_DIR 

Type used to set direction

CNXK_GPIO_MSG_TYPE_SET_PIN_ACTIVE_LOW 

Type used to set inverted logic

CNXK_GPIO_MSG_TYPE_GET_PIN_VALUE 

Type used to read value

CNXK_GPIO_MSG_TYPE_GET_PIN_EDGE 

Type used to read edge

CNXK_GPIO_MSG_TYPE_GET_PIN_DIR 

Type used to read direction

CNXK_GPIO_MSG_TYPE_GET_PIN_ACTIVE_LOW 

Type used to read inverted logic state

CNXK_GPIO_MSG_TYPE_REGISTER_IRQ 

Type used to register interrupt handler (deprecated)

CNXK_GPIO_MSG_TYPE_REGISTER_IRQ2 

Type used to register interrupt handler

CNXK_GPIO_MSG_TYPE_UNREGISTER_IRQ 

Type used to remove interrupt handler

Definition at line 43 of file rte_pmd_cnxk_gpio.h.

◆ cnxk_gpio_pin_edge

Available edges

Enumerator
CNXK_GPIO_PIN_EDGE_NONE 

Set edge to none

CNXK_GPIO_PIN_EDGE_FALLING 

Set edge to falling

CNXK_GPIO_PIN_EDGE_RISING 

Set edge to rising

CNXK_GPIO_PIN_EDGE_BOTH 

Set edge to both rising and falling

Definition at line 69 of file rte_pmd_cnxk_gpio.h.

◆ cnxk_gpio_pin_dir

Available directions

Enumerator
CNXK_GPIO_PIN_DIR_IN 

Set direction to input

CNXK_GPIO_PIN_DIR_OUT 

Set direction to output

CNXK_GPIO_PIN_DIR_HIGH 

Set direction to output and value to 1

Definition at line 81 of file rte_pmd_cnxk_gpio.h.

Function Documentation

◆ rte_pmd_gpio_set_pin_value()

static __rte_always_inline int rte_pmd_gpio_set_pin_value ( uint16_t  dev_id,
int  gpio,
int  val 
)
static

Set output to specific value

Parameters
dev_idThe identifier of the device
gpioZero-based GPIO number
valValue output will be set to. 0 represents low state while 1 high state
Returns
Returns 0 on success, negative error code otherwise

Definition at line 185 of file rte_pmd_cnxk_gpio.h.

◆ rte_pmd_gpio_set_pin_edge()

static __rte_always_inline int rte_pmd_gpio_set_pin_edge ( uint16_t  dev_id,
int  gpio,
enum cnxk_gpio_pin_edge  edge 
)
static

Select signal edge that triggers interrupt

Parameters
dev_idThe identifier of the device
gpioZero-based GPIO number
edgeSignal edge that triggers interrupt
Returns
Returns 0 on success, negative error code otherwise

Definition at line 209 of file rte_pmd_cnxk_gpio.h.

◆ rte_pmd_gpio_set_pin_dir()

static __rte_always_inline int rte_pmd_gpio_set_pin_dir ( uint16_t  dev_id,
int  gpio,
enum cnxk_gpio_pin_dir  dir 
)
static

Configure GPIO as input or output

Parameters
dev_idThe identifier of the device
gpioZero-based GPIO number
dirDirection of the GPIO
Returns
Returns 0 on success, negative error code otherwise

Definition at line 234 of file rte_pmd_cnxk_gpio.h.

◆ rte_pmd_gpio_set_pin_active_low()

static __rte_always_inline int rte_pmd_gpio_set_pin_active_low ( uint16_t  dev_id,
int  gpio,
int  val 
)
static

Enable or disable inverted logic

If GPIO is configured as output then writing 1 or 0 will result in setting output to respectively low or high

If GPIO is configured as input then logic inversion applies to edges. Both current and future settings are affected

Parameters
dev_idThe identifier of the device
gpioZero-based GPIO number
val0 to disable, 1 to enable inverted logic
Returns
Returns 0 on success, negative error code otherwise

Definition at line 264 of file rte_pmd_cnxk_gpio.h.

◆ rte_pmd_gpio_get_pin_value()

static __rte_always_inline int rte_pmd_gpio_get_pin_value ( uint16_t  dev_id,
int  gpio,
int *  val 
)
static

Read GPIO value

Parameters
dev_idThe identifier of the device
gpioZero-based GPIO number
valWhere to store read logical signal value i.e 0 or 1
Returns
Returns 0 on success, negative error code otherwise

Definition at line 288 of file rte_pmd_cnxk_gpio.h.

◆ rte_pmd_gpio_get_pin_edge()

static __rte_always_inline int rte_pmd_gpio_get_pin_edge ( uint16_t  dev_id,
int  gpio,
enum cnxk_gpio_pin_edge *  edge 
)
static

Read GPIO edge

Parameters
dev_idThe identifier of the device
gpioZero-based GPIO number
edgeWhere to store edge
Returns
Returns 0 on success, negative error code otherwise

Definition at line 311 of file rte_pmd_cnxk_gpio.h.

◆ rte_pmd_gpio_get_pin_dir()

static __rte_always_inline int rte_pmd_gpio_get_pin_dir ( uint16_t  dev_id,
int  gpio,
enum cnxk_gpio_pin_dir *  dir 
)
static

Read GPIO direction

Parameters
dev_idThe identifier of the device
gpioZero-based GPIO number
dirWhere to store direction
Returns
Returns 0 on success, negative error code otherwise

Definition at line 335 of file rte_pmd_cnxk_gpio.h.

◆ rte_pmd_gpio_get_pin_active_low()

static __rte_always_inline int rte_pmd_gpio_get_pin_active_low ( uint16_t  dev_id,
int  gpio,
int *  val 
)
static

Read whether GPIO is active low

Parameters
dev_idThe identifier of the device
gpioZero-based GPIO number
valWhere to store active low state
Returns
Returns 0 on success, negative error code otherwise

Definition at line 358 of file rte_pmd_cnxk_gpio.h.

◆ rte_pmd_gpio_register_irq()

static __rte_always_inline int rte_pmd_gpio_register_irq ( uint16_t  dev_id,
int  gpio,
int  cpu,
cnxk_gpio_irq_handler_t  handler,
void *  data 
)
static

Attach interrupt handler to GPIO (deprecated)

Parameters
dev_idThe identifier of the device
gpioZero-based GPIO number
cpuCPU which will be handling interrupt
handlerInterrupt handler to be executed
dataData to be passed to interrupt handler
Returns
Returns 0 on success, negative error code otherwise

Definition at line 386 of file rte_pmd_cnxk_gpio.h.

◆ rte_pmd_gpio_register_irq2()

static __rte_always_inline int rte_pmd_gpio_register_irq2 ( uint16_t  dev_id,
int  gpio,
cnxk_gpio_irq_handler2_t  handler,
void *  data 
)
static

Attach interrupt handler to GPIO

Parameters
dev_idThe identifier of the device
gpioZero-based GPIO number
handlerInterrupt handler to be executed
dataData to be passed to interrupt handler
Returns
Returns 0 on success, negative error code otherwise

Definition at line 418 of file rte_pmd_cnxk_gpio.h.

◆ rte_pmd_gpio_unregister_irq()

static __rte_always_inline int rte_pmd_gpio_unregister_irq ( uint16_t  dev_id,
int  gpio 
)
static

Detach interrupt handler from GPIO

Parameters
dev_idThe identifier of the device
gpioZero-based GPIO number
Returns
Returns 0 on success, negative error code otherwise

Definition at line 444 of file rte_pmd_cnxk_gpio.h.

◆ rte_pmd_gpio_enable_interrupt()

static __rte_always_inline int rte_pmd_gpio_enable_interrupt ( uint16_t  dev_id,
int  gpio,
enum cnxk_gpio_pin_edge  edge 
)
static

Enable interrupt

Parameters
dev_idThe identifier of the device
gpioZero-based GPIO number
edgeEdge that should trigger interrupt
Returns
Returns 0 on success, negative error code otherwise

Definition at line 468 of file rte_pmd_cnxk_gpio.h.

◆ rte_pmd_gpio_disable_interrupt()

static __rte_always_inline int rte_pmd_gpio_disable_interrupt ( uint16_t  dev_id,
int  gpio 
)
static

Disable interrupt

Parameters
dev_idThe identifier of the device
gpioZero-based GPIO number
Returns
Returns 0 on success, negative error code otherwise

Definition at line 486 of file rte_pmd_cnxk_gpio.h.