The MCUXpresso SDK provides a driver for the GPDMA.
GPDMA driver provides two types of APIs:
The first type is functional APIs, or the basic channel operation APIs. Such as GPDMA_SetTransferConfig, GPDMA_EnableChannel. Generally, functional APIs use the GPDMA_Type *base as parameter. They are simple basic function blocks and does not handle the interrupts. Application should implement the ISR if only functional APIs used.
The second type is transactional APIs. Such as GPDMA_SubmitTransfer. Generally these APIs uses the parameter gpdma_handle_t. Transactional APIs handles the interrupts, user could get the interrupt status by registering callback.
The functional APIs and transactional APIs are very similar to each other, please refer the driver examples.
|
| typedef void(* | gpdma_callback )(struct _gpdma_handle *handle, void *userData, uint32_t status) |
| | Define callback function for GPDMA. More...
|
| |
|
| enum | gpdma_status_clear_t {
kGPDMA_StatusClearInterruptTerminalCountRequest = 0x0,
kGPDMA_StatusClearInterruptError
} |
| | GPDMA Interrupt Clear Status. More...
|
| |
| enum | gpdma_status_t {
kGPDMA_StatusInterrupt = 0x0,
kGPDMA_StatusInterruptTerminalCountRequest,
kGPDMA_StatusInterruptError,
kGPDMA_StatusRawInterruptTerminalCount,
kGPDMA_StatusRawErrorInterrupt,
kGPDMA_StatusEnabledChannel
} |
| | GPDMA Type of Status. More...
|
| |
| enum | gpdma_transfer_type_t {
kGPDMA_TransferM2MControllerDma = 0UL,
kGPDMA_TransferM2PControllerDma = 1UL,
kGPDMA_TransferP2MControllerDma = 2UL,
kGPDMA_TransferP2PControllerDma = 3UL,
kGPDMA_TransferP2PControllerDestPeripheral = 4UL,
kGPDMA_TransferM2PControllerPeripheral = 5UL,
kGPDMA_TransferP2MControllerPeripheral = 6UL,
kGPDMA_TransferP2PControllerSrcPeripheral = 7UL
} |
| | GPDMA transfer type. More...
|
| |
| enum | gpdma_transfer_width_t {
kGPDMA_TransferWidth1Bytes = 0U,
kGPDMA_TransferWidth2Bytes = 1U,
kGPDMA_TransferWidth4Bytes = 2U
} |
| | GPDMA transfer width configuration. More...
|
| |
| enum | gpdma_burst_size_t {
kGPDMA_BurstSize1 = 0U,
kGPDMA_BurstSize4 = 1U,
kGPDMA_BurstSize8 = 2U,
kGPDMA_BurstSize16 = 3U,
kGPDMA_BurstSize32 = 4U,
kGPDMA_BurstSize64 = 5U,
kGPDMA_BurstSize128 = 6U,
kGPDMA_BurstSize256 = 7U
} |
| | GPDMA transfer configuration. More...
|
| |
|
| static void | GPDMA_EnableChannelInterrupts (GPDMA_Type *base, uint8_t channel) |
| | Enables the interrupt source for the GPDMA transfer. More...
|
| |
| static void | GPDMA_DisableChannelInterrupts (GPDMA_Type *base, uint8_t channel) |
| | Disables the interrupt source for the GPDMA transfer. More...
|
| |
| static void | GPDMA_SetChannelSourcePeripheral (GPDMA_Type *base, uint8_t channel, gpdma_request_source_t srcPeripheral) |
| | Set the GPDMA request source peripheral. More...
|
| |
| static void | GPDMA_SetChannelDestinationPeripheral (GPDMA_Type *base, uint8_t channel, gpdma_request_source_t destPeripheral) |
| | Set the GPDMA request destination peripheral. More...
|
| |
| void | GPDMA_EnableChannel (GPDMA_Type *base, uint8_t channel, bool enable) |
| | Enable or Disable the GPDMA Channel. More...
|
| |
| void | GPDMA_StopChannel (GPDMA_Type *base, uint8_t channel) |
| | Stop a stream GPDMA transfer. More...
|
| |
| status_t | GPDMA_CheckChannelInterrupts (GPDMA_Type *base, uint8_t channel) |
| | The GPDMA stream interrupt status checking. More...
|
| |
| bool | GPDMA_GetChannelStatus (GPDMA_Type *base, uint8_t channel, gpdma_status_t flag) |
| | Read the status from different registers according to the flag. More...
|
| |
| void | GPDMA_ClearChannelStatus (GPDMA_Type *base, uint8_t channel, gpdma_status_clear_t flag) |
| | Clear the Interrupt status from different registers according to the flag. More...
|
| |
| status_t | GPDMA_PrepareDescriptor (gpdma_descriptor_t *descriptor, void *srcAddr, gpdma_burst_size_t srcBurstSize, gpdma_transfer_width_t srcTransferWidth, void *destAddr, gpdma_burst_size_t destBurstSize, gpdma_transfer_width_t destTransferWidth, uint32_t totalBytes, gpdma_transfer_type_t transferType, uint32_t linkListItem) |
| | Prepares the GPDMA transfer descriptor. More...
|
| |
| void | GPDMA_PrepareTransferConfig (gpdma_transfer_config_t *config, void *srcAddr, gpdma_burst_size_t srcBurstSize, gpdma_transfer_width_t srcTransferWidth, void *destAddr, gpdma_burst_size_t destBurstSize, gpdma_transfer_width_t destTransferWidth, uint32_t totalBytes, gpdma_transfer_type_t transferType, uint32_t linkListItem) |
| | Prepares the GPDMA transfer structure configurations. More...
|
| |
| status_t | GPDMA_SetTransferConfig (GPDMA_Type *base, uint8_t channel, const gpdma_transfer_config_t *config) |
| | Configures the GPDMA transfer attribute. More...
|
| |
| uint8_t | GPDMA_GetFreeChannel (GPDMA_Type *base) |
| | Get a free GPDMA channel. More...
|
| |
| struct gpdma_transfer_config_t |
| uint32_t gpdma_transfer_config_t::srcAddr |
| uint32_t gpdma_transfer_config_t::destAddr |
| uint32_t gpdma_transfer_config_t::linkListItem |
| struct gpdma_descriptor_t |
Data Fields |
|
uint32_t | srcAddr |
| | Source address.
|
| |
|
uint32_t | destAddr |
| | Destination address.
|
| |
| uint32_t | lli |
| | Link to next descriptor. More...
|
| |
| uint32_t | control |
| | Control word that has transfer size, trasnfer type etc. More...
|
| |
| uint32_t gpdma_descriptor_t::lli |
| uint32_t gpdma_descriptor_t::control |
| void* gpdma_handle_t::userData |
| uint8_t gpdma_handle_t::channel |
| GPDMA_Type* gpdma_handle_t::base |
| #define FSL_GPDMA_DRIVER_VERSION (MAKE_VERSION(2, 0, 1)) |
| typedef void(* gpdma_callback)(struct _gpdma_handle *handle, void *userData, uint32_t status) |
This callback function is called in the GPDMA interrupt handle. Run into callback function means the transfer users need is done.
- Parameters
-
| handle | GPDMA handle pointer, users shall not touch the values inside. |
| userData | The callback user parameter pointer. Users can use this parameter to involve things users need to change in GPDMA callback function. |
| status | GPDMA trasnfer status |
| Enumerator |
|---|
| kGPDMA_StatusClearInterruptTerminalCountRequest |
GPDMA Interrupt Terminal Count Request Clear.
|
| kGPDMA_StatusClearInterruptError |
GPDMA Interrupt Error Clear.
|
| Enumerator |
|---|
| kGPDMA_StatusInterrupt |
GPDMA Interrupt Status.
|
| kGPDMA_StatusInterruptTerminalCountRequest |
GPDMA Interrupt Terminal Count Request Status.
|
| kGPDMA_StatusInterruptError |
GPDMA Interrupt Error Status.
|
| kGPDMA_StatusRawInterruptTerminalCount |
GPDMA Raw Interrupt Terminal Count Status.
|
| kGPDMA_StatusRawErrorInterrupt |
GPDMA Raw Error Interrupt Status.
|
| kGPDMA_StatusEnabledChannel |
GPDMA Enabled Channel Status.
|
| Enumerator |
|---|
| kGPDMA_TransferM2MControllerDma |
Memory to memory, GPDMA control.
|
| kGPDMA_TransferM2PControllerDma |
Memory to peripheral, GPDMA control.
|
| kGPDMA_TransferP2MControllerDma |
Peripheral to memory, GPDMA control.
|
| kGPDMA_TransferP2PControllerDma |
Source peripheral to destination peripheral, GPDMA control.
|
| kGPDMA_TransferP2PControllerDestPeripheral |
Source peripheral to destination peripheral, destination peripheral control.
|
| kGPDMA_TransferM2PControllerPeripheral |
Memory to peripheral, peripheral control.
|
| kGPDMA_TransferP2MControllerPeripheral |
Peripheral to memory, peripheral control.
|
| kGPDMA_TransferP2PControllerSrcPeripheral |
Source peripheral to destination peripheral, source peripheral control.
|
| Enumerator |
|---|
| kGPDMA_TransferWidth1Bytes |
Source/Destination data transfer width is 1 byte every time.
|
| kGPDMA_TransferWidth2Bytes |
Source/Destination data transfer width is 2 bytes every time.
|
| kGPDMA_TransferWidth4Bytes |
Source/Destination data transfer width is 4 bytes every time.
|
| Enumerator |
|---|
| kGPDMA_BurstSize1 |
Source/Destination data burst size is 1 every time.
|
| kGPDMA_BurstSize4 |
Source/Destination data burst size is 4 every time.
|
| kGPDMA_BurstSize8 |
Source/Destination data burst size is 8 every time.
|
| kGPDMA_BurstSize16 |
Source/Destination data burst size is 16 every time.
|
| kGPDMA_BurstSize32 |
Source/Destination data burst size is 32 every time.
|
| kGPDMA_BurstSize64 |
Source/Destination data burst size is 64 every time.
|
| kGPDMA_BurstSize128 |
Source/Destination data burst size is 128 every time.
|
| kGPDMA_BurstSize256 |
Source/Destination data burst size is 256 every time.
|
| status_t GPDMA_Init |
( |
GPDMA_Type * |
base | ) |
|
- Parameters
-
| base | GPDMA peripheral base address. |
- Return values
-
| kStatus_Success | Initialiation succeed. |
| kStatus_Timeout | Timeout during initialization. |
| void GPDMA_Deinit |
( |
GPDMA_Type * |
base | ) |
|
- Parameters
-
| base | GPDMA peripheral base address. |
| static void GPDMA_EnableChannelInterrupts |
( |
GPDMA_Type * |
base, |
|
|
uint8_t |
channel |
|
) |
| |
|
inlinestatic |
- Parameters
-
| base | Base address of GPDMA module. |
| channel | The GPDMA channel (0 to 7). |
| static void GPDMA_DisableChannelInterrupts |
( |
GPDMA_Type * |
base, |
|
|
uint8_t |
channel |
|
) |
| |
|
inlinestatic |
- Parameters
-
| base | Base address of GPDMA module. |
| channel | The GPDMA channel (0 to 7). |
| static void GPDMA_SetChannelSourcePeripheral |
( |
GPDMA_Type * |
base, |
|
|
uint8_t |
channel, |
|
|
gpdma_request_source_t |
srcPeripheral |
|
) |
| |
|
inlinestatic |
- Parameters
-
| base | Base address of GPDMA module. |
| channel | The GPDMA channel (0 to 7). |
| srcPeripheral | GPDMA hardware service request source for the channel. |
| static void GPDMA_SetChannelDestinationPeripheral |
( |
GPDMA_Type * |
base, |
|
|
uint8_t |
channel, |
|
|
gpdma_request_source_t |
destPeripheral |
|
) |
| |
|
inlinestatic |
- Parameters
-
| base | Base address of GPDMA module. |
| channel | The GPDMA channel (0 to 7). |
| destPeripheral | GPDMA hardware service request source for the channel. |
| void GPDMA_EnableChannel |
( |
GPDMA_Type * |
base, |
|
|
uint8_t |
channel, |
|
|
bool |
enable |
|
) |
| |
- Parameters
-
| base | Base address of GPDMA module. |
| channel | The GPDMA channel (0 to 7). |
| enable | true to enable GPDMA or false to disable GPDMA channel. |
| void GPDMA_StopChannel |
( |
GPDMA_Type * |
base, |
|
|
uint8_t |
channel |
|
) |
| |
- Parameters
-
| base | Base address of GPDMA module. |
| channel | The GPDMA channel (0 to 7). |
| status_t GPDMA_CheckChannelInterrupts |
( |
GPDMA_Type * |
base, |
|
|
uint8_t |
channel |
|
) |
| |
- Parameters
-
| base | Base address of GPDMA module. |
| channel | The GPDMA channel (0 to 7). |
- Returns
- status: kStatus_Success It means succeed. kStatus_Fail It means failed.
| bool GPDMA_GetChannelStatus |
( |
GPDMA_Type * |
base, |
|
|
uint8_t |
channel, |
|
|
gpdma_status_t |
flag |
|
) |
| |
- Parameters
-
| base | Base address of GPDMA module. |
| channel | The GPDMA channel (0 to 7). |
| flag | The GPDMA interrupt flag. |
- Returns
- status: true It means flag is set. false It means flag is not set.
- Parameters
-
| base | Base address of GPDMA module. |
| channel | The GPDMA channel (0 to 7). |
| flag | The GPDMA interrupt flag. |
- Parameters
-
| descriptor | The transfer descriptor. |
| srcAddr | GPDMA transfer source address. |
| srcBurstSize | source address offset. |
| srcTransferWidth | Source data trasnfer size every time. |
| destAddr | GPDMA transfer destination address. |
| destBurstSize | destination address offset. |
| destTransferWidth | Destination data trasnfer size every time. |
| totalBytes | GPDMA transfer bytes to be transferred. |
| transferType | GPDMA transfer type. |
| linkListItem | Pointer to next transfer descriptor. |
| retval | kStatus_Success Prepared successfully. |
| retval | kStatus_InvalidArgument Failed because invalid argument. |
- Parameters
-
| config | The user configuration structure of type. |
| srcAddr | GPDMA transfer source address. |
| srcBurstSize | source address offset. |
| srcTransferWidth | Source data trasnfer size every time. |
| destAddr | GPDMA transfer destination address. |
| destBurstSize | destination address offset. |
| destTransferWidth | Destination data trasnfer size every time. |
| totalBytes | GPDMA transfer bytes to be transferred. |
| transferType | GPDMA transfer type. |
| linkListItem | Pointer to next transfer descriptor. |
- Parameters
-
| base | GPDMA peripheral base address. |
| channel | The GPDMA channel (0 to 7). |
| config | Pointer to GPDMA transfer configuration structure. |
- Return values
-
| kStatus_Busy | The channel is busy. |
| kStatus_Success | Set succeed. |
| uint8_t GPDMA_GetFreeChannel |
( |
GPDMA_Type * |
base | ) |
|
- Parameters
-
| base | Base address of GPDMA module. |
- Returns
- The channel number which is selected in case of success (0 to 7).
-
Maximum channel number (8) in case channel is not available.
| void GPDMA_CreateHandle |
( |
gpdma_handle_t * |
handle, |
|
|
GPDMA_Type * |
base, |
|
|
uint8_t |
channel |
|
) |
| |
- Parameters
-
| handle | GPDMA handle pointer. The GPDMA handle stores callback function and parameters. |
| base | GPDMA peripheral base address. |
| channel | The GPDMA channel (0 to 7). |
- Parameters
-
| handle | GPDMA handle pointer. |
| callback | GPDMA callback function pointer. |
| userData | A parameter for the callback function. |
- Parameters
-
| handle | GPDMA handle pointer. |
| config | Pointer to GPDMA transfer configuration structure. |
- Return values
-
| kStatus_Busy | The channel is busy. |
| kStatus_Success | Set succeed. |
This function aborts GPDMA transfer specified by handle.
handle GPDMA handle pointer.
User can call this function after GPDMA_SubmitTransfer.
- Parameters
-
| handle | GPDMA handle pointer. |
| void GPDMA_HandleIRQ |
( |
GPDMA_Type * |
base | ) |
|
- Parameters
-
| base | Base address of GPDMA module. |