ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
Loading...
Searching...
No Matches
ra8_dmac.h
Go to the documentation of this file.
1
30
31#pragma once
32
33#ifdef __cplusplus
34extern "C" {
35#endif
36
37#include <stdint.h>
38
39#include "ra8_err.h"
40
55
73
87
118/* cppcheck reads ra8_dmac.h without seeing tests/mocks/src/ra8_fake_dma.c or the
119 * DMAC register accesses in libs/ra8_hal/src/ra8_dmac.c, so it flags
120 * every field as unused even though the driver reads all of them. */
134
168[[nodiscard]] ra8_err_t ra8_dmac_start(uint8_t channel, const ra8_dmac_config_t* cfg);
169
184[[nodiscard]] ra8_err_t ra8_dmac_stop(uint8_t channel);
185
202
212typedef void (*ra8_dmac_callback_fn_t)(void* ctx);
213
245[[nodiscard]] ra8_err_t ra8_dmac_start_repeat(uint8_t channel, const ra8_dmac_config_t* cfg);
246
278[[nodiscard]] ra8_err_t ra8_dmac_start_block(uint8_t channel, const ra8_dmac_config_t* cfg);
279
308[[nodiscard]] ra8_err_t ra8_dmac_set_address_mode(uint8_t channel,
309 ra8_dmac_addr_mode_t src_mode,
310 ra8_dmac_addr_mode_t dest_mode);
311
335[[nodiscard]] ra8_err_t
337
361[[nodiscard]] ra8_err_t
362ra8_dmac_attach_callback(uint8_t channel, ra8_dmac_callback_fn_t fn, void* ctx);
363
385void ra8_dmac_dispatch(uint8_t channel);
386
406void ra8_dmac_dispatch_half(uint8_t channel);
407
444[[nodiscard]] ra8_err_t ra8_dmac_software_trigger(uint8_t channel);
445
476[[nodiscard]] ra8_err_t ra8_dmac_is_active(uint8_t channel, bool* out_active);
477
514[[nodiscard]] ra8_err_t ra8_dmac_wait_idle(uint8_t channel, uint32_t poll_limit);
515
516#ifdef __cplusplus
517}
518#endif
void ra8_dmac_dispatch_half(uint8_t channel)
Fire the per-channel half-complete callback (DMINT.RPTIE path).
Definition ra8_dmac.c:548
void(* ra8_dmac_callback_fn_t)(void *ctx)
Per-channel DMAC completion / half-complete callback signature.
Definition ra8_dmac.h:212
ra8_dmac_mode_t
Transfer mode select.
Definition ra8_dmac.h:67
@ k_ra8_dmac_mode_repeat
DMTMD.MD = 01b.
Definition ra8_dmac.h:69
@ k_ra8_dmac_mode_repeat_block
DMTMD.MD = 11b.
Definition ra8_dmac.h:71
@ k_ra8_dmac_mode_normal
DMTMD.MD = 00b.
Definition ra8_dmac.h:68
@ k_ra8_dmac_mode_block
DMTMD.MD = 10b.
Definition ra8_dmac.h:70
ra8_dmac_repeat_area_t
Selects which side is the repeat / block area (DMTMD.DTS).
Definition ra8_dmac.h:82
@ k_ra8_dmac_repeat_area_dest
DTS = 00b.
Definition ra8_dmac.h:83
@ k_ra8_dmac_repeat_area_none
DTS = 10b.
Definition ra8_dmac.h:85
@ k_ra8_dmac_repeat_area_src
DTS = 01b.
Definition ra8_dmac.h:84
void ra8_dmac_dispatch(uint8_t channel)
Fire the per-channel completion callback (DMINT.DTIE path).
Definition ra8_dmac.c:535
ra8_err_t ra8_dmac_start_repeat(uint8_t channel, const ra8_dmac_config_t *cfg)
Programme a DMAC channel in repeat-area transfer mode.
Definition ra8_dmac.c:478
ra8_dmac_width_t
Transfer element width.
Definition ra8_dmac.h:50
@ k_ra8_dmac_width_word
32-bit transfers (DMTMD.SZ = 10b).
Definition ra8_dmac.h:53
@ k_ra8_dmac_width_byte
8-bit transfers (DMTMD.SZ = 00b).
Definition ra8_dmac.h:51
@ k_ra8_dmac_width_half
16-bit transfers (DMTMD.SZ = 01b).
Definition ra8_dmac.h:52
ra8_err_t ra8_dmac_attach_half_complete_handler(uint8_t channel, ra8_dmac_callback_fn_t fn, void *ctx)
Attach a half-block IRQ callback to a DMAC channel.
Definition ra8_dmac.c:514
ra8_err_t ra8_dmac_stop(uint8_t channel)
Disable a DMAC0 channel and drop its MSTP reference.
Definition ra8_dmac.c:432
ra8_err_t ra8_dmac_is_active(uint8_t channel, bool *out_active)
Query whether a DMAC0 channel is mid-transfer.
Definition ra8_dmac.c:576
ra8_err_t ra8_dmac_start(uint8_t channel, const ra8_dmac_config_t *cfg)
Programme and enable a DMAC0 channel.
Definition ra8_dmac.c:398
ra8_err_t ra8_dmac_set_address_mode(uint8_t channel, ra8_dmac_addr_mode_t src_mode, ra8_dmac_addr_mode_t dest_mode)
Override the DMAMD.SM / DMAMD.DM address-update modes.
Definition ra8_dmac.c:492
ra8_err_t ra8_dmac_start_block(uint8_t channel, const ra8_dmac_config_t *cfg)
Programme a DMAC channel in block-transfer mode.
Definition ra8_dmac.c:483
ra8_err_t ra8_dmac_wait_idle(uint8_t channel, uint32_t poll_limit)
Spin until a DMAC0 channel goes idle or a poll bound expires.
Definition ra8_dmac.c:588
ra8_dmac_addr_mode_t
Per-side address-update mode (DMAMD.SM / DMAMD.DM).
Definition ra8_dmac.h:196
@ k_ra8_dmac_addr_decrement
11b: decrement.
Definition ra8_dmac.h:200
@ k_ra8_dmac_addr_fixed
00b: address fixed.
Definition ra8_dmac.h:197
@ k_ra8_dmac_addr_offset
01b: offset addition.
Definition ra8_dmac.h:198
@ k_ra8_dmac_addr_increment
10b: increment.
Definition ra8_dmac.h:199
ra8_err_t ra8_dmac_attach_callback(uint8_t channel, ra8_dmac_callback_fn_t fn, void *ctx)
Attach a transfer-end IRQ callback to a DMAC channel.
Definition ra8_dmac.c:524
ra8_err_t ra8_dmac_software_trigger(uint8_t channel)
Software-trigger one transfer request on a DMAC0 channel.
Definition ra8_dmac.c:565
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
DMAC channel configuration.
Definition ra8_dmac.h:121
ra8_dmac_mode_t mode
Transfer mode (DMTMD.MD).
Definition ra8_dmac.h:128
ra8_dmac_repeat_area_t repeat_area
DMTMD.DTS area select.
Definition ra8_dmac.h:130
uint16_t count
Transfer count (DMCRA low).
Definition ra8_dmac.h:124
bool irq_each
Enable RPTIE/ESIE per repeat.
Definition ra8_dmac.h:131
uint32_t src
Source address (DMSAR).
Definition ra8_dmac.h:122
bool enable_dtie
Enable DMINT.DTIE on full end.
Definition ra8_dmac.h:132
bool dst_inc
true: DM = increment, else fixed.
Definition ra8_dmac.h:127
bool src_inc
true: SM = increment, else fixed.
Definition ra8_dmac.h:126
uint16_t block_count
DMCRB block/repeat count.
Definition ra8_dmac.h:129
uint32_t dst
Destination address (DMDAR).
Definition ra8_dmac.h:123
ra8_dmac_width_t width
Transfer element width.
Definition ra8_dmac.h:125