102 "P800(J26-1 in UART mux)",
105 "P803(J26-4 in SPI mux)",
106 "P804(J26-1 in SPI mux)",
123 if (out ==
nullptr) {
161 if (pre ==
nullptr || mid ==
nullptr || post ==
nullptr || st ==
nullptr) {
165 if (pre->
level[i] != 0U && mid->
level[i] == 0U) {
168 if (pre->
level[i] != 0U && post->
level[i] == 0U) {
171 if (pre->
level[i] != 0U || mid->
level[i] != 0U || post->
level[i] != 0U) {
174 if (pre->
level[i] == 0U || mid->
level[i] == 0U || post->
level[i] == 0U) {
180uint8_t
c6_probe_best(
const uint32_t* votes, uint8_t ignore, uint32_t min_votes)
182 if (votes ==
nullptr || min_votes == 0U) {
186 uint32_t best_score = 0U;
189 if (i == ignore || votes[i] < min_votes) {
192 if (votes[i] > best_score) {
193 best_score = votes[i];
198 if (votes[i] == best_score) {
233 if (out_low ==
nullptr) {
263 err = (released !=
k_ra8_ok) ? released : restored;
288 :
" follows the pull-up\r\n");
315 if (st ==
nullptr || hs_idx ==
nullptr || dr_idx ==
nullptr) {
357 if (out_level ==
nullptr) {
386 if (after_high != 0U && after_low == 0U) {
389 if (after_high == 0U && after_low == 0U) {
392 if (after_high != 0U && after_low != 0U) {
400 static const char*
const k_kind_name[] = {
401 "floating(no termination)",
402 "low-side(pull-down or driven low)",
403 "high-side(pull-up or driven high)",
407 uint8_t after_high = 0U;
408 uint8_t after_low = 0U;
472 bool answered =
false;
474 if (idle.
level[i] != 0U && asserted.
level[i] == 0U) {
Shared contract for the EK-RA8D2 <-> ESP32-C6 esp-hosted SPI probe.
@ k_c6_sb_count
Side-band pin count.
@ k_c6_probe_settle_ms
Post-transfer side-band settle.
@ k_c6_probe_cs_hold_ms
Chip-select setup / hold.
void c6_probe_puts(const char *text)
Emit a bounded, NUL-terminated ASCII literal on the console.
c6_wire_kind_t
What the drive-and-release test says is on the far end of a net.
@ k_c6_wire_low_side
Snapped to 0: pull-down or driven low.
@ k_c6_wire_high_side
Snapped to 1: pull-up or driven high.
@ k_c6_wire_odd
Inverted result: not physically sane.
@ k_c6_wire_floating
Held both levels: no termination.
void c6_probe_put_u32(uint32_t value)
Emit an unsigned integer in decimal.
@ k_c6_probe_min_votes
Votes required to claim a mapping.
@ k_c6_probe_pull_samples
Reads per pin in the pull-up contest.
@ k_c6_probe_pull_settle_ms
Settle between pull-up contest reads.
@ k_c6_wire_count
Muxed-net candidate count.
c6_wire_kind_t c6_probe_wire_kind(uint8_t after_high, uint8_t after_low)
Classify one Pmod1 net from its two drive-and-release samples.
void c6_probe_vote(const c6_sideband_sample_t *pre, const c6_sideband_sample_t *mid, const c6_sideband_sample_t *post, c6_probe_stats_t *st)
Fold one transaction's three samples into the classification votes.
const char * c6_probe_sideband_name(uint8_t idx)
Name a side-band pin for the console.
static const char *const k_c6_wire_label[k_c6_wire_count+1U]
Console labels for k_c6_wire_pin, same order.
static const ra8_port_pin_t k_c6_sideband_pin[k_c6_sb_count]
The four Pmod1 side-band pins, in c6_sideband_idx_t order.
static const char *const k_c6_sideband_label[k_c6_sb_count+1U]
Console labels for k_c6_sideband_pin, same order.
static ra8_err_t internal_kick_net(ra8_port_pin_t pin, ra8_level_t level, uint8_t *out_level)
Drive one net to a level, release it, and sample what it settles to.
static bool internal_cs_try(uint8_t idx, c6_probe_stats_t *st)
Assert one candidate chip-select and report any side-band response.
void c6_probe_sample_sideband(c6_sideband_sample_t *out)
Read every Pmod1 side-band pin into one sample.
void c6_probe_print_sideband(const char *label, const c6_sideband_sample_t *s)
Print a labelled side-band sample as label P006=1 P402=0 ....
ra8_err_t c6_probe_pull_contest(c6_probe_stats_t *st)
Find which side-band pins an external driver is holding low.
uint8_t c6_probe_sunk_pin(const c6_probe_stats_t *st, uint8_t ignore)
Name the one pin that lost every read of the pull-up contest.
static ra8_err_t internal_pull_read(ra8_port_pin_t pin, uint8_t *out_low)
Hold one pin against the internal pull-up and count the low reads.
ra8_err_t c6_probe_sideband_init(void)
Claim the four Pmod1 side-band pins as no-pull digital inputs.
uint8_t c6_probe_best(const uint32_t *votes, uint8_t ignore, uint32_t min_votes)
Pick the side-band pin that won the vote outright, or report none.
void c6_probe_wire_test(void)
Run the drive-and-release test over every Pmod1 muxed net.
static const ra8_port_pin_t k_c6_wire_pin[k_c6_wire_count]
The five Pmod1 muxed-net candidates, in c6_wire_idx_t order.
uint8_t c6_probe_cs_hunt(c6_probe_stats_t *st)
Find which MCU pin the board's Pmod1 mux has wired to the C6's chip-select, and identify HANDSHAKE at...
void c6_probe_resolve_map(const c6_probe_stats_t *st, uint8_t *hs_idx, uint8_t *dr_idx)
Resolve the HANDSHAKE and DATA_READY side-band map from the accumulated evidence.
Board-support layer for the Renesas EK-RA8D2 v1 evaluation kit.
@ k_ra8_board_pmod1_uart_cts
Pmod1 UART CTS (CTS2), P800.
@ k_ra8_board_pmod1_spi_copi
Pmod1.2 COPI (MOSI2/TXD2 per UM),P801.
@ k_ra8_board_pmod1_spi_sck
Pmod1.4 SCK (SCK2), P803.
@ k_ra8_board_pmod1_spi_cs
Pmod1.1 CS (SS2/IRQ14), P804.
@ k_ra8_board_pmod1_spi_cipo
Pmod1.3 CIPO (MISO2/RXD2 per UM),P802.
@ k_ra8_board_pmod1_gpio_a
Pmod1.9 GPIO, P412.
@ k_ra8_board_pmod1_gpio_b
Pmod1.10 GPIO, P413.
@ k_ra8_board_pmod1_irq
Pmod1.7 IRQ (IRQ11-DS), P006.
@ k_ra8_board_pmod1_reset
Pmod1.8 RESET, P402.
ra8_board_eth_pin_t pin
Pin.
Error Code Definitions for ra8-firmware.
@ k_ra8_ok
Success – operation completed with all postconditions satisfied.
@ k_ra8_err_null_ptr
Pointer was NULL where a valid pointer was required.
ra8_err_codes_t ra8_err_t
Canonical error-return type used by every ra8-firmware API.
ra8_port_pin_t
Packed (port << 8) | pin pin identifier.
ra8_level_t
Digital output / input level.
@ k_ra8_level_high
Drive or read 1.
@ k_ra8_level_low
Drive or read 0.
@ k_ra8_pull_none
No internal pull.
@ k_ra8_pull_up
Internal pull-up.
High-level GPIO helpers on top of the PORT + PFS register layer.
ra8_err_t ra8_gpio_read(ra8_port_pin_t pin, ra8_level_t *out_level)
Read a previously-configured input.
ra8_err_t ra8_gpio_input_init(ra8_port_pin_t pin, ra8_pin_pull_t pull)
Configure a pin as a digital input.
ra8_err_t ra8_gpio_output_init(ra8_port_pin_t pin, ra8_level_t init_level)
Configure a pin as a digital output and drive it to an initial level.
ra8_err_t ra8_gpio_write(ra8_port_pin_t pin, ra8_level_t level)
Drive a previously-configured output to the given level.
ra8_err_t ra8_gpio_release(ra8_port_pin_t pin)
Release a GPIO pin claim.
SysTick-based tick counter, delay and timestamp helpers.
void ra8_delay_ms(uint32_t ms)
Busy-wait for at least ms milliseconds.
Running evidence gathered across every transaction.
uint8_t pull_low[k_c6_sb_count]
Reads that lost to an external sink.
uint8_t ever_high[k_c6_sb_count]
Pin was seen high at least once.
uint32_t hs_vote[k_c6_sb_count]
Pin dropped while CS was asserted.
uint32_t dr_vote[k_c6_sb_count]
Pin dropped once the queue drained.
uint8_t pull_samples
Pull-up reads per pin; 0 = not run.
uint8_t ever_low[k_c6_sb_count]
Pin was seen low at least once.
One simultaneous reading of every side-band pin.
uint8_t level[k_c6_sb_count]
Per-pin logic level (0 or 1).