RTEMS 7.0-rc1
Loading...
Searching...
No Matches
Data Structures | Typedefs | Functions
dma-allocator.c File Reference

This source file contains the implementation of the DMA allocator. More...

#include <bsp.h>
#include <bsp/dma.h>
#include <bsp/fatal.h>
#include <inttypes.h>
#include <rtems/bspIo.h>
#include <rtems/sysinit.h>
#include <stdio.h>
#include <stdlib.h>
#include <stm32h7/hal.h>

Data Structures

struct  stm32h7_dma_context
 

Typedefs

typedef struct stm32h7_dma_context stm32h7_dma_context
 

Functions

DMA_HandleTypeDef * stm32h7_dma_alloc (void *parent, uint32_t request_type, uint32_t direction, uint32_t priority)
 Acquire a DMA channel.
 
void stm32h7_dma_free (DMA_HandleTypeDef *dma_channel)
 Release a DMA channel.
 

Detailed Description

This source file contains the implementation of the DMA allocator.

Function Documentation

◆ stm32h7_dma_alloc()

DMA_HandleTypeDef * stm32h7_dma_alloc ( void *  parent,
uint32_t  request_type,
uint32_t  direction,
uint32_t  priority 
)

Acquire a DMA channel.

This function returns a DMA channel that can be used for memory-to-memory, memory-to-peripheral, or peripheral-to-memory transactions. The returned DMA channel is reserved for exclusive use until it is released using stm32h7_dma_free().

Parameters
parentA pointer to the parent structure that will temporarily own the allocated DMA channel. This should be a *_HandleTypeDef pointer such as SPI_HandleTypeDef
request_typeA DMA_Request_selection value defining the endpoints of the transfer
directionA DMA_Data_transfer_direction value defining the direction of the transfer
priorityA DMA_Priority_level value defining the priority of the transfer
Returns
A configured DMA channel handle pointer or NULL or error

◆ stm32h7_dma_free()

void stm32h7_dma_free ( DMA_HandleTypeDef *  dma_channel)

Release a DMA channel.

This function tears down and releases a DMA channel allocated using stm32h7_dma_alloc().

Parameters
dma_channelA DMA channel handle pointer