|
ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
|
The single esp-hosted transaction, its decode and its verdict. More...
#include <stdint.h>#include "c6_hosted.h"#include "esp_hosted_header.h"#include "esp_hosted_interface.h"#include "esp_hosted_os_abstraction.h"#include "esp_hosted_transport.h"#include "port_esp_hosted_host_os.h"#include "port_esp_hosted_host_spi.h"#include "transport_drv.h"Go to the source code of this file.
Enumerations | |
| enum | c6_hosted_proto_t : uint16_t { k_c6_hosted_hdr_bytes = (uint16_t)sizeof(struct esp_payload_header) , k_c6_hosted_max_payload = (uint16_t)MAX_PAYLOAD_SIZE , k_c6_hosted_byte_ones = 0xFFU , k_c6_hosted_filler_if_num = 0x0FU } |
| Protocol sizes the verdict is judged against. More... | |
| enum | c6_hosted_fill_t : uint8_t { k_c6_hosted_fill_mixed = 0U , k_c6_hosted_fill_zero = 1U , k_c6_hosted_fill_ones = 2U } |
| Coarse classification of the whole received buffer. More... | |
| enum | c6_hosted_verdict_t : uint8_t { k_c6_hosted_verdict_pass = 0U , k_c6_hosted_verdict_idle = 1U , k_c6_hosted_verdict_transfer = 2U , k_c6_hosted_verdict_zero = 3U , k_c6_hosted_verdict_ones = 4U , k_c6_hosted_verdict_offset = 5U , k_c6_hosted_verdict_length = 6U , k_c6_hosted_verdict_csum = 7U } |
| Outcome of the single transaction, in the order it is tested. More... | |
Functions | |
| static void | c6_hosted_build_idle_frame (void) |
| Build the idle frame this application transmits. | |
| static c6_hosted_fill_t | c6_hosted_rx_fill (void) |
| Classify the received buffer as all-zero, all-ones or mixed. | |
| static uint16_t | c6_hosted_rx_checksum (void) |
| Recompute the checksum of the received frame. | |
| static c6_hosted_verdict_t | c6_hosted_classify (int32_t rc, uint16_t calc) |
| Decide the verdict for the completed transaction. | |
| static const char * | c6_hosted_verdict_text (c6_hosted_verdict_t verdict) |
| Map a verdict onto the text printed after PASS or FAIL. | |
| static void | c6_hosted_print_rx_header (uint16_t calc) |
| Print every field of the received payload header. | |
| void | c6_hosted_run_transaction (void) |
| Clock one full-duplex transaction and report the verdict. | |
Variables | |
| static c6_hosted_frame_t | s_c6_hosted_tx |
| Transmit buffer holding the single idle frame this app sends. | |
| static c6_hosted_frame_t | s_c6_hosted_rx |
| Receive buffer the co-processor's frame lands in. | |
The single esp-hosted transaction, its decode and its verdict.
Builds one valid zero-length esp-hosted frame, clocks it through the OS-abstraction vtable's _h_do_bus_transfer, decodes whatever came back and prints a single PASS/FAIL verdict line.
The undriven-bus test comes before the header tests deliberately. The C6 holds its controller-in line with an internal pull-down, so a connected co-processor that never saw a valid transaction reads all-zero, while an unterminated RA8 input floats to all-ones; the two are different faults, and reporting either as a checksum mismatch would point at the wrong problem entirely. See the app README for what each verdict implicates.
Every protocol size is read from the vendored headers rather than restated, so an upstream change moves this file with it.
Definition in file c6_hosted_frame.c.
| enum c6_hosted_fill_t : uint8_t |
Coarse classification of the whole received buffer.
A buffer that is uniformly 0x00 or uniformly 0xFF did not come from a peripheral, so it is reported as an undriven bus rather than as whatever header-shaped nonsense its first twelve bytes happen to form.
| Enumerator | |
|---|---|
| k_c6_hosted_fill_mixed | The buffer holds a mix of byte values. |
| k_c6_hosted_fill_zero | Every byte is 0x00. |
| k_c6_hosted_fill_ones | Every byte is 0xFF. |
Definition at line 97 of file c6_hosted_frame.c.
| enum c6_hosted_proto_t : uint16_t |
Protocol sizes the verdict is judged against.
Each value is derived from a vendored header, so an upstream change to the transport buffer or the payload header moves these with it instead of leaving a stale literal behind.
Definition at line 66 of file c6_hosted_frame.c.
| enum c6_hosted_verdict_t : uint8_t |
Outcome of the single transaction, in the order it is tested.
One enumerator per failing check, so the printed reason names the first thing that was actually wrong instead of a generic failure.
Definition at line 117 of file c6_hosted_frame.c.
|
static |
Build the idle frame this application transmits.
Definition at line 169 of file c6_hosted_frame.c.
References k_c6_hosted_hdr_bytes, and s_c6_hosted_tx.
Referenced by c6_hosted_run_transaction().
|
static |
Decide the verdict for the completed transaction.
| [in] | rc | Value _h_do_bus_transfer returned. |
| [in] | calc | Checksum recomputed by c6_hosted_rx_checksum. |
| k_c6_hosted_verdict_transfer | The transfer itself failed. |
| k_c6_hosted_verdict_zero | The bus was never driven (all-zero). |
| k_c6_hosted_verdict_ones | The bus was never driven (all-ones). |
| k_c6_hosted_verdict_offset | Offset is not the header size. |
| k_c6_hosted_verdict_length | Length exceeds MAX_PAYLOAD_SIZE. |
| k_c6_hosted_verdict_csum | Checksum mismatch. |
| k_c6_hosted_verdict_idle | The co-processor's filler frame. |
| k_c6_hosted_verdict_pass | Every check passed. |
calc came from c6_hosted_rx_checksum for this same buffer. Definition at line 271 of file c6_hosted_frame.c.
References c6_hosted_rx_fill(), k_c6_hosted_fill_ones, k_c6_hosted_fill_zero, k_c6_hosted_filler_if_num, k_c6_hosted_hdr_bytes, k_c6_hosted_max_payload, k_c6_hosted_verdict_csum, k_c6_hosted_verdict_idle, k_c6_hosted_verdict_length, k_c6_hosted_verdict_offset, k_c6_hosted_verdict_ones, k_c6_hosted_verdict_pass, k_c6_hosted_verdict_transfer, k_c6_hosted_verdict_zero, RET_OK, and s_c6_hosted_rx.
Referenced by c6_hosted_run_transaction().
|
static |
Print every field of the received payload header.
| [in] | calc | Checksum recomputed by c6_hosted_rx_checksum. |
Definition at line 352 of file c6_hosted_frame.c.
References c6_hosted_put_hex(), c6_hosted_put_u32(), c6_hosted_puts(), k_c6_hosted_hex_byte, k_c6_hosted_hex_csum, and s_c6_hosted_rx.
Referenced by c6_hosted_run_transaction().
| void c6_hosted_run_transaction | ( | void | ) |
Clock one full-duplex transaction and report the verdict.
Definition at line 373 of file c6_hosted_frame.c.
References c6_hosted_build_idle_frame(), c6_hosted_classify(), c6_hosted_print_rx_header(), c6_hosted_put_i32(), c6_hosted_put_u32(), c6_hosted_puts(), c6_hosted_rx_checksum(), c6_hosted_verdict_text(), g_h, k_c6_hosted_frame_bytes, k_c6_hosted_verdict_idle, k_c6_hosted_verdict_pass, s_c6_hosted_rx, and s_c6_hosted_tx.
Referenced by c6_hosted_worker_entry().
|
static |
Recompute the checksum of the received frame.
Definition at line 235 of file c6_hosted_frame.c.
References k_c6_hosted_hdr_bytes, k_c6_hosted_max_payload, and s_c6_hosted_rx.
Referenced by c6_hosted_run_transaction().
|
static |
Classify the received buffer as all-zero, all-ones or mixed.
| k_c6_hosted_fill_zero | Every byte is 0x00. |
| k_c6_hosted_fill_ones | Every byte is 0xFF. |
| k_c6_hosted_fill_mixed | Anything else. |
Definition at line 200 of file c6_hosted_frame.c.
References k_c6_hosted_byte_ones, k_c6_hosted_fill_mixed, k_c6_hosted_fill_ones, k_c6_hosted_fill_zero, k_c6_hosted_frame_bytes, and s_c6_hosted_rx.
Referenced by c6_hosted_classify().
|
static |
Map a verdict onto the text printed after PASS or FAIL.
| [in] | verdict | Verdict to describe. |
| link up | The verdict is k_c6_hosted_verdict_pass. |
| link up – co-processor returned its idle filler frame | The verdict is k_c6_hosted_verdict_idle. |
verdict came from c6_hosted_classify. Definition at line 316 of file c6_hosted_frame.c.
References k_c6_hosted_verdict_csum, k_c6_hosted_verdict_idle, k_c6_hosted_verdict_length, k_c6_hosted_verdict_offset, k_c6_hosted_verdict_ones, k_c6_hosted_verdict_pass, k_c6_hosted_verdict_transfer, and k_c6_hosted_verdict_zero.
Referenced by c6_hosted_run_transaction().
|
static |
Receive buffer the co-processor's frame lands in.
Same type and alignment as s_c6_hosted_tx, and left zero until the transfer runs, so an all-zero buffer afterwards genuinely means nothing was clocked in.
Definition at line 155 of file c6_hosted_frame.c.
Referenced by c6_hosted_classify(), c6_hosted_print_rx_header(), c6_hosted_run_transaction(), c6_hosted_rx_checksum(), and c6_hosted_rx_fill().
|
static |
Transmit buffer holding the single idle frame this app sends.
A c6_hosted_frame_t, so the payload header is reached through a union member rather than a cast. Aligned to k_c6_hosted_dma_align, the alignment the transport expects of a transaction buffer. Zero as .bss, so the bytes after the header are already the padding a valid frame wants.
Definition at line 142 of file c6_hosted_frame.c.
Referenced by c6_hosted_build_idle_frame(), and c6_hosted_run_transaction().