ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
Loading...
Searching...
No Matches
ra8_agt.c
Go to the documentation of this file.
1
19
20#include "ra8_agt.h"
21
22#include <stdint.h>
23
24#include "ra8_agt_regs.h"
25#include "ra8_attributes.h"
26#include "ra8_check.h"
27#include "ra8_err.h"
28#include "ra8_log.h"
29#include "ra8_mstp.h"
30
31static const char* s_tag = "AGT";
32
43typedef enum : uint8_t {
46
55
72
99{
100 if (channel >= k_ra8_agt_mstp_id_count) {
101 return k_ra8_ok;
102 }
103 if (s_agt_mstp_held[channel]) {
104 return k_ra8_ok;
105 }
106 /* HUM Ch 11.2.9 "MSTPCRD : Module Stop Control Register D" p 448 */
107 const ra8_err_t err = ra8_mstp_enable(s_agt_mstp_table[channel]);
108 if (err != k_ra8_ok) {
109 return err;
110 }
111 s_agt_mstp_held[channel] = true;
112 return k_ra8_ok;
113}
114
139{
140 if (channel >= k_ra8_agt_mstp_id_count) {
141 return k_ra8_ok;
142 }
143 if (!s_agt_mstp_held[channel]) {
144 return k_ra8_ok;
145 }
146 s_agt_mstp_held[channel] = false;
147 /* HUM Ch 11.2.9 "MSTPCRD : Module Stop Control Register D" p 448 */
148 return ra8_mstp_disable(s_agt_mstp_table[channel]);
149}
150
151[[nodiscard]] ra8_err_t ra8_agt_start_free_run(uint8_t channel, uint16_t reload)
152{
153 volatile r_agt_regs_t* reg = ra8_agt(channel);
154 RA8_CHECK_NULL_PTR(reg, s_tag, "channel out of range");
155
156 /* Acquire the per-channel MSTP reference once (issue #68). */
157 const ra8_err_t mst_err = internal_agt_mstp_acquire(channel);
158 RA8_RETURN_ON_ERROR(mst_err, s_tag, "agt_start: mstp enable");
159
160 /* HUM Ch 24.2.4 "AGTCR : AGT Control Register" p 1167 */
161 reg->AGTCR = 0U;
162 /* HUM Ch 24.2.5 "AGTMR1 : AGT Mode Register 1" p 1168 -- timer mode,
163 * PCLKB source. */
164 reg->AGTMR1 = 0U;
165 /* HUM Ch 24.2.6 "AGTMR2 : AGT Mode Register 2" p 1169 */
166 reg->AGTMR2 = 0U;
167 /* HUM Ch 24.2.1 "AGT : AGT Counter" p 1165 */
168 reg->AGT = reload;
169 /* HUM Ch 24.2.4 "AGTCR : AGT Control Register" p 1167 */
170 /* TSTART = 1. */
171 reg->AGTCR = 0x01U;
172
173 ra8_log_info_val(s_tag, "start channel", (uint32_t)channel);
174 return k_ra8_ok;
175}
176
177[[nodiscard]] ra8_err_t ra8_agt_stop(uint8_t channel)
178{
179 volatile r_agt_regs_t* reg = ra8_agt(channel);
180 RA8_CHECK_NULL_PTR(reg, s_tag, "channel out of range");
181 /* HUM Ch 24.2.4 "AGTCR : AGT Control Register" p 1167 */
182 reg->AGTCR = 0U;
183 return k_ra8_ok;
184}
185
186/* =============================================================================
187 * full build-out
188 * =============================================================================
189 */
190
192static void* s_agt_ctx;
193
221ra8_err_t ra8_agt_deinit(uint8_t channel)
222{
223 volatile r_agt_regs_t* reg = ra8_agt(channel);
224 RA8_CHECK_NULL_PTR(reg, s_tag, "channel out of range");
225 /* HUM Ch 24.2.4 "AGTCR : AGT Control Register" p 1167 */
226 reg->AGTCR = 0U;
227 return internal_agt_mstp_release(channel);
228}
229
255ra8_err_t ra8_agt_set_reload(uint8_t channel, uint16_t reload)
256{
257 volatile r_agt_regs_t* reg = ra8_agt(channel);
258 RA8_CHECK_NULL_PTR(reg, s_tag, "channel out of range");
259 /* HUM Ch 24.2.1 "AGT : AGT Counter" p 1165 */
260 reg->AGT = reload;
261 return k_ra8_ok;
262}
263
289ra8_err_t ra8_agt_get_status(uint8_t channel, uint8_t* out_mask)
290{
291 RA8_CHECK_NULL_PTR(out_mask, s_tag, "out_mask must not be nullptr");
292 volatile const r_agt_regs_t* reg = ra8_agt(channel);
293 RA8_CHECK_NULL_PTR(reg, s_tag, "channel out of range");
294 /* HUM Ch 24.2.4 "AGTCR : AGT Control Register" p 1167 */
295 *out_mask = reg->AGTCR;
296 return k_ra8_ok;
297}
298
325{
326 s_agt_fn = fn;
327 s_agt_ctx = ctx;
328 return k_ra8_ok;
329}
330
351void ra8_agt_dispatch(uint8_t channel)
352{
353 if (ra8_agt(channel) == nullptr) {
354 return;
355 }
356 const ra8_agt_event_fn_t fn = s_agt_fn;
357 void* const ctx = s_agt_ctx;
358 if (fn != nullptr) {
359 fn(ctx, channel);
360 }
361}
362
390{
391 volatile r_agt_regs_t* reg = ra8_agt(channel);
392 RA8_CHECK_NULL_PTR(reg, s_tag, "channel out of range");
393 /* HUM Ch 24.2.4 "AGTCR : AGT Control Register" p 1167 */
394 reg->AGTCR = 0U;
395 return internal_agt_mstp_release(channel);
396}
397
424{
425 if (ra8_agt(channel) == nullptr) {
427 }
428 return internal_agt_mstp_acquire(channel);
429}
430
431/* =============================================================================
432 * Pulse-output mode -- HUM Ch 24.3.4 p 1177
433 * =============================================================================
434 */
435
462{
463 uint8_t v = (uint8_t)k_ra8_agt_agtioc_toe_msk;
465 v |= (uint8_t)k_ra8_agt_agtioc_tedgsel_msk;
466 }
467 return v;
468}
469
498{
499 if (compare == k_ra8_agt_pulse_compare_a) {
501 }
502 if (compare == k_ra8_agt_pulse_compare_b) {
504 }
505 return 0U;
506}
507
533 uint16_t duty)
534{
535 const uint16_t parked = (uint16_t)k_ra8_agt_compare_parked_value;
536 /* HUM Ch 24.2.2 "AGTCMA : AGT Compare Match A Register" p 1166 */
537 reg->AGTCMA = (compare == k_ra8_agt_pulse_compare_a) ? duty : parked;
538 /* HUM Ch 24.2.3 "AGTCMB : AGT Compare Match B Register" p 1166 */
539 reg->AGTCMB = (compare == k_ra8_agt_pulse_compare_b) ? duty : parked;
540}
541
578
601 const ra8_agt_pulse_cfg_t* cfg)
602{
603 /* Stop first. */
604 /* HUM Ch 24.2.4 "AGTCR : AGT Control Register" p 1167 */
605 reg->AGTCR = 0U;
606 /* TMOD=001b (pulse output mode), TCK = PCLKB. */
607 /* HUM Ch 24.2.5 "AGTMR1 : AGT Mode Register 1" p 1168 */
609 /* HUM Ch 24.2.6 "AGTMR2 : AGT Mode Register 2" p 1169 */
610 reg->AGTMR2 = 0U;
611 /* TOE = 1, polarity from the config. */
612 /* HUM Ch 24.2.7 "AGTIOC : AGT I/O Control Register" p 1170 */
614 /* HUM Ch 24.2.9 "AGTCMSR : AGT Compare Match Function Select" p 1172 */
617 /* HUM Ch 24.2.1 "AGT : AGT Counter" p 1165 */
618 reg->AGT = cfg->period;
619}
620
650{
651 RA8_CHECK_NULL_PTR(cfg, s_tag, "cfg must not be nullptr");
652 volatile r_agt_regs_t* reg = ra8_agt(channel);
653 RA8_CHECK_NULL_PTR(reg, s_tag, "channel out of range");
654
656 RA8_RETURN_ON_ERROR(verr, s_tag, "agt_pulse: cfg validation");
657
658 /* Acquire the per-channel MSTP reference once (issue #68). */
659 const ra8_err_t mst_err = internal_agt_mstp_acquire(channel);
660 /* GCOVR_EXCL_BR_START -- MSTP HW readback */
661 RA8_RETURN_ON_ERROR(mst_err, s_tag, "agt_pulse: mstp enable");
662 /* GCOVR_EXCL_BR_STOP */
663
665
666 /* TSTART = 1. */
667 /* HUM Ch 24.2.4 "AGTCR : AGT Control Register" p 1167 */
668 reg->AGTCR = (uint8_t)k_ra8_agt_agtcr_tstart_msk;
669
670 /* One-shot mode is implemented at the polling layer: the caller
671 * inspects AGTCR.TUNDF and calls ra8_agt_stop() once it sees the
672 * first underflow. The hardware itself only knows continuous
673 * pulse output (HUM Ch 24.3.4 p 1177). */
674 (void)cfg->mode;
675
676 ra8_log_info_val(s_tag, "pulse start channel", (uint32_t)channel);
677 return k_ra8_ok;
678}
679
680/* =============================================================================
681 * Cascade mode -- HUM Ch 24.1 Table 24.1 p 1164 + Ch 24.2.5 p 1168 note 6
682 * =============================================================================
683 */
684
711 uint8_t* out_tck)
712{
713 switch (clock) {
715 *out_tck = (uint8_t)k_ra8_agt_agtmr1_tck_pclkb;
716 return k_ra8_ok;
718 *out_tck = (uint8_t)k_ra8_agt_agtmr1_tck_pclkb_div8;
719 return k_ra8_ok;
721 *out_tck = (uint8_t)k_ra8_agt_agtmr1_tck_pclkb_div2;
722 return k_ra8_ok;
723 default:
725 }
726}
727
749RA8_INTERNAL static void
750internal_agt_cascade_arm_half(volatile r_agt_regs_t* reg, uint8_t tmr1, uint16_t reload)
751{
752 /* Stop the channel before touching the mode-control regs. */
753 /* HUM Ch 24.2.4 "AGTCR : AGT Control Register" p 1167 */
754 reg->AGTCR = 0U;
755 /* HUM Ch 24.2.5 "AGTMR1 : AGT Mode Register 1" p 1168 */
756 reg->AGTMR1 = tmr1;
757 /* HUM Ch 24.2.6 "AGTMR2 : AGT Mode Register 2" p 1169 */
758 reg->AGTMR2 = 0U;
759 /* No external output in cascade timer mode. */
760 /* HUM Ch 24.2.7 "AGTIOC : AGT I/O Control Register" p 1170 */
761 reg->AGTIOC = 0U;
762 /* No compare-match output. */
763 /* HUM Ch 24.2.9 "AGTCMSR : AGT Compare Match Function Select" p 1172 */
764 reg->AGTCMSR = 0U;
765 /* HUM Ch 24.2.1 "AGT : AGT Counter" p 1165 */
766 reg->AGT = reload;
767}
768
774
798{
799 /* One MSTP reference per channel (issue #68): re-arming the cascade every
800 * AGT1 underflow must not leak a fresh AGT0/AGT1 reference per period. */
802 RA8_RETURN_ON_ERROR(m0, s_tag, "cascade: mstp AGT0");
804 RA8_RETURN_ON_ERROR(m1, s_tag, "cascade: mstp AGT1");
805 return k_ra8_ok;
806}
807
832 volatile r_agt_regs_t* hi,
833 uint32_t reload32,
834 uint8_t tck_lo)
835{
836 const uint16_t reload_lo = (uint16_t)(reload32 & (uint32_t)k_ra8_agt_cascade_lo_mask);
837 const uint16_t reload_hi = (uint16_t)((reload32 >> (uint32_t)k_ra8_agt_cascade_hi_shift) &
838 (uint32_t)k_ra8_agt_cascade_lo_mask);
839
840 /* HUM Ch 24.2.5 "AGTMR1 : AGT Mode Register 1" p 1168 */
841 const uint8_t tmr1_lo = (uint8_t)((uint8_t)k_ra8_agt_agtmr1_tmod_timer | tck_lo);
842 /* HUM Ch 24.2.5 "AGTMR1 : AGT Mode Register 1" p 1168 */
843 const uint8_t tmr1_hi =
845
846 internal_agt_cascade_arm_half(lo, tmr1_lo, reload_lo);
847 internal_agt_cascade_arm_half(hi, tmr1_hi, reload_hi);
848
849 /* Start AGT1 first so it samples the AGT0 underflow on the very */
850 /* first cycle. */
851 /* HUM Ch 24.2.4 "AGTCR : AGT Control Register" p 1167 */
852 hi->AGTCR = (uint8_t)k_ra8_agt_agtcr_tstart_msk;
853 /* HUM Ch 24.2.4 "AGTCR : AGT Control Register" p 1167 */
854 lo->AGTCR = (uint8_t)k_ra8_agt_agtcr_tstart_msk;
855}
856
879{
880 if (cfg->on_underflow != nullptr) {
881 s_agt_fn = cfg->on_underflow;
882 s_agt_ctx = cfg->ctx;
883 }
884}
885
911 volatile r_agt_regs_t** out_hi)
912{
913 *out_lo = ra8_agt((uint8_t)k_ra8_agt_cascade_lo_channel);
914 *out_hi = ra8_agt((uint8_t)k_ra8_agt_cascade_hi_channel);
915 RA8_CHECK_NULL_PTR(*out_lo, s_tag, "cascade: AGT0 unavailable");
916 RA8_CHECK_NULL_PTR(*out_hi, s_tag, "cascade: AGT1 unavailable");
917 return k_ra8_ok;
918}
919
950{
951 RA8_CHECK_NULL_PTR(cfg, s_tag, "cfg must not be nullptr");
952 uint8_t tck_lo = 0U;
953 const ra8_err_t cerr = internal_agt_cascade_clock_to_tck(cfg->clock, &tck_lo);
954 RA8_RETURN_ON_ERROR(cerr, s_tag, "cascade: bad clock enum");
955
956 volatile r_agt_regs_t* lo = nullptr;
957 volatile r_agt_regs_t* hi = nullptr;
958 const ra8_err_t herr = internal_agt_cascade_resolve_halves(&lo, &hi);
959 RA8_RETURN_ON_ERROR(herr, s_tag, "cascade: half resolve");
960
962 RA8_RETURN_ON_ERROR(merr, s_tag, "cascade: mstp enable");
963
966 ra8_log_info_val(s_tag, "cascade start", cfg->reload32);
967 return k_ra8_ok;
968}
static ra8_err_t internal_agt_cascade_resolve_halves(volatile r_agt_regs_t **out_lo, volatile r_agt_regs_t **out_hi)
Fetch and validate both AGT register windows for cascade.
Definition ra8_agt.c:910
ra8_agt_cascade_split_t
Shift / mask used to split the cascade 32-bit reload.
Definition ra8_agt.c:770
@ k_ra8_agt_cascade_lo_mask
RA8 AGT cascade lo mask.
Definition ra8_agt.c:771
@ k_ra8_agt_cascade_hi_shift
RA8 AGT cascade hi shift.
Definition ra8_agt.c:772
static void internal_agt_cascade_install_callback(const ra8_agt_cascade_cfg_t *cfg)
Install the optional cascade-completion callback.
Definition ra8_agt.c:878
static ra8_err_t internal_agt_cascade_clock_to_tck(ra8_agt_cascade_clk_t clock, uint8_t *out_tck)
Translate the cascade clock enum into an AGTMR1.TCK encoding.
Definition ra8_agt.c:710
ra8_err_t ra8_agt_set_reload(uint8_t channel, uint16_t reload)
Change the AGT reload value at runtime.
Definition ra8_agt.c:255
static void internal_agt_pulse_program_registers(volatile r_agt_regs_t *reg, const ra8_agt_pulse_cfg_t *cfg)
Write the AGT mode / I/O / compare-match registers for pulse output.
Definition ra8_agt.c:600
static void internal_agt_cascade_program_and_start(volatile r_agt_regs_t *lo, volatile r_agt_regs_t *hi, uint32_t reload32, uint8_t tck_lo)
Programme both AGT halves and start them in cascade order.
Definition ra8_agt.c:831
ra8_err_t ra8_agt_exit_stop(uint8_t channel)
Exit MSTP-gated stop for one AGT channel.
Definition ra8_agt.c:423
ra8_err_t ra8_agt_attach_handler(ra8_agt_event_fn_t fn, void *ctx)
Attach an AGT event callback (shared across channels).
Definition ra8_agt.c:324
ra8_err_t ra8_agt_start_free_run(uint8_t channel, uint16_t reload)
Start an AGT channel in free-running mode.
Definition ra8_agt.c:151
static void internal_agt_pulse_program_compare(volatile r_agt_regs_t *reg, ra8_agt_pulse_compare_t compare, uint16_t duty)
Programme the AGTCMA / AGTCMB compare register for pulse mode.
Definition ra8_agt.c:531
ra8_agt_mstp_limit_t
Number of AGT channels that have dedicated MSTPD bits.
Definition ra8_agt.c:43
@ k_ra8_agt_mstp_id_count
RA8 AGT mstp ID count.
Definition ra8_agt.c:44
static const ra8_mstp_t s_agt_mstp_table[k_ra8_agt_mstp_id_count]
Channel-index -> MSTP id lookup for AGT0 / AGT1.
Definition ra8_agt.c:51
static ra8_err_t internal_agt_mstp_acquire(uint8_t channel)
Acquire the per-channel AGT MSTP reference exactly once (issue #68).
Definition ra8_agt.c:98
static void internal_agt_cascade_arm_half(volatile r_agt_regs_t *reg, uint8_t tmr1, uint16_t reload)
Reset and arm one cascade half in plain timer mode.
Definition ra8_agt.c:750
static uint8_t internal_agt_pulse_agtcmsr_value(ra8_agt_pulse_compare_t compare)
Build the AGTCMSR mask for a chosen compare-match output.
Definition ra8_agt.c:497
static ra8_agt_event_fn_t s_agt_fn
Definition ra8_agt.c:191
static ra8_err_t internal_agt_cascade_mstp_enable_both(void)
Power on both halves of the cascade pair.
Definition ra8_agt.c:797
ra8_err_t ra8_agt_deinit(uint8_t channel)
Tear down one AGT channel.
Definition ra8_agt.c:221
ra8_err_t ra8_agt_start_cascade(const ra8_agt_cascade_cfg_t *cfg)
Cascade AGT0 and AGT1 into a 32-bit virtual down-counter.
Definition ra8_agt.c:949
ra8_err_t ra8_agt_get_status(uint8_t channel, uint8_t *out_mask)
Read the AGTCR status register.
Definition ra8_agt.c:289
static ra8_err_t internal_agt_mstp_release(uint8_t channel)
Release the per-channel AGT MSTP reference if held (issue #68).
Definition ra8_agt.c:138
static ra8_err_t internal_agt_pulse_validate_cfg(const ra8_agt_pulse_cfg_t *cfg)
Validate the enum members of a pulse-output config block.
Definition ra8_agt.c:566
static void * s_agt_ctx
Definition ra8_agt.c:192
static uint8_t internal_agt_pulse_agtioc_value(ra8_agt_output_polarity_t polarity)
Translate the pulse-mode polarity enum into an AGTIOC mask.
Definition ra8_agt.c:461
ra8_err_t ra8_agt_start_pulse_output(uint8_t channel, const ra8_agt_pulse_cfg_t *cfg)
Arm one AGT channel in pulse-output / output-compare mode.
Definition ra8_agt.c:649
ra8_err_t ra8_agt_enter_stop(uint8_t channel)
Put one AGT channel into MSTP-gated stop.
Definition ra8_agt.c:389
ra8_err_t ra8_agt_stop(uint8_t channel)
Stop an AGT channel.
Definition ra8_agt.c:177
void ra8_agt_dispatch(uint8_t channel)
Dispatch an AGT event to the registered shared callback.
Definition ra8_agt.c:351
static bool s_agt_mstp_held[k_ra8_agt_mstp_id_count]
Per-channel "this driver holds the MSTP reference" latch (AGT0/AGT1).
Definition ra8_agt.c:71
Asynchronous General-Purpose Timer (AGT) driver header.
ra8_agt_pulse_compare_t
Compare-match output channel selection for pulse mode.
Definition ra8_agt.h:151
@ k_ra8_agt_pulse_compare_b
AGTCMB + AGTOBn toggle armed.
Definition ra8_agt.h:154
@ k_ra8_agt_pulse_compare_a
AGTCMA + AGTOAn toggle armed.
Definition ra8_agt.h:153
@ k_ra8_agt_pulse_compare_none
No compare-match output.
Definition ra8_agt.h:152
void(* ra8_agt_event_fn_t)(void *ctx, uint8_t channel)
AGT event callback.
Definition ra8_agt.h:46
ra8_agt_cascade_clk_t
Definition ra8_agt.h:214
@ k_ra8_agt_cascade_clk_pclkb
TCK = 000b.
Definition ra8_agt.h:215
@ k_ra8_agt_cascade_clk_pclkb_div2
TCK = 011b.
Definition ra8_agt.h:217
@ k_ra8_agt_cascade_clk_pclkb_div8
TCK = 001b.
Definition ra8_agt.h:216
ra8_agt_output_polarity_t
Initial level of the AGTOn pulse output.
Definition ra8_agt.h:134
@ k_ra8_agt_output_polarity_active_low
TEDGSEL = 0, start-high pin.
Definition ra8_agt.h:136
@ k_ra8_agt_output_polarity_active_high
TEDGSEL = 1, start-low pin.
Definition ra8_agt.h:135
Asynchronous General-Purpose Timer (AGT) register layout for RA8D2.
static volatile r_agt_regs_t * ra8_agt(uint8_t channel)
Get pointer to AGT channel N.
@ k_ra8_agt_cascade_lo_channel
Low 16 bits live in AGT0.
@ k_ra8_agt_cascade_hi_channel
High 16 bits live in AGT1.
@ k_ra8_agt_agtmr1_tmod_timer
TMOD = 000b.
@ k_ra8_agt_agtmr1_tmod_pulse_output
TMOD = 001b.
@ k_ra8_agt_agtmr1_tck_pclkb
TCK = 000b @ bit 4.
@ k_ra8_agt_agtmr1_tck_pclkb_div2
TCK = 011b @ bit 4.
@ k_ra8_agt_agtmr1_tck_pclkb_div8
TCK = 001b @ bit 4.
@ k_ra8_agt_agtmr1_tck_agt0_underflow
TCK = 101b (AGT1 only).
@ k_ra8_agt_agtcr_tstart_msk
RA8 AGT agtcr tstart msk.
@ k_ra8_agt_compare_parked_value
RA8 AGT compare parked value.
@ k_ra8_agt_agtioc_tedgsel_msk
Output polarity bit 0.
@ k_ra8_agt_agtioc_toe_msk
AGTOn pin output enable.
@ k_ra8_agt_agtcmsr_tcmea_msk
Compare match A enable.
@ k_ra8_agt_agtcmsr_toeb_msk
AGTOBn output enable.
@ k_ra8_agt_agtcmsr_tcmeb_msk
Compare match B enable.
@ k_ra8_agt_agtcmsr_toea_msk
AGTOAn output enable.
static const char * s_tag
Logging / check tag.
Definition ra8_app.c:17
Annotation-attribute framework macros for ra8-firmware.
#define RA8_ISR_SAFE
The function is callable from interrupt context.
#define RA8_INTERNAL
Marker that a function is intended to be static (file-local).
Validation and Error-Checking Macros for ra8-firmware.
#define RA8_RETURN_ON_ERROR(err, tag, message)
Early return on error, propagating the code upward.
Definition ra8_check.h:184
#define RA8_CHECK_NULL_PTR(ptr, tag, message)
Reject nullptr pointer, returning k_ra8_err_null_ptr.
Definition ra8_check.h:243
Error Code Definitions for ra8-firmware.
@ k_ra8_err_invalid_arg
Invalid function argument.
Definition ra8_err.h:152
@ k_ra8_ok
Success – operation completed with all postconditions satisfied.
Definition ra8_err.h:119
ra8_err_codes_t ra8_err_t
Canonical error-return type used by every ra8-firmware API.
Definition ra8_err.h:546
Lightweight Logging Interface for ra8-firmware.
#define ra8_log_info_val(tag, message, value)
RA8 log info val.
Definition ra8_log.h:366
Ref-counted Module Stop Control wrapper for the RA8D2.
ra8_err_t ra8_mstp_enable(ra8_mstp_t id)
Reference-counted "ungate this peripheral" request.
Definition ra8_mstp.c:343
ra8_err_t ra8_mstp_disable(ra8_mstp_t id)
Reference-counted "gate this peripheral" request.
Definition ra8_mstp.c:382
ra8_mstp_t
Packed (reg << 8) | bit module-stop identifier.
@ k_ra8_mstp_agt0
MSTPD5 AGT0.
@ k_ra8_mstp_agt1
MSTPD4 AGT1.
AGT (16-bit view) register layout, one per channel.
volatile uint8_t AGTMR2
+0x0A Mode 2.
volatile uint8_t AGTCR
+0x08 Control.
volatile uint16_t AGTCMA
+0x02 Compare Match A.
volatile uint8_t AGTIOC
+0x0C I/O Control.
volatile uint16_t AGT
+0x00 16-bit counter.
volatile uint8_t AGTCMSR
+0x0E Compare Match Function.
volatile uint8_t AGTMR1
+0x09 Mode 1.
volatile uint16_t AGTCMB
+0x04 Compare Match B.
Configuration for ra8_agt_start_cascade.
Definition ra8_agt.h:237
void * ctx
Opaque ctx forwarded to callback.
Definition ra8_agt.h:241
ra8_agt_event_fn_t on_underflow
Optional: fires on AGT1 underflow.
Definition ra8_agt.h:240
uint32_t reload32
32-bit virtual reload value.
Definition ra8_agt.h:238
ra8_agt_cascade_clk_t clock
Count source for the AGT0 half.
Definition ra8_agt.h:239
Configuration for ra8_agt_start_pulse_output.
Definition ra8_agt.h:173
ra8_agt_pulse_compare_t compare
Which compare-match pin is armed.
Definition ra8_agt.h:178
uint16_t period
16-bit reload (AGT register).
Definition ra8_agt.h:174
uint16_t duty
Compare-match A/B value.
Definition ra8_agt.h:175
ra8_agt_pulse_mode_t mode
continuous or one-shot.
Definition ra8_agt.h:176
ra8_agt_output_polarity_t polarity
Start-level of AGTOn.
Definition ra8_agt.h:177