S32 SDK
edma_hal.h File Reference
#include <stdint.h>
#include <stdbool.h>
#include "device_registers.h"

Go to the source code of this file.

Enumerations

enum  edma_arbitration_algorithm_t { EDMA_ARBITRATION_FIXED_PRIORITY = 0U, EDMA_ARBITRATION_ROUND_ROBIN }
 eDMA channel arbitration algorithm used for selection among channels. Implements : edma_arbitration_algorithm_t_Class More...
 
enum  edma_channel_priority_t {
  EDMA_CHN_PRIORITY_0 = 0U, EDMA_CHN_PRIORITY_1 = 1U, EDMA_CHN_PRIORITY_2 = 2U, EDMA_CHN_PRIORITY_3 = 3U,
  EDMA_CHN_PRIORITY_4 = 4U, EDMA_CHN_PRIORITY_5 = 5U, EDMA_CHN_PRIORITY_6 = 6U, EDMA_CHN_PRIORITY_7 = 7U,
  EDMA_CHN_PRIORITY_8 = 8U, EDMA_CHN_PRIORITY_9 = 9U, EDMA_CHN_PRIORITY_10 = 10U, EDMA_CHN_PRIORITY_11 = 11U,
  EDMA_CHN_PRIORITY_12 = 12U, EDMA_CHN_PRIORITY_13 = 13U, EDMA_CHN_PRIORITY_14 = 14U, EDMA_CHN_PRIORITY_15 = 15U,
  EDMA_CHN_DEFAULT_PRIORITY = 255U
}
 eDMA channel priority setting Implements : edma_channel_priority_t_Class More...
 
enum  edma_modulo_t {
  EDMA_MODULO_OFF = 0U, EDMA_MODULO_2B, EDMA_MODULO_4B, EDMA_MODULO_8B,
  EDMA_MODULO_16B, EDMA_MODULO_32B, EDMA_MODULO_64B, EDMA_MODULO_128B,
  EDMA_MODULO_256B, EDMA_MODULO_512B, EDMA_MODULO_1KB, EDMA_MODULO_2KB,
  EDMA_MODULO_4KB, EDMA_MODULO_8KB, EDMA_MODULO_16KB, EDMA_MODULO_32KB,
  EDMA_MODULO_64KB, EDMA_MODULO_128KB, EDMA_MODULO_256KB, EDMA_MODULO_512KB,
  EDMA_MODULO_1MB, EDMA_MODULO_2MB, EDMA_MODULO_4MB, EDMA_MODULO_8MB,
  EDMA_MODULO_16MB, EDMA_MODULO_32MB, EDMA_MODULO_64MB, EDMA_MODULO_128MB,
  EDMA_MODULO_256MB, EDMA_MODULO_512MB, EDMA_MODULO_1GB, EDMA_MODULO_2GB
}
 eDMA modulo configuration Implements : edma_modulo_t_Class More...
 
enum  edma_transfer_size_t {
  EDMA_TRANSFER_SIZE_1B = 0x0U, EDMA_TRANSFER_SIZE_2B = 0x1U, EDMA_TRANSFER_SIZE_4B = 0x2U, EDMA_TRANSFER_SIZE_16B = 0x4U,
  EDMA_TRANSFER_SIZE_32B = 0x5U
}
 eDMA transfer configuration Implements : edma_transfer_size_t_Class More...
 
enum  edma_bandwidth_config_t { EDMA_BANDWIDTH_STALL_NONE = 0U, EDMA_BANDWIDTH_STALL_4_CYCLES = 2U, EDMA_BANDWIDTH_STALL_8_CYCLES = 3U }
 Bandwidth control configuration Implements : edma_bandwidth_config_t_Class. More...
 

Functions

eDMA HAL driver module level operation
void EDMA_HAL_Init (DMA_Type *base)
 Initializes eDMA module to known state. More...
 
void EDMA_HAL_CancelTransfer (DMA_Type *base)
 Cancels the remaining data transfer. More...
 
void EDMA_HAL_CancelTransferWithError (DMA_Type *base)
 Cancels the remaining data transfer and treats it as an error condition. More...
 
static void EDMA_HAL_SetHaltCmd (DMA_Type *base, bool halt)
 Halts/Un-halts the DMA Operations. More...
 
static void EDMA_HAL_SetHaltOnErrorCmd (DMA_Type *base, bool haltOnError)
 Halts or does not halt the eDMA module when an error occurs. More...
 
static void EDMA_HAL_SetDebugCmd (DMA_Type *base, bool enable)
 Enables/Disables the eDMA DEBUG mode. More...
 
eDMA HAL error checking
static bool EDMA_HAL_GetValidErrorNotCleared (const DMA_Type *base)
 Checks for valid errors. More...
 
static bool EDMA_HAL_GetTransferCancelledError (const DMA_Type *base)
 Checks for cancelled transfers. More...
 
static bool EDMA_HAL_GetChannelPriorityError (const DMA_Type *base)
 Checks for channel priority errors. More...
 
static bool EDMA_HAL_GetSourceAddressError (const DMA_Type *base)
 Checks for source address errors. More...
 
static bool EDMA_HAL_GetSourceOffsetError (const DMA_Type *base)
 Checks for source offset errors. More...
 
static bool EDMA_HAL_GetDestinationAddressError (const DMA_Type *base)
 Checks for destination address errors. More...
 
static bool EDMA_HAL_GetDestinationOffsetError (const DMA_Type *base)
 Checks for destination offset errors. More...
 
static bool EDMA_HAL_GetMinorMajorLoopConfigError (const DMA_Type *base)
 Checks for minor/major loop configuration errors. More...
 
static bool EDMA_HAL_GetScatterGatherError (const DMA_Type *base)
 Checks for scatter/gather configuration errors. More...
 
static bool EDMA_HAL_GetSourceBusError (const DMA_Type *base)
 Checks for source bus errors. More...
 
static bool EDMA_HAL_GetDestinationBusError (const DMA_Type *base)
 Checks for destination bus errors. More...
 
static uint8_t EDMA_HAL_GetChannelWithError (const DMA_Type *base)
 Error channel number. More...
 
eDMA HAL driver channel priority and arbitration configuration
static void EDMA_HAL_SetChannelPreemptMode (DMA_Type *base, uint32_t channel, bool preemptive, bool preemptible)
 Sets the preemption feature for the eDMA channel. More...
 
static void EDMA_HAL_SetChannelPriority (DMA_Type *base, uint32_t channel, edma_channel_priority_t priority)
 Sets the eDMA channel priority. More...
 
static void EDMA_HAL_SetChannelArbitrationMode (DMA_Type *base, edma_arbitration_algorithm_t channelArbitration)
 Sets the channel arbitration algorithm. More...
 
static edma_arbitration_algorithm_t EDMA_HAL_GetChannelArbitrationMode (const DMA_Type *base)
 Gets the channel arbitration algorithm. More...
 
eDMA HAL driver configuration and operation
static void EDMA_HAL_SetMinorLoopMappingCmd (DMA_Type *base, bool enable)
 Enables/Disables the minor loop mapping. More...
 
static void EDMA_HAL_SetContinuousLinkCmd (DMA_Type *base, bool continuous)
 Enables or disables the continuous transfer mode. More...
 
void EDMA_HAL_SetErrorIntCmd (DMA_Type *base, uint8_t channel, bool enable)
 Enables/Disables the error interrupt for channels. More...
 
static uint32_t EDMA_HAL_GetErrorIntStatusFlag (const DMA_Type *base)
 Gets the eDMA error interrupt status. More...
 
static void EDMA_HAL_ClearErrorIntStatusFlag (DMA_Type *base, uint8_t channel)
 Clears the error interrupt status for the eDMA channel or channels. More...
 
void EDMA_HAL_SetDmaRequestCmd (DMA_Type *base, uint8_t channel, bool enable)
 Enables/Disables the DMA request for the channel or all channels. More...
 
static bool EDMA_HAL_GetDmaRequestStatusFlag (const DMA_Type *base, uint32_t channel)
 Gets the eDMA channel DMA request status. More...
 
static void EDMA_HAL_ClearDoneStatusFlag (DMA_Type *base, uint8_t channel)
 Clears the done status for a channel or all channels. More...
 
static void EDMA_HAL_TriggerChannelStart (DMA_Type *base, uint8_t channel)
 Triggers the eDMA channel. More...
 
static bool EDMA_HAL_GetIntStatusFlag (const DMA_Type *base, uint32_t channel)
 Gets the eDMA channel interrupt request status. More...
 
static void EDMA_HAL_ClearIntStatusFlag (DMA_Type *base, uint8_t channel)
 Clears the interrupt status for the eDMA channel or all channels. More...
 
static void EDMA_HAL_SetAsyncRequestInStopModeCmd (DMA_Type *base, uint32_t channel, bool enable)
 Enables/Disables an asynchronous request in stop mode. More...
 
eDMA HAL driver TCD configuration functions
void EDMA_HAL_TCDClearReg (DMA_Type *base, uint32_t channel)
 Clears all registers to 0 for the hardware TCD. More...
 
static void EDMA_HAL_TCDSetSrcAddr (DMA_Type *base, uint32_t channel, uint32_t address)
 Configures the source address for the hardware TCD. More...
 
static void EDMA_HAL_TCDSetSrcOffset (DMA_Type *base, uint32_t channel, int16_t offset)
 Configures the source address signed offset for the hardware TCD. More...
 
void EDMA_HAL_TCDSetAttribute (DMA_Type *base, uint32_t channel, edma_modulo_t srcModulo, edma_modulo_t destModulo, edma_transfer_size_t srcTransferSize, edma_transfer_size_t destTransferSize)
 Configures the transfer attribute for the eDMA channel. More...
 
void EDMA_HAL_TCDSetNbytes (DMA_Type *base, uint32_t channel, uint32_t nbytes)
 Configures the nbytes for the eDMA channel. More...
 
uint32_t EDMA_HAL_TCDGetNbytes (const DMA_Type *base, uint32_t channel)
 Gets the nbytes configuration data for the TCD. More...
 
static void EDMA_HAL_TCDSetSrcMinorLoopOffsetCmd (DMA_Type *base, uint32_t channel, bool enable)
 Enables/disables the source minor loop offset feature for the TCD. More...
 
static void EDMA_HAL_TCDSetDestMinorLoopOffsetCmd (DMA_Type *base, uint32_t channel, bool enable)
 Enables/disables the destination minor loop offset feature for the TCD. More...
 
void EDMA_HAL_TCDSetMinorLoopOffset (DMA_Type *base, uint32_t channel, int32_t offset)
 Configures the minor loop offset for the TCD. More...
 
static void EDMA_HAL_TCDSetSrcLastAdjust (DMA_Type *base, uint32_t channel, int32_t size)
 Configures the last source address adjustment for the TCD. More...
 
static void EDMA_HAL_TCDSetDestAddr (DMA_Type *base, uint32_t channel, uint32_t address)
 Configures the destination address for the TCD. More...
 
static void EDMA_HAL_TCDSetDestOffset (DMA_Type *base, uint32_t channel, int16_t offset)
 Configures the destination address signed offset for the TCD. More...
 
static void EDMA_HAL_TCDSetDestLastAdjust (DMA_Type *base, uint32_t channel, int32_t adjust)
 Configures the last source address adjustment. More...
 
void EDMA_HAL_TCDSetScatterGatherLink (DMA_Type *base, uint32_t channel, uint32_t nextTCDAddr)
 Configures the memory address for the next transfer TCD for the TCD. More...
 
static void EDMA_HAL_TCDSetBandwidth (DMA_Type *base, uint32_t channel, edma_bandwidth_config_t bandwidth)
 Configures the bandwidth for the TCD. More...
 
static void EDMA_HAL_TCDSetChannelMajorLink (DMA_Type *base, uint32_t channel, uint32_t majorLinkChannel, bool enable)
 Configures the major channel link the TCD. More...
 
static void EDMA_HAL_TCDSetScatterGatherCmd (DMA_Type *base, uint32_t channel, bool enable)
 Enables/Disables the scatter/gather feature for the TCD. More...
 
static void EDMA_HAL_TCDSetDisableDmaRequestAfterTCDDoneCmd (DMA_Type *base, uint32_t channel, bool disable)
 Disables/Enables the DMA request after the major loop completes for the TCD. More...
 
static void EDMA_HAL_TCDSetHalfCompleteIntCmd (DMA_Type *base, uint32_t channel, bool enable)
 Enables/Disables the half complete interrupt for the TCD. More...
 
static void EDMA_HAL_TCDSetIntCmd (DMA_Type *base, uint32_t channel, bool enable)
 Enables/Disables the interrupt after the major loop completes for the TCD. More...
 
static void EDMA_HAL_TCDTriggerChannelStart (DMA_Type *base, uint32_t channel)
 Triggers the start bits for the TCD. More...
 
static bool EDMA_HAL_TCDGetChannelActiveStatus (const DMA_Type *base, uint32_t channel)
 Checks whether the channel is running for the TCD. More...
 
void EDMA_HAL_TCDSetChannelMinorLink (DMA_Type *base, uint32_t channel, uint32_t linkChannel, bool enable)
 Sets the channel minor link for the TCD. More...
 
void EDMA_HAL_TCDSetMajorCount (DMA_Type *base, uint32_t channel, uint32_t count)
 Sets the major iteration count according to minor loop channel link setting. More...
 
uint32_t EDMA_HAL_TCDGetBeginMajorCount (const DMA_Type *base, uint32_t channel)
 Returns the begin major iteration count. More...
 
uint32_t EDMA_HAL_TCDGetCurrentMajorCount (const DMA_Type *base, uint32_t channel)
 Returns the current major iteration count. More...
 
uint32_t EDMA_HAL_TCDGetFinishedBytes (const DMA_Type *base, uint32_t channel)
 Gets the number of bytes already transferred for the TCD. More...
 
uint32_t EDMA_HAL_TCDGetUnfinishedBytes (const DMA_Type *base, uint32_t channel)
 Gets the number of bytes haven't transferred for the TCD. More...
 
static bool EDMA_HAL_TCDGetDoneStatusFlag (const DMA_Type *base, uint32_t channel)
 Gets the channel done status. More...