RA Flexible Software Package Documentation  Release v4.1.0

 
Ethernet Interface

Detailed Description

Interface for Ethernet functions.

Summary

The Ethernet interface provides Ethernet functionality. The Ethernet interface supports the following features:

Implemented by:

Data Structures

struct  ether_callback_args_t
 
struct  ether_cfg_t
 
struct  ether_api_t
 
struct  ether_instance_t
 

Typedefs

typedef void ether_ctrl_t
 

Enumerations

enum  ether_wake_on_lan_t
 
enum  ether_flow_control_t
 
enum  ether_multicast_t
 
enum  ether_promiscuous_t
 
enum  ether_zerocopy_t
 
enum  ether_event_t
 

Data Structure Documentation

◆ ether_callback_args_t

struct ether_callback_args_t

Callback function parameter data

Data Fields
uint32_t channel Device channel number.
ether_event_t event Event code.
uint32_t status_ecsr ETHERC status register for interrupt handler.
uint32_t status_eesr ETHERC/EDMAC status register for interrupt handler.
void const * p_context Placeholder for user data. Set in ether_api_t::open function in ether_cfg_t.

◆ ether_cfg_t

struct ether_cfg_t

Configuration parameters.

Data Fields

uint8_t channel
 Channel.
 
ether_zerocopy_t zerocopy
 Zero copy enable or disable in Read/Write function.
 
ether_multicast_t multicast
 Multicast enable or disable.
 
ether_promiscuous_t promiscuous
 Promiscuous mode enable or disable.
 
ether_flow_control_t flow_control
 Flow control functionally enable or disable.
 
ether_padding_t padding
 Padding length inserted into the received Ethernet frame.
 
uint32_t padding_offset
 Offset of the padding inserted into the received Ethernet frame.
 
uint32_t broadcast_filter
 Limit of the number of broadcast frames received continuously.
 
uint8_t * p_mac_address
 Pointer of MAC address.
 
uint8_t num_tx_descriptors
 Number of transmission descriptor.
 
uint8_t num_rx_descriptors
 Number of receive descriptor.
 
uint8_t ** pp_ether_buffers
 Transmit and receive buffer.
 
uint32_t ether_buffer_size
 Size of transmit and receive buffer.
 
IRQn_Type irq
 NVIC interrupt number.
 
uint32_t interrupt_priority
 NVIC interrupt priority.
 
void(* p_callback )(ether_callback_args_t *p_args)
 Callback provided when an ISR occurs.
 
ether_phy_instance_t const * p_ether_phy_instance
 Pointer to ETHER_PHY instance.
 
void const * p_context
 Placeholder for user data. More...
 
void const * p_extend
 Placeholder for user extension.
 

Field Documentation

◆ p_context

void const* ether_cfg_t::p_context

Placeholder for user data.

Placeholder for user data. Passed to the user callback in ether_callback_args_t.

◆ ether_api_t

struct ether_api_t

Functions implemented at the HAL layer will follow this API.

Data Fields

fsp_err_t(* open )(ether_ctrl_t *const p_api_ctrl, ether_cfg_t const *const p_cfg)
 
fsp_err_t(* close )(ether_ctrl_t *const p_api_ctrl)
 
fsp_err_t(* read )(ether_ctrl_t *const p_api_ctrl, void *const p_buffer, uint32_t *const length_bytes)
 
fsp_err_t(* bufferRelease )(ether_ctrl_t *const p_api_ctrl)
 
fsp_err_t(* rxBufferUpdate )(ether_ctrl_t *const p_api_ctrl, void *const p_buffer)
 
fsp_err_t(* write )(ether_ctrl_t *const p_api_ctrl, void *const p_buffer, uint32_t const frame_length)
 
fsp_err_t(* linkProcess )(ether_ctrl_t *const p_api_ctrl)
 
fsp_err_t(* wakeOnLANEnable )(ether_ctrl_t *const p_api_ctrl)
 
fsp_err_t(* txStatusGet )(ether_ctrl_t *const p_api_ctrl, void *const p_buffer_address)
 
fsp_err_t(* callbackSet )(ether_ctrl_t *const p_api_ctrl, void(*p_callback)(ether_callback_args_t *), void const *const p_context, ether_callback_args_t *const p_callback_memory)
 

Field Documentation

◆ open

fsp_err_t(* ether_api_t::open) (ether_ctrl_t *const p_api_ctrl, ether_cfg_t const *const p_cfg)

Open driver.

Implemented as
Parameters
[in]p_api_ctrlPointer to control structure.
[in]p_cfgPointer to pin configuration structure.

◆ close

fsp_err_t(* ether_api_t::close) (ether_ctrl_t *const p_api_ctrl)

Close driver.

Implemented as
Parameters
[in]p_api_ctrlPointer to control structure.

◆ read

fsp_err_t(* ether_api_t::read) (ether_ctrl_t *const p_api_ctrl, void *const p_buffer, uint32_t *const length_bytes)

Read packet if data is available.

Implemented as
Parameters
[in]p_api_ctrlPointer to control structure.
[in]p_bufferPointer to where to store read data.
[in]length_bytesNumber of bytes in buffer

◆ bufferRelease

fsp_err_t(* ether_api_t::bufferRelease) (ether_ctrl_t *const p_api_ctrl)

Release rx buffer from buffer pool process in zero-copy read operation.

Implemented as
Parameters
[in]p_api_ctrlPointer to control structure.

◆ rxBufferUpdate

fsp_err_t(* ether_api_t::rxBufferUpdate) (ether_ctrl_t *const p_api_ctrl, void *const p_buffer)

Update the buffer pointer in the current receive descriptor.

Implemented as
Parameters
[in]p_api_ctrlPointer to control structure.
[in]p_bufferNew address to write into the rx buffer descriptor.

◆ write

fsp_err_t(* ether_api_t::write) (ether_ctrl_t *const p_api_ctrl, void *const p_buffer, uint32_t const frame_length)

Write packet.

Implemented as
Parameters
[in]p_api_ctrlPointer to control structure.
[in]p_bufferPointer to data to write.
[in]frame_lengthSend ethernet frame size (without 4 bytes of CRC data size).

◆ linkProcess

fsp_err_t(* ether_api_t::linkProcess) (ether_ctrl_t *const p_api_ctrl)

Process link.

Implemented as
Parameters
[in]p_api_ctrlPointer to control structure.

◆ wakeOnLANEnable

fsp_err_t(* ether_api_t::wakeOnLANEnable) (ether_ctrl_t *const p_api_ctrl)

Enable magic packet detection.

Implemented as
Parameters
[in]p_api_ctrlPointer to control structure.

◆ txStatusGet

fsp_err_t(* ether_api_t::txStatusGet) (ether_ctrl_t *const p_api_ctrl, void *const p_buffer_address)

Get the address of the most recently sent buffer.

Implemented as
Parameters
[in]p_api_ctrlPointer to control structure.
[out]p_buffer_addressPointer to the address of the most recently sent buffer.

◆ callbackSet

fsp_err_t(* ether_api_t::callbackSet) (ether_ctrl_t *const p_api_ctrl, void(*p_callback)(ether_callback_args_t *), void const *const p_context, ether_callback_args_t *const p_callback_memory)

Specify callback function and optional context pointer and working memory pointer.

Implemented as
Parameters
[in]p_ctrlPointer to the ETHER control block.
[in]p_callbackCallback function
[in]p_contextPointer to send to callback function
[in]p_working_memoryPointer to volatile memory where callback structure can be allocated. Callback arguments allocated here are only valid during the callback.

◆ ether_instance_t

struct ether_instance_t

This structure encompasses everything that is needed to use an instance of this interface.

Data Fields
ether_ctrl_t * p_ctrl Pointer to the control structure for this instance.
ether_cfg_t const * p_cfg Pointer to the configuration structure for this instance.
ether_api_t const * p_api Pointer to the API structure for this instance.

Typedef Documentation

◆ ether_ctrl_t

typedef void ether_ctrl_t

Control block. Allocate an instance specific control block to pass into the API calls.

Implemented as

Enumeration Type Documentation

◆ ether_wake_on_lan_t

Wake on LAN

Enumerator
ETHER_WAKE_ON_LAN_DISABLE 

Disable Wake on LAN.

ETHER_WAKE_ON_LAN_ENABLE 

Enable Wake on LAN.

◆ ether_flow_control_t

Flow control functionality

Enumerator
ETHER_FLOW_CONTROL_DISABLE 

Disable flow control functionality.

ETHER_FLOW_CONTROL_ENABLE 

Enable flow control functionality with pause frames.

◆ ether_multicast_t

Multicast Filter

Enumerator
ETHER_MULTICAST_DISABLE 

Disable reception of multicast frames.

ETHER_MULTICAST_ENABLE 

Enable reception of multicast frames.

◆ ether_promiscuous_t

Promiscuous Mode

Enumerator
ETHER_PROMISCUOUS_DISABLE 

Only receive packets with current MAC address, multicast, and broadcast.

ETHER_PROMISCUOUS_ENABLE 

Receive all packets.

◆ ether_zerocopy_t

Zero copy

Enumerator
ETHER_ZEROCOPY_DISABLE 

Disable zero copy in Read/Write function.

ETHER_ZEROCOPY_ENABLE 

Enable zero copy in Read/Write function.

◆ ether_event_t

Event code of callback function

Enumerator
ETHER_EVENT_WAKEON_LAN 

Magic packet detection event.

ETHER_EVENT_LINK_ON 

Link up detection event.

ETHER_EVENT_LINK_OFF 

Link down detection event.

ETHER_EVENT_INTERRUPT 

Interrupt event.