Go to the documentation of this file.
32 #define TRACE_LEVEL NIC_TRACE_LEVEL
77 TRACE_INFO(
"Initializing W5500 Ethernet controller...\r\n");
80 interface->spiDriver->init();
83 if(interface->extIntDriver != NULL)
85 interface->extIntDriver->init();
103 interface->macAddr.b[0]);
105 interface->macAddr.b[1]);
107 interface->macAddr.b[2]);
109 interface->macAddr.b[3]);
111 interface->macAddr.b[4]);
113 interface->macAddr.b[5]);
122 for(i = 1; i <= 7; i++)
169 interface->nicEvent =
TRUE;
204 if(linkState && !interface->linkState)
227 interface->linkState =
TRUE;
231 else if(!linkState && interface->linkState)
234 interface->linkState =
FALSE;
253 if(interface->extIntDriver != NULL)
255 interface->extIntDriver->enableIrq();
268 if(interface->extIntDriver != NULL)
270 interface->extIntDriver->disableIrq();
319 interface->nicEvent =
TRUE;
530 interface->spiDriver->assertCs();
541 interface->spiDriver->transfer(
data);
544 interface->spiDriver->deassertCs();
562 interface->spiDriver->assertCs();
573 data = interface->spiDriver->transfer(0x00);
576 interface->spiDriver->deassertCs();
595 interface->spiDriver->assertCs();
606 interface->spiDriver->transfer(
MSB(
data));
607 interface->spiDriver->transfer(
LSB(
data));
610 interface->spiDriver->deassertCs();
628 interface->spiDriver->assertCs();
639 data = interface->spiDriver->transfer(0x00) << 8;
640 data |= interface->spiDriver->transfer(0x00);
643 interface->spiDriver->deassertCs();
665 interface->spiDriver->assertCs();
676 for(i = 0; i <
length; i++)
678 interface->spiDriver->transfer(
data[i]);
682 interface->spiDriver->deassertCs();
701 interface->spiDriver->assertCs();
712 for(i = 0; i <
length; i++)
714 data[i] = interface->spiDriver->transfer(0x00);
718 interface->spiDriver->deassertCs();
732 for(i = 0; i < 64; i++)
735 TRACE_DEBUG(
"%02" PRIX16
": 0x%02" PRIX8
"\r\n", i,
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.
#define W5500_Sn_SR_SOCK_MACRAW
#define W5500_CTRL_BSB_Sn_REG(n)
size_t netBufferRead(void *dest, const NetBuffer *src, size_t srcOffset, size_t length)
Read data from a multi-part buffer.
uint8_t w5500ReadReg8(NetInterface *interface, uint8_t control, uint16_t address)
Read 8-bit register.
Structure describing a buffer that spans multiple chunks.
void w5500Tick(NetInterface *interface)
W5500 timer handler.
#define ETH_MAX_FRAME_SIZE
#define W5500_PHYCFGR_DPX
#define W5500_ETH_RX_BUFFER_SIZE
void w5500DisableIrq(NetInterface *interface)
Disable interrupts.
#define W5500_Sn_RXBUF_SIZE_16KB
#define W5500_CTRL_BSB_COMMON_REG
void nicProcessPacket(NetInterface *interface, uint8_t *packet, size_t length, NetRxAncillary *ancillary)
Handle a packet received by the network controller.
#define W5500_CTRL_BSB_S0_TX_BUFFER
#define W5500_CTRL_RWB_WRITE
error_t w5500Init(NetInterface *interface)
W5500 controller initialization.
#define W5500_Sn_IMR_SEND_OK
void w5500DumpReg(NetInterface *interface)
Dump registers for debugging purpose.
#define W5500_Sn_IMR_RECV
const NetRxAncillary NET_DEFAULT_RX_ANCILLARY
@ ERROR_FAILURE
Generic error code.
#define W5500_Sn_IR_SEND_OK
#define W5500_ETH_TX_BUFFER_SIZE
#define W5500_CTRL_RWB_READ
error_t w5500ReceivePacket(NetInterface *interface)
Receive a packet.
#define W5500_SIMR_S0_IMR
__weak_func void w5500InitHook(NetInterface *interface)
W5500 custom configuration.
#define W5500_Sn_MR_PROTOCOL_MACRAW
size_t netBufferGetLength(const NetBuffer *buffer)
Get the actual length of a multi-part buffer.
#define W5500_CTRL_OM_FDM2
error_t w5500SendPacket(NetInterface *interface, const NetBuffer *buffer, size_t offset, NetTxAncillary *ancillary)
Send a packet.
#define W5500_Sn_TXBUF_SIZE_0KB
#define W5500_CTRL_OM_FDM1
#define W5500_Sn_RXBUF_SIZE_0KB
#define W5500_PHYCFGR_SPD
void w5500EventHandler(NetInterface *interface)
W5500 event handler.
const NicDriver w5500Driver
W5500 driver.
#define W5500_CTRL_OM_VDM
error_t w5500UpdateMacAddrFilter(NetInterface *interface)
Configure MAC address filtering.
#define W5500_Sn_TXBUF_SIZE_16KB
#define W5500_Sn_TXBUF_SIZE
bool_t w5500IrqHandler(NetInterface *interface)
W5500 interrupt service routine.
void w5500WriteReg8(NetInterface *interface, uint8_t control, uint16_t address, uint8_t data)
Write 8-bit register.
uint16_t w5500ReadReg16(NetInterface *interface, uint8_t control, uint16_t address)
Read 16-bit register.
#define W5500_CTRL_BSB_S0_REG
void osSetEvent(OsEvent *event)
Set the specified event object to the signaled state.
void w5500WriteReg16(NetInterface *interface, uint8_t control, uint16_t address, uint16_t data)
Write 16-bit register.
void w5500WriteBuffer(NetInterface *interface, uint8_t control, uint16_t address, const uint8_t *data, size_t length)
Write TX buffer.
#define W5500_Sn_RXBUF_SIZE
void w5500EnableIrq(NetInterface *interface)
Enable interrupts.
#define W5500_PHYCFGR_LNK
#define W5500_CTRL_BSB_S0_RX_BUFFER
WIZnet W5500 Ethernet controller.
void w5500ReadBuffer(NetInterface *interface, uint8_t control, uint16_t address, uint8_t *data, size_t length)
Read RX buffer.
@ NIC_TYPE_ETHERNET
Ethernet interface.