![]() |
PDL for FM0+
Version1.0
Peripheral Driverl Library for FM0+
|
Data Structures | |
union | un_dmac_dmaca_t |
union | un_dmac_dmacb_t |
struct | stc_dma_int_sel |
DMA interrupt selection. More... | |
struct | stc_dma_int_cb |
DMA interrupt callback function. More... | |
struct | stc_dma_intern_data |
Datatype for holding internal data needed for DMA. More... | |
struct | stc_dma_config |
DMA configuration. More... | |
Defines | |
#define | GET_DMA_ADDRESS(x) (FM0P_DMAC_BASE + (0x10ul * (x)) + 0x10ul) |
#define | DMA_CH_COUNT (4u) |
#define | DMA_MAX_CH_INDEX (3u) |
#define | DMA_DMACA_OFFSET 0x00ul |
#define | DMA_DMACB_OFFSET 0x04ul |
#define | DMA_DMASA_OFFSET 0x08ul |
#define | DMA_DMADA_OFFSET 0x0Cul |
Typedefs | |
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 enum en_dma_idreq | en_dma_idreq_t |
DMA IDREQ number. | |
typedef enum dma_stop_cause | en_dma_stop_cause_t |
DMA stop cause. | |
typedef struct stc_dma_int_sel | stc_dma_int_sel_t |
DMA interrupt selection. | |
typedef struct stc_dma_int_cb | stc_dma_int_cb_t |
DMA interrupt callback function. | |
typedef struct stc_dma_intern_data | stc_dma_intern_data_t |
Datatype for holding internal data needed for DMA. | |
typedef struct stc_dma_config | stc_dma_config_t |
DMA configuration. | |
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 { 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... | |
enum | dma_stop_cause { DmaStopByAddrOverflow = 0, DmaStopByTransferStopRqst = 1, DmaStopBySrcAccessError = 2, DmaStopByDstAccessError = 3, DmaStopByTransferComplete = 4, DmaStopByTransferPause = 5 } |
DMA stop cause. More... | |
Functions | |
static en_result_t | Dma_Irq_Init (uint8_t u8DmaChannel) |
Init DMA interrupt IRQ. | |
static en_result_t | Dma_Irq_DeInit (uint8_t u8DmaChannel) |
De-Init DMA interrupt. | |
void | DmaIrqHandler (uint8_t u8DmaChannel) |
DMA interrupt handler. | |
en_result_t | Dma_EnableInt (uint8_t u8DmaChannel, stc_dma_int_sel_t *pstcIntSel, stc_dma_int_cb_t *pstcIntCb) |
Enable interrupt of a DMA channel. | |
en_result_t | Dma_DisableInt (uint8_t u8DmaChannel, stc_dma_int_sel_t *pstcIntSel) |
Disable interrupt of a DMA channel. | |
en_result_t | Dma_Init_Channel (uint8_t u8DmaChannel, volatile stc_dma_config_t *pstcConfig) |
Initializes a DMA channel. | |
en_result_t | Dma_DeInit_Channel (uint8_t u8DmaChannel) |
De-Initializes a DMA channel. | |
en_result_t | Dma_SetChannel (uint8_t u8DmaChannel, boolean_t bEnable, boolean_t bPause, boolean_t bSoftwareTrigger) |
Enable, disable, pause, or trigger a DMA channel via configuration. | |
en_dma_stop_cause_t | Dma_GetStopCause (uint8_t u8DmaChannel) |
Read stop cause of a DMA channel. | |
en_result_t | Dma_Enable (void) |
Enable DMA globally. | |
en_result_t | Dma_Disable (void) |
Disable DMA globally. | |
Variables | |
static stc_dma_intern_data_t | stcDmaInternData |
Store DMA internal data. | |
stc_dma_intern_data_t | stcDmaInternData |
Provided functions of DMA module:
Dma_Init_Channel() initializes a DMA channel with the structure type stc_dma_config_t.
Dma_Init_Channel() resets a DMA channel to its initial status.
Dma_SetChannel() can enable/disable and triggers a channel by software.
Dma_GetStopCause() gets the DMA completion cause.
Dma_Enable() enables the entire DMA module and Dma_Disable() disables entire DMA module.
#define DMA_CH_COUNT (4u) |
#define DMA_DMACA_OFFSET 0x00ul |
Definition at line 106 of file dma.h.
Referenced by Dma_DeInit_Channel(), Dma_Init_Channel(), and Dma_SetChannel().
#define DMA_DMACB_OFFSET 0x04ul |
Definition at line 107 of file dma.h.
Referenced by Dma_DeInit_Channel(), Dma_DisableInt(), Dma_EnableInt(), Dma_GetStopCause(), Dma_Init_Channel(), and DmaIrqHandler().
#define DMA_DMADA_OFFSET 0x0Cul |
Definition at line 109 of file dma.h.
Referenced by Dma_DeInit_Channel(), and Dma_Init_Channel().
#define DMA_DMASA_OFFSET 0x08ul |
Definition at line 108 of file dma.h.
Referenced by Dma_DeInit_Channel(), and Dma_Init_Channel().
#define DMA_MAX_CH_INDEX (3u) |
Definition at line 103 of file dma.h.
Referenced by Dma_DisableInt(), and Dma_EnableInt().
#define GET_DMA_ADDRESS | ( | x | ) | (FM0P_DMAC_BASE + (0x10ul * (x)) + 0x10ul) |
Definition at line 71 of file dma.c.
Referenced by Dma_DeInit_Channel(), Dma_DisableInt(), Dma_EnableInt(), Dma_GetStopCause(), Dma_Init_Channel(), Dma_SetChannel(), and DmaIrqHandler().
typedef enum en_dma_idreq en_dma_idreq_t |
DMA IDREQ number.
typedef enum dma_stop_cause en_dma_stop_cause_t |
DMA stop cause.
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_int_cb stc_dma_int_cb_t |
DMA interrupt callback function.
typedef struct stc_dma_int_sel stc_dma_int_sel_t |
DMA interrupt selection.
typedef struct stc_dma_intern_data stc_dma_intern_data_t |
Datatype for holding internal data needed for DMA.
enum dma_stop_cause |
DMA stop cause.
enum en_dma_idreq |
DMA IDREQ number.
enum en_dma_transfermode |
enum en_dma_transferwidth |
en_result_t Dma_DeInit_Channel | ( | uint8_t | u8DmaChannel | ) |
De-Initializes a DMA channel.
Clears an DMA channel.
[in] | u8DmaChannel | DMA channel number |
Ok | init successful |
ErrorInvalidParameter | pstcAdc == NULL or other invalid configuration |
Definition at line 487 of file dma.c.
References 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_DisableInt | ( | uint8_t | u8DmaChannel, |
stc_dma_int_sel_t * | pstcIntSel | ||
) |
Disable interrupt of a DMA channel.
[in] | u8DmaChannel | DMA channel index |
[in] | pstcIntSel | DMA interrupt selection structure |
Ok | Interrupt disabled normally |
ErrorInvalidParameter | If one of following cases matchs:
|
Definition at line 308 of file dma.c.
References stc_dma_intern_data::apfnDmaCallback, stc_dma_intern_data::apfnDmaErrorCallback, stc_dma_int_sel::bCompleteInt, stc_dma_int_sel::bErrorInt, DMA_DMACB_OFFSET, Dma_Irq_DeInit(), DMA_MAX_CH_INDEX, ErrorInvalidParameter, GET_DMA_ADDRESS, Ok, un_dmac_dmacb_t::stcDMACB, TRUE, and un_dmac_dmacb_t::u32DMACB.
en_result_t Dma_Enable | ( | void | ) |
en_result_t Dma_EnableInt | ( | uint8_t | u8DmaChannel, |
stc_dma_int_sel_t * | pstcIntSel, | ||
stc_dma_int_cb_t * | pstcIntCb | ||
) |
Enable interrupt of a DMA channel.
Enable interrupt and set interrupt callback function of a DMA channel
[in] | u8DmaChannel | DMA channel index |
[in] | pstcIntSel | DMA interrupt selection structure |
[in] | pstcIntCb | DMA interrupt callback function |
Ok | Interrupt enabled normally |
ErrorInvalidParameter | If one of followng cases matchs:
|
Definition at line 257 of file dma.c.
References stc_dma_intern_data::apfnDmaCallback, stc_dma_intern_data::apfnDmaErrorCallback, stc_dma_int_sel::bCompleteInt, stc_dma_int_sel::bErrorInt, DMA_DMACB_OFFSET, Dma_Irq_Init(), DMA_MAX_CH_INDEX, ErrorInvalidParameter, GET_DMA_ADDRESS, Ok, stc_dma_int_cb::pfnCompleteCallback, stc_dma_int_cb::pfnErrorCallback, un_dmac_dmacb_t::stcDMACB, TRUE, and un_dmac_dmacb_t::u32DMACB.
en_dma_stop_cause_t Dma_GetStopCause | ( | uint8_t | u8DmaChannel | ) |
Read stop cause of a DMA channel.
[in] | u8DmaChannel | DMA channel |
DmaStopByAddrOverflow | DMA stops by address overflow |
DmaStopByTransferStopRqst | DMA stops by transfer stop request |
DmaStopBySrcAccessError | DMA stops by source access error |
DmaStopByDstAccessError | DMA stops by destination access error |
DmaStopByTransferComplete | DMA stops by transfer completion |
DmaStopByTransferPause | DMA stops by transfer pause |
Definition at line 558 of file dma.c.
References DMA_DMACB_OFFSET, GET_DMA_ADDRESS, un_dmac_dmacb_t::stcDMACB, and un_dmac_dmacb_t::u32DMACB.
en_result_t Dma_Init_Channel | ( | uint8_t | u8DmaChannel, |
volatile stc_dma_config_t * | pstcConfig | ||
) |
Initializes a DMA channel.
Sets up an DMA channel without starting immediate DMA transfer. Set_Dma_Channel() is used for starting DMA transfer.
[in] | u8DmaChannel | DMA channel number |
[in] | pstcConfig | DMA module configuration |
Ok | init successful |
ErrorInvalidParameter | pstcAdc == NULL or other invalid configuration |
OperationInProgress | DMA channel already in use |
Definition at line 362 of file dma.c.
References stc_dma_config::bEnableBitMask, stc_dma_config::bFixedDestination, stc_dma_config::bFixedSource, stc_dma_config::bReloadCount, stc_dma_config::bReloadDestination, stc_dma_config::bReloadSource, Dma16Bit, Dma32Bit, Dma8Bit, DMA_DMACA_OFFSET, DMA_DMACB_OFFSET, DMA_DMADA_OFFSET, DMA_DMASA_OFFSET, DmaBlockTransfer, DmaBurstTransfer, DmaDemandTransfer, stc_dma_config::enDmaIdrq, stc_dma_config::enTransferMode, stc_dma_config::enTransferWdith, ErrorInvalidParameter, GET_DMA_ADDRESS, Ok, 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, and stc_dma_config::u8BlockCount.
static en_result_t Dma_Irq_DeInit | ( | uint8_t | u8DmaChannel | ) | [static] |
De-Init DMA interrupt.
[in] | u8DmaChannel | Channel number |
Ok | de-init successful |
Definition at line 203 of file dma.c.
References Ok, and PDL_DEFAULT_INTERRUPT_LEVEL.
Referenced by Dma_DeInit_Channel(), and Dma_DisableInt().
static en_result_t Dma_Irq_Init | ( | uint8_t | u8DmaChannel | ) | [static] |
Init DMA interrupt IRQ.
[in] | u8DmaChannel | Channel number |
Ok | init successful |
Definition at line 164 of file dma.c.
References Ok, PDL_IRQ_LEVEL_MFS6_14_RX_DMA0, PDL_IRQ_LEVEL_MFS6_14_TX_DMA1, PDL_IRQ_LEVEL_MFS7_15_RX_DMA2, and PDL_IRQ_LEVEL_MFS7_15_TX_DMA3.
Referenced by Dma_EnableInt().
en_result_t Dma_SetChannel | ( | uint8_t | u8DmaChannel, |
boolean_t | bEnable, | ||
boolean_t | bPause, | ||
boolean_t | bSoftwareTrigger | ||
) |
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] | u8DmaChannel | DMA channel number |
[in] | bEnable | Enable the channel or not |
[in] | bPause | Pause the channel or not |
[in] | bSoftwareTrigger | Trigger DMA by software or not |
Ok | Setting finished |
Definition at line 520 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 127 of file dma.c.
References stc_dma_intern_data::apfnDmaCallback, stc_dma_intern_data::apfnDmaErrorCallback, DMA_DMACB_OFFSET, and GET_DMA_ADDRESS.
Referenced by MFS6_14_RX_DMA0_IRQHandler(), MFS6_14_TX_DMA1_IRQHandler(), MFS7_15_RX_DMA2_IRQHandler(), and MFS7_15_TX_DMA3_IRQHandler().
stc_dma_intern_data_t stcDmaInternData [static] |