PebbleOS v4.47.0-1312-gf1984a001
Loading...
Searching...
No Matches
nRF5 GPIOTE

GPIO tasks and events of the nRF5 SoCs. More...

Data Structures

struct  pbl_gpio_nrf5_gpiote_channel
 Owner of a GPIOTE channel. More...
 
struct  pbl_gpio_nrf5_gpiote_state
 GPIOTE state. More...
 
struct  pbl_gpio_nrf5_gpiote
 nRF5 GPIOTE. More...
 

Macros

#define PBL_GPIO_NRF5_GPIOTE_CHANNELS   8U
 Number of GPIOTE channels.
 
#define PBL_GPIO_NRF5_GPIOTE_DEFINE(sym, _name, _base, _irq)
 Define an nRF5 GPIOTE.
 

Functions

int pbl_gpio_nrf5_gpiote_alloc (const struct pbl_gpio_nrf5_gpiote *gpiote, uint8_t *channel)
 Allocate a channel for the tasks of a driver.
 
void pbl_gpio_nrf5_gpiote_task_configure (const struct pbl_gpio_nrf5_gpiote *gpiote, uint8_t channel, uint32_t psel)
 Drive a pin from the tasks of an allocated channel.
 
void pbl_gpio_nrf5_gpiote_task_trigger (const struct pbl_gpio_nrf5_gpiote *gpiote, uint8_t channel, bool high)
 Drive the pin of a task channel high or low.
 
uintptr_t pbl_gpio_nrf5_gpiote_task_addr (const struct pbl_gpio_nrf5_gpiote *gpiote, uint8_t channel, bool high)
 Address of the task driving the pin of a task channel high or low, for PPI.
 
int pbl_gpio_nrf5_gpiote_configure (const struct pbl_gpio_nrf5_gpiote *gpiote, const struct pbl_intc *intc, uint32_t hwirq, uint32_t psel, uint32_t type)
 Bind a channel to a pin, for a line of an interrupt controller.
 
int pbl_gpio_nrf5_gpiote_enable (const struct pbl_gpio_nrf5_gpiote *gpiote, const struct pbl_intc *intc, uint32_t hwirq)
 Raise the events of the channel of a line.
 
int pbl_gpio_nrf5_gpiote_disable (const struct pbl_gpio_nrf5_gpiote *gpiote, const struct pbl_intc *intc, uint32_t hwirq)
 Stop the events of the channel of a line, leaving its input unsensed.
 
void pbl_gpio_nrf5_gpiote_free (const struct pbl_gpio_nrf5_gpiote *gpiote, const struct pbl_intc *intc, uint32_t hwirq)
 Unbind the channel of a line, leaving it to others.
 

Detailed Description

GPIO tasks and events of the nRF5 SoCs.

Its channels raise the interrupt lines of the GPIO ports' controllers, and drive pins from tasks for other drivers.


Data Structure Documentation

◆ pbl_gpio_nrf5_gpiote_channel

struct pbl_gpio_nrf5_gpiote_channel

Owner of a GPIOTE channel.

Data Fields
uint8_t hwirq Line of the controller.
const struct pbl_intc * intc Controller of the line, nullptr when free or reserved.
bool reserved Whether a driver reserved the channel for its tasks.

◆ pbl_gpio_nrf5_gpiote_state

struct pbl_gpio_nrf5_gpiote_state

GPIOTE state.

Data Fields
struct pbl_gpio_nrf5_gpiote_channel channels[PBL_GPIO_NRF5_GPIOTE_CHANNELS] Owner of each channel.

◆ pbl_gpio_nrf5_gpiote

struct pbl_gpio_nrf5_gpiote

nRF5 GPIOTE.

Data Fields
uintptr_t base Registers.
struct pbl_device dev Device.
pbl_irq_t irq Interrupt.
struct pbl_gpio_nrf5_gpiote_state * state State.

Macro Definition Documentation

◆ PBL_GPIO_NRF5_GPIOTE_CHANNELS

#define PBL_GPIO_NRF5_GPIOTE_CHANNELS   8U

Number of GPIOTE channels.

◆ PBL_GPIO_NRF5_GPIOTE_DEFINE

#define PBL_GPIO_NRF5_GPIOTE_DEFINE (   sym,
  _name,
  _base,
  _irq 
)
Value:
static struct pbl_gpio_nrf5_gpiote_state sym##_gpiote_state; \
const struct pbl_gpio_nrf5_gpiote sym = { \
.dev = PBL_DEVICE_INIT(sym, _name, pbl_gpio_nrf5_gpiote_init, nullptr), \
.state = &sym##_gpiote_state, \
.base = (_base), \
.irq = (_irq), \
}; \
PBL_DEVICE_REGISTER(sym, &sym.dev); \
PBL_IRQ_CONNECT_NUM(_irq, CONFIG_GPIO_NRF5_GPIOTE_IRQ_PRIO, pbl_gpio_nrf5_gpiote_irq_handler, \
&sym, 0)
#define PBL_DEVICE_INIT(sym, _name, _init, _parent)
Initializer for the struct pbl_device of device instance sym.
Definition device.h:169
#define PBL_DEVICE_STATE_DEFINE(sym)
Define the runtime state of device instance sym.
Definition device.h:132
uintptr_t base
Registers.
Definition nrf5_gpiote.h:48
pbl_irq_t irq
Interrupt.
Definition nrf5_gpiote.h:50
struct pbl_device dev
Device.
Definition nrf5_gpiote.h:44
nRF5 GPIOTE.
Definition nrf5_gpiote.h:42
GPIOTE state.
Definition nrf5_gpiote.h:36
struct pbl_device_state * state
Runtime state.
Definition device.h:102

Define an nRF5 GPIOTE.

Parameters
symSymbol.
_nameName.
_baseRegisters.
_irqInterrupt.

Function Documentation

◆ pbl_gpio_nrf5_gpiote_alloc()

int pbl_gpio_nrf5_gpiote_alloc ( const struct pbl_gpio_nrf5_gpiote *  gpiote,
uint8_t *  channel 
)

Allocate a channel for the tasks of a driver.

Parameters
gpioteGPIOTE.
[out]channelAllocated channel.
Returns
0 or -ENOMEM if all channels are in use.

◆ pbl_gpio_nrf5_gpiote_configure()

int pbl_gpio_nrf5_gpiote_configure ( const struct pbl_gpio_nrf5_gpiote *  gpiote,
const struct pbl_intc *  intc,
uint32_t  hwirq,
uint32_t  psel,
uint32_t  type 
)

Bind a channel to a pin, for a line of an interrupt controller.

The channel stays allocated to the line until it is freed.

Parameters
gpioteGPIOTE.
intcController of the line.
hwirqLine.
pselAbsolute pin.
typeEdge, PBL_IRQ_TYPE_EDGE_*.
Returns
0, -ENOTSUP for a level or -ENOMEM if all channels are in use.

◆ pbl_gpio_nrf5_gpiote_disable()

int pbl_gpio_nrf5_gpiote_disable ( const struct pbl_gpio_nrf5_gpiote *  gpiote,
const struct pbl_intc *  intc,
uint32_t  hwirq 
)

Stop the events of the channel of a line, leaving its input unsensed.

Parameters
gpioteGPIOTE.
intcController of the line.
hwirqLine.
Returns
0 or -EINVAL if the line has no channel.

◆ pbl_gpio_nrf5_gpiote_enable()

int pbl_gpio_nrf5_gpiote_enable ( const struct pbl_gpio_nrf5_gpiote *  gpiote,
const struct pbl_intc *  intc,
uint32_t  hwirq 
)

Raise the events of the channel of a line.

Parameters
gpioteGPIOTE.
intcController of the line.
hwirqLine.
Returns
0 or -EINVAL if the line has no channel.

◆ pbl_gpio_nrf5_gpiote_free()

void pbl_gpio_nrf5_gpiote_free ( const struct pbl_gpio_nrf5_gpiote *  gpiote,
const struct pbl_intc *  intc,
uint32_t  hwirq 
)

Unbind the channel of a line, leaving it to others.

Parameters
gpioteGPIOTE.
intcController of the line.
hwirqLine.

◆ pbl_gpio_nrf5_gpiote_task_addr()

uintptr_t pbl_gpio_nrf5_gpiote_task_addr ( const struct pbl_gpio_nrf5_gpiote *  gpiote,
uint8_t  channel,
bool  high 
)

Address of the task driving the pin of a task channel high or low, for PPI.

Parameters
gpioteGPIOTE.
channelTask channel.
highWhether the task drives it high.
Returns
Task address.

◆ pbl_gpio_nrf5_gpiote_task_configure()

void pbl_gpio_nrf5_gpiote_task_configure ( const struct pbl_gpio_nrf5_gpiote *  gpiote,
uint8_t  channel,
uint32_t  psel 
)

Drive a pin from the tasks of an allocated channel.

Parameters
gpioteGPIOTE.
channelChannel from pbl_gpio_nrf5_gpiote_alloc().
pselAbsolute pin.

◆ pbl_gpio_nrf5_gpiote_task_trigger()

void pbl_gpio_nrf5_gpiote_task_trigger ( const struct pbl_gpio_nrf5_gpiote *  gpiote,
uint8_t  channel,
bool  high 
)

Drive the pin of a task channel high or low.

Parameters
gpioteGPIOTE.
channelTask channel.
highWhether to drive it high.