ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
Loading...
Searching...
No Matches
ra8_lvd_internal.h
Go to the documentation of this file.
1
14
15#pragma once
16
17#ifdef __cplusplus
18extern "C" {
19#endif
20
21#include <stdint.h>
22
23#include "ra8_attributes.h"
24#include "ra8_err.h"
25#include "ra8_lvd.h"
26
27/* =============================================================================
28 * Cross-TU channel-map sharing
29 *
30 * The ra8_lvd driver is split across multiple translation units
31 * (ra8_lvd.c plus ra8_lvd_runtime.c / ra8_lvd_events.c). The channel-map
32 * descriptor, its index enum, the lookup table, and the handful of
33 * register helpers below are referenced by more than one TU, so they
34 * live here -- defined once in ra8_lvd.c, declared for every consumer.
35 * =============================================================================
36 */
37
56
68
82
108 uint8_t* out_idx);
109
132
155
178 uint8_t clear_mask,
179 uint8_t set_bits);
180
214 uint32_t after_assert_val,
215 uint32_t hysteresis,
216 uint32_t negate);
217
249RA8_PRIV bool
250priv_ra8_lvd_internal_set_ri_bit(uint32_t reset_val, uint32_t reset_on_rise_val, uint32_t response);
251
252#ifdef __cplusplus
253}
254#endif
Annotation-attribute framework macros for ra8-firmware.
#define RA8_PRIV
Module-private helper: shared across TUs but only inside one library.
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
const ra8_lvd_channel_map_t g_lvd_map[k_ra8_lvd_map_idx_count]
Lookup table from ra8_lvd_map_idx_t to register offsets.
Definition ra8_lvd.c:108
Programmable Voltage Detection (PVD / LVD) HAL driver.
bool priv_ra8_lvd_internal_reject_hvd_after(uint32_t hvd_val, uint32_t after_assert_val, uint32_t hysteresis, uint32_t negate)
Pure predicate for "RN=1 prohibited when RHSEL=1" rejection.
Definition ra8_lvd.c:51
ra8_err_t priv_ra8_lvd_internal_channel_to_idx(ra8_lvd_channel_t channel, uint8_t *out_idx)
Translate a public channel id to an index into g_lvd_map.
Definition ra8_lvd.c:141
ra8_err_t priv_ra8_lvd_internal_validate_div(ra8_lvd_loco_div_t div)
Validate FSAMP[1:0] candidate (0..3).
Definition ra8_lvd.c:194
uint8_t priv_ra8_lvd_internal_read_ri(const ra8_lvd_channel_map_t *map)
Read PVDmCR0.RI for an m channel.
Definition ra8_lvd.c:233
bool priv_ra8_lvd_internal_set_ri_bit(uint32_t reset_val, uint32_t reset_on_rise_val, uint32_t response)
Pure predicate for the CR0 "set RI bit" decision.
Definition ra8_lvd.c:75
ra8_lvd_map_idx_t
Indices into g_lvd_map.
@ k_ra8_lvd_map_idx_ch5
PVD5.
@ k_ra8_lvd_map_idx_ch4
PVD4.
@ k_ra8_lvd_map_idx_count
Sentinel.
@ k_ra8_lvd_map_idx_ch2
PVD2.
@ k_ra8_lvd_map_idx_ch1
PVD1.
void priv_ra8_lvd_internal_cr0_rmw(const ra8_lvd_channel_map_t *map, uint8_t clear_mask, uint8_t set_bits)
Read-modify-write helper for PVDmCR0 / PVDnCR0 with reserved-bit rewrite forced.
Definition ra8_lvd.c:325
ra8_lvd_off_t
Absolute addresses of every PVD-related register on the RA8D2.
ra8_lvd_loco_div_t
PVDmCR0.FSAMP[1:0] / PVDnCR0.FSAMP[1:0] sampling-clock divider.
ra8_lvd_channel_t
Voltage-monitor channel selector.
Per-channel register-offset bundle.
ra8_lvd_off_t fcr
PVDxFCR (RHSEL).
ra8_lvd_off_t cmpcr
PVDxCMPCR offset.
ra8_lvd_off_t cr0
PVDxCR0 offset.
ra8_lvd_off_t cr1
PVDxCR1 (m only; n: same as cr0 stub).
ra8_lvd_off_t sr
PVDxSR (m only; n: same as cr0 stub).
bool has_irq
true for monitor m channels (1, 2).