RTEMS 7.0-rc1
Loading...
Searching...
No Matches
Enumerations | Functions
raspberrypi-dma.h File Reference

Raspberry Pi specific DMA definitions. More...

#include <bsp/raspberrypi.h>
#include <bsp/rpi-gpio.h>
#include <bsp/utility.h>
#include <rtems/malloc.h>
#include <rtems/rtems/cache.h>
#include <rtems/score/basedefs.h>
#include <rtems/score/cpu.h>
#include <stdlib.h>
#include <string.h>

Go to the source code of this file.

Enumerations

enum  rpi_dma_channel {
  DMA_CHANNEL_0 , DMA_CHANNEL_1 , DMA_CHANNEL_2 , DMA_CHANNEL_3 ,
  DMA_CHANNEL_4 , DMA_CHANNEL_5 , DMA_CHANNEL_6 , DMA_LITE_CHANNEL_7 ,
  DMA_LITE_CHANNEL_8 , DMA_LITE_CHANNEL_9 , DMA_LITE_CHANNEL_10 , DMA4_CHANNEL_11 ,
  DMA4_CHANNEL_12 , DMA4_CHANNEL_13 , DMA4_CHANNEL_14
}
 DMA channel identifiers for BCM2711 (0–6 full, 7–10 lite, 11–14 DMA4).
 

Functions

rtems_status_code rpi_dma_start_transfer (rpi_dma_channel channel)
 Start a previously initialized DMA transfer on channel.
 
rtems_status_code rpi_dma_wait (rpi_dma_channel channel)
 Block until the current DMA transfer on channel completes.
 
rtems_status_code rpi_dma_mem_to_mem_init (rpi_dma_channel channel, void *source_address, void *destination_address, uint32_t transfer_length)
 Initialize a memcpy-style DMA transfer from source_address to destination_address of transfer_length bytes on channel.
 

Detailed Description

Raspberry Pi specific DMA definitions.

Function Documentation

◆ rpi_dma_mem_to_mem_init()

rtems_status_code rpi_dma_mem_to_mem_init ( rpi_dma_channel  channel,
void *  source_address,
void *  destination_address,
uint32_t  transfer_length 
)

Initialize a memcpy-style DMA transfer from source_address to destination_address of transfer_length bytes on channel.

Allocates and prepares the channel-specific control block, performs required cache maintenance (flush control block and source; invalidate destination), issues CS reset/abort, and writes CONBLK_AD (with DMA4 address packing via DMA4_AD_SHIFT). This function does not start the transfer; call rpi_dma_start_transfer() and then rpi_dma_wait().

Parameters
channelDMA channel to use (0–6 noarmal DMA, 7–10 lite, 11–14 DMA4).
source_addressSource buffer (must be CPU_CACHE_LINE_BYTES aligned).
destination_addressDestination buffer (must be CPU_CACHE_LINE_BYTES aligned).
transfer_lengthNumber of bytes to copy.
Return values
RTEMS_SUCCESSFULon success.
RTEMS_INVALID_NUMBERif channel is invalid/unsupported or has no base address.
RTEMS_INVALID_ADDRESSif source_address or destination_address are misaligned.
RTEMS_NO_MEMORYif control block allocation failed.

◆ rpi_dma_start_transfer()

rtems_status_code rpi_dma_start_transfer ( rpi_dma_channel  channel)

Start a previously initialized DMA transfer on channel.

Expects the channel's CONBLK_AD to point to a valid control block. Sets ACTIVE and required priorities.

Parameters
channelDMA channel to start.
Return values
RTEMS_SUCCESSFULon success.
RTEMS_INVALID_NUMBERif channel is invalid.

◆ rpi_dma_wait()

rtems_status_code rpi_dma_wait ( rpi_dma_channel  channel)

Block until the current DMA transfer on channel completes.

Busy-waits for ACTIVE to clear and frees the control block previously programmed into CONBLK_AD (including DMA4 address unshifting). Does not invalidate/flush user buffers beyond setup done by the init helpers.

Parameters
channelDMA channel to wait on.
Return values
RTEMS_SUCCESSFULon success.
RTEMS_INVALID_NUMBERif channel is invalid.
RTEMS_UNSATISFIEDif the channel reports an error.