ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
Loading...
Searching...
No Matches
c6_fwver.h
Go to the documentation of this file.
1
41
42#pragma once
43
44#include <stddef.h>
45#include <stdint.h>
46
47#include "esp_hosted_header.h"
49#include "ra8_err.h"
50
87
117
161
182typedef union c6_fwver_frame {
185 struct esp_payload_header header;
188
209typedef struct c6_fwver_pump_stats {
210 uint16_t transfers;
211 uint16_t frames;
212 uint16_t idle;
213 uint16_t bad_checksum;
214 uint16_t malformed;
215 uint16_t hs_timeouts;
216 uint16_t ifnum_defect;
221
237typedef bool (*c6_fwver_sink_t)(uint8_t if_type,
238 uint8_t if_num,
239 const uint8_t* payload,
240 uint16_t len);
241
256void c6_fwver_puts(const char* text);
257
270void c6_fwver_put_u32(uint32_t value);
271
285void c6_fwver_put_i32(int32_t value);
286
302void c6_fwver_put_hex(uint32_t value, uint8_t digits);
303
321void c6_fwver_put_text(const uint8_t* text, size_t len);
322
338void c6_fwver_print_banner(uint32_t cpuclk_hz, uint32_t pclka_hz);
339
357void c6_fwver_print_pump(const char* label, const c6_fwver_pump_stats_t* stats);
358
420[[nodiscard]] ra8_err_t c6_fwver_link_pump(uint8_t if_type,
421 uint8_t if_num,
422 const uint8_t* payload,
423 uint16_t payload_len,
424 uint16_t max_transfers,
425 c6_fwver_sink_t sink,
426 c6_fwver_pump_stats_t* stats);
427
450[[nodiscard]] ra8_err_t c6_fwver_priv_host_caps(uint8_t* out, uint16_t cap, uint16_t* out_len);
451
473bool c6_fwver_priv_consume(uint8_t if_type, uint8_t if_num, const uint8_t* payload, uint16_t len);
474
489[[nodiscard]] uint32_t c6_fwver_priv_init_version(void);
490
515[[nodiscard]] ra8_err_t c6_fwver_rpc_request(uint8_t* out, uint16_t cap, uint16_t* out_len);
516
539bool c6_fwver_rpc_consume(uint8_t if_type, uint8_t if_num, const uint8_t* payload, uint16_t len);
540
559bool c6_fwver_rpc_report(void);
560
578bool c6_fwver_dispatch(uint8_t if_type, uint8_t if_num, const uint8_t* payload, uint16_t len);
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.
c6_fwver_cfg_t
Link, thread and pacing parameters this application chooses.
Definition c6_fwver.h:70
@ k_c6_fwver_worker_prio
Worker priority and preemption threshold.
Definition c6_fwver.h:83
@ k_c6_fwver_edge_poll_ms
Poll period for a side-band pin with no ICU channel.
Definition c6_fwver.h:74
@ k_c6_fwver_heartbeat_ms
Heartbeat gap after the verdict, in milliseconds and therefore in ThreadX ticks.
Definition c6_fwver.h:77
@ k_c6_fwver_boot_wait_ms
Settling delay before the first transaction.
Definition c6_fwver.h:76
@ k_c6_fwver_uart_baud
Console rate, 8N1, over the J-Link OB VCOM.
Definition c6_fwver.h:71
@ k_c6_fwver_rpc_uid
UID stamped on the request; the response must carry it back unchanged.
Definition c6_fwver.h:84
@ k_c6_fwver_worker_stack
Worker-thread stack, in bytes.
Definition c6_fwver.h:80
@ k_c6_fwver_sck_hz
SPI bit rate; the rate the port ran at on silicon in the c6_hosted_init bring-up.
Definition c6_fwver.h:72
@ k_c6_fwver_dma_align
Transaction-buffer alignment, in bytes.
Definition c6_fwver.h:79
bool(* c6_fwver_sink_t)(uint8_t if_type, uint8_t if_num, const uint8_t *payload, uint16_t len)
Receiver for one well-formed frame the co-processor sent.
Definition c6_fwver.h:237
bool c6_fwver_rpc_consume(uint8_t if_type, uint8_t if_num, const uint8_t *payload, uint16_t len)
Decode an ESP_SERIAL_IF frame as the awaited RPC response.
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.
void c6_fwver_put_i32(int32_t value)
Emit a signed 32-bit value in decimal.
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.
void c6_fwver_put_hex(uint32_t value, uint8_t digits)
Emit a value as a fixed-width lower-case hexadecimal field.
c6_fwver_link_t
Frame geometry and pump budgets the transaction layer works to.
Definition c6_fwver.h:138
@ k_c6_fwver_gap_ms
Settling gap between consecutive transactions.
Definition c6_fwver.h:154
@ k_c6_fwver_hs_poll_ms
Sampling period while waiting for HANDSHAKE.
Definition c6_fwver.h:152
@ k_c6_fwver_max_transfers
Transactions one pump may clock before giving up.
Definition c6_fwver.h:141
@ k_c6_fwver_hs_giveup
Consecutive HANDSHAKE timeouts after which the pump stops.
Definition c6_fwver.h:145
@ k_c6_fwver_frame_bytes
Bytes clocked in one full-duplex transaction.
Definition c6_fwver.h:139
@ k_c6_fwver_hs_wait_ms
Milliseconds to wait for HANDSHAKE before abandoning a transaction.
Definition c6_fwver.h:143
@ k_c6_fwver_tx_max
Bound on any payload this application transmits: the packed RPC request and its TLV envelope are two ...
Definition c6_fwver.h:156
union c6_fwver_frame c6_fwver_frame_t
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_priv_consume(uint8_t if_type, uint8_t if_num, const uint8_t *payload, uint16_t len)
Decode an ESP_PRIV_IF frame and report what it announced.
c6_fwver_fmt_t
Bounds for the console formatters in src/c6_fwver_console.c.
Definition c6_fwver.h:103
@ k_c6_fwver_hex_word
Hex digits printed for a 16-bit field.
Definition c6_fwver.h:112
@ k_c6_fwver_hex_byte
Hex digits printed for a byte-wide field.
Definition c6_fwver.h:111
@ k_c6_fwver_hex_alpha
First nibble value spelled with a letter.
Definition c6_fwver.h:110
@ k_c6_fwver_str_max
Longest string the console helper emits.
Definition c6_fwver.h:104
@ k_c6_fwver_dec_digits
Digits in the widest 32-bit decimal value.
Definition c6_fwver.h:106
@ k_c6_fwver_dec_radix
Decimal radix.
Definition c6_fwver.h:105
@ k_c6_fwver_hex_mask
Nibble mask.
Definition c6_fwver.h:109
@ k_c6_fwver_hex_digits
Digits in the widest 32-bit hex value.
Definition c6_fwver.h:107
@ k_c6_fwver_text_max
Longest co-processor-supplied string echoed to the console; anything longer is truncated rather than ...
Definition c6_fwver.h:113
@ k_c6_fwver_hex_bits
Bits per hexadecimal digit.
Definition c6_fwver.h:108
void c6_fwver_put_text(const uint8_t *text, size_t len)
Emit a length-counted byte range as printable text.
bool c6_fwver_rpc_report(void)
Print the recorded response and decide the run's verdict.
uint32_t c6_fwver_priv_init_version(void)
Report the version the boot INIT event announced, if one arrived.
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.
#define MAX_TRANSPORT_BUFFER_SIZE
Bytes moved in one SDIO block transfer.
esp-hosted port header: full-duplex SPI transport buffer size.
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
What one call to c6_fwver_link_pump actually did on the wire.
Definition c6_fwver.h:209
uint16_t malformed
Frames whose offset or length could not be believed.
Definition c6_fwver.h:214
uint16_t idle
Filler frames the co-processor returned (len zero).
Definition c6_fwver.h:212
bool bus_error
A bus transfer did not return RET_OK.
Definition c6_fwver.h:218
uint16_t transfers
Full-duplex transactions clocked.
Definition c6_fwver.h:210
bool sink_stopped
The sink asked the pump to stop early.
Definition c6_fwver.h:219
uint16_t bad_checksum
Frames whose recomputed checksum disagreed.
Definition c6_fwver.h:213
uint16_t frames
Well-formed payload frames handed to the sink.
Definition c6_fwver.h:211
uint16_t ifnum_defect
Bad-checksum frames explained by the co-processor's if_num accounting; see the app README.
Definition c6_fwver.h:216
uint16_t hs_timeouts
Transactions abandoned waiting for HANDSHAKE.
Definition c6_fwver.h:215
One esp-hosted transaction buffer, addressable either way.
Definition c6_fwver.h:182
uint8_t bytes[k_c6_fwver_frame_bytes]
The transaction as the transport sees it: flat bytes.
Definition c6_fwver.h:183
struct esp_payload_header header
The same storage as the protocol sees it: a payload header.
Definition c6_fwver.h:185