|
ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
|
Clock Accuracy Check driver. More...
Go to the source code of this file.
Typedefs | |
| typedef void(* | ra8_cac_event_fn_t) (void *ctx, uint8_t status_mask) |
| CAC event callback. | |
Enumerations | |
| enum | ra8_cac_status_mask_t : uint8_t { k_ra8_cac_status_none = 0x00U , k_ra8_cac_status_ferrf = 0x01U , k_ra8_cac_status_mendf = 0x02U , k_ra8_cac_status_ovff = 0x04U } |
| CASTR status-flag bit masks (HUM Ch 10.2.5 "CASTR" p 424). More... | |
Functions | |
| ra8_err_t | ra8_cac_init (uint16_t upper, uint16_t lower) |
| Programme CAC with upper + lower bounds on measured cycles. | |
| ra8_err_t | ra8_cac_measure (uint16_t *out_count) |
| Kick off a CAC measurement and wait for completion. | |
| ra8_err_t | ra8_cac_deinit (void) |
| Tear down the CAC (disable + MSTP release). | |
| ra8_err_t | ra8_cac_get_status (uint8_t *out_mask) |
| Read the CASTR flag bits. | |
| ra8_err_t | ra8_cac_clear_status (uint8_t mask) |
| Clear the CASTR flag bits via CAICR. | |
| ra8_err_t | ra8_cac_attach_handler (ra8_cac_event_fn_t fn, void *ctx) |
| Attach a callback for CAC events. | |
| void | ra8_cac_dispatch (void) |
| Dispatch CAC events – snapshot + fire callback. | |
| ra8_err_t | ra8_cac_enter_stop (void) |
| Put CAC into MSTP-gated stop. | |
| ra8_err_t | ra8_cac_exit_stop (void) |
| Exit MSTP-gated stop. | |
Clock Accuracy Check driver.
Declares configuration and status access for hardware clock-accuracy measurement against caller-supplied cycle limits.
Definition in file ra8_cac.h.
| typedef void(* ra8_cac_event_fn_t) (void *ctx, uint8_t status_mask) |
| enum ra8_cac_status_mask_t : uint8_t |
CASTR status-flag bit masks (HUM Ch 10.2.5 "CASTR" p 424).
CASTR layout (cross-verified against FSP R_CAC_Type.CASTR_b and CMSIS R_CAC_CASTR_*_Pos in R7KA8D2KF_core0.h):
To clear a flag, write 1 to the matching *CL bit in CAICR shifted up by k_ra8_cac_castr_to_caicr_shift (= 4): FERRFCL=bit4, MENDFCL=bit5, OVFFCL=bit6 (HUM Ch 10.2.4 "CAICR" p 423).
|
nodiscard |
Attach a callback for CAC events.
Definition at line 205 of file ra8_cac.c.
References k_ra8_ok, and s_cac_state.
|
nodiscard |
Clear the CASTR flag bits via CAICR.
Definition at line 191 of file ra8_cac.c.
References r_cac_regs_t::CAICR, k_ra8_cac_castr_to_caicr_shift, k_ra8_cac_status_mask_all, k_ra8_ok, and ra8_cac().
|
nodiscard |
Tear down the CAC (disable + MSTP release).
Definition at line 169 of file ra8_cac.c.
References r_cac_regs_t::CACR0, r_cac_regs_t::CACR1, r_cac_regs_t::CACR2, r_cac_regs_t::CAICR, internal_cac_wait_cfme(), k_ra8_mstp_cac, ra8_cac(), ra8_mstp_disable(), and s_cac_state.
| void ra8_cac_dispatch | ( | void | ) |
Dispatch CAC events – snapshot + fire callback.
See the matching header declaration for the full contract; this site adds no behaviour beyond what the public API documents.
Definition at line 212 of file ra8_cac.c.
References r_cac_regs_t::CAICR, r_cac_regs_t::CASTR, k_ra8_cac_castr_to_caicr_shift, k_ra8_cac_status_mask_all, ra8_cac(), and s_cac_state.
|
nodiscard |
Put CAC into MSTP-gated stop.
Definition at line 227 of file ra8_cac.c.
References r_cac_regs_t::CACR0, internal_cac_wait_cfme(), k_ra8_mstp_cac, ra8_cac(), and ra8_mstp_disable().
|
nodiscard |
Exit MSTP-gated stop.
Definition at line 236 of file ra8_cac.c.
References k_ra8_mstp_cac, and ra8_mstp_enable().
|
nodiscard |
Read the CASTR flag bits.
Definition at line 184 of file ra8_cac.c.
References k_ra8_cac_status_mask_all, k_ra8_ok, ra8_cac(), RA8_CHECK_NULL_PTR, and s_tag.
Referenced by internal_sample().
|
nodiscard |
Programme CAC with upper + lower bounds on measured cycles.
| [in] | upper | Upper limit count. |
| [in] | lower | Lower limit count. |
Definition at line 99 of file ra8_cac.c.
References r_cac_regs_t::CACR0, r_cac_regs_t::CACR1, r_cac_regs_t::CACR2, r_cac_regs_t::CAICR, r_cac_regs_t::CALLVR, r_cac_regs_t::CAULVR, internal_cac_wait_cfme(), k_ra8_cac_castr_to_caicr_shift, k_ra8_cac_status_mask_all, k_ra8_mstp_cac, k_ra8_ok, ra8_cac(), ra8_log_info, ra8_mstp_enable(), RA8_RETURN_ON_ERROR, and s_tag.
Referenced by internal_configure().
|
nodiscard |
Kick off a CAC measurement and wait for completion.
| [out] | out_count | Counter value captured on completion. |
Definition at line 125 of file ra8_cac.c.
References r_cac_regs_t::CACNTBR, r_cac_regs_t::CACR0, r_cac_regs_t::CASTR, internal_cac_wait_cfme(), k_ra8_cac_poll_limit, k_ra8_cacr0_cfme, k_ra8_castr_mendf, k_ra8_err_hw_timeout, k_ra8_ok, ra8_cac(), RA8_CHECK_NULL_PTR, and s_tag.
Referenced by internal_sample().