quasar_dma.h

This module sets up DMA transactions and provides DMA mode read/write functions.

Copyright

Copyright (C) 2026 SPARK Microsystems International Inc. All rights reserved.

License

This source code is proprietary and subject to the SPARK Microsystems Software EULA found in this package in file EULA.txt.

Author

SPARK FW Team.

Defines

QUASAR_DMA_SELECTION_GPDMA1_CHANNEL8_OFFSET 72
QUASAR_DMA_GET_SELECTED_IRQ(dma_channel) ((IRQn_Type)(((dma_channel) <= QUASAR_DMA_SELECTION_GPDMA1_CHANNEL7

) ? \

(GPDMA1_Channel0_IRQn + (dma_channel)) :              \

(QUASAR_DMA_SELECTION_GPDMA1_CHANNEL8_OFFSET + (dma_channel))))


Typedefs

typedef enum quasar_dma_selection quasar_dma_selection_t

List of all available channel of the general purpose DMA 1 instances.

typedef enum quasar_dma_peripheral quasar_dma_peripheral_t

List of all available peripherals that can be used as source or/and destination for DMA transfers.

typedef struct quasar_dma_config quasar_dma_config_t

Quasar BSP DMA configuration.

Enums

enum quasar_dma_selection

List of all available channel of the general purpose DMA 1 instances.

Values:

enumerator QUASAR_DMA_SELECTION_GPDMA1_CHANNEL0 = 0

Select channel 0 of the general purpose DMA 1 instance.

enumerator QUASAR_DMA_SELECTION_GPDMA1_CHANNEL1 = 1

Select channel 1 of the general purpose DMA 1 instance.

enumerator QUASAR_DMA_SELECTION_GPDMA1_CHANNEL2 = 2

Select channel 2 of the general purpose DMA 1 instance.

enumerator QUASAR_DMA_SELECTION_GPDMA1_CHANNEL3 = 3

Select channel 3 of the general purpose DMA 1 instance.

enumerator QUASAR_DMA_SELECTION_GPDMA1_CHANNEL4 = 4

Select channel 4 of the general purpose DMA 1 instance.

enumerator QUASAR_DMA_SELECTION_GPDMA1_CHANNEL5 = 5

Select channel 5 of the general purpose DMA 1 instance.

enumerator QUASAR_DMA_SELECTION_GPDMA1_CHANNEL6 = 6

Select channel 6 of the general purpose DMA 1 instance.

enumerator QUASAR_DMA_SELECTION_GPDMA1_CHANNEL7 = 7

Select channel 7 of the general purpose DMA 1 instance.

enumerator QUASAR_DMA_SELECTION_GPDMA1_CHANNEL8 = 8

Select channel 8 of the general purpose DMA 1 instance.

enumerator QUASAR_DMA_SELECTION_GPDMA1_CHANNEL9 = 9

Select channel 9 of the general purpose DMA 1 instance.

enumerator QUASAR_DMA_SELECTION_GPDMA1_CHANNEL10 = 10

Select channel 10 of the general purpose DMA 1 instance.

enumerator QUASAR_DMA_SELECTION_GPDMA1_CHANNEL11 = 11

Select channel 11 of the general purpose DMA 1 instance.

enumerator QUASAR_DMA_SELECTION_GPDMA1_CHANNEL12 = 12

Select channel 12 of the general purpose DMA 1 instance.

enumerator QUASAR_DMA_SELECTION_GPDMA1_CHANNEL13 = 13

Select channel 13 of the general purpose DMA 1 instance.

enumerator QUASAR_DMA_SELECTION_GPDMA1_CHANNEL14 = 14

Select channel 14 of the general purpose DMA 1 instance.

enumerator QUASAR_DMA_SELECTION_GPDMA1_CHANNEL15 = 15

Select channel 15 of the general purpose DMA 1 instance.

enumerator QUASAR_DMA_SELECTION_NOT_USED = 16

Do not select any channel general purpose DMA 1 instance if only tx or rx is used.

enum quasar_dma_peripheral

List of all available peripherals that can be used as source or/and destination for DMA transfers.

Values:

enumerator QUASAR_DMA_PERIPHERAL_UART = 0

Select the UART peripheral to be used for the DMA transfer.

enumerator QUASAR_DMA_PERIPHERAL_SPI

Select the SPI peripheral to be used for the DMA transfer.

enumerator QUASAR_DMA_PERIPHERAL_QSPI

Select the QSPI peripheral to be used for the DMA transfer.

Functions

void quasar_dma_init(quasar_dma_config_t dma_config, quasar_bsp_status_t *err)

Initializes the DMA to operate in either peripheral to memory or memory to peripheral mode.

Note

Currently, only peripherals of type UART are supported with this DMA configuration.

Parameters:
  • dma_config[in] Configuration of the DMA peripheral.

  • err[out] Pointer to store error status.

void quasar_dma_deinit(quasar_dma_config_t dma_config, quasar_bsp_status_t *err)

Deinitializes the DMA, disabling its operation and interrupt handling.

Parameters:
  • dma_config[in] Configuration of the DMA peripheral.

  • err[out] Pointer to store error status.

void quasar_dma_qspi_populate_handle(quasar_dma_config_t dma_config)

Populate both TX and RX DMA handle.

Note

QSPI DMA handle are populated at init only so that there is less processing needed at runtime since DMA is initialized at every transfer.

Parameters:

dma_config[in] Configuration of the DMA peripheral.

void quasar_dma_enable_irq(quasar_dma_selection_t dma_selection)

Enable the DMA’s global interrupt.

Parameters:

dma_selection[in] Selected DMA.

void quasar_dma_disable_irq(quasar_dma_selection_t dma_selection)

Disable the DMA’s global interrupt.

Parameters:

dma_selection[in] Selected DMA.

void quasar_dma_set_channel0_dma_callback(void (*irq_callback)(void))

This function sets the function callback for the GPDMA1 Channel 0 interrupt.

Parameters:

irq_callback[in] External interrupt callback function pointer.

void quasar_dma_set_channel1_dma_callback(void (*irq_callback)(void))

This function sets the function callback for the GPDMA1 Channel 1 interrupt.

Parameters:

irq_callback[in] External interrupt callback function pointer.

void quasar_dma_set_channel2_dma_callback(void (*irq_callback)(void))

This function sets the function callback for the GPDMA1 Channel 2 interrupt.

Parameters:

irq_callback[in] External interrupt callback function pointer.

void quasar_dma_set_channel3_dma_callback(void (*irq_callback)(void))

This function sets the function callback for the GPDMA1 Channel 3 interrupt.

Parameters:

irq_callback[in] External interrupt callback function pointer.

void quasar_dma_set_channel4_dma_callback(void (*irq_callback)(void))

This function sets the function callback for the GPDMA1 Channel 4 interrupt.

Parameters:

irq_callback[in] External interrupt callback function pointer.

void quasar_dma_set_channel5_dma_callback(void (*irq_callback)(void))

This function sets the function callback for the GPDMA1 Channel 5 interrupt.

Parameters:

irq_callback[in] External interrupt callback function pointer.

void quasar_dma_set_channel6_dma_callback(void (*irq_callback)(void))

This function sets the function callback for the GPDMA1 Channel 6 interrupt.

Parameters:

irq_callback[in] External interrupt callback function pointer.

void quasar_dma_set_channel7_dma_callback(void (*irq_callback)(void))

This function sets the function callback for the GPDMA1 Channel 7 interrupt.

Parameters:

irq_callback[in] External interrupt callback function pointer.

void quasar_dma_set_channel8_dma_callback(void (*irq_callback)(void))

This function sets the function callback for the GPDMA1 Channel 8 interrupt.

Parameters:

irq_callback[in] External interrupt callback function pointer.

void quasar_dma_set_channel9_dma_callback(void (*irq_callback)(void))

This function sets the function callback for the GPDMA1 Channel 9 interrupt.

Parameters:

irq_callback[in] External interrupt callback function pointer.

void quasar_dma_set_channel10_dma_callback(void (*irq_callback)(void))

This function sets the function callback for the GPDMA1 Channel 10 interrupt.

Parameters:

irq_callback[in] External interrupt callback function pointer.

void quasar_dma_set_channel11_dma_callback(void (*irq_callback)(void))

This function sets the function callback for the GPDMA1 Channel 11 interrupt.

Parameters:

irq_callback[in] External interrupt callback function pointer.

void quasar_dma_set_channel12_dma_callback(void (*irq_callback)(void))

This function sets the function callback for the GPDMA1 Channel 12 interrupt.

Parameters:

irq_callback[in] External interrupt callback function pointer.

void quasar_dma_set_channel13_dma_callback(void (*irq_callback)(void))

This function sets the function callback for the GPDMA1 Channel 13 interrupt.

Parameters:

irq_callback[in] External interrupt callback function pointer.

void quasar_dma_set_channel14_dma_callback(void (*irq_callback)(void))

This function sets the function callback for the GPDMA1 Channel 14 interrupt.

Parameters:

irq_callback[in] External interrupt callback function pointer.

void quasar_dma_set_channel15_dma_callback(void (*irq_callback)(void))

This function sets the function callback for the GPDMA1 Channel 15 interrupt.

Parameters:

irq_callback[in] External interrupt callback function pointer.

struct quasar_dma_config
#include <quasar_dma.h>

Quasar BSP DMA configuration.

Public Members

quasar_dma_selection_t dma_selection_tx

Selected DMA instance for transmission.

quasar_dma_selection_t dma_selection_rx

Selected DMA instance for reception.

quasar_dma_peripheral_t dma_peripheral

Selected DMA peripheral (This driver configure the DMA transfer mode as memory-to-peripheral vice-versa).

uint8_t peripheral_selection

Selected peripheral instance.

quasar_irq_priority_t irq_priority

Available IRQ priority.