46 return (err ==
k_ra8_ok) && ((reg_value & mask) != 0U);
49static const char*
s_tag =
"RMPHY";
51typedef enum : uint8_t {
61typedef enum : uint16_t {
158 for (uint16_t i = 0U; i < poll_max; ++i) {
201 if (
s_state.gbit_advertise != 0U) {
268 const uint16_t poll_max =
446 if (
s_state.gbit_advertise != 0U) {
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).
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_err_invalid_arg
Invalid function argument.
@ k_ra8_err_exists
Item already exists – cannot create again.
@ k_ra8_err_invalid_state
Module in wrong state for requested operation.
@ k_ra8_err_hw_timeout
Hardware timed out waiting for a flag or handshake.
@ k_ra8_err_not_initialized
Module not initialized – _init() not yet called successfully.
@ k_ra8_ok
Success – operation completed with all postconditions satisfied.
ra8_err_codes_t ra8_err_t
Canonical error-return type used by every ra8-firmware API.
static ra8_err_t internal_reset_and_wait(void)
Issue BMCR.RESET to the PHY and poll until it self-clears.
Lightweight Logging Interface for ra8-firmware.
#define ra8_log_info_val(tag, message, value)
RA8 log info val.
@ k_ra8_rmac_phy_bmsr_link_up
BMSR bit 2.
@ k_ra8_rmac_phy_bmcr_an_enable
BMCR bit 12.
@ k_ra8_rmac_phy_bmcr_an_restart
BMCR bit 9.
@ k_ra8_rmac_phy_bmcr_reset
BMCR bit 15.
ra8_err_t ra8_rmac_phy_mdio_read(uint8_t reg_addr, uint16_t *out_data)
Read a 16-bit Clause-22 PHY register.
static void internal_resolve_speed(ra8_rmac_phy_link_t *out)
Resolve the negotiated speed once the link is up and AN done.
ra8_err_t ra8_rmac_phy_close(void)
Close the PHY driver and forget all cached state.
ra8_err_t ra8_rmac_phy_link_status_get(ra8_rmac_phy_link_t *out)
Read BMSR / 1000T-status / LPA and decode the link state.
static ra8_err_t internal_program_advertise(void)
Program the auto-negotiation advertisement registers.
static ra8_err_t internal_open_validate(const ra8_rmac_phy_cfg_t *cfg)
Validate an ra8_rmac_phy_cfg_t before it is latched by open.
ra8_err_t ra8_rmac_phy_mdio_write(uint8_t reg_addr, uint16_t data)
Write a 16-bit Clause-22 PHY register.
ra8_err_t ra8_rmac_phy_lsi_get(ra8_rmac_phy_lsi_t *out)
Return the LSI tag the caller passed to ra8_rmac_phy_open.
bool priv_ra8_rmac_phy_internal_speed_ok(ra8_err_t err, uint16_t reg_value, uint16_t mask)
Pure speed-detected predicate – see header for full contract.
ra8_err_t ra8_rmac_phy_open(const ra8_rmac_phy_cfg_t *cfg)
Open the RMAC PHY driver and bring the off-chip PHY out of reset.
@ k_ra8_rmac_phy_bmsr_an_complete
RA8 rmac PHY bmsr an complete.
@ k_ra8_rmac_phy_msr_1000full
RA8 rmac PHY msr 1000full.
@ k_ra8_rmac_phy_lpa_10full
RA8 rmac PHY lpa 10full.
@ k_ra8_rmac_phy_lpa_100full
RA8 rmac PHY lpa 100full.
@ k_ra8_rmac_phy_lpa_100half
RA8 rmac PHY lpa 100half.
@ k_ra8_rmac_phy_lpa_10half
RA8 rmac PHY lpa 10half.
@ k_ra8_rmac_phy_msr_1000half
RA8 rmac PHY msr 1000half.
@ k_ra8_rmac_phy_reg_status
RA8 rmac PHY register status.
@ k_ra8_rmac_phy_reset_poll_max
RA8 rmac PHY reset poll maximum.
@ k_ra8_rmac_phy_reg_an_advert
RA8 rmac PHY register an advert.
@ k_ra8_rmac_phy_reg_control
RA8 rmac PHY register control.
@ k_ra8_rmac_phy_reg_1000t_ctrl
RA8 rmac PHY register 1000t control.
@ k_ra8_rmac_phy_reg_an_partner
RA8 rmac PHY register an partner.
@ k_ra8_rmac_phy_reg_1000t_status
RA8 rmac PHY register 1000t status.
ra8_err_t ra8_rmac_phy_auto_negotiate_start(void)
Restart auto-negotiation by writing BMCR.
Reduced-MAC (RMAC) PHY driver – off-chip PHY for the GMAC-FPI.
@ k_ra8_rmac_phy_speed_no_link
RA8 rmac PHY speed no link.
@ k_ra8_rmac_phy_speed_100f
RA8 rmac PHY speed 100f.
@ k_ra8_rmac_phy_speed_10h
RA8 rmac PHY speed 10h.
@ k_ra8_rmac_phy_speed_1000f
RA8 rmac PHY speed 1000f.
@ k_ra8_rmac_phy_speed_10f
RA8 rmac PHY speed 10f.
@ k_ra8_rmac_phy_speed_100h
RA8 rmac PHY speed 100h.
@ k_ra8_rmac_phy_speed_1000h
RA8 rmac PHY speed 1000h.
@ k_ra8_rmac_phy_addr_max
RA8 rmac PHY address maximum.
@ k_ra8_rmac_phy_reg_max
RA8 rmac PHY register maximum.
ra8_rmac_phy_lsi_t
Supported PHY-LSI identifiers.
@ k_ra8_rmac_phy_lsi_count
RA8 rmac PHY lsi count.
Test-access surface for ra8_rmac_phy internal helpers (MC/DC).
Configuration descriptor.
uint16_t local_advertise
Clause-22 reg 4 advertised.
uint16_t reset_poll_max
Reset poll maximum.
ra8_rmac_phy_lsi_t lsi_type
Lsi type.
uint16_t gbit_advertise
Clause-22 reg 9 (1000T).
uint8_t phy_address
PHY address.
uint16_t local_advertise
Local advertise.
uint16_t gbit_advertise
Gbit advertise.
uint16_t last_bmsr
Last bmsr.
uint8_t phy_address
PHY address.
ra8_rmac_phy_lsi_t lsi_type
Lsi type.
ra8_err_t(* write)(void *ctx, uint8_t phy_addr, uint8_t reg_addr, uint16_t data)
Write.
ra8_err_t(* read)(void *ctx, uint8_t phy_addr, uint8_t reg_addr, uint16_t *out_data)
Read.
Resolved PHY link status snapshot.
ra8_rmac_phy_speed_t speed
Negotiated speed/duplex when up.
uint8_t auto_neg_done
Auto neg done.
uint16_t partner_ability
Partner ability.