DMA Drivers API¶
-
group
sof_dma_drivers
DMA Drivers API specification.
Defines
-
DMA_DIR_MEM_TO_MEM
¶ local memory copy
-
DMA_DIR_HMEM_TO_LMEM
¶ host memory to local mem copy
-
DMA_DIR_LMEM_TO_HMEM
¶ local mem to host mem copy
-
DMA_DIR_MEM_TO_DEV
¶ local mem to dev copy
-
DMA_DIR_DEV_TO_MEM
¶ dev to local mem copy
-
DMA_DIR_DEV_TO_DEV
¶ dev to dev copy
-
DMA_CAP_HDA
¶ HDA DMA.
-
DMA_CAP_GP_LP
¶ GP LP DMA.
-
DMA_CAP_GP_HP
¶ GP HP DMA.
-
DMA_DEV_HOST
¶ connectable to host
-
DMA_DEV_HDA
¶ connectable to HD/A link
-
DMA_DEV_SSP
¶ connectable to SSP fifo
-
DMA_DEV_DMIC
¶ connectable to DMIC fifo
-
DMA_DEV_SSI
¶ connectable to SSI / SPI fifo
-
DMA_DEV_ALH
¶ connectable to ALH link
-
DMA_DEV_SAI
¶ connectable to SAI fifo
-
DMA_DEV_ESAI
¶ connectable to ESAI fifo
-
DMA_ACCESS_EXCLUSIVE
¶
-
DMA_ACCESS_SHARED
¶
-
DMA_COPY_BLOCKING
¶
-
DMA_COPY_ONE_SHOT
¶
-
DMA_CHAN_INVALID
¶
-
DMA_CORE_INVALID
¶
-
DMA_ATTR_BUFFER_ALIGNMENT
¶
-
DMA_ATTR_COPY_ALIGNMENT
¶
-
DMA_ATTR_BUFFER_ADDRESS_ALIGNMENT
¶
-
DMA_ATTR_BUFFER_PERIOD_COUNT
¶
-
dma_set_drvdata
(dma, data)¶
-
dma_get_drvdata
(dma)¶
-
dma_base
(dma)¶
-
dma_irq
(dma)¶
-
dma_irq_name
(dma)¶
-
dma_chan_size
(dma)¶
-
dma_chan_base
(dma, chan)¶
-
dma_chan_get_data
(chan)¶
-
dma_chan_set_data
(chan, data)¶
Typedefs
-
typedef int (*
dma_process_func
)(const struct audio_stream *source, uint32_t ioffset, struct audio_stream *sink, uint32_t ooffset, uint32_t frames)¶
-
typedef void (*
dma_process
)(const struct audio_stream *, struct audio_stream *, uint32_t)¶
Enums
Functions
-
int
dmac_init
(struct sof *sof)¶ API to initialize a platform DMA controllers.
- Parameters
[in] sof
: Pointer to firmware main context.
-
struct dma *
dma_get
(uint32_t dir, uint32_t caps, uint32_t dev, uint32_t flags)¶ API to request a platform DMAC.
Users can request DMAC based on dev type, copy direction, capabilities and access privilege. For exclusive access, ret DMAC with no channels draining. For shared access, ret DMAC with the least number of channels draining.
-
static struct dma_chan_data *
dma_channel_get
(struct dma *dma, int req_channel)¶
-
static void
dma_channel_put
(struct dma_chan_data *channel)¶
-
static int
dma_start
(struct dma_chan_data *channel)¶
-
static int
dma_stop
(struct dma_chan_data *channel)¶
-
static int
dma_pause
(struct dma_chan_data *channel)¶
-
static int
dma_release
(struct dma_chan_data *channel)¶
-
static int
dma_status
(struct dma_chan_data *channel, struct dma_chan_status *status, uint8_t direction)¶
-
static int
dma_set_config
(struct dma_chan_data *channel, struct dma_sg_config *config)¶
-
static int
dma_get_data_size
(struct dma_chan_data *channel, uint32_t *avail, uint32_t *free)¶
-
static int
dma_interrupt
(struct dma_chan_data *channel, enum dma_irq_cmd cmd)¶
-
static uint32_t
dma_chan_reg_read
(struct dma_chan_data *channel, uint32_t reg)¶
-
static uint16_t
dma_chan_reg_read16
(struct dma_chan_data *channel, uint32_t reg)¶
-
static void
dma_chan_reg_write
(struct dma_chan_data *channel, uint32_t reg, uint32_t value)¶
-
static void
dma_chan_reg_write16
(struct dma_chan_data *channel, uint32_t reg, uint16_t value)¶
-
static void
dma_chan_reg_update_bits
(struct dma_chan_data *channel, uint32_t reg, uint32_t mask, uint32_t value)¶
-
static void
dma_chan_reg_update_bits16
(struct dma_chan_data *channel, uint32_t reg, uint16_t mask, uint16_t value)¶
-
static bool
dma_is_scheduling_source
(struct dma_chan_data *channel)¶
-
static void
dma_sg_init
(struct dma_sg_elem_array *ea)¶
-
int
dma_sg_alloc
(struct dma_sg_elem_array *ea, enum mem_zone zone, uint32_t direction, uint32_t buffer_count, uint32_t buffer_bytes, uintptr_t dma_buffer_addr, uintptr_t external_addr)¶
-
void
dma_sg_free
(struct dma_sg_elem_array *ea)¶
-
static uint32_t
dma_sg_get_size
(struct dma_sg_elem_array *ea)¶ Get the total size of SG buffer.
- Return
Size of the buffer.
- Parameters
ea
: Array of SG elements.
-
int
dma_buffer_copy_from
(struct comp_buffer *source, struct comp_buffer *sink, dma_process_func process, uint32_t source_bytes)¶
-
int
dma_buffer_copy_to
(struct comp_buffer *source, struct comp_buffer *sink, dma_process_func process, uint32_t sink_bytes)¶
-
int
dma_copy_from_host
(struct dma_copy *dc, struct dma_sg_config *host_sg, int32_t host_offset, void *local_ptr, int32_t size)¶
-
int
dma_copy_from_host_nowait
(struct dma_copy *dc, struct dma_sg_config *host_sg, int32_t host_offset, void *local_ptr, int32_t size)¶
-
int
dma_copy_to_host_nowait
(struct dma_copy *dc, struct dma_sg_config *host_sg, int32_t host_offset, void *local_ptr, int32_t size)¶
-
struct
dma_sg_elem
¶ - #include <dma.h>
Element of SG list (as array item).
-
struct
dma_cb_data
¶ - #include <dma.h>
Data used in DMA callbacks.
-
struct
dma_sg_elem_array
¶ - #include <dma.h>
SG elem array.
-
struct
dma_sg_config
¶ - #include <dma.h>
-
struct
dma_chan_status
¶ - #include <dma.h>
-
struct
dma_ops
¶ - #include <dma.h>
Public Members
-
struct dma_chan_data *(*
channel_get
)(struct dma *dma, unsigned int req_channel)¶
-
void (*
channel_put
)(struct dma_chan_data *channel)¶
-
int (*
start
)(struct dma_chan_data *channel)¶
-
int (*
stop
)(struct dma_chan_data *channel)¶
-
int (*
copy
)(struct dma_chan_data *channel, int bytes, uint32_t flags)¶
-
int (*
pause
)(struct dma_chan_data *channel)¶
-
int (*
release
)(struct dma_chan_data *channel)¶
-
int (*
status
)(struct dma_chan_data *channel, struct dma_chan_status *status, uint8_t direction)¶
-
int (*
set_config
)(struct dma_chan_data *channel, struct dma_sg_config *config)¶
-
int (*
get_data_size
)(struct dma_chan_data *channel, uint32_t *avail, uint32_t *free)¶
-
int (*
interrupt
)(struct dma_chan_data *channel, enum dma_irq_cmd cmd)¶
-
struct dma_chan_data *(*
-
struct
dma_plat_data
¶ - #include <dma.h>
-
struct
dma
¶ - #include <dma.h>
Public Members
-
struct dma_plat_data
plat_data
¶
-
spinlock_t
lock
¶ locking mechanism
-
int
sref
¶ simple ref counter, guarded by lock
-
atomic_t
num_channels_busy
¶
-
struct dma_chan_data *
chan
¶
-
void *
priv_data
¶
-
struct dma_plat_data
-
struct
dma_chan_data
¶ - #include <dma.h>
-
struct
dma_info
¶ - #include <dma.h>
-
struct
dma_copy
¶ - #include <dma.h>
-
-
group
sof_dma_copy_func
This function is in a separate subgroup to solve a name clash with struct dma_copy {}.
Functions
-
static int
dma_copy
(struct dma_chan_data *channel, int bytes, uint32_t flags)¶
-
static int
This function is listed separately to solve a name clash with the struct dma_copy {} above.