Go to the documentation of this file.
32 #define TRACE_LEVEL NIC_TRACE_LEVEL
55 #if (ETH_VLAN_SUPPORT == ENABLED)
66 if(interface->parent == NULL)
70 interface = interface->parent;
87 #if (ETH_VIRTUAL_IF_SUPPORT == ENABLED || ETH_VLAN_SUPPORT == ENABLED || \
88 ETH_PORT_TAGGING_SUPPORT == ENABLED)
95 if(interface->nicDriver != NULL || interface->parent == NULL)
99 interface = interface->parent;
116 #if (ETH_PORT_TAGGING_SUPPORT == ENABLED)
123 if(interface->port != 0 || interface->parent == NULL)
127 interface = interface->parent;
131 return interface->port;
147 #if (ETH_VLAN_SUPPORT == ENABLED)
154 if(interface->vlanId != 0 || interface->parent == NULL)
158 interface = interface->parent;
162 return interface->vlanId;
178 #if (ETH_VMAN_SUPPORT == ENABLED)
185 if(interface->vmanId != 0 || interface->parent == NULL)
189 interface = interface->parent;
193 return interface->vmanId;
210 #if (ETH_VIRTUAL_IF_SUPPORT == ENABLED || ETH_VLAN_SUPPORT == ENABLED || \
211 ETH_PORT_TAGGING_SUPPORT == ENABLED)
219 if(interface == parent)
226 if(interface->parent == NULL)
230 interface = interface->parent;
237 return (interface == parent) ?
TRUE :
FALSE;
254 if(interface->nicDriver != NULL)
257 interface->nicDriver->disableIrq(interface);
260 interface->nicDriver->tick(interface);
263 if(interface->configured)
265 interface->nicDriver->enableIrq(interface);
287 #if (TRACE_LEVEL >= TRACE_LEVEL_DEBUG)
300 if(interface->configured && interface->nicDriver != NULL)
318 interface->nicDriver->disableIrq(interface);
321 error = interface->nicDriver->sendPacket(interface, buffer, offset,
325 if(interface->configured)
327 interface->nicDriver->enableIrq(interface);
358 if(interface->nicDriver != NULL)
361 interface->nicDriver->disableIrq(interface);
364 error = interface->nicDriver->updateMacAddrFilter(interface);
367 if(interface->configured)
369 interface->nicDriver->enableIrq(interface);
401 if(interface->configured)
404 interface->nicDriver->enableIrq(interface);
411 type = interface->nicDriver->type;
413 #if (ETH_SUPPORT == ENABLED)
422 #if (PPP_SUPPORT == ENABLED)
431 #if (IPV4_SUPPORT == ENABLED)
441 #if (IPV6_SUPPORT == ENABLED)
459 #if (NET_LOOPBACK_IF_SUPPORT == ENABLED)
463 #if (IPV4_SUPPORT == ENABLED)
501 #if (IPV6_SUPPORT == ENABLED)
549 interface->nicDriver->disableIrq(interface);
572 if(physicalInterface->configured)
574 physicalInterface->nicDriver->enableIrq(physicalInterface);
589 virtualInterface->linkSpeed = interface->linkSpeed;
590 virtualInterface->duplexMode = interface->duplexMode;
593 virtualInterface->linkState = interface->linkState;
601 physicalInterface->nicDriver->disableIrq(physicalInterface);
void nicNotifyLinkChange(NetInterface *interface)
Process link state change notification.
#define ipv4IsMulticastAddr(ipAddr)
@ ERROR_INVALID_INTERFACE
Invalid interface.
error_t nicSendPacket(NetInterface *interface, const NetBuffer *buffer, size_t offset, NetTxAncillary *ancillary)
Send a packet to the network controller.
Structure describing a buffer that spans multiple chunks.
void ipv4ProcessPacket(NetInterface *interface, Ipv4Header *packet, size_t length, NetRxAncillary *ancillary)
Incoming IPv4 packet processing.
#define NIC_MAX_BLOCKING_TIME
#define NET_INTERFACE_COUNT
void ipv6ProcessPacket(NetInterface *interface, NetBuffer *ipPacket, size_t ipPacketOffset, NetRxAncillary *ancillary)
Incoming IPv6 packet processing.
void nicProcessPacket(NetInterface *interface, uint8_t *packet, size_t length, NetRxAncillary *ancillary)
Handle a packet received by the network controller.
#define TRACE_DEBUG_NET_BUFFER(p, b, o, n)
IPv4 multicast filtering.
@ NIC_TYPE_LOOPBACK
Loopback interface.
error_t ipv4CheckDestAddr(NetInterface *interface, Ipv4Addr ipAddr)
Destination IPv4 address filtering.
Helper functions for IPv4.
NetInterface * nicGetPhysicalInterface(NetInterface *interface)
Retrieve physical interface.
void ethProcessFrame(NetInterface *interface, uint8_t *frame, size_t length, NetRxAncillary *ancillary)
Process an incoming Ethernet frame.
error_t ipv6CheckDestAddr(NetInterface *interface, const Ipv6Addr *ipAddr)
Destination IPv6 address filtering.
Helper functions for IPv6.
void pppProcessFrame(NetInterface *interface, uint8_t *frame, size_t length, NetRxAncillary *ancillary)
Process an incoming PPP frame.
size_t netBufferGetLength(const NetBuffer *buffer)
Get the actual length of a multi-part buffer.
void netProcessLinkChange(NetInterface *interface)
Process link state change event.
error_t nicUpdateMacAddrFilter(NetInterface *interface)
Configure MAC address filtering.
error_t ipv4MulticastFilter(NetInterface *interface, Ipv4Addr destAddr, Ipv4Addr srcAddr)
Filter out incoming multicast traffic.
uint32_t systime_t
System time.
@ NIC_TYPE_PPP
PPP interface.
#define TRACE_DEBUG_ARRAY(p, a, n)
bool_t osWaitForEvent(OsEvent *event, systime_t timeout)
Wait until the specified event is in the signaled state.
Network interface controller abstraction layer.
#define macCompAddr(macAddr1, macAddr2)
#define netGetSystemTickCount()
@ NIC_TYPE_IPV4
IPv4 interface.
@ NIC_TYPE_6LOWPAN
6LoWPAN interface
void nicTick(NetInterface *interface)
Network controller timer handler.
NetInterface * nicGetLogicalInterface(NetInterface *interface)
Retrieve logical interface.
uint16_t nicGetVmanId(NetInterface *interface)
Retrieve VMAN identifier.
uint16_t nicGetVlanId(NetInterface *interface)
Retrieve VLAN identifier.
uint8_t nicGetSwitchPort(NetInterface *interface)
Retrieve switch port identifier.
bool_t nicIsParentInterface(NetInterface *interface, NetInterface *parent)
Test parent/child relationship between 2 interfaces.
const MacAddr MAC_UNSPECIFIED_ADDR
@ NIC_TYPE_ETHERNET
Ethernet interface.