Functions to notify the user application about events on the Ethernet interface. More...
Functions | |
void | netETH_Notify (uint32_t if_num, netETH_Event event, uint32_t val) |
Notify the user of Ethernet link state change event. [user-provided]. | |
void | netETH_ReceiveRaw (uint32_t if_num, const uint8_t *buf, uint32_t len) |
Receive raw Ethernet data. [user-provided]. | |
Functions to notify the user application about events on the Ethernet interface.
An Ethernet link state change is reported by the function netETH_Notify. If you need to monitor the status of your connection, you must implement this function.
void netETH_Notify | ( | uint32_t | if_num, |
netETH_Event | event, | ||
uint32_t | val | ||
) |
Notify the user of Ethernet link state change event. [user-provided].
[in] | if_num | Ethernet interface number. |
[in] | event | Ethernet link state event as defined in netETH_Event. |
[in] | val | pointer to the event value. |
The callback function netETH_Notify polls the link status and notifies the user about state changes.
The argument if_num specifies the Ethernet Interface for which the link status has changed.
The argument event specifies link event, as defined in netETH_Event enumeration:
Event | Description |
---|---|
netETH_LinkDown | Link down |
netETH_LinkUp | Link up; val=link_info |
netETH_Wakeup | Wake-up (on Magic Packet) |
netETH_TimerAlarm | Timer Alarm (PTP) |
The argument val stores the value of the link event.
Code Example
void netETH_ReceiveRaw | ( | uint32_t | if_num, |
const uint8_t * | buf, | ||
uint32_t | len | ||
) |
Receive raw Ethernet data. [user-provided].
[in] | if_num | Ethernet interface number. |
[in] | buf | buffer containing the received data. |
[in] | len | length of received data in bytes. |
The user function netETH_ReceiveRaw is called by the Ethernet interface to provide raw Ethernet frames to the user. The data contains Ethernet header and payload data. This allows the users to implement additional Ethernet protocols, which are not supported by the network library.
The network library calls this function, if the Ethernet Type is not supported. For supported Ethernet Types: ARP (0x0806), IPv4 (0x0800) and IPv6 (0x86dd), the function is not called.
The argument if_num specifies the Ethernet Interface which received the frame.
The argument buf points to a buffer containing the received Ethernet frame data.
The argument len specifies the number of received data bytes.
Code Example