![]() |
PDL for FM4
Version1.2
Peripheral Driverl Library for FM4
|
Data Structures | |
| union | un_dmac_dmaca_t |
| union | un_dmac_dmacb_t |
| struct | stc_dma_intern_data |
| Datatype for holding internal data needed for DMA. More... | |
| struct | stc_dma_instance_data |
| DMA instance data type. More... | |
| struct | stc_dma_config |
| DMA configuration. More... | |
Macros | |
| #define | GET_DMA_ADDRESS(x) (FM4_DMAC_BASE + (0x10ul * (x)) + 0x10ul) |
| #define | DMA_DMACA_OFFSET 0x00ul |
| #define | DMA_DMACB_OFFSET 0x04ul |
| #define | DMA_DMASA_OFFSET 0x08ul |
| #define | DMA_DMADA_OFFSET 0x0Cul |
| #define | DMA_CHANNEL_ACTIVE 1u |
| #define | DMA_CHANNEL_INACTIVE 0u |
Typedefs | |
| typedef enum en_dma_transfermode | en_dma_transfermode_t |
| DMA transfer data width. More... | |
| typedef enum en_dma_transferwidth | en_dma_transferwidth_t |
| DMA transfer data width. More... | |
| typedef enum en_dma_idreq | en_dma_idreq_t |
| DMA IDREQ number. More... | |
| typedef struct stc_dma_intern_data | stc_dma_intern_data_t |
| Datatype for holding internal data needed for DMA. More... | |
| typedef struct stc_dma_instance_data | stc_dma_instance_data_t |
| DMA instance data type. More... | |
| typedef struct stc_dma_config | stc_dma_config_t |
| DMA configuration. More... | |
Enumerations | |
| enum | en_dma_transfermode { DmaBlockTransfer = 0, DmaBurstTransfer = 1, DmaDemandTransfer = 2 } |
| DMA transfer data width. More... | |
| enum | en_dma_transferwidth { Dma8Bit = 0, Dma16Bit = 1, Dma32Bit = 2 } |
| DMA transfer data width. More... | |
| enum | en_dma_idreq { Ep1DrqUsb0 = 0, Ep2DrqUsb0 = 1, Ep3DrqUsb0 = 2, Ep4DrqUsb0 = 3, Ep5DrqUsb0 = 4, Adc0 = 5, Adc1 = 6, Adc2 = 7, Bt0Irq0 = 8, Bt2Irq0 = 9, Bt4Irq0 = 10, Bt6Irq0 = 11, MfsRx0 = 12, MfsTx0 = 13, MfsRx1 = 14, MfsTx1 = 15, MfsRx2 = 16, MfsTx2 = 17, MfsRx3 = 18, MfsTx3 = 19, MfsRx4 = 20, MfsTx4 = 21, MfsRx5 = 22, MfsTx5 = 23, MfsRx6 = 24, MfsTx6 = 25, MfsRx7 = 26, MfsTx7 = 27, ExtIrq0 = 28, ExtIrq1 = 29, ExtIrq2 = 30, ExtIrq3 = 31, Software = 1234 } |
| DMA IDREQ number. More... | |
Functions | |
| static en_result_t | Dma_Irq_Init (uint8_t u8DmaChannel) |
| Init DMA interrupt. More... | |
| static en_result_t | Dma_Irq_DeInit (uint8_t u8DmaChannel) |
| De-Init DMA interrupt. More... | |
| void | DmaIrqHandler (uint8_t u8DmaChannel) |
| DMA interrupt handler. More... | |
| en_result_t | Dma_Init_Channel (volatile stc_dma_config_t *pstcConfig) |
| Initializes a DMA channel. More... | |
| en_result_t | Dma_Set_Channel (volatile stc_dma_config_t *pstcConfig) |
| Enable, disable, pause, or trigger a DMA channel via configuration. More... | |
| en_result_t | Dma_Enable (void) |
| Enable DMA globally. More... | |
| en_result_t | Dma_Disable (void) |
| Disable DMA globally. More... | |
| en_result_t | Dma_DeInit_Channel (volatile stc_dma_config_t *pstcConfig) |
| De-Initializes a DMA channel. More... | |
| en_result_t | Dma_Set_ChannelParam (uint8_t u8DmaChannel, boolean_t bEnable, boolean_t bPause, boolean_t bSoftwareTrigger) |
| Enable, disable, pause, or trigger a DMA channel via arguments. More... | |
| en_result_t | Dma_DeInit_ChannelParam (uint8_t u8DmaChannel) |
| De-Initializes a DMA channel via channel parameter. More... | |
Variables | |
| stc_dma_intern_data_t | stcDmaInternData |
| stc_dma_intern_data_t | stcDmaInternData |
Provided functions of DMA module:
The DMA is configured by Dma_Init_Channel() but not started then. With the function Dma_Set_Channel() the enable, pause and/or trigger bits can be set. Dma_Enable() enables globally the DMA and Dma_Disable() disables DMA globally. Dma_DeInit_Channel() clears a channel for a possible new configuration.
Once a DMA channel was setup by Dma_Init_Channel() it cannot be re-initialized by this function (with a new configuration) anymore. result_t::OperationInProgress is returned in this case. Dma_DeInit_Channel() has to be called before to unlock the channel for a new configuration.
Dma_Set_ChannelParam() and Dma_DeInit_ChannelParam() perform the same functionality as Dma_Set_Channel() and Dma_DeInit_Channel() instead of configuration usage. Here direct arguments are used.
| #define DMA_CHANNEL_ACTIVE 1u |
Definition at line 114 of file dma.h.
Referenced by Dma_Init_Channel().
| #define DMA_CHANNEL_INACTIVE 0u |
Definition at line 115 of file dma.h.
Referenced by Dma_DeInit_Channel(), and Dma_DeInit_ChannelParam().
| #define DMA_DMACA_OFFSET 0x00ul |
Definition at line 107 of file dma.h.
Referenced by Dma_DeInit_Channel(), Dma_DeInit_ChannelParam(), Dma_Init_Channel(), Dma_Set_Channel(), and Dma_Set_ChannelParam().
| #define DMA_DMACB_OFFSET 0x04ul |
Definition at line 108 of file dma.h.
Referenced by Dma_DeInit_Channel(), Dma_DeInit_ChannelParam(), Dma_Init_Channel(), and DmaIrqHandler().
| #define DMA_DMADA_OFFSET 0x0Cul |
Definition at line 110 of file dma.h.
Referenced by Dma_DeInit_Channel(), Dma_DeInit_ChannelParam(), and Dma_Init_Channel().
| #define DMA_DMASA_OFFSET 0x08ul |
Definition at line 109 of file dma.h.
Referenced by Dma_DeInit_Channel(), Dma_DeInit_ChannelParam(), and Dma_Init_Channel().
| #define GET_DMA_ADDRESS | ( | x | ) | (FM4_DMAC_BASE + (0x10ul * (x)) + 0x10ul) |
Definition at line 70 of file dma.c.
Referenced by Dma_DeInit_Channel(), Dma_DeInit_ChannelParam(), Dma_Init_Channel(), Dma_Set_Channel(), Dma_Set_ChannelParam(), and DmaIrqHandler().
| typedef enum en_dma_idreq en_dma_idreq_t |
DMA IDREQ number.
| typedef enum en_dma_transfermode en_dma_transfermode_t |
DMA transfer data width.
| typedef enum en_dma_transferwidth en_dma_transferwidth_t |
DMA transfer data width.
| typedef struct stc_dma_config stc_dma_config_t |
DMA configuration.
| typedef struct stc_dma_instance_data stc_dma_instance_data_t |
DMA instance data type.
| typedef struct stc_dma_intern_data stc_dma_intern_data_t |
Datatype for holding internal data needed for DMA.
| enum en_dma_idreq |
DMA IDREQ number.
| enum en_dma_transfermode |
| enum en_dma_transferwidth |
| en_result_t Dma_DeInit_Channel | ( | volatile stc_dma_config_t * | pstcConfig | ) |
De-Initializes a DMA channel.
Clears an DMA channel.
| [in] | pstcConfig | DMA module configuration |
| Ok | init successful |
| ErrorInvalidParameter | pstcAdc == NULL or other invalid configuration |
Definition at line 508 of file dma.c.
References stc_dma_intern_data::au8DmaChannelActive, DMA_CHANNEL_INACTIVE, DMA_DMACA_OFFSET, DMA_DMACB_OFFSET, DMA_DMADA_OFFSET, DMA_DMASA_OFFSET, Dma_Irq_DeInit(), ErrorInvalidParameter, GET_DMA_ADDRESS, Ok, and stc_dma_config::u8DmaChannel.

| en_result_t Dma_DeInit_ChannelParam | ( | uint8_t | u8DmaChannel | ) |
De-Initializes a DMA channel via channel parameter.
Clears an DMA channel.
| [in] | u8DmaChannel | DMA channel to be de-initialized |
| Ok | init successful |
Definition at line 590 of file dma.c.
References stc_dma_intern_data::au8DmaChannelActive, DMA_CHANNEL_INACTIVE, DMA_DMACA_OFFSET, DMA_DMACB_OFFSET, DMA_DMADA_OFFSET, DMA_DMASA_OFFSET, Dma_Irq_DeInit(), GET_DMA_ADDRESS, and Ok.

| en_result_t Dma_Disable | ( | void | ) |
| en_result_t Dma_Enable | ( | void | ) |
| en_result_t Dma_Init_Channel | ( | volatile stc_dma_config_t * | pstcConfig | ) |
Initializes a DMA channel.
Sets up an DMA channel without starting immediate DMA transfer. Enable_Dma_Channel() is used for starting DMA transfer.
| [in] | pstcConfig | DMA module configuration |
| Ok | init successful |
| ErrorInvalidParameter | pstcAdc == NULL or other invalid configuration |
| OperationInProgress | DMA channel already in use |
Definition at line 283 of file dma.c.
References stc_dma_intern_data::apfnDmaCallback, stc_dma_intern_data::apfnDmaErrorCallback, stc_dma_intern_data::au8DmaChannelActive, stc_dma_config::bCompletionInterruptEnable, stc_dma_config::bEnableBitMask, stc_dma_config::bErrorInterruptEnable, stc_dma_config::bFixedDestination, stc_dma_config::bFixedSource, stc_dma_config::bReloadCount, stc_dma_config::bReloadDestination, stc_dma_config::bReloadSource, Dma16Bit, Dma32Bit, Dma8Bit, DMA_CHANNEL_ACTIVE, DMA_DMACA_OFFSET, DMA_DMACB_OFFSET, DMA_DMADA_OFFSET, DMA_DMASA_OFFSET, Dma_Irq_Init(), DmaBlockTransfer, DmaBurstTransfer, DmaDemandTransfer, stc_dma_config::enDmaIdrq, stc_dma_config::enTransferMode, stc_dma_config::enTransferWdith, ErrorInvalidParameter, GET_DMA_ADDRESS, Ok, OperationInProgress, stc_dma_config::pfnCallback, stc_dma_config::pfnErrorCallback, Software, un_dmac_dmaca_t::stcDMACA, un_dmac_dmacb_t::stcDMACB, TRUE, stc_dma_config::u16TransferCount, stc_dma_config::u32DestinationAddress, un_dmac_dmaca_t::u32DMACA, un_dmac_dmacb_t::u32DMACB, stc_dma_config::u32SourceAddress, stc_dma_config::u8BlockCount, and stc_dma_config::u8DmaChannel.

|
static |
De-Init DMA interrupt.
Sets up an DMA error/completion interrupt.
| [in] | u8DmaChannel | Channel number |
| Ok | de-init successful |
Definition at line 219 of file dma.c.
References Ok, and PDL_DEFAULT_INTERRUPT_LEVEL.
Referenced by Dma_DeInit_Channel(), and Dma_DeInit_ChannelParam().

|
static |
Init DMA interrupt.
Sets up an DMA error/completion interrupt.
| [in] | u8DmaChannel | Channel number |
| Ok | init successful |
Definition at line 158 of file dma.c.
References Ok, PDL_DMA0_LEVEL, PDL_DMA1_LEVEL, PDL_DMA2_LEVEL, PDL_DMA3_LEVEL, PDL_DMA4_LEVEL, PDL_DMA5_LEVEL, PDL_DMA6_LEVEL, and PDL_DMA7_LEVEL.
Referenced by Dma_Init_Channel().

| en_result_t Dma_Set_Channel | ( | volatile stc_dma_config_t * | pstcConfig | ) |
Enable, disable, pause, or trigger a DMA channel via configuration.
This function enables, disables, pauses or triggers a DMA transfer according to the settings in the configuration bits for EB (Enable), PB (Pause) and ST (Software Trigger)
| [in] | pstcConfig | DMA module configuration |
| Ok | Setting finished |
Definition at line 441 of file dma.c.
References stc_dma_config::bEnable, stc_dma_config::bPause, stc_dma_config::bSoftwareTrigger, DMA_DMACA_OFFSET, ErrorInvalidParameter, GET_DMA_ADDRESS, Ok, un_dmac_dmaca_t::stcDMACA, TRUE, un_dmac_dmaca_t::u32DMACA, and stc_dma_config::u8DmaChannel.
| en_result_t Dma_Set_ChannelParam | ( | uint8_t | u8DmaChannel, |
| boolean_t | bEnable, | ||
| boolean_t | bPause, | ||
| boolean_t | bSoftwareTrigger | ||
| ) |
Enable, disable, pause, or trigger a DMA channel via arguments.
This function enables, disables, pauses or triggers a DMA transfer according to the settings in the configuration bits for EB (Enable), PB (Pause) and ST (Software Trigger)
| [in] | u8DmaChannel | DMA channel to be set |
| [in] | bEnable | TRUE = Channel enabled, FALSE = Channel disabled |
| [in] | bPause | TRUE = Channel paused, FALSE = Channel working |
| [in] | bSoftwareTrigger | TRUE = Channel trigger, FALSE = Channel no trigger |
| Ok | Setting finished |
Definition at line 554 of file dma.c.
References DMA_DMACA_OFFSET, GET_DMA_ADDRESS, Ok, un_dmac_dmaca_t::stcDMACA, TRUE, and un_dmac_dmaca_t::u32DMACA.
| void DmaIrqHandler | ( | uint8_t | u8DmaChannel | ) |
DMA interrupt handler.
| [in] | u8DmaChannel | Channel number |
Definition at line 119 of file dma.c.
References stc_dma_intern_data::apfnDmaCallback, stc_dma_intern_data::apfnDmaErrorCallback, DMA_DMACB_OFFSET, and GET_DMA_ADDRESS.
| stc_dma_intern_data_t stcDmaInternData |
| stc_dma_intern_data_t stcDmaInternData |