45#include "ra8_esp_hosted_tx_shim_sync_internal.h"
59static const char*
const s_tag =
"eh_edge";
84typedef enum : uint8_t {
190 if (prev_level == now_level) {
394 if (period_ms == 0U) {
407 void (*handler)(
void*),
410 if (handler ==
nullptr) {
439 s_rows[slot].handler = handler;
441 s_rows[slot].sense = sense;
442 s_rows[slot].last_level = level;
static const char * s_tag
Logging / check tag.
Annotation-attribute framework macros for ra8-firmware.
#define RA8_PRIV
Module-private helper: shared across TUs but only inside one library.
#define RA8_INTERNAL
Marker that a function is intended to be static (file-local).
ra8_board_eth_pin_t pin
Pin.
Error Code Definitions for ra8-firmware.
@ k_ra8_err_no_mem
Static buffer exhausted (no dynamic memory on this project).
@ k_ra8_err_invalid_arg
Invalid function argument.
@ k_ra8_err_exists
Item already exists – cannot create again.
@ k_ra8_ok
Success – operation completed with all postconditions satisfied.
@ k_ra8_err_null_ptr
Pointer was NULL where a valid pointer was required.
@ k_ra8_err_rtos_error
Generic RTOS error (reserved for future use).
@ k_ra8_err_not_found
Requested item not found (lookup / search missed).
ra8_err_codes_t ra8_err_t
Canonical error-return type used by every ra8-firmware API.
const ra8_pin_interface_t * priv_ra8_esp_hosted_gpio_pin_interface(void)
Report the pin driver currently installed in the slice.
static void internal_timer_expiry(ULONG arg)
ThreadX expiry function: run one sampling pass.
static bool internal_sample(ra8_port_pin_t pin, uint8_t *out_level)
Read one pin through the slice's injected pin interface.
ra8_err_t priv_ra8_esp_hosted_gpio_edge_register(ra8_port_pin_t pin, uint8_t sense, void(*handler)(void *), void *arg)
Take a pin under software edge detection.
void priv_ra8_esp_hosted_gpio_edge_poll_once(void)
Sample every polled row once and dispatch the edges seen.
static uint8_t internal_find(ra8_port_pin_t pin)
Find the row watching a pin.
static char s_tx_name_eh_edge[]
Writable ThreadX object name for the eh_edge object.
static ra8_err_t internal_timer_arm(void)
Create the shared periodic timer if it is not already running.
ra8_err_t priv_ra8_esp_hosted_gpio_edge_unregister(ra8_port_pin_t pin)
Drop a pin from software edge detection.
static bool s_timer_live
True while s_timer has been created and not yet deleted.
static uint16_t s_poll_ms
Sampling period in milliseconds, shared by every polled row.
ra8_esp_hosted_gpio_edge_const_t
Named constants the detector needs beyond the shared limits.
@ k_ra8_esp_hosted_gpio_edge_low
Sample read low.
@ k_ra8_esp_hosted_gpio_edge_high
Sample read high.
@ k_ra8_esp_hosted_gpio_edge_one_row
Rows one registration adds.
struct ra8_esp_hosted_gpio_edge_row ra8_esp_hosted_gpio_edge_row_t
static ra8_err_t internal_timer_disarm(void)
Delete the shared periodic timer if it is running.
ra8_err_t priv_ra8_esp_hosted_gpio_set_edge_poll_ms(uint16_t period_ms)
Set the sampling period the software edge detector runs at.
static TX_TIMER s_timer
The one periodic ThreadX timer shared by every polled row.
uint8_t priv_ra8_esp_hosted_gpio_edge_count(void)
Report how many pins are under software edge detection.
bool priv_ra8_esp_hosted_gpio_edge_seen(uint8_t prev_level, uint8_t now_level, uint8_t sense)
Decide whether two consecutive samples show the configured edge.
static ra8_esp_hosted_gpio_edge_row_t s_rows[k_ra8_esp_hosted_gpio_row_max]
Every pin currently under software edge detection.
Module-private surface of the esp-hosted side-band GPIO slice.
@ k_ra8_esp_hosted_gpio_poll_ms_default
Sampling period used until priv_ra8_esp_hosted_gpio_set_edge_poll_ms runs.
@ k_ra8_esp_hosted_gpio_row_max
Rows in the polled edge table; also the registration ceiling.
Interrupt Control Unit (ICU) register layout for the Renesas RA8D2.
@ k_ra8_icu_irqmd_rising
01: rising edge.
@ k_ra8_icu_irqmd_both
10: rising OR falling.
@ k_ra8_icu_irqmd_low
11: low-level sensitive.
Lightweight Logging Interface for ra8-firmware.
#define ra8_log_error_val(tag, message, value)
RA8 log error val.
Abstract pin-driver interface for dependency injection.
Typed Port / Pin Constants for the RA8D2 IOPORT Module.
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.
High-level GPIO helpers on top of the PORT + PFS register layer.
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_release(ra8_port_pin_t pin)
Release a GPIO pin claim.
unsigned int UINT
ThreadX-compatible unsigned int (host stub).
unsigned long ULONG
ThreadX-compatible unsigned long (host stub).
One pin under software edge detection.
ra8_port_pin_t pin
Packed pin being sampled.
uint8_t last_level
Level seen by the previous sample.
uint8_t sense
Edge selector, ra8_icu_irqmd_t.
void(* handler)(void *arg)
Vendored callback to invoke.
bool used
True while the row is occupied.
void * arg
Opaque argument for handler.
void * ctx
Opaque context handed to every call.
ra8_err_t(* read)(void *ctx, ra8_port_pin_t pin, ra8_level_t *out_level)
Read a pin.