|
ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
|
Hand-decoded esp-hosted payload header for the ESP32-C6 SPI probe. More...
Go to the source code of this file.
Functions | |
| static uint16_t | internal_le16 (const uint8_t *buf, uint8_t off_lo) |
| Read a little-endian 16-bit field out of a byte buffer. | |
| uint16_t | c6_probe_checksum (const uint8_t *buf, uint16_t count) |
| Recompute the esp-hosted checksum over a received frame. | |
| void | c6_probe_decode_header (const uint8_t *buf, c6_hdr_t *out) |
| Unpack the twelve-byte esp-hosted payload header. | |
| c6_frame_kind_t | c6_probe_classify (const c6_hdr_t *h) |
| Implementation of c6_probe_classify() – filler check first. | |
| void | c6_probe_print_header (const c6_hdr_t *h) |
| Print the decoded header fields on one console line. | |
| void | c6_probe_dump_payload (const uint8_t *buf, uint16_t len) |
| Hex-dump the leading payload bytes of a received frame. | |
Hand-decoded esp-hosted payload header for the ESP32-C6 SPI probe.
Unpacks and judges struct esp_payload_header (esp-hosted-mcu common/esp_hosted_header.h, pinned commit 949bb30) straight out of the receive buffer, without vendoring any upstream source. Field offsets, endianness and the acceptance rules all live in c6_proto.h next to the upstream file they were read from.
Definition in file c6_frame.c.
| uint16_t c6_probe_checksum | ( | const uint8_t * | buf, |
| uint16_t | count ) |
Recompute the esp-hosted checksum over a received frame.
compute_checksum() in esp-hosted-mcu common/transport/esp_hosted_transport.h is a plain 16-bit sum of every byte from the start of the header through the end of the payload. Both peers zero the checksum field before summing (process_spi_rx_buf in host/drivers/transport/spi/spi_drv.c), so the two checksum bytes are skipped here instead of being cleared, which leaves the receive buffer intact for the hex dump.
| [in] | buf | Receive buffer. |
| [in] | count | Bytes to sum: header offset plus payload length. |
| 0 | buf was NULL, count was zero, or the sum is zero. |
Definition at line 55 of file c6_frame.c.
References k_c6_hdr_off_csum_hi, k_c6_hdr_off_csum_lo, and k_c6_proto_buf_size.
Referenced by c6_probe_decode_header().
| c6_frame_kind_t c6_probe_classify | ( | const c6_hdr_t * | h | ) |
Implementation of c6_probe_classify() – filler check first.
Judge a decoded header against the upstream receive rules.
Definition at line 95 of file c6_frame.c.
References c6_hdr_t::checksum, c6_hdr_t::computed, c6_hdr_t::if_num, c6_hdr_t::if_type, k_c6_dummy_if_num, k_c6_frame_bad_csum, k_c6_frame_data, k_c6_frame_garbage, k_c6_frame_idle, k_c6_if_max, k_c6_proto_hdr_size, k_c6_proto_payload_max, c6_hdr_t::len, and c6_hdr_t::offset.
Referenced by internal_report_frame().
| void c6_probe_decode_header | ( | const uint8_t * | buf, |
| c6_hdr_t * | out ) |
Unpack the twelve-byte esp-hosted payload header.
| [in] | buf | Receive buffer holding a completed transaction. |
| [out] | out | Decoded header; ignored when NULL. |
Definition at line 72 of file c6_frame.c.
References c6_probe_checksum(), c6_hdr_t::checksum, c6_hdr_t::computed, c6_hdr_t::flags, c6_hdr_t::if_num, c6_hdr_t::if_type, internal_le16(), k_c6_hdr_off_csum_lo, k_c6_hdr_off_flags, k_c6_hdr_off_iface, k_c6_hdr_off_len_lo, k_c6_hdr_off_off_lo, k_c6_hdr_off_pkttype, k_c6_hdr_off_seq_lo, k_c6_hdr_off_throttle, k_c6_mask_nibble, k_c6_mask_throttle, k_c6_proto_hdr_size, k_c6_proto_payload_max, k_c6_shift_nibble, c6_hdr_t::len, c6_hdr_t::offset, c6_hdr_t::pkt_type, c6_hdr_t::seq_num, and c6_hdr_t::throttle.
Referenced by internal_report_frame().
| void c6_probe_dump_payload | ( | const uint8_t * | buf, |
| uint16_t | len ) |
Hex-dump the leading payload bytes of a received frame.
| [in] | buf | Receive buffer. |
| [in] | len | Payload length claimed by the header. |
Definition at line 142 of file c6_frame.c.
References c6_probe_put_hex(), c6_probe_puts(), k_c6_fmt_hex_byte, k_c6_probe_dump_bytes, and k_c6_proto_hdr_size.
Referenced by internal_report_frame().
| void c6_probe_print_header | ( | const c6_hdr_t * | h | ) |
Print the decoded header fields on one console line.
| [in] | h | Decoded header; ignored when NULL. |
Definition at line 116 of file c6_frame.c.
References c6_probe_put_hex(), c6_probe_put_u32(), c6_probe_puts(), c6_hdr_t::checksum, c6_hdr_t::computed, c6_hdr_t::flags, c6_hdr_t::if_num, c6_hdr_t::if_type, k_c6_fmt_hex_byte, k_c6_fmt_hex_word, c6_hdr_t::len, c6_hdr_t::offset, c6_hdr_t::pkt_type, and c6_hdr_t::seq_num.
Referenced by internal_report_frame().
|
static |
Read a little-endian 16-bit field out of a byte buffer.
Matches le16toh as used throughout esp-hosted-mcu, and is byte-order-correct on any host because it reassembles from bytes rather than aliasing a uint16_t.
| [in] | buf | Source buffer. |
| [in] | off_lo | Offset of the low byte; the high byte follows it. |
| 0 | buf was NULL or the field genuinely reads zero. |
Definition at line 46 of file c6_frame.c.
References k_c6_shift_byte.
Referenced by c6_probe_decode_header().