Network interface controller abstraction layer. More...
#include "core/net.h"
Go to the source code of this file.
Data Structures | |
struct | SwitchFdbEntry |
Forwarding database entry. More... | |
struct | SwitchVlanEntry |
VLAN entry. More... | |
struct | NicDriver |
NIC driver. More... | |
struct | PhyDriver |
Ethernet PHY driver. More... | |
struct | SwitchDriver |
Ethernet switch driver. More... | |
struct | SmiDriver |
SMI driver. More... | |
struct | SpiDriver |
SPI driver. More... | |
struct | UartDriver |
UART driver. More... | |
struct | ExtIntDriver |
External interrupt line driver. More... | |
Macros | |
#define | NIC_TICK_INTERVAL 1000 |
#define | NIC_MAX_BLOCKING_TIME INFINITE_DELAY |
#define | NIC_CONTEXT_SIZE 16 |
#define | SWITCH_CPU_PORT 32 |
#define | SWITCH_CPU_PORT_MASK 0x80000000 |
#define | SMI_SYNC 0xFFFFFFFF |
#define | SMI_START 1 |
#define | SMI_OPCODE_0 0 |
#define | SMI_OPCODE_WRITE 1 |
#define | SMI_OPCODE_READ 2 |
#define | SMI_TA 2 |
Typedefs | |
typedef error_t(* | NicInit) (NetInterface *interface) |
typedef void(* | NicTick) (NetInterface *interface) |
typedef void(* | NicEnableIrq) (NetInterface *interface) |
typedef void(* | NicDisableIrq) (NetInterface *interface) |
typedef void(* | NicEventHandler) (NetInterface *interface) |
typedef error_t(* | NicSendPacket) (NetInterface *interface, const NetBuffer *buffer, size_t offset, NetTxAncillary *ancillary) |
typedef error_t(* | NicUpdateMacAddrFilter) (NetInterface *interface) |
typedef error_t(* | NicUpdateMacConfig) (NetInterface *interface) |
typedef void(* | NicWritePhyReg) (uint8_t opcode, uint8_t phyAddr, uint8_t regAddr, uint16_t data) |
typedef uint16_t(* | NicReadPhyReg) (uint8_t opcode, uint8_t phyAddr, uint8_t regAddr) |
typedef error_t(* | PhyInit) (NetInterface *interface) |
typedef void(* | PhyTick) (NetInterface *interface) |
typedef void(* | PhyEnableIrq) (NetInterface *interface) |
typedef void(* | PhyDisableIrq) (NetInterface *interface) |
typedef void(* | PhyEventHandler) (NetInterface *interface) |
typedef error_t(* | SwitchInit) (NetInterface *interface) |
typedef void(* | SwitchTick) (NetInterface *interface) |
typedef void(* | SwitchEnableIrq) (NetInterface *interface) |
typedef void(* | SwitchDisableIrq) (NetInterface *interface) |
typedef void(* | SwitchEventHandler) (NetInterface *interface) |
typedef error_t(* | SwitchTagFrame) (NetInterface *interface, NetBuffer *buffer, size_t *offset, NetTxAncillary *ancillary) |
typedef error_t(* | SwitchUntagFrame) (NetInterface *interface, uint8_t **frame, size_t *length, NetRxAncillary *ancillary) |
typedef bool_t(* | SwitchGetLinkState) (NetInterface *interface, uint8_t port) |
typedef uint32_t(* | SwitchGetLinkSpeed) (NetInterface *interface, uint8_t port) |
typedef NicDuplexMode(* | SwitchGetDuplexMode) (NetInterface *interface, uint8_t port) |
typedef void(* | SwitchSetPortState) (NetInterface *interface, uint8_t port, SwitchPortState state) |
typedef SwitchPortState(* | SwitchGetPortState) (NetInterface *interface, uint8_t port) |
typedef void(* | SwitchSetAgingTime) (NetInterface *interface, uint32_t agingTime) |
typedef void(* | SwitchEnableIgmpSnooping) (NetInterface *interface, bool_t enable) |
typedef void(* | SwitchEnableMldSnooping) (NetInterface *interface, bool_t enable) |
typedef void(* | SwitchEnableRsvdMcastTable) (NetInterface *interface, bool_t enable) |
typedef error_t(* | SwitchAddFdbEntry) (NetInterface *interface, const SwitchFdbEntry *entry) |
typedef error_t(* | SwitchDeleteFdbEntry) (NetInterface *interface, const SwitchFdbEntry *entry) |
typedef error_t(* | SwitchGetFdbEntry) (NetInterface *interface, uint_t index, SwitchFdbEntry *entry) |
typedef void(* | SwitchFlushStaticFdbTable) (NetInterface *interface) |
typedef void(* | SwitchFlushDynamicFdbTable) (NetInterface *interface, uint8_t port) |
typedef void(* | SwitchSetUnknownMcastFwdPorts) (NetInterface *interface, bool_t enable, uint32_t forwardPorts) |
typedef error_t(* | SmiInit) (void) |
typedef void(* | SmiWritePhyReg) (uint8_t opcode, uint8_t phyAddr, uint8_t regAddr, uint16_t data) |
typedef uint16_t(* | SmiReadPhyReg) (uint8_t opcode, uint8_t phyAddr, uint8_t regAddr) |
typedef error_t(* | SpiInit) (void) |
typedef error_t(* | SpiSetMode) (uint_t mode) |
typedef error_t(* | SpiSetBitrate) (uint_t bitrate) |
typedef void(* | SpiAssertCs) (void) |
typedef void(* | SpiDeassertCs) (void) |
typedef uint8_t(* | SpiTransfer) (uint8_t data) |
typedef void(* | SpiTransferMultipleBytes) (const uint8_t *txBuffer, uint8_t *rxBuffer, size_t length) |
typedef error_t(* | UartInit) (void) |
typedef void(* | UartEnableIrq) (void) |
typedef void(* | UartDisableIrq) (void) |
typedef void(* | UartStartTx) (void) |
typedef error_t(* | ExtIntInit) (void) |
typedef void(* | ExtIntEnableIrq) (void) |
typedef void(* | ExtIntDisableIrq) (void) |
Enumerations | |
enum | NicType { NIC_TYPE_UNKNOWN = 0, NIC_TYPE_ETHERNET = 1, NIC_TYPE_PPP = 2, NIC_TYPE_IPV4 = 3, NIC_TYPE_IPV6 = 4, NIC_TYPE_6LOWPAN = 4, NIC_TYPE_LOOPBACK = 5 } |
NIC types. More... | |
enum | NicLinkState { NIC_LINK_STATE_DOWN = 0, NIC_LINK_STATE_UP = 1, NIC_LINK_STATE_AUTO = 2 } |
Link state. More... | |
enum | NicLinkSpeed { NIC_LINK_SPEED_UNKNOWN = 0, NIC_LINK_SPEED_10MBPS = 10000000, NIC_LINK_SPEED_100MBPS = 100000000, NIC_LINK_SPEED_1GBPS = 1000000000 } |
Link speed. More... | |
enum | NicDuplexMode { NIC_UNKNOWN_DUPLEX_MODE = 0, NIC_HALF_DUPLEX_MODE = 1, NIC_FULL_DUPLEX_MODE = 2 } |
Duplex mode. More... | |
enum | SwitchPortState { SWITCH_PORT_STATE_UNKNOWN = 0, SWITCH_PORT_STATE_DISABLED = 1, SWITCH_PORT_STATE_BLOCKING = 2, SWITCH_PORT_STATE_LISTENING = 3, SWITCH_PORT_STATE_LEARNING = 4, SWITCH_PORT_STATE_FORWARDING = 5 } |
Switch port state. More... | |
Functions | |
NetInterface * | nicGetLogicalInterface (NetInterface *interface) |
Retrieve logical interface. More... | |
NetInterface * | nicGetPhysicalInterface (NetInterface *interface) |
Retrieve physical interface. More... | |
uint8_t | nicGetSwitchPort (NetInterface *interface) |
Retrieve switch port identifier. More... | |
uint16_t | nicGetVlanId (NetInterface *interface) |
Retrieve VLAN identifier. More... | |
uint16_t | nicGetVmanId (NetInterface *interface) |
Retrieve VMAN identifier. More... | |
bool_t | nicIsParentInterface (NetInterface *interface, NetInterface *parent) |
Test parent/child relationship between 2 interfaces. More... | |
void | nicTick (NetInterface *interface) |
Network controller timer handler. More... | |
error_t | nicSendPacket (NetInterface *interface, const NetBuffer *buffer, size_t offset, NetTxAncillary *ancillary) |
Send a packet to the network controller. More... | |
error_t | nicUpdateMacAddrFilter (NetInterface *interface) |
Configure MAC address filtering. More... | |
void | nicProcessPacket (NetInterface *interface, uint8_t *packet, size_t length, NetRxAncillary *ancillary) |
Handle a packet received by the network controller. More... | |
void | nicNotifyLinkChange (NetInterface *interface) |
Process link state change notification. More... | |
Variables | |
systime_t | nicTickCounter |
Detailed Description
Network interface controller abstraction layer.
License
SPDX-License-Identifier: GPL-2.0-or-later
Copyright (C) 2010-2024 Oryx Embedded SARL. All rights reserved.
This file is part of CycloneTCP Open.
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- Version
- 2.4.4
Definition in file nic.h.
Macro Definition Documentation
◆ NIC_CONTEXT_SIZE
◆ NIC_MAX_BLOCKING_TIME
#define NIC_MAX_BLOCKING_TIME INFINITE_DELAY |
◆ NIC_TICK_INTERVAL
◆ SMI_OPCODE_0
◆ SMI_OPCODE_READ
◆ SMI_OPCODE_WRITE
◆ SMI_START
◆ SMI_SYNC
◆ SMI_TA
◆ SWITCH_CPU_PORT
◆ SWITCH_CPU_PORT_MASK
Typedef Documentation
◆ ExtIntDisableIrq
◆ ExtIntEnableIrq
◆ ExtIntInit
◆ NicDisableIrq
typedef void(* NicDisableIrq) (NetInterface *interface) |
◆ NicEnableIrq
typedef void(* NicEnableIrq) (NetInterface *interface) |
◆ NicEventHandler
typedef void(* NicEventHandler) (NetInterface *interface) |
◆ NicInit
typedef error_t(* NicInit) (NetInterface *interface) |
◆ NicReadPhyReg
◆ NicSendPacket
typedef error_t(* NicSendPacket) (NetInterface *interface, const NetBuffer *buffer, size_t offset, NetTxAncillary *ancillary) |
◆ NicTick
typedef void(* NicTick) (NetInterface *interface) |
◆ NicUpdateMacAddrFilter
typedef error_t(* NicUpdateMacAddrFilter) (NetInterface *interface) |
◆ NicUpdateMacConfig
typedef error_t(* NicUpdateMacConfig) (NetInterface *interface) |
◆ NicWritePhyReg
◆ PhyDisableIrq
typedef void(* PhyDisableIrq) (NetInterface *interface) |
◆ PhyEnableIrq
typedef void(* PhyEnableIrq) (NetInterface *interface) |
◆ PhyEventHandler
typedef void(* PhyEventHandler) (NetInterface *interface) |
◆ PhyInit
typedef error_t(* PhyInit) (NetInterface *interface) |
◆ PhyTick
typedef void(* PhyTick) (NetInterface *interface) |
◆ SmiInit
◆ SmiReadPhyReg
◆ SmiWritePhyReg
◆ SpiAssertCs
◆ SpiDeassertCs
◆ SpiInit
◆ SpiSetBitrate
◆ SpiSetMode
◆ SpiTransfer
◆ SpiTransferMultipleBytes
◆ SwitchAddFdbEntry
typedef error_t(* SwitchAddFdbEntry) (NetInterface *interface, const SwitchFdbEntry *entry) |
◆ SwitchDeleteFdbEntry
typedef error_t(* SwitchDeleteFdbEntry) (NetInterface *interface, const SwitchFdbEntry *entry) |
◆ SwitchDisableIrq
typedef void(* SwitchDisableIrq) (NetInterface *interface) |
◆ SwitchEnableIgmpSnooping
typedef void(* SwitchEnableIgmpSnooping) (NetInterface *interface, bool_t enable) |
◆ SwitchEnableIrq
typedef void(* SwitchEnableIrq) (NetInterface *interface) |
◆ SwitchEnableMldSnooping
typedef void(* SwitchEnableMldSnooping) (NetInterface *interface, bool_t enable) |
◆ SwitchEnableRsvdMcastTable
typedef void(* SwitchEnableRsvdMcastTable) (NetInterface *interface, bool_t enable) |
◆ SwitchEventHandler
typedef void(* SwitchEventHandler) (NetInterface *interface) |
◆ SwitchFlushDynamicFdbTable
typedef void(* SwitchFlushDynamicFdbTable) (NetInterface *interface, uint8_t port) |
◆ SwitchFlushStaticFdbTable
typedef void(* SwitchFlushStaticFdbTable) (NetInterface *interface) |
◆ SwitchGetDuplexMode
typedef NicDuplexMode(* SwitchGetDuplexMode) (NetInterface *interface, uint8_t port) |
◆ SwitchGetFdbEntry
typedef error_t(* SwitchGetFdbEntry) (NetInterface *interface, uint_t index, SwitchFdbEntry *entry) |
◆ SwitchGetLinkSpeed
typedef uint32_t(* SwitchGetLinkSpeed) (NetInterface *interface, uint8_t port) |
◆ SwitchGetLinkState
typedef bool_t(* SwitchGetLinkState) (NetInterface *interface, uint8_t port) |
◆ SwitchGetPortState
typedef SwitchPortState(* SwitchGetPortState) (NetInterface *interface, uint8_t port) |
◆ SwitchInit
typedef error_t(* SwitchInit) (NetInterface *interface) |
◆ SwitchSetAgingTime
typedef void(* SwitchSetAgingTime) (NetInterface *interface, uint32_t agingTime) |
◆ SwitchSetPortState
typedef void(* SwitchSetPortState) (NetInterface *interface, uint8_t port, SwitchPortState state) |
◆ SwitchSetUnknownMcastFwdPorts
typedef void(* SwitchSetUnknownMcastFwdPorts) (NetInterface *interface, bool_t enable, uint32_t forwardPorts) |
◆ SwitchTagFrame
typedef error_t(* SwitchTagFrame) (NetInterface *interface, NetBuffer *buffer, size_t *offset, NetTxAncillary *ancillary) |
◆ SwitchTick
typedef void(* SwitchTick) (NetInterface *interface) |
◆ SwitchUntagFrame
typedef error_t(* SwitchUntagFrame) (NetInterface *interface, uint8_t **frame, size_t *length, NetRxAncillary *ancillary) |
◆ UartDisableIrq
◆ UartEnableIrq
◆ UartInit
◆ UartStartTx
Enumeration Type Documentation
◆ NicDuplexMode
enum NicDuplexMode |
◆ NicLinkSpeed
enum NicLinkSpeed |
◆ NicLinkState
enum NicLinkState |
◆ NicType
enum NicType |
◆ SwitchPortState
enum SwitchPortState |
Function Documentation
◆ nicGetLogicalInterface()
NetInterface* nicGetLogicalInterface | ( | NetInterface * | interface | ) |
◆ nicGetPhysicalInterface()
NetInterface* nicGetPhysicalInterface | ( | NetInterface * | interface | ) |
◆ nicGetSwitchPort()
uint8_t nicGetSwitchPort | ( | NetInterface * | interface | ) |
◆ nicGetVlanId()
uint16_t nicGetVlanId | ( | NetInterface * | interface | ) |
◆ nicGetVmanId()
uint16_t nicGetVmanId | ( | NetInterface * | interface | ) |
◆ nicIsParentInterface()
bool_t nicIsParentInterface | ( | NetInterface * | interface, |
NetInterface * | parent | ||
) |
◆ nicNotifyLinkChange()
void nicNotifyLinkChange | ( | NetInterface * | interface | ) |
◆ nicProcessPacket()
void nicProcessPacket | ( | NetInterface * | interface, |
uint8_t * | packet, | ||
size_t | length, | ||
NetRxAncillary * | ancillary | ||
) |
◆ nicSendPacket()
error_t nicSendPacket | ( | NetInterface * | interface, |
const NetBuffer * | buffer, | ||
size_t | offset, | ||
NetTxAncillary * | ancillary | ||
) |
Send a packet to the network controller.
- Parameters
-
[in] interface Underlying network interface [in] buffer Multi-part buffer containing the data to send [in] offset Offset to the first data byte [in] ancillary Additional options passed to the stack along with the packet
- Returns
- Error code
◆ nicTick()
void nicTick | ( | NetInterface * | interface | ) |
◆ nicUpdateMacAddrFilter()
error_t nicUpdateMacAddrFilter | ( | NetInterface * | interface | ) |