caffeine-hal 0.6.6
A Header-Defined Interface c library, it provides the hal layer for the Caffeine framework
Loading...
Searching...
No Matches
Data Structures | Macros | Typedefs | Enumerations | Functions
cfn_hal_eth.h File Reference

Ethernet / MAC HAL API. More...

#include "cfn_hal.h"
#include "cfn_hal_base.h"
#include "cfn_hal_gpio.h"
#include "cfn_hal_types.h"

Go to the source code of this file.

Data Structures

struct  cfn_hal_eth_link_status_t
 Ethernet link status information. More...
 
struct  cfn_hal_eth_config_t
 Ethernet configuration structure. More...
 
struct  cfn_hal_eth_phy_t
 Ethernet hardware physical mapping. More...
 
struct  cfn_hal_eth_api_s
 Ethernet Virtual Method Table (VMT). More...
 

Macros

#define CFN_HAL_ETH_PHY_REG_BMCR   0x00U
 Standard IEEE 802.3 PHY Registers.
 
#define CFN_HAL_ETH_PHY_REG_BSR   0x01U
 
#define CFN_HAL_ETH_PHY_REG_ID1   0x02U
 
#define CFN_HAL_ETH_PHY_REG_ID2   0x03U
 
#define CFN_HAL_ETH_PHY_REG_ANAR   0x04U
 
#define CFN_HAL_ETH_PHY_REG_ANLPAR   0x05U
 
#define CFN_HAL_ETH_PHY_REG_ANER   0x06U
 
#define CFN_HAL_ETH_PHY_BMCR_RESET   CFN_HAL_BIT(15)
 BMCR (Basic Mode Control Register) bit definitions.
 
#define CFN_HAL_ETH_PHY_BMCR_LOOPBACK   CFN_HAL_BIT(14)
 
#define CFN_HAL_ETH_PHY_BMCR_SPEED_100   CFN_HAL_BIT(13)
 
#define CFN_HAL_ETH_PHY_BMCR_AUTONEG   CFN_HAL_BIT(12)
 
#define CFN_HAL_ETH_PHY_BMCR_POWERDOWN   CFN_HAL_BIT(11)
 
#define CFN_HAL_ETH_PHY_BMCR_ISOLATE   CFN_HAL_BIT(10)
 
#define CFN_HAL_ETH_PHY_BMCR_RESTART   CFN_HAL_BIT(9)
 
#define CFN_HAL_ETH_PHY_BMCR_DUPLEX   CFN_HAL_BIT(8)
 
#define CFN_HAL_ETH_PHY_BSR_100BASET4   CFN_HAL_BIT(15)
 BSR (Basic Mode Status Register) bit definitions.
 
#define CFN_HAL_ETH_PHY_BSR_100BASEXFD   CFN_HAL_BIT(14)
 
#define CFN_HAL_ETH_PHY_BSR_100BASEXHD   CFN_HAL_BIT(13)
 
#define CFN_HAL_ETH_PHY_BSR_10BASETFD   CFN_HAL_BIT(12)
 
#define CFN_HAL_ETH_PHY_BSR_10BASETHD   CFN_HAL_BIT(11)
 
#define CFN_HAL_ETH_PHY_BSR_AUTONEGCMP   CFN_HAL_BIT(5)
 
#define CFN_HAL_ETH_PHY_BSR_REMOTEFLT   CFN_HAL_BIT(4)
 
#define CFN_HAL_ETH_PHY_BSR_AUTONEGABL   CFN_HAL_BIT(3)
 
#define CFN_HAL_ETH_PHY_BSR_LINKSTAT   CFN_HAL_BIT(2)
 
#define CFN_HAL_ETH_PHY_BSR_JABBERDET   CFN_HAL_BIT(1)
 
#define CFN_HAL_ETH_PHY_BSR_EXTENDED   CFN_HAL_BIT(0)
 
#define CFN_HAL_ETH_PHY_ANAR_NEXT_PAGE   CFN_HAL_BIT(15)
 ANAR (Auto-Negotiation Advertisement Register) bit definitions.
 
#define CFN_HAL_ETH_PHY_ANAR_REM_FAULT   CFN_HAL_BIT(13)
 
#define CFN_HAL_ETH_PHY_ANAR_PAUSE   CFN_HAL_BIT(10)
 
#define CFN_HAL_ETH_PHY_ANAR_100T4   CFN_HAL_BIT(9)
 
#define CFN_HAL_ETH_PHY_ANAR_100FD   CFN_HAL_BIT(8)
 
#define CFN_HAL_ETH_PHY_ANAR_100HD   CFN_HAL_BIT(7)
 
#define CFN_HAL_ETH_PHY_ANAR_10FD   CFN_HAL_BIT(6)
 
#define CFN_HAL_ETH_PHY_ANAR_10HD   CFN_HAL_BIT(5)
 
#define CFN_HAL_ETH_PHY_ANAR_SELECTOR   0x001FU
 

Typedefs

typedef struct cfn_hal_eth_s cfn_hal_eth_t
 
typedef struct cfn_hal_eth_api_s cfn_hal_eth_api_t
 
typedef void(* cfn_hal_eth_callback_t) (cfn_hal_eth_t *driver, uint32_t event_mask, uint32_t error_mask, void *user_arg)
 Ethernet callback signature.
 

Enumerations

enum  cfn_hal_eth_event_t {
  CFN_HAL_ETH_EVENT_NONE = 0 , CFN_HAL_ETH_EVENT_RX_COMPLETE = CFN_HAL_BIT(0) , CFN_HAL_ETH_EVENT_TX_COMPLETE = CFN_HAL_BIT(1) , CFN_HAL_ETH_EVENT_LINK_UP = CFN_HAL_BIT(2) ,
  CFN_HAL_ETH_EVENT_LINK_DOWN = CFN_HAL_BIT(3)
}
 Ethernet nominal event flags. More...
 
enum  cfn_hal_eth_error_t { CFN_HAL_ETH_ERROR_NONE = 0 , CFN_HAL_ETH_ERROR_MAC = CFN_HAL_BIT(0) , CFN_HAL_ETH_ERROR_PHY = CFN_HAL_BIT(1) , CFN_HAL_ETH_ERROR_GENERAL = CFN_HAL_BIT(2) }
 Ethernet exception error flags. More...
 
enum  cfn_hal_eth_link_speed_t { CFN_HAL_ETH_LINK_SPEED_10M , CFN_HAL_ETH_LINK_SPEED_100M , CFN_HAL_ETH_LINK_SPEED_1000M }
 Ethernet link speed. More...
 
enum  cfn_hal_eth_link_duplex_t { CFN_HAL_ETH_LINK_DUPLEX_HALF , CFN_HAL_ETH_LINK_DUPLEX_FULL }
 Ethernet link duplex mode. More...
 

Functions

 CFN_HAL_VMT_CHECK (struct cfn_hal_eth_api_s)
 
 CFN_HAL_CREATE_DRIVER_TYPE (eth, cfn_hal_eth_config_t, cfn_hal_eth_api_t, cfn_hal_eth_phy_t, cfn_hal_eth_callback_t)
 
CFN_HAL_INLINE void cfn_hal_eth_populate (cfn_hal_eth_t *driver, uint32_t peripheral_id, struct cfn_hal_clock_s *clock, void *dependency, const cfn_hal_eth_api_t *api, const cfn_hal_eth_phy_t *phy, const cfn_hal_eth_config_t *config, cfn_hal_eth_callback_t callback, void *user_arg)
 
CFN_HAL_INLINE cfn_hal_error_code_t cfn_hal_eth_config_validate (const cfn_hal_eth_t *driver, const cfn_hal_eth_config_t *config)
 Validates the Ethernet configuration.
 
CFN_HAL_INLINE cfn_hal_error_code_t cfn_hal_eth_init (cfn_hal_eth_t *driver)
 Initializes the Ethernet driver.
 
CFN_HAL_INLINE cfn_hal_error_code_t cfn_hal_eth_deinit (cfn_hal_eth_t *driver)
 Deinitializes the Ethernet driver.
 
CFN_HAL_INLINE cfn_hal_error_code_t cfn_hal_eth_config_set (cfn_hal_eth_t *driver, const cfn_hal_eth_config_t *config)
 Sets the Ethernet configuration.
 
CFN_HAL_INLINE cfn_hal_error_code_t cfn_hal_eth_config_get (cfn_hal_eth_t *driver, cfn_hal_eth_config_t *config)
 Gets the current Ethernet configuration.
 
CFN_HAL_INLINE cfn_hal_error_code_t cfn_hal_eth_callback_register (cfn_hal_eth_t *driver, const cfn_hal_eth_callback_t callback, void *user_arg)
 Registers a callback for Ethernet events and errors.
 
CFN_HAL_INLINE cfn_hal_error_code_t cfn_hal_eth_power_state_set (cfn_hal_eth_t *driver, cfn_hal_power_state_t state)
 Sets the Ethernet power state.
 
CFN_HAL_INLINE cfn_hal_error_code_t cfn_hal_eth_event_enable (cfn_hal_eth_t *driver, uint32_t event_mask)
 Enables one or more Ethernet nominal events.
 
CFN_HAL_INLINE cfn_hal_error_code_t cfn_hal_eth_event_disable (cfn_hal_eth_t *driver, uint32_t event_mask)
 Disables one or more Ethernet nominal events.
 
CFN_HAL_INLINE cfn_hal_error_code_t cfn_hal_eth_event_get (cfn_hal_eth_t *driver, uint32_t *event_mask)
 Retrieves the current Ethernet nominal event status.
 
CFN_HAL_INLINE cfn_hal_error_code_t cfn_hal_eth_error_enable (cfn_hal_eth_t *driver, uint32_t error_mask)
 Enables one or more Ethernet exception errors.
 
CFN_HAL_INLINE cfn_hal_error_code_t cfn_hal_eth_error_disable (cfn_hal_eth_t *driver, uint32_t error_mask)
 Disables one or more Ethernet exception errors.
 
CFN_HAL_INLINE cfn_hal_error_code_t cfn_hal_eth_error_get (cfn_hal_eth_t *driver, uint32_t *error_mask)
 Retrieves the current Ethernet exception error status.
 
CFN_HAL_INLINE cfn_hal_error_code_t cfn_hal_eth_start (cfn_hal_eth_t *driver)
 Starts the Ethernet MAC and DMA operations.
 
CFN_HAL_INLINE cfn_hal_error_code_t cfn_hal_eth_stop (cfn_hal_eth_t *driver)
 Stops the Ethernet MAC and DMA operations.
 
CFN_HAL_INLINE cfn_hal_error_code_t cfn_hal_eth_transmit_frame (cfn_hal_eth_t *driver, const uint8_t *frame, size_t length, uint32_t timeout)
 Transmits an Ethernet frame.
 
CFN_HAL_INLINE cfn_hal_error_code_t cfn_hal_eth_receive_frame (cfn_hal_eth_t *driver, uint8_t *buffer, size_t max_length, size_t *received_length, uint32_t timeout)
 Receives an Ethernet frame.
 
CFN_HAL_INLINE cfn_hal_error_code_t cfn_hal_eth_read_phy_reg (cfn_hal_eth_t *driver, uint16_t phy_addr, uint16_t reg_addr, uint16_t *value, uint32_t timeout)
 Reads a PHY register via MDIO.
 
CFN_HAL_INLINE cfn_hal_error_code_t cfn_hal_eth_write_phy_reg (cfn_hal_eth_t *driver, uint16_t phy_addr, uint16_t reg_addr, uint16_t value, uint32_t timeout)
 Writes a PHY register via MDIO.
 
CFN_HAL_INLINE cfn_hal_error_code_t cfn_hal_eth_get_link_status (cfn_hal_eth_t *driver, cfn_hal_eth_link_status_t *status, uint32_t timeout)
 Retrieves the current link status.
 
cfn_hal_error_code_t cfn_hal_eth_construct (cfn_hal_eth_t *driver, const cfn_hal_eth_config_t *config, const cfn_hal_eth_phy_t *phy, struct cfn_hal_clock_s *clock, void *dependency, cfn_hal_eth_callback_t callback, void *user_arg)
 
cfn_hal_error_code_t cfn_hal_eth_destruct (cfn_hal_eth_t *driver)
 

Detailed Description

Ethernet / MAC HAL API.

Copyright (c) 2026 Hisham Moussa Daou https://www.whileone.me

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Macro Definition Documentation

◆ CFN_HAL_ETH_PHY_ANAR_100FD

#define CFN_HAL_ETH_PHY_ANAR_100FD   CFN_HAL_BIT(8)

100Base-TX full duplex ability

◆ CFN_HAL_ETH_PHY_ANAR_100HD

#define CFN_HAL_ETH_PHY_ANAR_100HD   CFN_HAL_BIT(7)

100Base-TX half duplex ability

◆ CFN_HAL_ETH_PHY_ANAR_100T4

#define CFN_HAL_ETH_PHY_ANAR_100T4   CFN_HAL_BIT(9)

100Base-T4 ability

◆ CFN_HAL_ETH_PHY_ANAR_10FD

#define CFN_HAL_ETH_PHY_ANAR_10FD   CFN_HAL_BIT(6)

10Base-T full duplex ability

◆ CFN_HAL_ETH_PHY_ANAR_10HD

#define CFN_HAL_ETH_PHY_ANAR_10HD   CFN_HAL_BIT(5)

10Base-T half duplex ability

◆ CFN_HAL_ETH_PHY_ANAR_NEXT_PAGE

#define CFN_HAL_ETH_PHY_ANAR_NEXT_PAGE   CFN_HAL_BIT(15)

ANAR (Auto-Negotiation Advertisement Register) bit definitions.

Next page ability

◆ CFN_HAL_ETH_PHY_ANAR_PAUSE

#define CFN_HAL_ETH_PHY_ANAR_PAUSE   CFN_HAL_BIT(10)

Pause support

◆ CFN_HAL_ETH_PHY_ANAR_REM_FAULT

#define CFN_HAL_ETH_PHY_ANAR_REM_FAULT   CFN_HAL_BIT(13)

Remote fault

◆ CFN_HAL_ETH_PHY_ANAR_SELECTOR

#define CFN_HAL_ETH_PHY_ANAR_SELECTOR   0x001FU

Protocol selector field

◆ CFN_HAL_ETH_PHY_BMCR_AUTONEG

#define CFN_HAL_ETH_PHY_BMCR_AUTONEG   CFN_HAL_BIT(12)

Enable auto-negotiation

◆ CFN_HAL_ETH_PHY_BMCR_DUPLEX

#define CFN_HAL_ETH_PHY_BMCR_DUPLEX   CFN_HAL_BIT(8)

Full duplex (0 = half)

◆ CFN_HAL_ETH_PHY_BMCR_ISOLATE

#define CFN_HAL_ETH_PHY_BMCR_ISOLATE   CFN_HAL_BIT(10)

Isolate PHY from MII

◆ CFN_HAL_ETH_PHY_BMCR_LOOPBACK

#define CFN_HAL_ETH_PHY_BMCR_LOOPBACK   CFN_HAL_BIT(14)

Enable loopback

◆ CFN_HAL_ETH_PHY_BMCR_POWERDOWN

#define CFN_HAL_ETH_PHY_BMCR_POWERDOWN   CFN_HAL_BIT(11)

PHY power down

◆ CFN_HAL_ETH_PHY_BMCR_RESET

#define CFN_HAL_ETH_PHY_BMCR_RESET   CFN_HAL_BIT(15)

BMCR (Basic Mode Control Register) bit definitions.

PHY reset

◆ CFN_HAL_ETH_PHY_BMCR_RESTART

#define CFN_HAL_ETH_PHY_BMCR_RESTART   CFN_HAL_BIT(9)

Restart auto-negotiation

◆ CFN_HAL_ETH_PHY_BMCR_SPEED_100

#define CFN_HAL_ETH_PHY_BMCR_SPEED_100   CFN_HAL_BIT(13)

Select 100Mbps (0 = 10Mbps)

◆ CFN_HAL_ETH_PHY_BSR_100BASET4

#define CFN_HAL_ETH_PHY_BSR_100BASET4   CFN_HAL_BIT(15)

BSR (Basic Mode Status Register) bit definitions.

100Base-T4 support

◆ CFN_HAL_ETH_PHY_BSR_100BASEXFD

#define CFN_HAL_ETH_PHY_BSR_100BASEXFD   CFN_HAL_BIT(14)

100Base-X Full Duplex support

◆ CFN_HAL_ETH_PHY_BSR_100BASEXHD

#define CFN_HAL_ETH_PHY_BSR_100BASEXHD   CFN_HAL_BIT(13)

100Base-X Half Duplex support

◆ CFN_HAL_ETH_PHY_BSR_10BASETFD

#define CFN_HAL_ETH_PHY_BSR_10BASETFD   CFN_HAL_BIT(12)

10Base-T Full Duplex support

◆ CFN_HAL_ETH_PHY_BSR_10BASETHD

#define CFN_HAL_ETH_PHY_BSR_10BASETHD   CFN_HAL_BIT(11)

10Base-T Half Duplex support

◆ CFN_HAL_ETH_PHY_BSR_AUTONEGABL

#define CFN_HAL_ETH_PHY_BSR_AUTONEGABL   CFN_HAL_BIT(3)

Auto-negotiation ability

◆ CFN_HAL_ETH_PHY_BSR_AUTONEGCMP

#define CFN_HAL_ETH_PHY_BSR_AUTONEGCMP   CFN_HAL_BIT(5)

Auto-negotiation complete

◆ CFN_HAL_ETH_PHY_BSR_EXTENDED

#define CFN_HAL_ETH_PHY_BSR_EXTENDED   CFN_HAL_BIT(0)

Extended capability support

◆ CFN_HAL_ETH_PHY_BSR_JABBERDET

#define CFN_HAL_ETH_PHY_BSR_JABBERDET   CFN_HAL_BIT(1)

Jabber condition detected

◆ CFN_HAL_ETH_PHY_BSR_LINKSTAT

#define CFN_HAL_ETH_PHY_BSR_LINKSTAT   CFN_HAL_BIT(2)

Link status (1 = up)

◆ CFN_HAL_ETH_PHY_BSR_REMOTEFLT

#define CFN_HAL_ETH_PHY_BSR_REMOTEFLT   CFN_HAL_BIT(4)

Remote fault detected

◆ CFN_HAL_ETH_PHY_REG_ANAR

#define CFN_HAL_ETH_PHY_REG_ANAR   0x04U

Auto-Negotiation Advertisement Register

◆ CFN_HAL_ETH_PHY_REG_ANER

#define CFN_HAL_ETH_PHY_REG_ANER   0x06U

Auto-Negotiation Expansion Register

◆ CFN_HAL_ETH_PHY_REG_ANLPAR

#define CFN_HAL_ETH_PHY_REG_ANLPAR   0x05U

Auto-Negotiation Link Partner Ability Register

◆ CFN_HAL_ETH_PHY_REG_BMCR

#define CFN_HAL_ETH_PHY_REG_BMCR   0x00U

Standard IEEE 802.3 PHY Registers.

Basic Mode Control Register

◆ CFN_HAL_ETH_PHY_REG_BSR

#define CFN_HAL_ETH_PHY_REG_BSR   0x01U

Basic Mode Status Register

◆ CFN_HAL_ETH_PHY_REG_ID1

#define CFN_HAL_ETH_PHY_REG_ID1   0x02U

PHY Identifier 1 Register

◆ CFN_HAL_ETH_PHY_REG_ID2

#define CFN_HAL_ETH_PHY_REG_ID2   0x03U

PHY Identifier 2 Register

Typedef Documentation

◆ cfn_hal_eth_api_t

◆ cfn_hal_eth_callback_t

typedef void(* cfn_hal_eth_callback_t) (cfn_hal_eth_t *driver, uint32_t event_mask, uint32_t error_mask, void *user_arg)

Ethernet callback signature.

Parameters
driverPointer to the Ethernet driver instance.
event_maskMask of triggered nominal events.
error_maskMask of triggered exception errors.
user_argUser-defined argument passed during registration.

◆ cfn_hal_eth_t

typedef struct cfn_hal_eth_s cfn_hal_eth_t

Enumeration Type Documentation

◆ cfn_hal_eth_error_t

Ethernet exception error flags.

Enumerator
CFN_HAL_ETH_ERROR_NONE 
CFN_HAL_ETH_ERROR_MAC 

MAC layer error (CRC, jabber, etc)

CFN_HAL_ETH_ERROR_PHY 

PHY layer or MDIO error

CFN_HAL_ETH_ERROR_GENERAL 

General hardware error

◆ cfn_hal_eth_event_t

Ethernet nominal event flags.

Enumerator
CFN_HAL_ETH_EVENT_NONE 
CFN_HAL_ETH_EVENT_RX_COMPLETE 

Frame received

CFN_HAL_ETH_EVENT_TX_COMPLETE 

Frame transmitted

CFN_HAL_ETH_EVENT_LINK_UP 

Ethernet link established

CFN_HAL_ETH_EVENT_LINK_DOWN 

Ethernet link lost

◆ cfn_hal_eth_link_duplex_t

Ethernet link duplex mode.

Enumerator
CFN_HAL_ETH_LINK_DUPLEX_HALF 

Half duplex

CFN_HAL_ETH_LINK_DUPLEX_FULL 

Full duplex

◆ cfn_hal_eth_link_speed_t

Ethernet link speed.

Enumerator
CFN_HAL_ETH_LINK_SPEED_10M 

10 Mbps

CFN_HAL_ETH_LINK_SPEED_100M 

100 Mbps

CFN_HAL_ETH_LINK_SPEED_1000M 

1000 Mbps

Function Documentation

◆ CFN_HAL_CREATE_DRIVER_TYPE()

CFN_HAL_CREATE_DRIVER_TYPE ( eth  ,
cfn_hal_eth_config_t  ,
cfn_hal_eth_api_t  ,
cfn_hal_eth_phy_t  ,
cfn_hal_eth_callback_t   
)

◆ cfn_hal_eth_callback_register()

CFN_HAL_INLINE cfn_hal_error_code_t cfn_hal_eth_callback_register ( cfn_hal_eth_t driver,
const cfn_hal_eth_callback_t  callback,
void *  user_arg 
)

Registers a callback for Ethernet events and errors.

Parameters
driverPointer to the Ethernet driver instance.
callbackThe callback function to register.
user_argUser-defined argument passed to the callback.
Returns
CFN_HAL_ERROR_OK on success, or a specific error code on failure.

◆ cfn_hal_eth_config_get()

CFN_HAL_INLINE cfn_hal_error_code_t cfn_hal_eth_config_get ( cfn_hal_eth_t driver,
cfn_hal_eth_config_t config 
)

Gets the current Ethernet configuration.

Parameters
driverPointer to the Ethernet driver instance.
config[out] Pointer to store the configuration.
Returns
CFN_HAL_ERROR_OK on success, or a specific error code on failure.

◆ cfn_hal_eth_config_set()

CFN_HAL_INLINE cfn_hal_error_code_t cfn_hal_eth_config_set ( cfn_hal_eth_t driver,
const cfn_hal_eth_config_t config 
)

Sets the Ethernet configuration.

Parameters
driverPointer to the Ethernet driver instance.
configPointer to the configuration structure.
Returns
CFN_HAL_ERROR_OK on success, or a specific error code on failure.

◆ cfn_hal_eth_config_validate()

CFN_HAL_INLINE cfn_hal_error_code_t cfn_hal_eth_config_validate ( const cfn_hal_eth_t driver,
const cfn_hal_eth_config_t config 
)

Validates the Ethernet configuration.

Parameters
driverPointer to the ETH driver instance.
configPointer to the configuration structure.
Returns
CFN_HAL_ERROR_OK on success, or a specific error code on failure.

◆ cfn_hal_eth_construct()

cfn_hal_error_code_t cfn_hal_eth_construct ( cfn_hal_eth_t driver,
const cfn_hal_eth_config_t config,
const cfn_hal_eth_phy_t phy,
struct cfn_hal_clock_s *  clock,
void *  dependency,
cfn_hal_eth_callback_t  callback,
void *  user_arg 
)

◆ cfn_hal_eth_deinit()

CFN_HAL_INLINE cfn_hal_error_code_t cfn_hal_eth_deinit ( cfn_hal_eth_t driver)

Deinitializes the Ethernet driver.

Parameters
driverPointer to the Ethernet driver instance.
Returns
CFN_HAL_ERROR_OK on success, or a specific error code on failure.

◆ cfn_hal_eth_destruct()

cfn_hal_error_code_t cfn_hal_eth_destruct ( cfn_hal_eth_t driver)

◆ cfn_hal_eth_error_disable()

CFN_HAL_INLINE cfn_hal_error_code_t cfn_hal_eth_error_disable ( cfn_hal_eth_t driver,
uint32_t  error_mask 
)

Disables one or more Ethernet exception errors.

Parameters
driverPointer to the Ethernet driver instance.
error_maskMask of errors to disable.
Returns
CFN_HAL_ERROR_OK on success, or a specific error code on failure.

◆ cfn_hal_eth_error_enable()

CFN_HAL_INLINE cfn_hal_error_code_t cfn_hal_eth_error_enable ( cfn_hal_eth_t driver,
uint32_t  error_mask 
)

Enables one or more Ethernet exception errors.

Parameters
driverPointer to the Ethernet driver instance.
error_maskMask of errors to enable.
Returns
CFN_HAL_ERROR_OK on success, or a specific error code on failure.

◆ cfn_hal_eth_error_get()

CFN_HAL_INLINE cfn_hal_error_code_t cfn_hal_eth_error_get ( cfn_hal_eth_t driver,
uint32_t *  error_mask 
)

Retrieves the current Ethernet exception error status.

Parameters
driverPointer to the Ethernet driver instance.
error_mask[out] Pointer to store the error mask.
Returns
CFN_HAL_ERROR_OK on success, or a specific error code on failure.

◆ cfn_hal_eth_event_disable()

CFN_HAL_INLINE cfn_hal_error_code_t cfn_hal_eth_event_disable ( cfn_hal_eth_t driver,
uint32_t  event_mask 
)

Disables one or more Ethernet nominal events.

Parameters
driverPointer to the Ethernet driver instance.
event_maskMask of events to disable.
Returns
CFN_HAL_ERROR_OK on success, or a specific error code on failure.

◆ cfn_hal_eth_event_enable()

CFN_HAL_INLINE cfn_hal_error_code_t cfn_hal_eth_event_enable ( cfn_hal_eth_t driver,
uint32_t  event_mask 
)

Enables one or more Ethernet nominal events.

Parameters
driverPointer to the Ethernet driver instance.
event_maskMask of events to enable.
Returns
CFN_HAL_ERROR_OK on success, or a specific error code on failure.

◆ cfn_hal_eth_event_get()

CFN_HAL_INLINE cfn_hal_error_code_t cfn_hal_eth_event_get ( cfn_hal_eth_t driver,
uint32_t *  event_mask 
)

Retrieves the current Ethernet nominal event status.

Parameters
driverPointer to the Ethernet driver instance.
event_mask[out] Pointer to store the event mask.
Returns
CFN_HAL_ERROR_OK on success, or a specific error code on failure.

◆ cfn_hal_eth_get_link_status()

CFN_HAL_INLINE cfn_hal_error_code_t cfn_hal_eth_get_link_status ( cfn_hal_eth_t driver,
cfn_hal_eth_link_status_t status,
uint32_t  timeout 
)

Retrieves the current link status.

Parameters
driverPointer to the Ethernet driver instance.
status[out] Pointer to the link status structure.
timeoutMaximum time to wait for completion in milliseconds.
Returns
CFN_HAL_ERROR_OK on success, or a specific error code on failure.

◆ cfn_hal_eth_init()

CFN_HAL_INLINE cfn_hal_error_code_t cfn_hal_eth_init ( cfn_hal_eth_t driver)

Initializes the Ethernet driver.

Parameters
driverPointer to the Ethernet driver instance.
Returns
CFN_HAL_ERROR_OK on success, or a specific error code on failure.

◆ cfn_hal_eth_populate()

CFN_HAL_INLINE void cfn_hal_eth_populate ( cfn_hal_eth_t driver,
uint32_t  peripheral_id,
struct cfn_hal_clock_s *  clock,
void *  dependency,
const cfn_hal_eth_api_t api,
const cfn_hal_eth_phy_t phy,
const cfn_hal_eth_config_t config,
cfn_hal_eth_callback_t  callback,
void *  user_arg 
)

◆ cfn_hal_eth_power_state_set()

CFN_HAL_INLINE cfn_hal_error_code_t cfn_hal_eth_power_state_set ( cfn_hal_eth_t driver,
cfn_hal_power_state_t  state 
)

Sets the Ethernet power state.

Parameters
driverPointer to the Ethernet driver instance.
stateTarget power state.
Returns
CFN_HAL_ERROR_OK on success, or a specific error code on failure.

◆ cfn_hal_eth_read_phy_reg()

CFN_HAL_INLINE cfn_hal_error_code_t cfn_hal_eth_read_phy_reg ( cfn_hal_eth_t driver,
uint16_t  phy_addr,
uint16_t  reg_addr,
uint16_t *  value,
uint32_t  timeout 
)

Reads a PHY register via MDIO.

Parameters
driverPointer to the Ethernet driver instance.
phy_addrAddress of the target PHY.
reg_addrAddress of the target register.
value[out] Pointer to store the read value.
timeoutMaximum time to wait for completion in milliseconds.
Returns
CFN_HAL_ERROR_OK on success, or a specific error code on failure.

◆ cfn_hal_eth_receive_frame()

CFN_HAL_INLINE cfn_hal_error_code_t cfn_hal_eth_receive_frame ( cfn_hal_eth_t driver,
uint8_t *  buffer,
size_t  max_length,
size_t *  received_length,
uint32_t  timeout 
)

Receives an Ethernet frame.

Parameters
driverPointer to the Ethernet driver instance.
bufferPointer to the buffer where the frame will be stored.
max_lengthMaximum capacity of the buffer.
received_length[out] Actual number of bytes received.
timeoutMaximum time to wait for completion in milliseconds.
Returns
CFN_HAL_ERROR_OK on success, or a specific error code on failure.

◆ cfn_hal_eth_start()

CFN_HAL_INLINE cfn_hal_error_code_t cfn_hal_eth_start ( cfn_hal_eth_t driver)

Starts the Ethernet MAC and DMA operations.

Parameters
driverPointer to the Ethernet driver instance.
Returns
CFN_HAL_ERROR_OK on success, or a specific error code on failure.

◆ cfn_hal_eth_stop()

CFN_HAL_INLINE cfn_hal_error_code_t cfn_hal_eth_stop ( cfn_hal_eth_t driver)

Stops the Ethernet MAC and DMA operations.

Parameters
driverPointer to the Ethernet driver instance.
Returns
CFN_HAL_ERROR_OK on success, or a specific error code on failure.

◆ cfn_hal_eth_transmit_frame()

CFN_HAL_INLINE cfn_hal_error_code_t cfn_hal_eth_transmit_frame ( cfn_hal_eth_t driver,
const uint8_t *  frame,
size_t  length,
uint32_t  timeout 
)

Transmits an Ethernet frame.

Parameters
driverPointer to the Ethernet driver instance.
framePointer to the raw frame data.
lengthLength of the frame in bytes.
timeoutMaximum time to wait for completion in milliseconds.
Returns
CFN_HAL_ERROR_OK on success, or a specific error code on failure.

◆ cfn_hal_eth_write_phy_reg()

CFN_HAL_INLINE cfn_hal_error_code_t cfn_hal_eth_write_phy_reg ( cfn_hal_eth_t driver,
uint16_t  phy_addr,
uint16_t  reg_addr,
uint16_t  value,
uint32_t  timeout 
)

Writes a PHY register via MDIO.

Parameters
driverPointer to the Ethernet driver instance.
phy_addrAddress of the target PHY.
reg_addrAddress of the target register.
valueValue to write.
timeoutMaximum time to wait for completion in milliseconds.
Returns
CFN_HAL_ERROR_OK on success, or a specific error code on failure.

◆ CFN_HAL_VMT_CHECK()

CFN_HAL_VMT_CHECK ( struct cfn_hal_eth_api_s  )