ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
Loading...
Searching...
No Matches
c6_proto.h
Go to the documentation of this file.
1
36#pragma once
37
38#include <stdint.h>
39
40/* =============================================================================
41 * 1. Transport dimensions, header layout and interface identifiers
42 * =============================================================================
43 */
44
67typedef enum : uint16_t {
72
109
141
171typedef enum : uint8_t {
176
193typedef enum : uint8_t {
198} c6_bitop_t;
199
200/* =============================================================================
201 * 2. Frame decode, checksum and classification
202 * =============================================================================
203 */
204
230
246typedef struct {
247 uint8_t if_type;
248 uint8_t if_num;
249 uint8_t flags;
250 uint16_t len;
251 uint16_t offset;
252 uint16_t checksum;
253 uint16_t seq_num;
254 uint8_t throttle;
255 uint8_t pkt_type;
256 uint16_t computed;
257} c6_hdr_t;
258
281void c6_probe_decode_header(const uint8_t* buf, c6_hdr_t* out);
282
316uint16_t c6_probe_checksum(const uint8_t* buf, uint16_t count);
317
345
366void c6_probe_print_header(const c6_hdr_t* h);
367
389void c6_probe_dump_payload(const uint8_t* buf, uint16_t len);
void c6_probe_decode_header(const uint8_t *buf, c6_hdr_t *out)
Unpack the twelve-byte esp-hosted payload header.
Definition c6_frame.c:72
void c6_probe_print_header(const c6_hdr_t *h)
Print the decoded header fields on one console line.
Definition c6_frame.c:116
c6_bitop_t
Shifts and masks used to unpack the header.
Definition c6_proto.h:193
@ k_c6_shift_nibble
if_num sits in the upper nibble.
Definition c6_proto.h:194
@ k_c6_mask_throttle
throttle_cmd occupies bits 1:0.
Definition c6_proto.h:197
@ k_c6_mask_nibble
Four-bit field mask.
Definition c6_proto.h:195
@ k_c6_shift_byte
Little-endian high-byte shift.
Definition c6_proto.h:196
c6_hdr_offset_t
Byte offsets of every field in the esp-hosted payload header.
Definition c6_proto.h:95
@ k_c6_hdr_off_off_lo
Payload offset, low byte.
Definition c6_proto.h:100
@ k_c6_hdr_off_pkttype
reserved3 / hci_ or priv_pkt_type.
Definition c6_proto.h:107
@ k_c6_hdr_off_seq_hi
Sequence number, high byte.
Definition c6_proto.h:105
@ k_c6_hdr_off_throttle
throttle_cmd[1:0] | reserved[7:2].
Definition c6_proto.h:106
@ k_c6_hdr_off_seq_lo
Sequence number, low byte.
Definition c6_proto.h:104
@ k_c6_hdr_off_iface
if_type[3:0] | if_num[7:4].
Definition c6_proto.h:96
@ k_c6_hdr_off_off_hi
Payload offset, high byte.
Definition c6_proto.h:101
@ k_c6_hdr_off_flags
Fragment / wake / power-save bits.
Definition c6_proto.h:97
@ k_c6_hdr_off_csum_lo
Checksum, low byte.
Definition c6_proto.h:102
@ k_c6_hdr_off_len_lo
Payload length, low byte.
Definition c6_proto.h:98
@ k_c6_hdr_off_len_hi
Payload length, high byte.
Definition c6_proto.h:99
@ k_c6_hdr_off_csum_hi
Checksum, high byte.
Definition c6_proto.h:103
void c6_probe_dump_payload(const uint8_t *buf, uint16_t len)
Hex-dump the leading payload bytes of a received frame.
Definition c6_frame.c:142
c6_proto_priv_t
Private-interface packet and event tags, plus the filler signature.
Definition c6_proto.h:171
@ k_c6_dummy_if_num
if_num the C6 stamps into filler frames.
Definition c6_proto.h:174
@ k_c6_priv_event_init
event_type of the boot INIT event.
Definition c6_proto.h:173
@ k_c6_priv_pkt_event
priv_pkt_type of an event frame.
Definition c6_proto.h:172
c6_proto_dim_t
Fixed transport dimensions of the esp-hosted SPI FD transport.
Definition c6_proto.h:67
@ k_c6_proto_payload_max
Largest payload the header may claim.
Definition c6_proto.h:70
@ k_c6_proto_buf_size
Bytes clocked per transaction.
Definition c6_proto.h:68
@ k_c6_proto_hdr_size
sizeof(struct esp_payload_header).
Definition c6_proto.h:69
c6_frame_kind_t
Classification of one received 1600-byte transaction.
Definition c6_proto.h:224
@ k_c6_frame_data
Real frame, checksum verified.
Definition c6_proto.h:227
@ k_c6_frame_bad_csum
Header shape sane, checksum mismatched.
Definition c6_proto.h:228
@ k_c6_frame_garbage
No recognisable esp-hosted structure.
Definition c6_proto.h:225
@ k_c6_frame_idle
The C6's idle filler frame.
Definition c6_proto.h:226
uint16_t c6_probe_checksum(const uint8_t *buf, uint16_t count)
Recompute the esp-hosted checksum over a received frame.
Definition c6_frame.c:55
c6_frame_kind_t c6_probe_classify(const c6_hdr_t *h)
Judge a decoded header against the upstream receive rules.
Definition c6_frame.c:95
c6_if_type_t
esp-hosted interface identifiers carried in if_type.
Definition c6_proto.h:130
@ k_c6_if_hci
Bluetooth HCI.
Definition c6_proto.h:135
@ k_c6_if_priv
Private events, e.g.
Definition c6_proto.h:136
@ k_c6_if_ap
Wi-Fi soft-AP data.
Definition c6_proto.h:133
@ k_c6_if_serial
Control-plane (RPC) channel.
Definition c6_proto.h:134
@ k_c6_if_max
Idle filler marker.
Definition c6_proto.h:139
@ k_c6_if_sta
Wi-Fi station data.
Definition c6_proto.h:132
@ k_c6_if_test
Raw throughput test channel.
Definition c6_proto.h:137
@ k_c6_if_eth
Ethernet data.
Definition c6_proto.h:138
@ k_c6_if_invalid
Unused slot zero.
Definition c6_proto.h:131
Decoded esp-hosted payload header plus the locally recomputed sum.
Definition c6_proto.h:246
uint16_t computed
Checksum recomputed over the receive buffer.
Definition c6_proto.h:256
uint16_t seq_num
Sender sequence number.
Definition c6_proto.h:253
uint16_t checksum
Checksum carried on the wire.
Definition c6_proto.h:252
uint16_t offset
Payload offset; always the header size.
Definition c6_proto.h:251
uint16_t len
Payload length claimed by the sender.
Definition c6_proto.h:250
uint8_t pkt_type
HCI / private packet sub-type.
Definition c6_proto.h:255
uint8_t if_num
Interface instance number.
Definition c6_proto.h:248
uint8_t flags
Fragment / wake / power-save bits.
Definition c6_proto.h:249
uint8_t throttle
Wi-Fi transmit throttle command.
Definition c6_proto.h:254
uint8_t if_type
Interface identifier (c6_if_type_t).
Definition c6_proto.h:247