|
ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
|
Event Link Controller (ELC) software-event demo for the 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_elc.h"#include "ra8_elc_regs.h"#include "ra8_err.h"#include "ra8_isr.h"#include "ra8_mstp.h"#include "ra8_time.h"Go to the source code of this file.
Enumerations | |
| enum | elc_demo_const_t : uint32_t { k_elc_demo_baud = 115200U , k_elc_demo_period_ms = 1000U } |
| App-wide tunables. More... | |
| enum | elc_demo_byte_t : uint8_t { k_elc_demo_slot = 0U , k_elc_demo_sw_event_idx = 0U , k_elc_demo_ascii_zero = '0' , k_elc_demo_ascii_one = '1' , k_elc_demo_dec_base = 10U , k_elc_demo_uint_dec_max = 10U , k_elc_demo_print_buf = 48U } |
| ELC slot / software-event indices used by the demo. More... | |
Functions | |
| static void | internal_panic_halt (void) |
| Park forever after a fatal init failure. | |
| static void | internal_setup_or_halt (void) |
| Bring CGC + SysTick + console + ELC up. | |
| static uint8_t | internal_uint_to_dec (uint8_t *buf, uint32_t v) |
| Write a decimal uint32 into buf. | |
| static uint32_t | internal_format_line (uint8_t *out, bool enabled, uint32_t trig_count) |
| Format the per-cycle "elc: en=N trig=NN\r\n" line. | |
| void | main (void) |
| Application entry. | |
Event Link Controller (ELC) software-event demo for the EK-RA8D2.
Standalone EVM-tier app that exercises the libs/ra8_hal/inc/ra8_elc.h driver. The Event Link Controller lets one peripheral fire another peripheral's input without CPU involvement (HUM Ch 19, p 817..836). This demo:
SCI8 prints "elc: en=1 trig=NN\r\n" once a second; LED1 toggles per cycle; LED2 latches on if any ELC call hard-fails.
Bare EK-RA8D2 only – no external pins required because the software trigger replaces a real edge.
Definition in file main.c.
| enum elc_demo_byte_t : uint8_t |
ELC slot / software-event indices used by the demo.
| enum elc_demo_const_t : uint32_t |
|
static |
Format the per-cycle "elc: en=N trig=NN\r\n" line.
Copies fixed prefix, separator, and line-ending fragments around one enabled digit and the decimal trigger count without using a NUL-terminated or variadic formatting API.
| [out] | out | Destination buffer. |
| [in] | enabled | ELCR.ELCON state. |
| [in] | trig_count | Software-trigger count. |
out. | 18..27 | Complete line length, depending on trigger-count width. |
Definition at line 204 of file main.c.
References internal_uint_to_dec(), k_elc_demo_ascii_one, k_elc_demo_ascii_zero, and RA8_INTERNAL.
Referenced by main().
|
static |
Park forever after a fatal init failure.
Repeatedly executes WFI so an attached debugger can inspect the failed bring-up state without further peripheral traffic.
Definition at line 84 of file main.c.
References RA8_INTERNAL.
|
static |
Bring CGC + SysTick + console + ELC up.
Panic-halts on any fail.
Initializes the clocks, timebase, polled console, ELC slot-zero route, and both status LEDs in dependency order. Any failed HAL call transfers control to the terminal panic helper.
Definition at line 105 of file main.c.
References internal_panic_halt(), k_elc_demo_baud, k_elc_demo_slot, k_ra8_board_led1, k_ra8_board_led2, k_ra8_clock_id_cpuclk0, k_ra8_elc_event_icu_irq0, k_ra8_ok, ra8_board_led_init(), ra8_board_uart_console_init(), ra8_cgc_get_clock_hz(), ra8_cgc_init(), ra8_elc_init(), ra8_elc_link(), RA8_INTERNAL, ra8_mstp_init(), and ra8_time_init().
|
static |
Write a decimal uint32 into buf.
Extracts digits into a fixed local reverse buffer, then copies them in display order. Zero takes the explicit single-digit path.
| [out] | buf | Destination buffer (must hold at least 10 chars). |
| [in] | v | Value to render. |
| 1 | A zero or single-digit value was rendered. |
| 2..10 | The exact number of digits in a larger value. |
Definition at line 162 of file main.c.
References k_elc_demo_ascii_zero, k_elc_demo_dec_base, k_elc_demo_uint_dec_max, and RA8_INTERNAL.
Referenced by internal_format_line().
| void main | ( | void | ) |
Application entry.
The application entry point Reset_Handler hands control to.
Fires ELC software events once a second.
Definition at line 235 of file main.c.
References internal_format_line(), internal_panic_halt(), internal_setup_or_halt(), k_elc_demo_period_ms, k_elc_demo_print_buf, k_elc_demo_sw_event_idx, k_ra8_board_led1, k_ra8_board_led2, k_ra8_ok, ra8_board_led_on(), ra8_board_led_toggle(), ra8_board_uart_console_write(), ra8_delay_ms(), ra8_elc_is_enabled(), ra8_elc_software_trigger(), and ra8_isr_globals_enable().