PebbleOS v4.47.0-1362-gd278268fe
Loading...
Searching...
No Matches
DMA controller drivers

Interface for DMA controller drivers. More...

Data Structures

struct  pbl_dma_controller_ops
 DMA controller driver operations. More...
 
struct  pbl_dma_chan_state
 Runtime state of a channel. More...
 
struct  pbl_dma_controller
 A DMA controller. More...
 

Macros

#define PBL_DMA_CONTROLLER_STATE_DEFINE(sym, _num_channels)
 Define the class state of DMA controller sym, for the driver's define macro.
 
#define PBL_DMA_CONTROLLER_INIT(sym, _name, _init, _parent, _ops)
 Initializer for the struct pbl_dma_controller of controller sym.
 

Functions

void pbl_dma_complete (const struct pbl_dma_controller *ctrl, uint8_t channel, int status)
 Report the end of a channel's transfer, or of a period of a cyclic one, calling its callback.
 

Detailed Description

Interface for DMA controller drivers.

A driver embeds a struct pbl_dma_controller in its instance, sets it up with PBL_DMA_CONTROLLER_STATE_DEFINE() and PBL_DMA_CONTROLLER_INIT(), implements the struct pbl_dma_controller_ops the class calls, and reports transfer ends with pbl_dma_complete().


Data Structure Documentation

◆ pbl_dma_chan_state

struct pbl_dma_chan_state

Runtime state of a channel.

Data Fields
void * arg Callback argument.
pbl_dma_callback_t callback Transfer end callback, or NULL.
struct pbl_dma_slave_config cfg Peripheral side, from pbl_dma_slave_config().

◆ pbl_dma_controller

struct pbl_dma_controller

A DMA controller.

Data Fields
struct pbl_dma_chan_state * chans State of each channel.
struct pbl_device dev Device.
uint8_t num_channels Number of channels.
const struct pbl_dma_controller_ops * ops Driver operations.

Macro Definition Documentation

◆ PBL_DMA_CONTROLLER_INIT

#define PBL_DMA_CONTROLLER_INIT (   sym,
  _name,
  _init,
  _parent,
  _ops 
)
Value:
{ \
.dev = PBL_DEVICE_INIT_CLASS(sym, _name, _init, _parent, &pbl_dma_class), \
.ops = (_ops), \
.chans = sym##_dma_chans, \
.num_channels = sizeof(sym##_dma_chans) / sizeof(sym##_dma_chans[0]), \
}
#define PBL_DEVICE_INIT_CLASS(sym, _name, _init, _parent, _cls)
Initializer for the struct pbl_device of device instance sym, in class _cls.
Definition device.h:153

Initializer for the struct pbl_dma_controller of controller sym.

Parameters
symSymbol of the controller instance, with its state defined by PBL_DMA_CONTROLLER_STATE_DEFINE().
_nameName.
_initDevice init function, or NULL.
_parentParent device, or NULL.
_opsDriver operations.

◆ PBL_DMA_CONTROLLER_STATE_DEFINE

#define PBL_DMA_CONTROLLER_STATE_DEFINE (   sym,
  _num_channels 
)
Value:
static struct pbl_dma_chan_state sym##_dma_chans[_num_channels]
#define PBL_DEVICE_STATE_DEFINE(sym)
Define the runtime state of device instance sym.
Definition device.h:132
Runtime state of a channel.
Definition driver.h:50

Define the class state of DMA controller sym, for the driver's define macro.

Parameters
symSymbol of the controller instance.
_num_channelsNumber of channels.

Function Documentation

◆ pbl_dma_complete()

void pbl_dma_complete ( const struct pbl_dma_controller *  ctrl,
uint8_t  channel,
int  status 
)

Report the end of a channel's transfer, or of a period of a cyclic one, calling its callback.

Called by controller drivers from their interrupt handlers.

Parameters
ctrlController.
channelChannel.
status0 when the transfer completed, or a negative errno.