Zephyr API Documentation
2.7.0-rc2
A Scalable Open Source RTOS
|
DMA Interface. More...
Data Structures | |
struct | dma_block_config |
DMA block configuration structure. More... | |
struct | dma_config |
DMA configuration structure. More... | |
struct | dma_status |
struct | dma_context |
Macros | |
#define | DMA_MAGIC 0x47494749 |
Typedefs | |
typedef void(* | dma_callback_t) (const struct device *dev, void *user_data, uint32_t channel, int status) |
Callback function for DMA transfer completion. More... | |
Enumerations | |
enum | dma_channel_direction { MEMORY_TO_MEMORY = 0x0 , MEMORY_TO_PERIPHERAL , PERIPHERAL_TO_MEMORY , PERIPHERAL_TO_PERIPHERAL } |
enum | dma_addr_adj { DMA_ADDR_ADJ_INCREMENT , DMA_ADDR_ADJ_DECREMENT , DMA_ADDR_ADJ_NO_CHANGE } |
enum | dma_channel_filter { DMA_CHANNEL_NORMAL , DMA_CHANNEL_PERIODIC } |
Functions | |
static int | dma_config (const struct device *dev, uint32_t channel, struct dma_config *config) |
Configure individual channel for DMA transfer. More... | |
static int | dma_reload (const struct device *dev, uint32_t channel, uint32_t src, uint32_t dst, size_t size) |
Reload buffer(s) for a DMA channel. More... | |
int | dma_start (const struct device *dev, uint32_t channel) |
Enables DMA channel and starts the transfer, the channel must be configured beforehand. More... | |
int | dma_stop (const struct device *dev, uint32_t channel) |
Stops the DMA transfer and disables the channel. More... | |
int | dma_request_channel (const struct device *dev, void *filter_param) |
request DMA channel. More... | |
void | dma_release_channel (const struct device *dev, uint32_t channel) |
release DMA channel. More... | |
int | dma_chan_filter (const struct device *dev, int channel, void *filter_param) |
DMA channel filter. More... | |
static int | dma_get_status (const struct device *dev, uint32_t channel, struct dma_status *stat) |
get current runtime status of DMA transfer More... | |
static uint32_t | dma_width_index (uint32_t size) |
Look-up generic width index to be used in registers. More... | |
static uint32_t | dma_burst_index (uint32_t burst) |
Look-up generic burst index to be used in registers. More... | |
DMA Interface.
#define DMA_MAGIC 0x47494749 |
#include <include/drivers/dma.h>
dma_callback_t |
#include <include/drivers/dma.h>
Callback function for DMA transfer completion.
If enabled, callback function will be invoked at transfer completion or when error happens.
dev | Pointer to the DMA device calling the callback. |
user_data | A pointer to some user data or NULL |
channel | The channel number |
status | 0 on success, a negative errno otherwise |
enum dma_addr_adj |
#include <include/drivers/dma.h>
Valid values for source_addr_adj and dest_addr_adj
Enumerator | |
---|---|
DMA_ADDR_ADJ_INCREMENT | |
DMA_ADDR_ADJ_DECREMENT | |
DMA_ADDR_ADJ_NO_CHANGE |
#include <include/drivers/dma.h>
Enumerator | |
---|---|
MEMORY_TO_MEMORY | |
MEMORY_TO_PERIPHERAL | |
PERIPHERAL_TO_MEMORY | |
PERIPHERAL_TO_PERIPHERAL |
enum dma_channel_filter |
#include <include/drivers/dma.h>
Enumerator | |
---|---|
DMA_CHANNEL_NORMAL | |
DMA_CHANNEL_PERIODIC |
#include <include/drivers/dma.h>
Look-up generic burst index to be used in registers.
WARNING: This look-up works for most controllers, but may not work for yours. Ensure your controller expects the most common register bit values before using this convenience function. If your controller does not support these values, you will have to write your own look-up inside the controller driver.
burst | number of bytes to be sent in a single burst |
common | DMA index to be placed into registers. |
#include <include/drivers/dma.h>
DMA channel filter.
filter channel by attribute
dev | Pointer to the device structure for the driver instance. |
channel | channel number |
filter_param | filter attribute |
Negative | errno code if not support |
|
inlinestatic |
#include <include/drivers/dma.h>
Configure individual channel for DMA transfer.
dev | Pointer to the device structure for the driver instance. |
channel | Numeric identification of the channel to configure |
config | Data structure containing the intended configuration for the selected channel |
0 | if successful. |
Negative | errno code if failure. |
|
inlinestatic |
#include <include/drivers/dma.h>
get current runtime status of DMA transfer
Implementations must check the validity of the channel ID passed in and return -EINVAL if it is invalid or -ENOSYS if not supported.
dev | Pointer to the device structure for the driver instance. |
channel | Numeric identification of the channel where the transfer was being processed |
stat | a non-NULL dma_status object for storing DMA status |
non-negative | if successful. |
Negative | errno code if failure. |
#include <include/drivers/dma.h>
release DMA channel.
release DMA channel resources
dev | Pointer to the device structure for the driver instance. |
channel | channel number |
|
inlinestatic |
#include <include/drivers/dma.h>
Reload buffer(s) for a DMA channel.
dev | Pointer to the device structure for the driver instance. |
channel | Numeric identification of the channel to configure selected channel |
src | source address for the DMA transfer |
dst | destination address for the DMA transfer |
size | size of DMA transfer |
0 | if successful. |
Negative | errno code if failure. |
#include <include/drivers/dma.h>
request DMA channel.
request DMA channel resources return -EINVAL if there is no valid channel available.
dev | Pointer to the device structure for the driver instance. |
filter_param | filter function parameter |
dma | channel if successful. |
Negative | errno code if failure. |
#include <include/drivers/dma.h>
Enables DMA channel and starts the transfer, the channel must be configured beforehand.
Implementations must check the validity of the channel ID passed in and return -EINVAL if it is invalid.
dev | Pointer to the device structure for the driver instance. |
channel | Numeric identification of the channel where the transfer will be processed |
0 | if successful. |
Negative | errno code if failure. |
#include <include/drivers/dma.h>
Stops the DMA transfer and disables the channel.
Implementations must check the validity of the channel ID passed in and return -EINVAL if it is invalid.
dev | Pointer to the device structure for the driver instance. |
channel | Numeric identification of the channel where the transfer was being processed |
0 | if successful. |
Negative | errno code if failure. |
#include <include/drivers/dma.h>
Look-up generic width index to be used in registers.
WARNING: This look-up works for most controllers, but may not work for yours. Ensure your controller expects the most common register bit values before using this convenience function. If your controller does not support these values, you will have to write your own look-up inside the controller driver.
size | width of bus (in bytes) |
common | DMA index to be placed into registers. |