Platform independent implementation for the DMA API. More...
#include <inttypes.h>
#include "no_os_dma.h"
#include <stdlib.h>
#include "no_os_error.h"
#include "no_os_mutex.h"
#include "no_os_irq.h"
#include "no_os_alloc.h"
#include "no_os_list.h"
Functions | |
int | no_os_dma_init (struct no_os_dma_desc **desc, struct no_os_dma_init_param *param) |
Initialize the DMA controller. | |
int | no_os_dma_remove (struct no_os_dma_desc *desc) |
Remove resources allocated for the DMA controller. | |
int | no_os_dma_acquire_channel (struct no_os_dma_desc *desc, struct no_os_dma_ch **channel) |
Get a free DMA channel. | |
int | no_os_dma_release_channel (struct no_os_dma_desc *desc, struct no_os_dma_ch *channel) |
Free DMA channel. | |
int | no_os_dma_config_xfer (struct no_os_dma_desc *desc, struct no_os_dma_xfer_desc *xfer, uint32_t len, struct no_os_dma_ch *ch) |
Acquire a channel and configure the list of transfers. | |
int | no_os_dma_chan_lock (struct no_os_dma_ch *ch) |
Lock a DMA channel, so it won't be acquired even if it's free. | |
int | no_os_dma_chan_unlock (struct no_os_dma_ch *ch) |
Unlock a DMA channel, marking it available for acquisition. | |
int | no_os_dma_xfer_start (struct no_os_dma_desc *desc, struct no_os_dma_ch *ch) |
Acquire a channel and configure the list of transfers. | |
int | no_os_dma_xfer_abort (struct no_os_dma_desc *desc, struct no_os_dma_ch *ch) |
Abort the ongoing and any other future transfers scheduled for a channel. | |
bool | no_os_dma_is_completed (struct no_os_dma_desc *desc, struct no_os_dma_ch *ch) |
Get the state of a DMA channel (free or not). | |
bool | no_os_dma_in_progress (struct no_os_dma_desc *desc, struct no_os_dma_ch *ch) |
Whether or not there is a transfer in progress on a specific channel. | |
Platform independent implementation for the DMA API.
Copyright 2024(c) Analog Devices, Inc.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES, INC. “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL ANALOG DEVICES, INC. BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
int no_os_dma_acquire_channel | ( | struct no_os_dma_desc * | desc, |
struct no_os_dma_ch ** | channel ) |
Get a free DMA channel.
desc | - Structure containing the state of the DMA controller. |
channel | - Reference to the acquired channel. |
int no_os_dma_chan_lock | ( | struct no_os_dma_ch * | ch | ) |
Lock a DMA channel, so it won't be acquired even if it's free.
ch | - Reference to the DMA channel |
int no_os_dma_chan_unlock | ( | struct no_os_dma_ch * | ch | ) |
Unlock a DMA channel, marking it available for acquisition.
ch | - Reference to the DMA channel |
int no_os_dma_config_xfer | ( | struct no_os_dma_desc * | desc, |
struct no_os_dma_xfer_desc * | xfer, | ||
uint32_t | len, | ||
struct no_os_dma_ch * | ch ) |
Acquire a channel and configure the list of transfers.
desc | - Structure containing the state of the DMA controller |
xfer | - Array of DMA transfers. |
len | - The number of transfers in the xfer list. |
ch | - Previously acquired channel, for which the transfer will be configured. |
bool no_os_dma_in_progress | ( | struct no_os_dma_desc * | desc, |
struct no_os_dma_ch * | ch ) |
Whether or not there is a transfer in progress on a specific channel.
desc | - Reference to the DMA controller. |
ch | - Reference to the DMA channel. |
int no_os_dma_init | ( | struct no_os_dma_desc ** | desc, |
struct no_os_dma_init_param * | param ) |
Initialize the DMA controller.
desc | - Structure containing the state of the DMA controller |
param | - Initialization parameter for the DMA controller. |
bool no_os_dma_is_completed | ( | struct no_os_dma_desc * | desc, |
struct no_os_dma_ch * | ch ) |
Get the state of a DMA channel (free or not).
desc | - Reference to the DMA controller. |
ch | - Reference to the DMA channel. |
int no_os_dma_release_channel | ( | struct no_os_dma_desc * | desc, |
struct no_os_dma_ch * | channel ) |
Free DMA channel.
desc | - Structure containing the state of the DMA controller. |
channel | - Reference to the currently acquired channel. |
int no_os_dma_remove | ( | struct no_os_dma_desc * | desc | ) |
Remove resources allocated for the DMA controller.
desc | - Structure containing the state of the DMA controller |
int no_os_dma_xfer_abort | ( | struct no_os_dma_desc * | desc, |
struct no_os_dma_ch * | ch ) |
Abort the ongoing and any other future transfers scheduled for a channel.
desc | - Structure containing the state of the DMA controller |
ch | - Index for the channel we want to abort the transfer. |
int no_os_dma_xfer_start | ( | struct no_os_dma_desc * | desc, |
struct no_os_dma_ch * | ch ) |
Acquire a channel and configure the list of transfers.
desc | - Structure containing the state of the DMA controller |
ch | - Index for the channel we want to start the transfer on. |