|
ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
|
IWDT window-mode refresh demo for EK-RA8D2. More...
#include <stdint.h>#include "ra8_attributes.h"#include "ra8_board_ek_ra8d2.h"#include "ra8_boot_entry.h"#include "ra8_cgc.h"#include "ra8_err.h"#include "ra8_isr.h"#include "ra8_iwdt.h"#include "ra8_time.h"Go to the source code of this file.
Enumerations | |
| enum | iwdt_demo_const_t : uint32_t { k_iwdt_demo_baud = 115200U , k_iwdt_demo_poll_ms = 50U } |
| Demo tunables. More... | |
| enum | iwdt_demo_window_t : uint16_t { k_iwdt_demo_window_low = 0x0400U , k_iwdt_demo_window_high = 0x0C00U } |
| Window bounds in 14-bit IWDTSR.CNTVAL units (HUM 28.2.2). More... | |
Functions | |
| static void | internal_panic_halt (void) |
| Park the core after an unrecoverable IWDT demo failure. | |
| static void | internal_setup_or_halt (void) |
| Initialize clocks, SysTick, SCI8, and LED1. | |
| static bool | internal_in_window (uint16_t counter) |
| Decide whether the live counter sits inside the legal window. | |
| void | main (void) |
| Poll and refresh the IWDT only inside its legal window. | |
Variables | |
| static const uint8_t | s_iwdt_demo_msg_refresh [] = "iwdt: refresh in window\r\n" |
| static const uint8_t | s_iwdt_demo_msg_boot [] = "iwdt: poll counter\r\n" |
IWDT window-mode refresh demo for EK-RA8D2.
Demonstrates the IWDT in window mode, distinct from the existing watchdog_demo which simply refreshes until it stops. The IWDT period and window-start / window-end positions are programmed in the OFS0 option-setting register at flash time – the chip cannot reconfigure them at runtime. This demo refreshes the counter only inside the legal window (between IWDTRPES and IWDTRPSS) via ra8_iwdt_refresh_deferred, observes the live counter via ra8_iwdt_get_counter, and reads the IWDTSR underflow / refresh- error status via ra8_iwdt_get_status to detect window violations.
Bring-up sequence:
Definition in file main.c.
| enum iwdt_demo_const_t : uint32_t |
| enum iwdt_demo_window_t : uint16_t |
|
static |
Decide whether the live counter sits inside the legal window.
Applies the inclusive lower and upper OFS0-derived bounds used by the foreground loop before requesting a deferred refresh.
| [in] | counter | Current 14-bit IWDT counter sample. |
| true | counter lies within both inclusive bounds. |
| false | counter is below the lower or above the upper bound. |
Definition at line 132 of file main.c.
References k_iwdt_demo_window_high, k_iwdt_demo_window_low, and RA8_INTERNAL.
Referenced by main().
|
static |
Park the core after an unrecoverable IWDT demo failure.
Repeatedly executes WFI, retaining live IWDT and status-register state for an attached debugger until reset.
Definition at line 69 of file main.c.
References RA8_INTERNAL.
|
static |
Initialize clocks, SysTick, SCI8, and LED1.
Brings the foreground loop's dependencies up in order and transfers to the panic helper if any clock, console, or LED operation fails.
Definition at line 89 of file main.c.
References internal_panic_halt(), k_iwdt_demo_baud, k_ra8_board_led1, k_ra8_clock_id_cpuclk0, k_ra8_ok, ra8_board_led_init(), ra8_board_uart_console_init(), ra8_cgc_get_clock_hz(), ra8_cgc_init(), RA8_INTERNAL, and ra8_time_init().
| void main | ( | void | ) |
Poll and refresh the IWDT only inside its legal window.
The application entry point Reset_Handler hands control to.
Emits the boot banner, initializes the option-controlled IWDT, samples its counter, and on legal samples queues a refresh, clears status, toggles LED1, and emits the refresh banner.
Definition at line 152 of file main.c.
References internal_in_window(), internal_panic_halt(), internal_setup_or_halt(), k_iwdt_demo_poll_ms, k_ra8_board_led1, k_ra8_ok, ra8_board_led_toggle(), ra8_board_uart_console_write(), ra8_delay_ms(), ra8_isr_globals_enable(), ra8_iwdt_clear_status(), ra8_iwdt_get_counter(), ra8_iwdt_init(), ra8_iwdt_refresh_deferred(), s_iwdt_demo_msg_boot, and s_iwdt_demo_msg_refresh.
|
static |