ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
Loading...
Searching...
No Matches
ra8_esp_hosted_pins.c File Reference

ICU external-interrupt routing table for the esp-hosted link pins. More...

#include "ra8_esp_hosted_pins.h"
#include <stdint.h>
#include "ra8_attributes.h"
#include "ra8_board_ek_ra8d2_connectors.h"
#include "ra8_port_constants.h"
Include dependency graph for ra8_esp_hosted_pins.c:

Go to the source code of this file.

Data Structures

struct  ra8_esp_hosted_irq_route
 One row of the pin-to-ICU-channel routing table. More...

Typedefs

typedef struct ra8_esp_hosted_irq_route ra8_esp_hosted_irq_route_row_t

Enumerations

enum  ra8_esp_hosted_irq_route_t : uint8_t {
  k_ra8_esp_hosted_irq_pmod1_sideband = 11U ,
  k_ra8_esp_hosted_irq_pmod1_cs = 14U
}
 ICU channel numbers the EK-RA8D2 board layer records for Pmod1. More...

Functions

uint8_t ra8_esp_hosted_pin_irq_num (ra8_port_pin_t pin)
 Implementation of ra8_esp_hosted_pin_irq_num() – linear scan over a compile-time-sized routing table, so no caller-supplied value ever indexes it.

Variables

static const ra8_esp_hosted_irq_route_row_t s_ra8_esp_hosted_irq_map []
 Pin-to-ICU-channel routing for every Pmod1 net the link may use.
static const uint32_t s_ra8_esp_hosted_irq_map_rows
 Row count of s_ra8_esp_hosted_irq_map.

Detailed Description

ICU external-interrupt routing table for the esp-hosted link pins.

Tag
[Ring 4 / PORT] {World: NS}

Companion to ra8_esp_hosted_pins.h. The header states which RA8 pin carries which link signal; this file states which of those pins the package routes to an ICU external-interrupt channel, which is a separate fact and the one that decides whether a side-band net gets a hardware edge or the port's software edge detector.

The table lists every Pmod1 net the link can plausibly land on – including the ones with no channel – so a "no channel" answer is an explicit recorded fact rather than the result of falling off the end of a shorter list. On this package the ICU external-interrupt inputs are concentrated on port 0 and a handful of others, so of the four Pmod1 side-band nets only P006 has a channel. As the harness is wired that is HANDSHAKE, and DATA_READY on P402 is polled.

Since
0.1.0

Definition in file ra8_esp_hosted_pins.c.

Typedef Documentation

◆ ra8_esp_hosted_irq_route_row_t

Enumeration Type Documentation

◆ ra8_esp_hosted_irq_route_t

ICU channel numbers the EK-RA8D2 board layer records for Pmod1.

Named here rather than written as bare numbers so the table below reads as signal routing rather than arithmetic. Both values come from the board connector header, which carries the board User's Manual citation for each net.

Invariant
Every value is within the 0..15 range ra8_gpio_attach_irq accepts.
Example:
const uint8_t ch = (uint8_t)k_ra8_esp_hosted_irq_pmod1_sideband;
@ k_ra8_esp_hosted_irq_pmod1_sideband
IRQ11, the channel P006 (J26-7) is routed to.
See also
ra8_esp_hosted_pin_irq_num
Since
0.1.0
Enumerator
k_ra8_esp_hosted_irq_pmod1_sideband 

IRQ11, the channel P006 (J26-7) is routed to.

It is deep-standby capable, which is why the board layer names it IRQ11-DS. As the harness is wired, P006 carries HANDSHAKE, so this is the channel the link's hardware edge runs on.

k_ra8_esp_hosted_irq_pmod1_cs 

IRQ14, the channel P804 (J26-1) is routed to.

The link drives that pin as a chip-select output, so the channel goes unused here; it is recorded because a future harness could move a side-band net onto J26-1 and would then inherit a hardware edge for free.

Definition at line 57 of file ra8_esp_hosted_pins.c.

Function Documentation

◆ ra8_esp_hosted_pin_irq_num()

uint8_t ra8_esp_hosted_pin_irq_num ( ra8_port_pin_t pin)
nodiscard

Implementation of ra8_esp_hosted_pin_irq_num() – linear scan over a compile-time-sized routing table, so no caller-supplied value ever indexes it.

Report the ICU external-interrupt channel that serves a pin.

Definition at line 131 of file ra8_esp_hosted_pins.c.

References k_ra8_esp_hosted_irq_none, pin, s_ra8_esp_hosted_irq_map, and s_ra8_esp_hosted_irq_map_rows.

Referenced by c6_hosted_print_route(), and internal_config_gpio_as_interrupt().

Variable Documentation

◆ s_ra8_esp_hosted_irq_map

const ra8_esp_hosted_irq_route_row_t s_ra8_esp_hosted_irq_map[]
static
Initial value:
= {
{.pin = (uint16_t)k_ra8_board_pmod1_irq, .irq = (uint8_t)k_ra8_esp_hosted_irq_pmod1_sideband},
{.pin = (uint16_t)k_ra8_board_pmod1_spi_cs, .irq = (uint8_t)k_ra8_esp_hosted_irq_pmod1_cs},
{.pin = (uint16_t)k_ra8_board_pmod1_reset, .irq = (uint8_t)k_ra8_esp_hosted_irq_none},
{.pin = (uint16_t)k_ra8_board_pmod1_gpio_a, .irq = (uint8_t)k_ra8_esp_hosted_irq_none},
{.pin = (uint16_t)k_ra8_board_pmod1_gpio_b, .irq = (uint8_t)k_ra8_esp_hosted_irq_none},
}
@ k_ra8_board_pmod1_spi_cs
Pmod1.1 CS (SS2/IRQ14), P804.
@ 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.
@ k_ra8_esp_hosted_irq_pmod1_cs
IRQ14, the channel P804 (J26-1) is routed to.
@ k_ra8_esp_hosted_irq_none
No ICU channel routes this pin.

Pin-to-ICU-channel routing for every Pmod1 net the link may use.

Rows carrying k_ra8_esp_hosted_irq_none are deliberate: they record that the package routes no external-interrupt channel to that net, so the port must poll it. Removing such a row would turn a stated fact into an accident of table length.

Note
Read-only; the only consumer is ra8_esp_hosted_pin_irq_num.
Warning
Edit this together with ra8_esp_hosted_pin_t when the harness changes; the two describe the same wiring.
Since
0.1.0

Definition at line 108 of file ra8_esp_hosted_pins.c.

Referenced by ra8_esp_hosted_pin_irq_num().

◆ s_ra8_esp_hosted_irq_map_rows

const uint32_t s_ra8_esp_hosted_irq_map_rows
static
Initial value:
=
(uint32_t)(sizeof(s_ra8_esp_hosted_irq_map) / sizeof(s_ra8_esp_hosted_irq_map[0]))
static const ra8_esp_hosted_irq_route_row_t s_ra8_esp_hosted_irq_map[]
Pin-to-ICU-channel routing for every Pmod1 net the link may use.

Row count of s_ra8_esp_hosted_irq_map.

Derived from the array so the loop bound cannot drift from the data it bounds.

Note
Read-only; compile-time constant.
Warning
Never write a literal row count in its place.
Since
0.1.0

Definition at line 125 of file ra8_esp_hosted_pins.c.

Referenced by ra8_esp_hosted_pin_irq_num().