Zephyr AXI GPIO Driver Implementation
This page provides details on the implementation of the AXI GPIO Zephyr driver.
gpio_pin_configure
Argument1: device, Argument2: pin, Argument3: flags
supported flags,
GPIO_INPUT
GPIO_OUTPUT
GPIO_OUTPUT_LOW
GPIO_OUTPUT_HIGH
GPIO_OUTPUT_INACTIVE
GPIO_OUTPUT_ACTIVE
GPIO_ACTIVE_HIGH
GPIO_ACTIVE_LOW
Configure gpio pin as input or output based on user input.
In case of output mode configuration, based on user input output value is set.
gpio_port_get_raw
Argument1: device, Argument2: pointer to store data reg value
Read
DATA\_<X>register.
gpio_port_get
Argument1: device, Argument2: pointer to store data reg value
- Based on port configuration ACTIVE_HIGH or ACTIVE_LOW it returnthe port value. if port is configured as ACTIVE_lOW and value of
DATA\_<X>register is 0 then this api return 1.
gpio_port_set_masked_raw
Argument1: device, Argument2: BIT(pin), Argument3: value to write
Clear masked bits and write value into
DATA\_<X>register.
gpio_port_set_masked
Argument1: device, Argument2: BIT(pin), Argument3: value to write
Logical clear masked bits and write value into
DATA\_<X>register.
gpio_port_set_bits_raw
Argument1: device, Argument2: BIT(pins)
Write 1 into
DATA\_<X>register.
gpio_port_set_bits
Argument1: device, Argument2: BIT(pins)
logical write 1 into
DATA\_<X>register.
gpio_port_clear_bits_raw
Argument1: device, Argument2: BIT(pins)
Write 0 into
DATA\_<X>register.
gpio_port_clear_bits
Argument1: device, Argument2: BIT(pins)
Logical write 0 into
DATA\_<X>register.
gpio_port_toggle_bits
Argument1: device, Argument2: BIT(pins)
Toggle bits in
DATA\_<X>register.
gpio_port_set_clr_bits_raw
Argument1: device, Argument2: BIT(pins), Argument3: BIT(pins)
Set all the pins in arg2 to high and clear all pins in arg3
gpio_port_set_clr_bits
Argument1: device, Argument2: BIT(pins), Argument3: BIT(pins)
Logical set all the pins in arg2 to high and clear all pins in arg3
gpio_pin_get_raw
Argument1: device, Argument2: pin
Return 1 if pin value in port is 1 else 0.
gpio_pin_get
Argument1: device, Argument2: pin
Logical return 1 if pin value in port is 1 else 0.
gpio_pin_set_raw
Argument1: device, Argument2: pin, Argument3: value to be written into pin
Set or clear the pin value depends on arg3 value.
gpio_pin_set
Argument1: device, Argument2: pin, Argument3: value to be written into pin
Logical set or clear the pin value depends on arg3 value.
gpio_pin_toggle
Argument1: device, Argument2: pin
Toggle the pin value
gpio_pin_interrupt_configure
Argument1: device, Argument2: pin, Argument3: flags
supported flags,
GPIO_INT_EDGE_RISING
GPIO_INT_EDGE_FALLING
GPIO_INT_EDGE_BOTH
GPIO_INT_EDGE_TO_INACTIVE
GPIO_INT_EDGE_TO_ACTIVE
GPIO_INT_DISABLE
Disable interrupt or enable interrupt for a particular pin.
This clear pending interrupt
Configure interrupt type as edge-based trigger.
gpio_init_callback
Argument1: callback structure(struct gpio_callback), Argument2: isr_callback for the pin, Argument3: BIT(pins)
Init the callback structure with callback api and pin.
gpio_add_callback
Argument1: device, Argument2: callback structure
Register the call back to get called when interrupt is triggered for a particular pin.
gpio_remove_callback
Argument1: dt_spec_struct(struct gpio_dt_spec), Argument2: isr_callback
Remove the call back for the particular pin particular pin.
gpio_get_pending_int
Argument1: device
Axi gpio does not support level or edge interrupt through hardware but through this api we can simulate edge interrupt.
Based on the interrupt configuration returns changed pin value
used by isr routine in driver to identify the interrupt triggered pin and call corresponding callback