27static const char*
s_tag =
"MPC";
85 const uint32_t cur = *pfs;
86 const uint32_t masked = cur & ~clear_mask;
87 *pfs = masked | set_mask;
114 if (pfs ==
nullptr) {
142 if (pfs ==
nullptr) {
149 *pfs = psel_bits | pmr;
220 if (pfs ==
nullptr) {
static const char * s_tag
Logging / check tag.
Annotation-attribute framework macros for ra8-firmware.
#define RA8_INTERNAL
Marker that a function is intended to be static (file-local).
ra8_board_eth_pin_t pin
Pin.
Validation and Error-Checking Macros for ra8-firmware.
#define RA8_CHECK_NULL_PTR(ptr, tag, message)
Reject nullptr pointer, returning k_ra8_err_null_ptr.
Error Code Definitions for ra8-firmware.
@ k_ra8_ok
Success – operation completed with all postconditions satisfied.
@ k_ra8_err_gpio_invalid_pin
GPIO pin index out of range within its port (valid: 0..15).
@ k_ra8_err_gpio_invalid_port
GPIO port index out of range for this MCU.
ra8_err_codes_t ra8_err_t
Canonical error-return type used by every ra8-firmware API.
Lightweight Logging Interface for ra8-firmware.
#define ra8_log_info_val(tag, message, value)
RA8 log info val.
ra8_err_t ra8_mpc_set_open_drain(ra8_port_t port, ra8_pin_t pin, bool enable)
Enable or disable N-channel open-drain on a pin.
static ra8_err_t internal_check(ra8_port_t port, ra8_pin_t pin)
Bounds-check a (port, pin) pair.
ra8_err_t ra8_mpc_set_gpio(ra8_port_t port, ra8_pin_t pin, ra8_mpc_dir_t dir)
Reset a pin to plain GPIO with a chosen direction.
ra8_err_t ra8_mpc_set_irq(ra8_port_t port, ra8_pin_t pin)
Mark a pin as an external IRQ input (ISEL = 1).
static void internal_update_pfs(ra8_port_t port, ra8_pin_t pin, uint32_t clear_mask, uint32_t set_mask)
Update a single field of PmnPFS under PWPR unlock.
ra8_err_t ra8_mpc_route_peripheral(ra8_port_t port, ra8_pin_t pin, ra8_mpc_psel_t psel)
Route a pin to a peripheral function.
ra8_err_t ra8_mpc_read_pfs(ra8_port_t port, ra8_pin_t pin, uint32_t *out_val)
Read the raw 32-bit PmnPFS register for diagnostic use.
static void internal_reset_pfs(ra8_port_t port, ra8_pin_t pin, uint32_t set_mask)
All-fields reset + new-fields write under PWPR unlock.
ra8_err_t ra8_mpc_set_pull(ra8_port_t port, ra8_pin_t pin, ra8_mpc_pull_t pull)
Enable or disable the internal pull-up on a pin.
ra8_err_t ra8_mpc_set_analog(ra8_port_t port, ra8_pin_t pin)
Put a pin in analog-input mode (ASEL = 1).
Multi-function Pin Controller (MPC) facade.
ra8_mpc_pull_t
Pull-up enable for ra8_mpc_set_pull.
@ k_ra8_mpc_pull_up
RA8 mpc pull up.
ra8_mpc_psel_t
Peripheral function select values for the PMR/PSEL path.
ra8_mpc_dir_t
Pin direction for ra8_mpc_set_gpio.
@ k_ra8_mpc_dir_output
Output direction (PDR = 1).
Pin Function Select (PFS) register layout for the Renesas RA8D2.
@ k_ra8_pfs_mask_asel
RA8 PFS mask asel.
@ k_ra8_pfs_mask_pmr
RA8 PFS mask pmr.
@ k_ra8_pfs_mask_psel
bits 28..24 (5-bit function select).
@ k_ra8_pfs_mask_isel
RA8 PFS mask isel.
@ k_ra8_pfs_mask_ncodr
RA8 PFS mask ncodr.
@ k_ra8_pfs_mask_pdr
RA8 PFS mask pdr.
@ k_ra8_pfs_mask_pcr
RA8 PFS mask pcr.
@ k_ra8_pfs_bit_psel0
Peripheral select bit 0.
static void ra8_pfs_pwpr_lock(void)
Re-lock PFS writes.
static void ra8_pfs_pwpr_unlock(void)
Unlock PFS writes.
static volatile uint32_t * ra8_pfs_pmn(ra8_port_t port, ra8_pin_t pin)
Get pointer to the PmnPFS register for a single pin.
ra8_port_t
Port indices for the RA8D2 IOPORT module.
@ k_ra8_port_max
Highest valid port index.
ra8_pin_t
Pin indices within an IOPORT port (0..15).
@ k_ra8_pin_max
Highest valid pin index.