PebbleOS v4.43.0-67-g6ab408441
Loading...
Searching...
No Matches
dma.h File Reference
#include <stddef.h>
#include <stdint.h>
#include <pbl/device.h>

Data Structures

struct  pbl_dma_slave_config
 Peripheral side of a channel. More...
 
struct  pbl_dma_chan
 A channel, as used by a consumer. More...
 
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_CHAN(_ctrl, _channel, _request, _config)    {.ctrl = (_ctrl), .channel = (_channel), .request = (_request), .config = (_config)}
 Initializer for a struct pbl_dma_chan.
 
#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, _ops)
 Initializer for the struct pbl_dma_controller of controller sym.
 

Typedefs

typedef void(* pbl_dma_callback_t) (void *arg, int status)
 Transfer end callback, called from interrupt context.
 

Enumerations

enum  pbl_dma_dir { PBL_DMA_MEM_TO_DEV , PBL_DMA_DEV_TO_MEM }
 Transfer direction. More...
 
enum  pbl_dma_slave_buswidth { PBL_DMA_SLAVE_BUSWIDTH_1_BYTE = 1 , PBL_DMA_SLAVE_BUSWIDTH_2_BYTES = 2 , PBL_DMA_SLAVE_BUSWIDTH_4_BYTES = 4 }
 Peripheral register width, in bytes. More...
 

Functions

int pbl_dma_slave_config (const struct pbl_dma_chan *chan, const struct pbl_dma_slave_config *cfg)
 Set the peripheral side of a stopped channel up.
 
int pbl_dma_prep_slave_single (const struct pbl_dma_chan *chan, void *buf, size_t len, enum pbl_dma_dir dir, pbl_dma_callback_t callback, void *arg)
 Start a transfer between a buffer and the peripheral.
 
int pbl_dma_terminate (const struct pbl_dma_chan *chan)
 Stop a channel.
 
int pbl_dma_tx_status (const struct pbl_dma_chan *chan, size_t *residue)
 Read the bytes left of a channel's transfer.
 
void pbl_dma_complete (const struct pbl_dma_controller *ctrl, uint8_t channel, int status)
 Report the end of a channel's transfer, calling its callback.
 

Variables

const struct pbl_device_class pbl_dma_class
 Class of the DMA controllers.