Go to the documentation of this file.
32 #define TRACE_LEVEL NIC_TRACE_LEVEL
76 TRACE_INFO(
"Initializing ADIN1110 Ethernet controller...\r\n");
79 interface->spiDriver->init();
82 if(interface->extIntDriver != NULL)
84 interface->extIntDriver->init();
134 #if (ADIN1110_OA_SPI_SUPPORT == ENABLED)
154 #if (ADIN1110_OA_SPI_SUPPORT == ENABLED)
201 interface->nicEvent =
TRUE;
227 #if (ADIN1110_OA_SPI_SUPPORT == ENABLED)
237 if(linkState && !interface->linkState)
244 interface->linkState =
TRUE;
250 else if(!linkState && interface->linkState)
253 interface->linkState =
FALSE;
270 if(interface->extIntDriver != NULL)
272 interface->extIntDriver->enableIrq();
285 if(interface->extIntDriver != NULL)
287 interface->extIntDriver->disableIrq();
300 #if (ADIN1110_OA_SPI_SUPPORT == ENABLED)
303 interface->nicEvent =
TRUE;
331 interface->nicEvent =
TRUE;
361 interface->nicEvent =
TRUE;
382 #if (ADIN1110_OA_SPI_SUPPORT == ENABLED)
419 interface->linkState =
TRUE;
424 interface->linkState =
FALSE;
467 #if (ADIN1110_OA_SPI_SUPPORT == ENABLED)
540 interface->spiDriver->assertCs();
545 chunk[j] = interface->spiDriver->transfer(chunk[j]);
549 interface->spiDriver->deassertCs();
559 interface->nicEvent =
TRUE;
639 #if (ADIN1110_OA_SPI_SUPPORT == ENABLED)
680 interface->spiDriver->assertCs();
685 chunk[i] = interface->spiDriver->transfer(chunk[i]);
689 interface->spiDriver->deassertCs();
827 (interface->macAddr.b[0] << 8) | interface->macAddr.b[1]);
831 (interface->macAddr.b[2] << 24) | (interface->macAddr.b[3] << 16) |
832 (interface->macAddr.b[4] << 8) | interface->macAddr.b[5]);
840 entry = &interface->macAddrFilter[i];
848 (entry->
addr.b[0] << 8) | entry->
addr.b[1]);
852 (entry->
addr.b[2] << 24) | (entry->
addr.b[3] << 16) |
853 (entry->
addr.b[4] << 8) | entry->
addr.b[5]);
883 #if (ADIN1110_OA_SPI_SUPPORT == ENABLED)
911 interface->spiDriver->assertCs();
914 interface->spiDriver->transfer((header >> 24) & 0xFF);
915 interface->spiDriver->transfer((header >> 16) & 0xFF);
916 interface->spiDriver->transfer((header >> 8) & 0xFF);
917 interface->spiDriver->transfer(header & 0xFF);
920 interface->spiDriver->transfer((
data >> 24) & 0xFF);
921 interface->spiDriver->transfer((
data >> 16) & 0xFF);
922 interface->spiDriver->transfer((
data >> 8) & 0xFF);
923 interface->spiDriver->transfer(
data & 0xFF);
925 #if (ADIN1110_PROTECTION_SUPPORT == ENABLED)
931 interface->spiDriver->transfer((
data >> 24) & 0xFF);
932 interface->spiDriver->transfer((
data >> 16) & 0xFF);
933 interface->spiDriver->transfer((
data >> 8) & 0xFF);
934 interface->spiDriver->transfer(
data & 0xFF);
938 interface->spiDriver->transfer(0x00);
939 interface->spiDriver->transfer(0x00);
940 interface->spiDriver->transfer(0x00);
941 interface->spiDriver->transfer(0x00);
944 interface->spiDriver->deassertCs();
947 interface->spiDriver->assertCs();
951 interface->spiDriver->transfer(
address & 0xFF);
954 interface->spiDriver->transfer((
data >> 24) & 0xFF);
955 interface->spiDriver->transfer((
data >> 16) & 0xFF);
956 interface->spiDriver->transfer((
data >> 8) & 0xFF);
957 interface->spiDriver->transfer(
data & 0xFF);
960 interface->spiDriver->deassertCs();
974 #if (ADIN1110_OA_SPI_SUPPORT == ENABLED)
1003 interface->spiDriver->assertCs();
1006 interface->spiDriver->transfer((header >> 24) & 0xFF);
1007 interface->spiDriver->transfer((header >> 16) & 0xFF);
1008 interface->spiDriver->transfer((header >> 8) & 0xFF);
1009 interface->spiDriver->transfer(header & 0xFF);
1012 interface->spiDriver->transfer(0x00);
1013 interface->spiDriver->transfer(0x00);
1014 interface->spiDriver->transfer(0x00);
1015 interface->spiDriver->transfer(0x00);
1018 data = interface->spiDriver->transfer(0x00) << 24;
1019 data |= interface->spiDriver->transfer(0x00) << 16;
1020 data |= interface->spiDriver->transfer(0x00) << 8;
1021 data |= interface->spiDriver->transfer(0x00);
1023 #if (ADIN1110_PROTECTION_SUPPORT == ENABLED)
1026 interface->spiDriver->transfer(0x00);
1027 interface->spiDriver->transfer(0x00);
1028 interface->spiDriver->transfer(0x00);
1029 interface->spiDriver->transfer(0x00);
1033 interface->spiDriver->deassertCs();
1041 interface->spiDriver->assertCs();
1045 interface->spiDriver->transfer(
address & 0xFF);
1048 interface->spiDriver->transfer(0x00);
1051 data = interface->spiDriver->transfer(0x00) << 24;
1052 data |= interface->spiDriver->transfer(0x00) << 16;
1053 data |= interface->spiDriver->transfer(0x00) << 8;
1054 data |= interface->spiDriver->transfer(0x00);
1057 interface->spiDriver->deassertCs();
1075 for(i = 0; i < 256; i++)
1078 TRACE_DEBUG(
"0x%02" PRIX16
": 0x%08" PRIX32
"\r\n", i,
1167 for(i = 0; i < 32; i++)
1170 TRACE_DEBUG(
"%02" PRIu8
": 0x%04" PRIX16
"\r\n", i,
1287 #if (ADIN1110_OA_SPI_SUPPORT == DISABLED)
1291 interface->spiDriver->assertCs();
1295 interface->spiDriver->transfer(
ADIN1110_TX & 0xFF);
1299 interface->spiDriver->transfer((header >> 8) & 0xFF);
1300 interface->spiDriver->transfer(header & 0xFF);
1303 for(i = 0; i <
length; i++)
1305 interface->spiDriver->transfer(
data[i]);
1311 interface->spiDriver->transfer(0x00);
1315 interface->spiDriver->deassertCs();
1331 #if (ADIN1110_OA_SPI_SUPPORT == DISABLED)
1335 interface->spiDriver->assertCs();
1342 interface->spiDriver->transfer(0x00);
1346 *header = interface->spiDriver->transfer(0x00) << 16;
1347 *header |= interface->spiDriver->transfer(0x00);
1352 data[i] = interface->spiDriver->transfer(0x00);
1358 interface->spiDriver->transfer(0x00);
1364 interface->spiDriver->transfer(0x00);
1368 interface->spiDriver->deassertCs();
1391 return ~
data & 0x01;
bool_t osSetEventFromIsr(OsEvent *event)
Set an event object to the signaled state from an interrupt service routine.
void nicNotifyLinkChange(NetInterface *interface)
Process link state change notification.
void adin1110EventHandler(NetInterface *interface)
ADIN1110 event handler.
ADIN1110 10Base-T1L Ethernet controller.
error_t adin1110ReceivePacket(NetInterface *interface)
Receive a packet.
#define ADIN1110_CHUNK_PAYLOAD_SIZE
error_t adin1110Init(NetInterface *interface)
ADIN1110 controller initialization.
#define ADIN1110_MDIOACC_MDIO_ST_CLAUSE_45
#define ADIN1110_MDIOACC_MDIO_DATA
#define ADIN1110_CRSM_STAT_CRSM_SYS_RDY
#define ADIN1110_RX_FOOTER_DV
#define ADIN1110_TX_HEADER_EBO
size_t netBufferRead(void *dest, const NetBuffer *src, size_t srcOffset, size_t length)
Read data from a multi-part buffer.
Structure describing a buffer that spans multiple chunks.
#define MAC_ADDR_FILTER_SIZE
void adin1110WriteMmdReg(NetInterface *interface, uint8_t devAddr, uint16_t regAddr, uint16_t data)
Write MMD register.
#define ADIN1110_ADDR_FILT_LWRn(index)
uint32_t adin1110CalcParity(uint32_t data)
Calculate parity bit over a 32-bit data.
#define ADIN1110_STATUS1_LINK_CHANGE
uint_t refCount
Reference count for the current entry.
#define ADIN1110_ADDR_FILT_UPR_MAC_ADDR_47_32
void adin1110EnableIrq(NetInterface *interface)
Enable interrupts.
void adin1110Tick(NetInterface *interface)
ADIN1110 timer handler.
#define ADIN1110_LED_CNTRL_LED0_EN
#define ADIN1110_TX_SPACE
#define ADIN1110_MDIOACC1
#define ADIN1110_MDIOACC_MDIO_DEVAD
#define ADIN1110_CTRL_HEADER_AID
#define ADIN1110_TX_FRAME_OVERHEAD
#define ADIN1110_MDIOACC_MDIO_ST_CLAUSE_22
#define ADIN1110_CTRL_HEADER_ADDR
void nicProcessPacket(NetInterface *interface, uint8_t *packet, size_t length, NetRxAncillary *ancillary)
Handle a packet received by the network controller.
#define ADIN1110_SPI_CMD_WRITE
void adin1110DisableIrq(NetInterface *interface)
Disable interrupts.
#define ADIN1110_CONFIG0_RXCTE
#define ADIN1110_BUFSTS_TXC
#define osMemcpy(dest, src, length)
#define ADIN1110_ADDR_FILT_LWR_MAC_ADDR_31_0
#define ADIN1110_LED_POLARITY_LED0_POLARITY_AUTOSENSE
error_t adin1110UpdateMacAddrFilter(NetInterface *interface)
Configure MAC address filtering.
#define ADIN1110_MDIOACC_MDIO_OP_READ
#define ADIN1110_RX_FOOTER_SV
const NetRxAncillary NET_DEFAULT_RX_ANCILLARY
#define ADIN1110_TX_HEADER_EV
@ ERROR_FAILURE
Generic error code.
#define ADIN1110_MDIOACC_MDIO_OP_WRITE
const NicDriver adin1110Driver
ADIN1110 driver.
#define ADIN1110_BUFSTS_RCA
#define ADIN1110_ADDR_FILT_UPRn(index)
void adin1110WriteFifo(NetInterface *interface, uint16_t header, const uint8_t *data, size_t length)
Write TX FIFO.
uint16_t adin1110ReadMmdReg(NetInterface *interface, uint8_t devAddr, uint16_t regAddr)
Read MMD register.
#define ADIN1110_ADDR_FILT_UPR_TO_HOST
#define ADIN1110_LED_CNTRL_LED0_FUNCTION_LINKUP_TXRX_ACTIVITY
#define ADIN1110_STATUS1_P1_LINK_STATUS
#define ADIN1110_CTRL_HEADER_P
void adin1110WritePhyReg(NetInterface *interface, uint8_t address, uint16_t data)
Write PHY register.
#define ADIN1110_P1_RX_FSIZE
#define ADIN1110_LED_CNTRL_LED1_FUNCTION_MASTER
#define ADIN1110_FRAME_HEADER_SIZE
size_t netBufferGetLength(const NetBuffer *buffer)
Get the actual length of a multi-part buffer.
void adin1110DumpPhyReg(NetInterface *interface)
Dump PHY registers for debugging purpose.
uint32_t adin1110ReadReg(NetInterface *interface, uint16_t address)
Read SPI register.
#define ADIN1110_CTRL_HEADER_LEN
#define ADIN1110_STATUS1_P1_RX_RDY
#define ADIN1110_DIGIO_PINMUX
#define ADIN1110_RX_FOOTER_EBO
#define ADIN1110_STATUS0_RESETC
#define ADIN1110_TX_FSIZE
#define ADIN1110_ETH_TX_BUFFER_SIZE
#define ADIN1110_TX_HEADER_DNC
#define ADIN1110_CONFIG2_CRC_APPEND
#define ADIN1110_CRSM_SFT_PD_CNTRL
#define ADIN1110_IMASK1_P1_RX_RDY_MASK
#define ADIN1110_IMASK1_TX_RDY_MASK
#define ADIN1110_LED_POLARITY
#define ADIN1110_CONFIG0_ZARFE
#define ADIN1110_TX_HEADER_DV
void adin1110WriteReg(NetInterface *interface, uint16_t address, uint32_t data)
Write SPI register.
#define ADIN1110_TX_SPACE_TX_SPACE
bool_t adin1110IrqHandler(NetInterface *interface)
ADIN1110 interrupt service routine.
#define ADIN1110_ADDR_FILT_UPR_APPLY2PORT1
#define ADIN1110_RESET_SWRESET
void adin1110ReadFifo(NetInterface *interface, uint16_t *header, uint8_t *data, size_t length)
Read RX FIFO.
#define ADIN1110_CONFIG0_TXCTHRESH_16_CREDITS
#define ADIN1110_MDIOACC0
void adin1110DumpReg(NetInterface *interface)
Dump SPI registers for debugging purpose.
uint16_t adin1110ReadPhyReg(NetInterface *interface, uint8_t address)
Read PHY register.
#define ADIN1110_CRSM_STAT
#define ADIN1110_RX_FOOTER_EV
#define ADIN1110_MDIOACC_MDIO_PRTAD_DEFAULT
#define ADIN1110_TX_HEADER_SV
#define ADIN1110_CONFIG0_SYNC
#define ADIN1110_MDIOACC_MDIO_TRDONE
#define ADIN1110_CTRL_HEADER_WNR
#define ADIN1110_PHYID_MODEL_DEFAULT
void osSetEvent(OsEvent *event)
Set the specified event object to the signaled state.
#define ADIN1110_SPI_CMD_READ
#define ADIN1110_DIGIO_PINMUX_DIGIO_LED1_PINMUX
#define ADIN1110_CRSM_SFT_PD_CNTRL_CRSM_SFT_PD
#define ADIN1110_CTRL_HEADER_MMS
#define ADIN1110_IMASK1_LINK_CHANGE_MASK
#define ADIN1110_STATUS1_TX_RDY
#define ADIN1110_ADDR_TABLE_SIZE
#define osMemset(p, value, length)
#define ADIN1110_MDIOACC_MDIO_OP_ADDR
#define ADIN1110_CONFIG0_CSARFE
#define ADIN1110_LED_CNTRL
#define ADIN1110_PHYID_OUI_DEFAULT
error_t adin1110SendPacket(NetInterface *interface, const NetBuffer *buffer, size_t offset, NetTxAncillary *ancillary)
Send a packet.
#define ADIN1110_TX_HEADER_NORX
#define ADIN1110_ETH_RX_BUFFER_SIZE
#define ADIN1110_DIGIO_PINMUX_DIGIO_LED1_PINMUX_LED_1
__weak_func void adin1110InitHook(NetInterface *interface)
ADIN1110 custom configuration.
#define ADIN1110_RX_FOOTER_RCA
#define ADIN1110_P1_RX_FSIZE_P1_RX_FRM_SIZE
#define ADIN1110_LED_POLARITY_LED1_POLARITY_AUTOSENSE
#define ADIN1110_LED_CNTRL_LED1_EN
#define ADIN1110_PHYID_REVISION_DEFAULT
#define ADIN1110_CONFIG0_TXCTE
#define ADIN1110_CONFIG0_CPS_64B
@ NIC_TYPE_ETHERNET
Ethernet interface.