dmadrv.h File Reference

DMADRV API definition.

Version
5.4.0

License

(C) Copyright 2014 Silicon Labs, www.silabs.com

This file is licensed under the Silabs License Agreement. See the file "Silabs_License_Agreement.txt" for details. Before using this software for any purpose, you must agree to the terms of that agreement.

Definition in file dmadrv.h .

#include " em_device.h "
#include " ecode.h "
#include " em_dma.h "
#include "dmadrv_config.h"

Macros

#define DMADRV_MAX_XFER_COUNT ((int)(( _DMA_CTRL_N_MINUS_1_MASK >> _DMA_CTRL_N_MINUS_1_SHIFT ) + 1))
Maximum length of one DMA transfer.
#define ECODE_EMDRV_DMADRV_ALREADY_FREED ( ECODE_EMDRV_DMADRV_BASE | 0x00000006)
A DMA channel was free.
#define ECODE_EMDRV_DMADRV_ALREADY_INITIALIZED ( ECODE_EMDRV_DMADRV_BASE | 0x00000003)
DMA has already been initialized.
#define ECODE_EMDRV_DMADRV_CH_NOT_ALLOCATED ( ECODE_EMDRV_DMADRV_BASE | 0x00000007)
A channel is not reserved.
#define ECODE_EMDRV_DMADRV_CHANNELS_EXHAUSTED ( ECODE_EMDRV_DMADRV_BASE | 0x00000004)
No DMA channels available.
#define ECODE_EMDRV_DMADRV_IN_USE ( ECODE_EMDRV_DMADRV_BASE | 0x00000005)
DMA is in use.
#define ECODE_EMDRV_DMADRV_NOT_INITIALIZED ( ECODE_EMDRV_DMADRV_BASE | 0x00000002)
DMA is not initialized.
#define ECODE_EMDRV_DMADRV_OK ( ECODE_OK )
A successful return value.
#define ECODE_EMDRV_DMADRV_PARAM_ERROR ( ECODE_EMDRV_DMADRV_BASE | 0x00000001)
An illegal input parameter.
#define EMDRV_DMADRV_DMA_PRESENT
#define EMDRV_DMADRV_UDMA

Typedefs

typedef bool(* DMADRV_Callback_t ) (unsigned int channel, unsigned int sequenceNo, void *userParam)
DMADRV transfer completion callback function.

Enumerations

enum DMADRV_Datasize_t {
dmadrvDataSize1 = dmaDataSize1,
dmadrvDataSize2 = dmaDataSize2,
dmadrvDataSize4 = dmaDataSize4
}
Data size of one UDMA transfer item.
enum DMADRV_Peripheralsignal_t {
dmadrvPeripheralSignal_NONE = 0,
dmadrvPeripheralSignal_ADC0_SCAN = DMAREQ_ADC0_SCAN,
dmadrvPeripheralSignal_ADC0_SINGLE = DMAREQ_ADC0_SINGLE,
dmadrvPeripheralSignal_AES_DATARD = DMAREQ_AES_DATARD,
dmadrvPeripheralSignal_AES_DATAWR = DMAREQ_AES_DATAWR,
dmadrvPeripheralSignal_AES_KEYWR = DMAREQ_AES_KEYWR,
dmadrvPeripheralSignal_AES_XORDATAWR = DMAREQ_AES_XORDATAWR,
dmadrvPeripheralSignal_DAC0_CH0 = DMAREQ_DAC0_CH0,
dmadrvPeripheralSignal_DAC0_CH1 = DMAREQ_DAC0_CH1,
dmadrvPeripheralSignal_EBI_DDEMPTY = DMAREQ_EBI_DDEMPTY,
dmadrvPeripheralSignal_EBI_PXL0EMPTY = DMAREQ_EBI_PXL0EMPTY,
dmadrvPeripheralSignal_EBI_PXL1EMPTY = DMAREQ_EBI_PXL1EMPTY,
dmadrvPeripheralSignal_EBI_PXLFULL = DMAREQ_EBI_PXLFULL,
dmadrvPeripheralSignal_I2C0_RXDATAV = DMAREQ_I2C0_RXDATAV,
dmadrvPeripheralSignal_I2C0_TXBL = DMAREQ_I2C0_TXBL,
dmadrvPeripheralSignal_I2C1_RXDATAV = DMAREQ_I2C1_RXDATAV,
dmadrvPeripheralSignal_I2C1_TXBL = DMAREQ_I2C1_TXBL,
dmadrvPeripheralSignal_LESENSE_BUFDATAV = DMAREQ_LESENSE_BUFDATAV,
dmadrvPeripheralSignal_LEUART0_RXDATAV = DMAREQ_LEUART0_RXDATAV,
dmadrvPeripheralSignal_LEUART0_TXBL = DMAREQ_LEUART0_TXBL,
dmadrvPeripheralSignal_LEUART0_TXEMPTY = DMAREQ_LEUART0_TXEMPTY,
dmadrvPeripheralSignal_LEUART1_RXDATAV = DMAREQ_LEUART1_RXDATAV,
dmadrvPeripheralSignal_LEUART1_TXBL = DMAREQ_LEUART1_TXBL,
dmadrvPeripheralSignal_LEUART1_TXEMPTY = DMAREQ_LEUART1_TXEMPTY,
dmadrvPeripheralSignal_MSC_WDATA = DMAREQ_MSC_WDATA,
dmadrvPeripheralSignal_TIMER0_CC0 = DMAREQ_TIMER0_CC0,
dmadrvPeripheralSignal_TIMER0_CC1 = DMAREQ_TIMER0_CC1,
dmadrvPeripheralSignal_TIMER0_CC2 = DMAREQ_TIMER0_CC2,
dmadrvPeripheralSignal_TIMER0_UFOF = DMAREQ_TIMER0_UFOF,
dmadrvPeripheralSignal_TIMER1_CC0 = DMAREQ_TIMER1_CC0,
dmadrvPeripheralSignal_TIMER1_CC1 = DMAREQ_TIMER1_CC1,
dmadrvPeripheralSignal_TIMER1_CC2 = DMAREQ_TIMER1_CC2,
dmadrvPeripheralSignal_TIMER1_UFOF = DMAREQ_TIMER1_UFOF,
dmadrvPeripheralSignal_TIMER2_CC0 = DMAREQ_TIMER2_CC0,
dmadrvPeripheralSignal_TIMER2_CC1 = DMAREQ_TIMER2_CC1,
dmadrvPeripheralSignal_TIMER2_CC2 = DMAREQ_TIMER2_CC2,
dmadrvPeripheralSignal_TIMER2_UFOF = DMAREQ_TIMER2_UFOF,
dmadrvPeripheralSignal_TIMER3_CC0 = DMAREQ_TIMER3_CC0,
dmadrvPeripheralSignal_TIMER3_CC1 = DMAREQ_TIMER3_CC1,
dmadrvPeripheralSignal_TIMER3_CC2 = DMAREQ_TIMER3_CC2,
dmadrvPeripheralSignal_TIMER3_UFOF = DMAREQ_TIMER3_UFOF,
dmadrvPeripheralSignal_UART0_RXDATAV = DMAREQ_UART0_RXDATAV,
dmadrvPeripheralSignal_UART0_TXBL = DMAREQ_UART0_TXBL,
dmadrvPeripheralSignal_UART0_TXEMPTY = DMAREQ_UART0_TXEMPTY,
dmadrvPeripheralSignal_UART1_RXDATAV = DMAREQ_UART1_RXDATAV,
dmadrvPeripheralSignal_UART1_TXBL = DMAREQ_UART1_TXBL,
dmadrvPeripheralSignal_UART1_TXEMPTY = DMAREQ_UART1_TXEMPTY,
dmadrvPeripheralSignal_USART0_RXDATAV = DMAREQ_USART0_RXDATAV,
dmadrvPeripheralSignal_USART0_TXBL = DMAREQ_USART0_TXBL,
dmadrvPeripheralSignal_USART0_TXEMPTY = DMAREQ_USART0_TXEMPTY,
dmadrvPeripheralSignal_USART1_RXDATAV = DMAREQ_USART1_RXDATAV,
dmadrvPeripheralSignal_USART1_RXDATAVRIGHT = DMAREQ_USART1_RXDATAVRIGHT,
dmadrvPeripheralSignal_USART1_TXBL = DMAREQ_USART1_TXBL,
dmadrvPeripheralSignal_USART1_TXBLRIGHT = DMAREQ_USART1_TXBLRIGHT,
dmadrvPeripheralSignal_USART1_TXEMPTY = DMAREQ_USART1_TXEMPTY,
dmadrvPeripheralSignal_USART2_RXDATAV = DMAREQ_USART2_RXDATAV,
dmadrvPeripheralSignal_USART2_RXDATAVRIGHT = DMAREQ_USART2_RXDATAVRIGHT,
dmadrvPeripheralSignal_USART2_TXBL = DMAREQ_USART2_TXBL,
dmadrvPeripheralSignal_USART2_TXBLRIGHT = DMAREQ_USART2_TXBLRIGHT,
dmadrvPeripheralSignal_USART2_TXEMPTY = DMAREQ_USART2_TXEMPTY
}
Peripherals that can trigger UDMA transfers.

Functions

Ecode_t DMADRV_AllocateChannel (unsigned int *channelId, void *capabilities)
Allocate (reserve) a DMA channel.
Ecode_t DMADRV_DeInit (void)
Deinitialize DMADRV.
Ecode_t DMADRV_FreeChannel (unsigned int channelId)
Free an allocated (reserved) DMA channel.
Ecode_t DMADRV_Init (void)
Initialize DMADRV.
Ecode_t DMADRV_MemoryPeripheral (unsigned int channelId, DMADRV_PeripheralSignal_t peripheralSignal, void *dst, void *src, bool srcInc, int len, DMADRV_DataSize_t size, DMADRV_Callback_t callback, void *cbUserParam)
Start a memory to a peripheral DMA transfer.
Ecode_t DMADRV_MemoryPeripheralPingPong (unsigned int channelId, DMADRV_PeripheralSignal_t peripheralSignal, void *dst, void *src0, void *src1, bool srcInc, int len, DMADRV_DataSize_t size, DMADRV_Callback_t callback, void *cbUserParam)
Start a memory to a peripheral ping-pong DMA transfer.
Ecode_t DMADRV_PauseTransfer (unsigned int channelId)
Pause an ongoing DMA transfer.
Ecode_t DMADRV_PeripheralMemory (unsigned int channelId, DMADRV_PeripheralSignal_t peripheralSignal, void *dst, void *src, bool dstInc, int len, DMADRV_DataSize_t size, DMADRV_Callback_t callback, void *cbUserParam)
Start a peripheral to memory DMA transfer.
Ecode_t DMADRV_PeripheralMemoryPingPong (unsigned int channelId, DMADRV_PeripheralSignal_t peripheralSignal, void *dst0, void *dst1, void *src, bool dstInc, int len, DMADRV_DataSize_t size, DMADRV_Callback_t callback, void *cbUserParam)
Start a peripheral to memory ping-pong DMA transfer.
Ecode_t DMADRV_ResumeTransfer (unsigned int channelId)
Resume an ongoing DMA transfer.
Ecode_t DMADRV_StopTransfer (unsigned int channelId)
Stop an ongoing DMA transfer.
Ecode_t DMADRV_TransferActive (unsigned int channelId, bool *active)
Check if a transfer is running.
Ecode_t DMADRV_TransferCompletePending (unsigned int channelId, bool *pending)
Check if a transfer complete is pending.
Ecode_t DMADRV_TransferDone (unsigned int channelId, bool *done)
Check if a transfer has completed.
Ecode_t DMADRV_TransferRemainingCount (unsigned int channelId, int *remaining)
Get number of items remaining in a transfer.