51#include "esp_hosted_interface.h"
79typedef enum : uint16_t {
176 __asm__
volatile(
"wfi");
317 c6_fwver_puts(passed ?
" verdict=PASS\r\n" :
" verdict=FAIL\r\n");
347 c6_fwver_puts(
"c6_fwver: FAIL port init failed -- no transaction attempted\r\n");
376 (void)first_unused_memory;
396 c6_fwver_puts(
"c6_fwver: worker thread creation failed\r\n");
416 c6_fwver_puts(
"c6_fwver: entering ThreadX; port init runs from tx_application_define\r\n");
void main(void)
Secure fallback main entry point.
Shared contract for the esp-hosted RPC round-trip application.
ra8_err_t c6_fwver_link_pump(uint8_t if_type, uint8_t if_num, const uint8_t *payload, uint16_t payload_len, uint16_t max_transfers, c6_fwver_sink_t sink, c6_fwver_pump_stats_t *stats)
Clock full-duplex transactions until the sink is satisfied.
@ k_c6_fwver_worker_prio
Worker priority and preemption threshold.
@ k_c6_fwver_edge_poll_ms
Poll period for a side-band pin with no ICU channel.
@ k_c6_fwver_heartbeat_ms
Heartbeat gap after the verdict, in milliseconds and therefore in ThreadX ticks.
@ k_c6_fwver_boot_wait_ms
Settling delay before the first transaction.
@ k_c6_fwver_uart_baud
Console rate, 8N1, over the J-Link OB VCOM.
@ k_c6_fwver_worker_stack
Worker-thread stack, in bytes.
@ k_c6_fwver_sck_hz
SPI bit rate; the rate the port ran at on silicon in the c6_hosted_init bring-up.
bool c6_fwver_dispatch(uint8_t if_type, uint8_t if_num, const uint8_t *payload, uint16_t len)
Route a received frame to the module that understands it.
void c6_fwver_print_banner(uint32_t cpuclk_hz, uint32_t pclka_hz)
Print the banner: identity, clocks and SPI parameters.
ra8_err_t c6_fwver_priv_host_caps(uint8_t *out, uint16_t cap, uint16_t *out_len)
Build the host-capabilities frame the reference host sends first.
void c6_fwver_print_pump(const char *label, const c6_fwver_pump_stats_t *stats)
Print what one pump did, as one console line.
@ k_c6_fwver_max_transfers
Transactions one pump may clock before giving up.
@ k_c6_fwver_tx_max
Bound on any payload this application transmits: the packed RPC request and its TLV envelope are two ...
struct c6_fwver_pump_stats c6_fwver_pump_stats_t
ra8_err_t c6_fwver_rpc_request(uint8_t *out, uint16_t cap, uint16_t *out_len)
Build the TLV-wrapped RPC firmware-version request.
bool c6_fwver_rpc_report(void)
Print the recorded response and decide the run's verdict.
void c6_fwver_put_u32(uint32_t value)
Emit an unsigned 32-bit value in decimal.
void c6_fwver_puts(const char *text)
Write a NUL-terminated string to the board console.
void tx_application_define(void *first_unused_memory)
ThreadX system-define hook: build worker thread + byte pool.
static void c6_fwver_worker_entry(ULONG thread_input)
Worker thread: report the init, run both phases, judge, heartbeat.
static void c6_fwver_phase_request(void)
Send the firmware-version request and pump until it is answered.
static ra8_err_t s_c6_fwver_init_err
Exact result of ra8_esp_hosted_port_init.
static void c6_fwver_phase_caps(void)
Send the host-capabilities event and drain the co-processor's.
static void c6_fwver_setup_or_halt(void)
Bring clocks, module-stop state, SysTick and the console up.
static void c6_fwver_heartbeat(bool passed)
Print a liveness line forever, never returning.
static CHAR s_c6_fwver_worker_name[]
Thread name handed to ThreadX.
static uint32_t s_c6_fwver_pclka_hz
Cached PCLKA rate, the SCI baud-clock source the port divides.
c6_fwver_pump_budget_t
Per-phase transaction budgets, so each phase bounds its own wait.
@ k_c6_fwver_caps_transfers
Transactions the capabilities phase clocks.
static TX_THREAD s_c6_fwver_worker
Control block of the single application thread.
static uint32_t s_c6_fwver_cpuclk_hz
Cached CPUCLK0 rate, used to programme SysTick.
static UCHAR s_c6_fwver_worker_stack[k_c6_fwver_worker_stack]
Stack backing s_c6_fwver_worker.
static void c6_fwver_panic_halt(void)
Park the CPU forever after an unrecoverable bring-up failure.
static uint8_t s_c6_fwver_txbuf[k_c6_fwver_tx_max]
Staging buffer for the one payload each phase transmits.
Board-support layer for the Renesas EK-RA8D2 v1 evaluation kit.
@ k_ra8_board_pmod1_sci_channel
Pmod1 (J26) Simple-SPI is SCI2.
ra8_err_t ra8_board_uart_console_init(uint32_t baud)
Configure SCI8 + PD02/PD03 as the debug-console UART.
Boot entry points shared between a vector table and its startup code.
High-level Clock Generation Circuit driver.
ra8_err_t ra8_cgc_get_clock_hz(ra8_clock_id_t id, uint32_t *out_hz)
Query the current frequency of a clock-tree domain.
@ k_ra8_clock_id_cpuclk0
Cortex-M85 CPUCLK0.
@ k_ra8_clock_id_pclka
PCLKA.
ra8_err_t ra8_cgc_init(void)
Configure the clock tree to a safe default.
Error Code Definitions for ra8-firmware.
@ k_ra8_err_not_initialized
Module not initialized – _init() not yet called successfully.
@ k_ra8_ok
Success – operation completed with all postconditions satisfied.
ra8_err_codes_t ra8_err_t
Canonical error-return type used by every ra8-firmware API.
const char * ra8_err_to_str(ra8_err_t err)
Human-readable string for an error code.
Public entry point of the RA8D2 + ThreadX port of esp-hosted.
struct ra8_esp_hosted_port_cfg ra8_esp_hosted_port_cfg_t
ra8_err_t ra8_esp_hosted_port_init(const ra8_esp_hosted_port_cfg_t *cfg)
Bring the esp-hosted port up and publish the OS-abstraction vtable.
void ra8_esp_hosted_mem_dump(const char *label)
Report transport pool occupancy at a named point.
NVIC + ICU IELSR allocator.
void ra8_isr_globals_enable(void)
Globally enable maskable interrupts (PRIMASK = 0).
Ref-counted Module Stop Control wrapper for the RA8D2.
ra8_err_t ra8_mstp_init(void)
Re-establish the ra8_mstp ref-count table from current hardware state.
SysTick-based tick counter, delay and timestamp helpers.
ra8_err_t ra8_time_init(uint32_t cpu_hz)
Initialise SysTick for a 1 kHz tick interrupt.
void ra8_delay_ms(uint32_t ms)
Busy-wait for at least ms milliseconds.
unsigned int UINT
ThreadX-compatible unsigned int (host stub).
char CHAR
ThreadX-compatible CHAR (host stub).
unsigned long ULONG
ThreadX-compatible unsigned long (host stub).
Opaque thread stand-in for the host build.