|
ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
|
Test-access surface for ra8_lvd internal helpers (MC/DC). More...
Go to the source code of this file.
Data Structures | |
| struct | ra8_lvd_channel_map_t |
| Per-channel register-offset bundle. More... | |
Enumerations | |
| enum | ra8_lvd_map_idx_t : uint8_t { k_ra8_lvd_map_idx_ch1 = 0U , k_ra8_lvd_map_idx_ch2 = 1U , k_ra8_lvd_map_idx_ch4 = 2U , k_ra8_lvd_map_idx_ch5 = 3U , k_ra8_lvd_map_idx_count = 4U } |
| Indices into g_lvd_map. More... | |
Functions | |
| 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. | |
| ra8_err_t | priv_ra8_lvd_internal_validate_div (ra8_lvd_loco_div_t div) |
| Validate FSAMP[1:0] candidate (0..3). | |
| uint8_t | priv_ra8_lvd_internal_read_ri (const ra8_lvd_channel_map_t *map) |
| Read PVDmCR0.RI for an m channel. | |
| 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. | |
| 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. | |
| 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. | |
Variables | |
| 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. | |
Test-access surface for ra8_lvd internal helpers (MC/DC).
Not part of the public API. Tests under tests/ MAY include this header to drive compound boolean decisions that sit in TU-private helpers behind the public ra8_lvd facade.
Definition in file ra8_lvd_internal.h.
| enum ra8_lvd_map_idx_t : uint8_t |
Indices into g_lvd_map.
| Enumerator | |
|---|---|
| k_ra8_lvd_map_idx_ch1 | PVD1. |
| k_ra8_lvd_map_idx_ch2 | PVD2. |
| k_ra8_lvd_map_idx_ch4 | PVD4. |
| k_ra8_lvd_map_idx_ch5 | PVD5. |
| k_ra8_lvd_map_idx_count | Sentinel. |
Definition at line 61 of file ra8_lvd_internal.h.
| 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.
| [in] | channel | Public channel id. |
| [out] | out_idx | On success, the index in [0..3]. |
Folds the public ra8_lvd_channel_t enumerator (which uses the datasheet's PVD1/2/4/5 numbering) into a 0..3 array index used by the internal g_lvd_map lookup table. Shared across the ra8_lvd translation units.
| k_ra8_ok | Mapping succeeded. |
| k_ra8_err_invalid_arg | channel is not one of PVD1/2/4/5. |
Translate a public channel id to an index into g_lvd_map.
Definition at line 141 of file ra8_lvd.c.
References k_ra8_err_invalid_arg, k_ra8_lvd_ch1, k_ra8_lvd_ch2, k_ra8_lvd_ch4, k_ra8_lvd_ch5, k_ra8_lvd_map_idx_ch1, k_ra8_lvd_map_idx_ch2, k_ra8_lvd_map_idx_ch4, k_ra8_lvd_map_idx_ch5, and k_ra8_ok.
Referenced by ra8_lvd_attach_channel_handler(), ra8_lvd_channel_deinit(), ra8_lvd_channel_init(), ra8_lvd_clear_status(), ra8_lvd_configure_for_standby(), ra8_lvd_disable_cmpe(), ra8_lvd_disable_elc_event(), ra8_lvd_disable_irq(), ra8_lvd_disable_reset(), ra8_lvd_dispatch(), ra8_lvd_enable_cmpe(), ra8_lvd_enable_elc_event(), ra8_lvd_enable_irq(), ra8_lvd_enable_reset(), ra8_lvd_get_status(), ra8_lvd_set_filter(), ra8_lvd_set_hysteresis_mode(), ra8_lvd_set_irq_edge(), ra8_lvd_set_irq_kind(), ra8_lvd_set_negate_mode(), and ra8_lvd_set_threshold().
| 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.
Reads PVDxCR0, masks out clear_mask, ORs in set_bits, then folds the channel's mandatory reserved-bit pattern back in (HUM Ch 12.2.4 / 12.2.5). Shared across the ra8_lvd TUs.
| [in] | map | Channel map. |
| [in] | clear_mask | Bits to clear. |
| [in] | set_bits | Bits to set. |
Read-modify-write helper for PVDmCR0 / PVDnCR0 with reserved-bit rewrite forced.
Definition at line 325 of file ra8_lvd.c.
References ra8_lvd_channel_map_t::cr0, internal_cr0_apply_reserved(), and ra8_lvd_reg8().
Referenced by ra8_lvd_cancel_deep_standby_path(), ra8_lvd_channel_deinit(), ra8_lvd_configure_for_standby(), ra8_lvd_disable_cmpe(), ra8_lvd_disable_elc_event(), ra8_lvd_disable_irq(), ra8_lvd_disable_reset(), ra8_lvd_enable_cmpe(), ra8_lvd_enable_elc_event(), ra8_lvd_enable_irq(), ra8_lvd_enable_reset(), ra8_lvd_set_filter(), and ra8_lvd_set_negate_mode().
| uint8_t priv_ra8_lvd_internal_read_ri | ( | const ra8_lvd_channel_map_t * | map | ) |
Read PVDmCR0.RI for an m channel.
Returns the Reset-on-Voltage bit (HUM Ch 12.2.4 "PVDmCR0" p 597) so the caller can decide whether to issue a software reset on a detected voltage crossing. Shared across the ra8_lvd TUs.
| [in] | map | Channel map entry (must be has_irq=true). |
| 0 | RI bit clear – IRQ-only path. |
| !=0 | RI bit set – channel will reset the SoC on crossing. |
Read PVDmCR0.RI for an m channel.
Definition at line 233 of file ra8_lvd.c.
References ra8_lvd_channel_map_t::cr0, k_ra8_lvd_cr0_mask_ri, and ra8_lvd_reg8().
Referenced by ra8_lvd_set_hysteresis_mode().
| 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.
Returns true iff hysteresis equals the HVD code AND negate equals the after-assert code. Promoted from the inline compound AND at libs/ra8_hal/src/ra8_lvd.c.
| [in] | hvd_val | Numeric value of k_ra8_lvd_hysteresis_hvd. |
| [in] | after_assert_val | Numeric value of k_ra8_lvd_negate_after_assert. |
| [in] | hysteresis | Candidate hysteresis value. |
| [in] | negate | Candidate negate value. |
| true | Caller must return k_ra8_err_invalid_arg. |
| false | Combination is allowed. |
Pure predicate for "RN=1 prohibited when RHSEL=1" rejection.
Promoted helper so the line-494 AND can be driven under MC/DC.
| [in] | hvd_val | Numeric value of k_ra8_lvd_hysteresis_hvd. |
| [in] | after_assert_val | Numeric value of k_ra8_lvd_negate_after_assert. |
| [in] | hysteresis | Candidate hysteresis value. |
| [in] | negate | Candidate negate value. |
| true | Caller returns k_ra8_err_invalid_arg. |
| false | Combination is allowed. |
Definition at line 51 of file ra8_lvd.c.
Referenced by internal_validate_cfg().
| 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.
Returns true iff response equals the reset code OR equals the reset-on-rise code. Promoted from the inline compound OR at libs/ra8_hal/src/ra8_lvd.c inside internal_compose_cr0.
| [in] | reset_val | Numeric value of k_ra8_lvd_response_reset. |
| [in] | reset_on_rise_val | Numeric value of k_ra8_lvd_response_reset_on_rise. |
| [in] | response | Candidate response value. |
| true | Caller must OR k_ra8_lvd_cr0_mask_ri into CR0. |
| false | RI bit stays clear. |
Pure predicate for the CR0 "set RI bit" decision.
Promoted helper so the line-533 OR can be driven under MC/DC.
| [in] | reset_val | Numeric value of k_ra8_lvd_response_reset. |
| [in] | reset_on_rise_val | Numeric value of k_ra8_lvd_response_reset_on_rise. |
| [in] | response | Candidate response value. |
| true | Caller ORs RI bit into CR0. |
| false | RI bit stays clear. |
Definition at line 75 of file ra8_lvd.c.
Referenced by internal_compose_cr0().
| ra8_err_t priv_ra8_lvd_internal_validate_div | ( | ra8_lvd_loco_div_t | div | ) |
Validate FSAMP[1:0] candidate (0..3).
FSAMP[1:0] selects the LOCO sample-divider for the digital filter (HUM Ch 12.2.6 "PVDmCR1" p 599). All four encodings are valid. Shared across the ra8_lvd translation units.
| [in] | div | Divider candidate. |
| k_ra8_ok | Divider within enum domain. |
| k_ra8_err_invalid_arg | Divider above the documented maximum. |
Validate FSAMP[1:0] candidate (0..3).
Definition at line 194 of file ra8_lvd.c.
References k_ra8_err_invalid_arg, k_ra8_lvd_loco_div_max, and k_ra8_ok.
Referenced by internal_validate_cfg(), and ra8_lvd_set_filter().
|
extern |
Lookup table from ra8_lvd_map_idx_t to register offsets.
Single definition for the whole ra8_lvd driver. The descriptor type, its index enum, and the matching extern declaration live in ra8_lvd_internal.h so the runtime / events translation units can read the same table.
Defined once in ra8_lvd.c; declared here so the runtime / events translation units can read the same descriptor table.
Definition at line 108 of file ra8_lvd.c.
Referenced by ra8_lvd_attach_channel_handler(), ra8_lvd_cancel_deep_standby_path(), ra8_lvd_channel_deinit(), ra8_lvd_channel_init(), ra8_lvd_clear_status(), ra8_lvd_configure_for_standby(), ra8_lvd_disable_cmpe(), ra8_lvd_disable_elc_event(), ra8_lvd_disable_irq(), ra8_lvd_disable_reset(), ra8_lvd_dispatch(), ra8_lvd_enable_cmpe(), ra8_lvd_enable_elc_event(), ra8_lvd_enable_irq(), ra8_lvd_enable_reset(), ra8_lvd_get_status(), ra8_lvd_set_filter(), ra8_lvd_set_hysteresis_mode(), ra8_lvd_set_irq_edge(), ra8_lvd_set_irq_kind(), ra8_lvd_set_negate_mode(), and ra8_lvd_set_threshold().