GPDMA MCAL Module
Supported STM32 families: H5 · U5
Not supported: F4, G4, H7, L4
Overview
The Gpdma (General-Purpose DMA) module in MCAL provides an abstraction for configuring and managing DMA transfers on STM32 microcontrollers. It exposes public types and configuration structures for flexible DMA usage in embedded applications.
File Structure
Gpdma_Port.h— Declares the public API functions for the Gpdma module.Gpdma_Types.h— Defines public types, enums, and structures used by the Gpdma API.Gpdma.c— Implements the Gpdma module functionality.
Public API
Public Functions
All public functions are declared in Gpdma_Port.h. These functions provide access to DMA configuration, transfer control, and status queries. Example functions may include:
Gpdma_Init(const gpdma_ConfigStruct_t* config)Gpdma_StartTransfer(gpdma_PeriphId_t periph, gpdma_ChannelId_t channel, const gpdma_TransferConfig_t* xferConfig)Gpdma_StopTransfer(gpdma_PeriphId_t periph, gpdma_ChannelId_t channel)Gpdma_GetTransferState(gpdma_PeriphId_t periph, gpdma_ChannelId_t channel)
Refer to Gpdma_Port.h for the complete list and documentation of available functions.
Public Types
All public types used by the Gpdma API are defined in Gpdma_Types.h. These include:
- Enumerations for DMA peripherals, channels, directions, priorities, events, and errors (e.g.,
gpdma_PeriphId_t,gpdma_ChannelId_t,gpdma_Direction_t) - Structures for configuration (e.g.,
gpdma_TransferConfig_t,gpdma_ConfigStruct_t) - Callback function pointer types for interrupts
Refer to Gpdma_Types.h for detailed type definitions and descriptions.
Usage Example
#include "Gpdma_Port.h"
gpdmaTransferConfigt xferConfig = { // Initialize transfer configuration fields };
gpdmaConfigStructt dmaConfig = { .PeriphId = GPDMAPERIPH1, .ChannelId = GPDMACHANNEL0, .TransferConfig = &xferConfig, .TransfersCount = 1, // Other fields as needed };
int main(void) { GpdmaInit(&dmaConfig); GpdmaStartTransfer(GPDMAPERIPH1, GPDMACHANNEL0, &xferConfig); // … }
🛠 CMake Integration
- Include
Gpdma_Port.hin your project. - Link against the Gpdma module implementation files.
- Configure the module as needed for your hardware.
License
This project is licensed under the Creative Commons Attribution–NonCommercial 4.0 International (CC BY-NC 4.0).
You are free to use, modify, and share this work for non-commercial purposes, provided appropriate credit is given.
See LICENSE.md for full terms or visit creativecommons.org/licenses/by-nc/4.0.
Authors
- Mr.Nobody — embedbits.com
Contributions are welcome! Please open a pull request.