Go to the documentation of this file.
39 #define ETH_SUPPORT ENABLED
40 #elif (ETH_SUPPORT != ENABLED && ETH_SUPPORT != DISABLED)
41 #error ETH_SUPPORT parameter is not valid
45 #ifndef ETH_VIRTUAL_IF_SUPPORT
46 #define ETH_VIRTUAL_IF_SUPPORT DISABLED
47 #elif (ETH_VIRTUAL_IF_SUPPORT != ENABLED && ETH_VIRTUAL_IF_SUPPORT != DISABLED)
48 #error ETH_VIRTUAL_IF_SUPPORT parameter is not valid
52 #ifndef ETH_VLAN_SUPPORT
53 #define ETH_VLAN_SUPPORT DISABLED
54 #elif (ETH_VLAN_SUPPORT != ENABLED && ETH_VLAN_SUPPORT != DISABLED)
55 #error ETH_VLAN_SUPPORT parameter is not valid
59 #ifndef ETH_VMAN_SUPPORT
60 #define ETH_VMAN_SUPPORT DISABLED
61 #elif (ETH_VMAN_SUPPORT != ENABLED && ETH_VMAN_SUPPORT != DISABLED)
62 #error ETH_VMAN_SUPPORT parameter is not valid
66 #ifndef ETH_LLC_SUPPORT
67 #define ETH_LLC_SUPPORT DISABLED
68 #elif (ETH_LLC_SUPPORT != ENABLED && ETH_LLC_SUPPORT != DISABLED)
69 #error ETH_LLC_SUPPORT parameter is not valid
73 #ifndef ETH_PORT_TAGGING_SUPPORT
74 #define ETH_PORT_TAGGING_SUPPORT DISABLED
75 #elif (ETH_PORT_TAGGING_SUPPORT != ENABLED && ETH_PORT_TAGGING_SUPPORT != DISABLED)
76 #error ETH_PORT_TAGGING_SUPPORT parameter is not valid
80 #ifndef ETH_PORT_TAG_SIZE
81 #define ETH_PORT_TAG_SIZE 4
82 #elif (ETH_PORT_TAG_SIZE < 0)
83 #error ETH_PORT_TAG_SIZE parameter is not valid
87 #ifndef ETH_TIMESTAMP_SUPPORT
88 #define ETH_TIMESTAMP_SUPPORT DISABLED
89 #elif (ETH_TIMESTAMP_SUPPORT != ENABLED && ETH_TIMESTAMP_SUPPORT != DISABLED)
90 #error ETH_TIMESTAMP_SUPPORT parameter is not valid
94 #ifndef MAC_ADDR_FILTER_SIZE
95 #define MAC_ADDR_FILTER_SIZE 12
96 #elif (MAC_ADDR_FILTER_SIZE < 1)
97 #error MAC_ADDR_FILTER_SIZE parameter is not valid
101 #ifndef ETH_FAST_CRC_SUPPORT
102 #define ETH_FAST_CRC_SUPPORT DISABLED
103 #elif (ETH_FAST_CRC_SUPPORT != ENABLED && ETH_FAST_CRC_SUPPORT != DISABLED)
104 #error ETH_FAST_CRC_SUPPORT parameter is not valid
108 #define ETH_MIN_FRAME_SIZE 64
110 #define ETH_MAX_FRAME_SIZE 1518
112 #define ETH_HEADER_SIZE 14
114 #define ETH_CRC_SIZE 4
119 #define VLAN_PCP_POS 13
120 #define VLAN_DEI_POS 12
121 #define VLAN_VID_POS 0
122 #define VLAN_PCP_MASK 0xE000
123 #define VLAN_DEI_MASK 0x1000
124 #define VLAN_VID_MASK 0x0FFF
127 #define macCopyAddr(destMacAddr, srcMacAddr) osMemcpy(destMacAddr, srcMacAddr, sizeof(MacAddr))
130 #define macCompAddr(macAddr1, macAddr2) (!osMemcmp(macAddr1, macAddr2, sizeof(MacAddr)))
133 #define macIsMulticastAddr(macAddr) (((macAddr)->b[0] & 0x01) != 0)
136 #define eui64CopyAddr(destEui64Addr, srcEui64Addr) osMemcpy(destEui64Addr, srcEui64Addr, sizeof(Eui64))
139 #define eui64CompAddr(eui64Addr1, eui64Addr2) (!osMemcmp(eui64Addr1, eui64Addr2, sizeof(Eui64)))
177 #if defined(__CCRX__)
179 #elif defined(__CWCC__) || defined(_WIN32)
180 #pragma pack(push, 1)
250 #if defined(__CCRX__)
252 #elif defined(__CWCC__) || defined(_WIN32)
error_t ethInit(NetInterface *interface)
Ethernet related initialization.
error_t ethSendFrame(NetInterface *interface, const MacAddr *destAddr, uint16_t type, NetBuffer *buffer, size_t offset, NetTxAncillary *ancillary)
Send an Ethernet frame.
Structure describing a buffer that spans multiple chunks.
void macAddrToEui64(const MacAddr *macAddr, Eui64 *interfaceId)
Map a MAC address to the IPv6 modified EUI-64 identifier.
@ MAC_ADDR_FLAG_MULTICAST
uint_t refCount
Reference count for the current entry.
error_t ethAttachLlcRxCalback(NetInterface *interface, LlcRxCallback callback, void *param)
Register LLC frame received callback.
void(* LlcRxCallback)(NetInterface *interface, EthHeader *header, const uint8_t *data, size_t length, NetRxAncillary *ancillary, void *param)
LLC frame received callback.
const Eui64 EUI64_UNSPECIFIED_ADDR
error_t ethDropMacAddr(NetInterface *interface, const MacAddr *macAddr)
Remove a unicast/multicast address from the MAC filter table.
const MacAddr MAC_UNSPECIFIED_ADDR
char_t * macAddrToString(const MacAddr *macAddr, char_t *str)
Convert a MAC address to a dash delimited string.
char_t * eui64AddrToString(const Eui64 *eui64, char_t *str)
Convert an EUI-64 address to a dash delimited string.
error_t macStringToAddr(const char_t *str, MacAddr *macAddr)
Convert a string representation of a MAC address to a binary MAC address.
EthType
Ethernet Type field.
MacAddrFlags
MAC address flags.
error_t ethDetachLlcRxCalback(NetInterface *interface)
Unregister LLC frame received callback.
NetBuffer * ethAllocBuffer(size_t length, size_t *offset)
Allocate a buffer to hold an Ethernet frame.
const MacAddr MAC_BROADCAST_ADDR
typedef __packed_struct
MAC address.
error_t ethAcceptMacAddr(NetInterface *interface, const MacAddr *macAddr)
Add a unicast/multicast address to the MAC filter table.
void ethProcessFrame(NetInterface *interface, uint8_t *frame, size_t length, NetRxAncillary *ancillary)
Process an incoming Ethernet frame.
void ethDumpHeader(const EthHeader *ethHeader)
Dump Ethernet header for debugging purpose.
error_t eui64StringToAddr(const char_t *str, Eui64 *eui64)
Convert a string representation of an EUI-64 address to a binary EUI-64 address.