41#include "esp_hosted_header.h"
42#include "esp_hosted_interface.h"
43#include "esp_hosted_os_abstraction.h"
44#include "esp_hosted_transport.h"
47#include "transport_drv.h"
66typedef enum : uint16_t {
97typedef enum : uint8_t {
117typedef enum : uint8_t {
202 bool all_zero =
true;
203 bool all_ones =
true;
244 const uint16_t calc = compute_checksum(
s_c6_hosted_rx.bytes, span);
275 if (rc != (int32_t)
RET_OK) {
322 return "link up -- co-processor returned its idle filler frame";
324 return "bus transfer did not return RET_OK";
326 return "receive buffer all-zero -- co-processor did not drive the bus";
328 return "receive buffer all-ones -- co-processor did not drive the bus";
330 return "header offset is not the payload-header size";
332 return "advertised length exceeds MAX_PAYLOAD_SIZE";
334 return "checksum mismatch";
336 return "unrecognised verdict";
375 struct hosted_transport_context_t ctx = {};
382 const int32_t rc = (int32_t)
g_h.funcs->_h_do_bus_transfer(&ctx);
393 c6_hosted_puts(ok ?
"c6_hosted_init: PASS " :
"c6_hosted_init: FAIL ");
Shared contract for the esp-hosted port bring-up application.
union c6_hosted_frame c6_hosted_frame_t
@ k_c6_hosted_frame_bytes
Bytes clocked in one full-duplex transaction.
void c6_hosted_puts(const char *text)
Write a NUL-terminated string to the board console.
void c6_hosted_put_i32(int32_t value)
Emit a signed 32-bit value in decimal.
void c6_hosted_put_u32(uint32_t value)
Emit an unsigned 32-bit value in decimal.
void c6_hosted_put_hex(uint32_t value, uint8_t digits)
Emit a value as a fixed-width lower-case hexadecimal field.
@ k_c6_hosted_dma_align
Transaction-buffer alignment, in bytes.
@ k_c6_hosted_hex_byte
Hex digits printed for a byte-wide field.
@ k_c6_hosted_hex_csum
Hex digits printed for a 16-bit checksum.
static void c6_hosted_build_idle_frame(void)
Build the idle frame this application transmits.
static const char * c6_hosted_verdict_text(c6_hosted_verdict_t verdict)
Map a verdict onto the text printed after PASS or FAIL.
void c6_hosted_run_transaction(void)
Clock one full-duplex transaction and report the verdict.
static void c6_hosted_print_rx_header(uint16_t calc)
Print every field of the received payload header.
static c6_hosted_frame_t s_c6_hosted_tx
Transmit buffer holding the single idle frame this app sends.
static c6_hosted_verdict_t c6_hosted_classify(int32_t rc, uint16_t calc)
Decide the verdict for the completed transaction.
static uint16_t c6_hosted_rx_checksum(void)
Recompute the checksum of the received frame.
c6_hosted_fill_t
Coarse classification of the whole received buffer.
@ 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.
c6_hosted_proto_t
Protocol sizes the verdict is judged against.
@ k_c6_hosted_filler_if_num
The if_num the co-processor stamps into a filler frame.
@ k_c6_hosted_hdr_bytes
Payload-header size; twelve bytes on this ABI.
@ k_c6_hosted_max_payload
Largest payload a valid frame may advertise.
@ k_c6_hosted_byte_ones
The all-ones byte an unterminated RA8 input reads.
static c6_hosted_frame_t s_c6_hosted_rx
Receive buffer the co-processor's frame lands in.
static c6_hosted_fill_t c6_hosted_rx_fill(void)
Classify the received buffer as all-zero, all-ones or mixed.
c6_hosted_verdict_t
Outcome of the single transaction, in the order it is tested.
@ k_c6_hosted_verdict_transfer
The vtable transfer did not return RET_OK.
@ k_c6_hosted_verdict_csum
Received checksum differs from the recomputed one.
@ k_c6_hosted_verdict_offset
Header offset is not the payload-header size.
@ k_c6_hosted_verdict_idle
The co-processor's filler frame arrived: also a pass, and the usual answer to a host that asked nothi...
@ k_c6_hosted_verdict_length
Advertised length exceeds MAX_PAYLOAD_SIZE.
@ k_c6_hosted_verdict_ones
Receive buffer all-ones: bus not driven.
@ k_c6_hosted_verdict_zero
Receive buffer all-zero: bus not driven.
@ k_c6_hosted_verdict_pass
A data frame arrived and verified.
esp-hosted port header: RTOS handle types, return codes and budgets.
#define MAX_PAYLOAD_SIZE
Largest payload one transport frame can carry, in bytes.
#define RET_OK
Operation completed.
esp-hosted port header: full-duplex SPI transport buffer size.
struct hosted_config_t g_h
The handle the vendored core dereferences to reach the vtable.