ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
Loading...
Searching...
No Matches
ra8_dma.h
Go to the documentation of this file.
1
45
46#pragma once
47
48#ifdef __cplusplus
49extern "C" {
50#endif
51
52#include <stdint.h>
53
54#include "ra8_dmac.h"
55#include "ra8_elc_regs.h"
56#include "ra8_err.h"
57
58/* =============================================================================
59 * Types
60 * =============================================================================
61 */
62
67typedef enum : uint8_t {
70
75typedef enum : uint8_t {
78
88typedef void (*ra8_dma_complete_fn_t)(void* ctx);
89
112/* cppcheck cannot see tests/ so it flags every ra8_dma_request_t
113 * field as unused; the fields are read in ra8_dma.c and in
114 * tests/mocks/src/ra8_fake_dma.c. */
126
127/* =============================================================================
128 * Lifecycle
129 * =============================================================================
130 */
131
155[[nodiscard]] ra8_err_t ra8_dma_init(void);
156
175[[nodiscard]] ra8_err_t ra8_dma_deinit(void);
176
177/* =============================================================================
178 * Request / release
179 * =============================================================================
180 */
181
211[[nodiscard]] ra8_err_t ra8_dma_request(const ra8_dma_request_t* req, uint8_t* out_channel);
212
233[[nodiscard]] ra8_err_t ra8_dma_release(uint8_t channel);
234
256[[nodiscard]] ra8_err_t ra8_dma_channel_is_busy(uint8_t channel, bool* out_busy);
257
258#ifdef RA8_OFF_TARGET
284const ra8_dma_request_t* ra8_dma_fake_peek_request(uint8_t channel);
285#endif
286
310void ra8_dma_dispatch_complete(uint8_t channel);
311
312#ifdef __cplusplus
313}
314#endif
ra8_err_t ra8_dma_channel_is_busy(uint8_t channel, bool *out_busy)
Query the allocation state of a channel.
Definition ra8_dma.c:428
ra8_dma_invalid_channel_t
Sentinel for "no channel allocated".
Definition ra8_dma.h:75
@ k_ra8_dma_channel_none
RA8 DMA channel none.
Definition ra8_dma.h:76
ra8_err_t ra8_dma_init(void)
Initialise the DMA substrate.
Definition ra8_dma.c:215
ra8_err_t ra8_dma_release(uint8_t channel)
Stop a channel and return it to the free pool.
Definition ra8_dma.c:370
ra8_err_t ra8_dma_deinit(void)
Release the DMA substrate.
Definition ra8_dma.c:257
void ra8_dma_dispatch_complete(uint8_t channel)
Dispatch a transfer-end completion callback for one channel.
Definition ra8_dma.c:458
ra8_err_t ra8_dma_request(const ra8_dma_request_t *req, uint8_t *out_channel)
Allocate a DMAC channel, programme it, and start the trigger wiring.
Definition ra8_dma.c:308
ra8_dma_channel_count_t
Number of channels the DMAC backend exposes.
Definition ra8_dma.h:67
@ k_ra8_dma_channel_count
RA8 DMA channel count.
Definition ra8_dma.h:68
void(* ra8_dma_complete_fn_t)(void *ctx)
Caller-supplied completion callback.
Definition ra8_dma.h:88
8-channel DMA controller (DMAC0) driver
ra8_dmac_width_t
Transfer element width.
Definition ra8_dmac.h:50
Event Link Controller (ELC) register layout for the Renesas RA8D2.
ra8_elc_event_t
Partial list of ELC events (populate as drivers need them).
Error Code Definitions for ra8-firmware.
ra8_err_codes_t ra8_err_t
Canonical error-return type used by every ra8-firmware API.
Definition ra8_err.h:546
Descriptor for a single DMA transfer.
Definition ra8_dma.h:115
ra8_dma_complete_fn_t on_complete
On complete.
Definition ra8_dma.h:123
uintptr_t dst_addr
Dst address.
Definition ra8_dma.h:117
bool dst_inc
Dst inc.
Definition ra8_dma.h:121
ra8_dmac_width_t width
Width.
Definition ra8_dma.h:119
bool src_inc
Src inc.
Definition ra8_dma.h:120
uint16_t count
Count.
Definition ra8_dma.h:118
uintptr_t src_addr
Src address.
Definition ra8_dma.h:116
void * ctx
Ctx.
Definition ra8_dma.h:124
ra8_elc_event_t trigger
Trigger.
Definition ra8_dma.h:122