Go to the documentation of this file.
32 #define TRACE_LEVEL NIC_TRACE_LEVEL
77 TRACE_INFO(
"Initializing W6100 Ethernet controller...\r\n");
80 interface->spiDriver->init();
83 if(interface->extIntDriver != NULL)
85 interface->extIntDriver->init();
112 interface->macAddr.b[0]);
114 interface->macAddr.b[1]);
116 interface->macAddr.b[2]);
118 interface->macAddr.b[3]);
120 interface->macAddr.b[4]);
122 interface->macAddr.b[5]);
131 for(i = 1; i <= 7; i++)
182 interface->nicEvent =
TRUE;
217 if(linkState && !interface->linkState)
240 interface->linkState =
TRUE;
244 else if(!linkState && interface->linkState)
247 interface->linkState =
FALSE;
266 if(interface->extIntDriver != NULL)
268 interface->extIntDriver->enableIrq();
281 if(interface->extIntDriver != NULL)
283 interface->extIntDriver->disableIrq();
332 interface->nicEvent =
TRUE;
543 interface->spiDriver->assertCs();
554 interface->spiDriver->transfer(
data);
557 interface->spiDriver->deassertCs();
575 interface->spiDriver->assertCs();
586 data = interface->spiDriver->transfer(0x00);
589 interface->spiDriver->deassertCs();
608 interface->spiDriver->assertCs();
619 interface->spiDriver->transfer(
MSB(
data));
620 interface->spiDriver->transfer(
LSB(
data));
623 interface->spiDriver->deassertCs();
641 interface->spiDriver->assertCs();
652 data = interface->spiDriver->transfer(0x00) << 8;
653 data |= interface->spiDriver->transfer(0x00);
656 interface->spiDriver->deassertCs();
678 interface->spiDriver->assertCs();
689 for(i = 0; i <
length; i++)
691 interface->spiDriver->transfer(
data[i]);
695 interface->spiDriver->deassertCs();
714 interface->spiDriver->assertCs();
725 for(i = 0; i <
length; i++)
727 data[i] = interface->spiDriver->transfer(0x00);
731 interface->spiDriver->deassertCs();
745 for(i = 0; i < 4; i++)
748 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.
void w6100WriteBuffer(NetInterface *interface, uint8_t control, uint16_t address, const uint8_t *data, size_t length)
Write TX buffer.
#define W6100_CTRL_BSB_Sn_REG(n)
error_t w6100ReceivePacket(NetInterface *interface)
Receive a packet.
#define W6100_CTRL_BSB_S0_REG
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 W6100_Sn_TX_BSR_0KB
void w6100DumpReg(NetInterface *interface)
Dump registers for debugging purpose.
#define W6100_ETH_RX_BUFFER_SIZE
#define W6100_CTRL_BSB_S0_TX_BUFFER
#define ETH_MAX_FRAME_SIZE
#define W6100_CTRL_OM_FDM2
__weak_func void w6100InitHook(NetInterface *interface)
W6100 custom configuration.
bool_t w6100IrqHandler(NetInterface *interface)
W6100 interrupt service routine.
void w6100WriteReg8(NetInterface *interface, uint8_t control, uint16_t address, uint8_t data)
Write 8-bit register.
#define W6100_CTRL_BSB_COMMON_REG
void nicProcessPacket(NetInterface *interface, uint8_t *packet, size_t length, NetRxAncillary *ancillary)
Handle a packet received by the network controller.
error_t w6100Init(NetInterface *interface)
W6100 controller initialization.
void w6100EventHandler(NetInterface *interface)
W6100 event handler.
#define W6100_CIDR0_DEFAULT
WIZnet W6100 Ethernet controller.
uint8_t w6100ReadReg8(NetInterface *interface, uint8_t control, uint16_t address)
Read 8-bit register.
#define W6100_Sn_RX_BSR_16KB
const NetRxAncillary NET_DEFAULT_RX_ANCILLARY
@ ERROR_FAILURE
Generic error code.
#define W6100_NETLCKR_UNLOCK
void w6100ReadBuffer(NetInterface *interface, uint8_t control, uint16_t address, uint8_t *data, size_t length)
Read RX buffer.
uint16_t w6100ReadReg16(NetInterface *interface, uint8_t control, uint16_t address)
Read 16-bit register.
error_t w6100UpdateMacAddrFilter(NetInterface *interface)
Configure MAC address filtering.
size_t netBufferGetLength(const NetBuffer *buffer)
Get the actual length of a multi-part buffer.
#define W6100_Sn_IMR_SENDOK
#define W6100_ETH_TX_BUFFER_SIZE
#define W6100_Sn_RX_BSR_0KB
#define W6100_Sn_IRCLR_RECV
#define W6100_Sn_SR_SOCK_MACRAW
void w6100WriteReg16(NetInterface *interface, uint8_t control, uint16_t address, uint16_t data)
Write 16-bit register.
#define W6100_CTRL_OM_FDM1
#define W6100_Sn_IMR_RECV
#define W6100_CHPLCKR_UNLOCK
#define W6100_CTRL_BSB_S0_RX_BUFFER
#define W6100_CTRL_RWB_WRITE
#define W6100_Sn_IR_SENDOK
void w6100EnableIrq(NetInterface *interface)
Enable interrupts.
#define W6100_Sn_IRCLR_SENDOK
void osSetEvent(OsEvent *event)
Set the specified event object to the signaled state.
#define W6100_CTRL_RWB_READ
#define W6100_Sn_TX_BSR_16KB
#define W6100_CTRL_OM_VDM
error_t w6100SendPacket(NetInterface *interface, const NetBuffer *buffer, size_t offset, NetTxAncillary *ancillary)
Send a packet.
void w6100DisableIrq(NetInterface *interface)
Disable interrupts.
#define W6100_Sn_MR_PROTOCOL_MACRAW
void w6100Tick(NetInterface *interface)
W6100 timer handler.
const NicDriver w6100Driver
W6100 driver.
#define W6100_SIMR_S0_INT
@ NIC_TYPE_ETHERNET
Ethernet interface.