ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
Loading...
Searching...
No Matches
ra8_c6link.h
Go to the documentation of this file.
1
70
71#pragma once
72
73#ifdef __cplusplus
74extern "C" {
75#endif
76
77#include <stdint.h>
78
80#include "ra8_err.h"
81#include "ra8_mdl_protocol.h"
82
130
176
201
224typedef struct ra8_c6link_fw_version {
225 uint32_t major;
226 uint32_t minor;
227 uint32_t patch;
228 uint32_t chip_id;
229 char target[16];
230 uint8_t target_len;
232
266
309
332typedef struct ra8_c6link_fault {
333 uint32_t rpc_id;
334 int32_t resp;
336
361typedef struct ra8_c6link_stats {
362 uint16_t transfers;
363 uint16_t data;
364 uint16_t idle;
365 uint16_t bad_checksum;
366 uint16_t malformed;
367 uint16_t rpc_in;
368 uint16_t events;
369 uint16_t eth_in;
370 uint16_t undecodable;
371 uint16_t unrouted;
372 uint16_t hs_timeouts;
374
389typedef void (*ra8_c6link_event_cb_t)(void* ctx, const ra8_c6link_event_t* ev);
390
407typedef void (*ra8_c6link_rx_cb_t)(void* ctx, const uint8_t* frame, uint16_t len);
408
441
462typedef ra8_err_t (*ra8_c6link_take_fn_t)(void* ctx, const void* msg);
463
494
518typedef struct ra8_c6link {
522 void* cb_ctx;
523 uint8_t* arena;
524 uint32_t arena_bytes;
525 uint32_t arena_used;
526 uint32_t arena_last;
528 uint32_t next_uid;
532 /* tx_len/tx_if/open/boot_seen sit AFTER the two DMA-aligned frame buffers
533 and mdl_request, not beside the other bookkeeping fields above: the
534 bookkeeping ahead of `tx` already sums to an exact multiple of
535 k_ra8_c6link_dma_align, so `tx` needs no compiler-inserted padding to
536 reach its alignment boundary. Moving these four scalars back up
537 reintroduces 64 bytes of padding (verified via sizeof/offsetof) and
538 trips clang-analyzer-optin.performance.Padding. */
553 uint16_t tx_len;
554 uint8_t tx_if;
555 bool open;
558
602[[nodiscard]] ra8_err_t ra8_c6link_open(ra8_c6link_t* link, const ra8_c6link_cfg_t* cfg);
603
634[[nodiscard]] ra8_err_t ra8_c6link_close(ra8_c6link_t* link);
635
660[[nodiscard]] bool ra8_c6link_is_open(const ra8_c6link_t* link);
661
713[[nodiscard]] ra8_err_t
714ra8_c6link_poll(ra8_c6link_t* link, uint16_t max_transactions, ra8_c6link_stats_t* stats);
715
787[[nodiscard]] ra8_err_t
788ra8_c6link_await_ready(ra8_c6link_t* link, uint16_t max_transactions, ra8_c6link_fw_version_t* out);
789
830
873[[nodiscard]] ra8_err_t ra8_c6link_eth_send(ra8_c6link_t* link, const uint8_t* frame, uint16_t len);
874
903[[nodiscard]] ra8_err_t ra8_c6link_last_fault(const ra8_c6link_t* link, ra8_c6link_fault_t* out);
904
905#ifdef __cplusplus
906}
907#endif
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
Allocation-free constants shared by the RA8 and C6 media endpoints.
@ k_ra8_mdl_request_bytes_max
Maximum packed request bytes.