w5100s_driver.c
Go to the documentation of this file.
1 /**
2  * @file w5100s_driver.c
3  * @brief WIZnet W5100S Ethernet controller
4  *
5  * @section License
6  *
7  * SPDX-License-Identifier: GPL-2.0-or-later
8  *
9  * Copyright (C) 2010-2024 Oryx Embedded SARL. All rights reserved.
10  *
11  * This file is part of CycloneTCP Open.
12  *
13  * This program is free software; you can redistribute it and/or
14  * modify it under the terms of the GNU General Public License
15  * as published by the Free Software Foundation; either version 2
16  * of the License, or (at your option) any later version.
17  *
18  * This program is distributed in the hope that it will be useful,
19  * but WITHOUT ANY WARRANTY; without even the implied warranty of
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21  * GNU General Public License for more details.
22  *
23  * You should have received a copy of the GNU General Public License
24  * along with this program; if not, write to the Free Software Foundation,
25  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
26  *
27  * @author Oryx Embedded SARL (www.oryx-embedded.com)
28  * @version 2.4.0
29  **/
30 
31 //Switch to the appropriate trace level
32 #define TRACE_LEVEL NIC_TRACE_LEVEL
33 
34 //Dependencies
35 #include "core/net.h"
37 #include "debug.h"
38 
39 
40 /**
41  * @brief W5100S driver
42  **/
43 
45 {
47  ETH_MTU,
48  w5100sInit,
49  w5100sTick,
55  NULL,
56  NULL,
57  NULL,
58  TRUE,
59  TRUE,
60  TRUE,
61  TRUE
62 };
63 
64 
65 /**
66  * @brief W5100S controller initialization
67  * @param[in] interface Underlying network interface
68  * @return Error code
69  **/
70 
72 {
73  uint_t i;
74  uint8_t value;
75 
76  //Debug message
77  TRACE_INFO("Initializing W5100S Ethernet controller...\r\n");
78 
79  //Initialize SPI interface
80  interface->spiDriver->init();
81 
82  //Initialize external interrupt line driver
83  if(interface->extIntDriver != NULL)
84  {
85  interface->extIntDriver->init();
86  }
87 
88  //Wait for the SPI interface to be ready
89  do
90  {
91  //Read chip version register
92  value = w5100sReadReg8(interface, W5100S_VERR);
93 
94  //Check chip version
95  } while(value != W5100S_VERR_DEFAULT);
96 
97  //Perform software reset
99 
100  //Wait for reset completion
101  do
102  {
103  //Read mode register
104  value = w5100sReadReg8(interface, W5100S_MR);
105 
106  //The RST bit is automatically cleared after reset completion
107  } while((value & W5100S_MR_RST) != 0);
108 
109  //Unlock access to network configuration registers
111 
112  //Set the MAC address of the station
113  w5100sWriteReg8(interface, W5100S_SHAR0, interface->macAddr.b[0]);
114  w5100sWriteReg8(interface, W5100S_SHAR1, interface->macAddr.b[1]);
115  w5100sWriteReg8(interface, W5100S_SHAR2, interface->macAddr.b[2]);
116  w5100sWriteReg8(interface, W5100S_SHAR3, interface->macAddr.b[3]);
117  w5100sWriteReg8(interface, W5100S_SHAR4, interface->macAddr.b[4]);
118  w5100sWriteReg8(interface, W5100S_SHAR5, interface->macAddr.b[5]);
119 
120  //Set TX and RX buffer size for socket 0
123 
124  //Sockets 1 to 3 are not used
125  for(i = 1; i <= 3; i++)
126  {
131  }
132 
133  //Configure socket 0 in MACRAW mode
136 
137  //Open socket 0
139 
140  //Wait for command completion
141  do
142  {
143  //Read status register
144  value = w5100sReadReg8(interface, W5100S_S0_SR);
145 
146  //Check the status of the socket
147  } while(value != W5100S_Sn_SR_SOCK_MACRAW);
148 
149  //Configure socket 0 interrupts
152 
153  //Enable socket 0 interrupts
155 
156  //Perform custom configuration
157  w5100sInitHook(interface);
158 
159  //Dump registers for debugging purpose
160  w5100sDumpReg(interface);
161 
162  //Accept any packets from the upper layer
163  osSetEvent(&interface->nicTxEvent);
164 
165  //Force the TCP/IP stack to poll the link state at startup
166  interface->nicEvent = TRUE;
167  //Notify the TCP/IP stack of the event
169 
170  //Successful initialization
171  return NO_ERROR;
172 }
173 
174 
175 /**
176  * @brief W5100S custom configuration
177  * @param[in] interface Underlying network interface
178  **/
179 
180 __weak_func void w5100sInitHook(NetInterface *interface)
181 {
182 }
183 
184 
185 /**
186  * @brief W5100S timer handler
187  * @param[in] interface Underlying network interface
188  **/
189 
190 void w5100sTick(NetInterface *interface)
191 {
192  uint8_t value;
193  bool_t linkState;
194 
195  //Read PHY status register
196  value = w5100sReadReg8(interface, W5100S_PHYSR0);
197  //Retrieve current link state
198  linkState = (value & W5100S_PHYSR0_LINK) ? TRUE : FALSE;
199 
200  //Check link state
201  if(linkState && !interface->linkState)
202  {
203  //Get current speed
204  if((value & W5100S_PHYSR0_SPD) != 0)
205  {
206  interface->linkSpeed = NIC_LINK_SPEED_10MBPS;
207  }
208  else
209  {
210  interface->linkSpeed = NIC_LINK_SPEED_100MBPS;
211  }
212 
213  //Determine the new duplex mode
214  if((value & W5100S_PHYSR0_DPX) != 0)
215  {
216  interface->duplexMode = NIC_HALF_DUPLEX_MODE;
217  }
218  else
219  {
220  interface->duplexMode = NIC_FULL_DUPLEX_MODE;
221  }
222 
223  //Link is up
224  interface->linkState = TRUE;
225  //Process link state change event
226  nicNotifyLinkChange(interface);
227  }
228  else if(!linkState && interface->linkState)
229  {
230  //Link is down
231  interface->linkState = FALSE;
232  //Process link state change event
233  nicNotifyLinkChange(interface);
234  }
235  else
236  {
237  //No link change detected
238  }
239 }
240 
241 
242 /**
243  * @brief Enable interrupts
244  * @param[in] interface Underlying network interface
245  **/
246 
248 {
249  //Enable interrupts
250  if(interface->extIntDriver != NULL)
251  {
252  interface->extIntDriver->enableIrq();
253  }
254 }
255 
256 
257 /**
258  * @brief Disable interrupts
259  * @param[in] interface Underlying network interface
260  **/
261 
263 {
264  //Disable interrupts
265  if(interface->extIntDriver != NULL)
266  {
267  interface->extIntDriver->disableIrq();
268  }
269 }
270 
271 
272 /**
273  * @brief W5100S interrupt service routine
274  * @param[in] interface Underlying network interface
275  * @return TRUE if a higher priority task must be woken. Else FALSE is returned
276  **/
277 
279 {
280  bool_t flag;
281  uint16_t n;
282  uint8_t isr;
283 
284  //This flag will be set if a higher priority task must be woken
285  flag = FALSE;
286 
287  //Read socket interrupt register
288  isr = w5100sReadReg8(interface, W5100S_IR);
289  //Disable interrupts to release the interrupt line
290  w5100sWriteReg8(interface, W5100S_IMR, 0);
291 
292  //Socket 0 interrupt?
293  if((isr & W5100S_IR_S0_INT) != 0)
294  {
295  //Read socket 0 interrupt register
296  isr = w5100sReadReg8(interface, W5100S_S0_IR);
297 
298  //Packet transmission complete?
299  if((isr & W5100S_Sn_IR_SENDOK) != 0)
300  {
301  //Get the amount of free memory available in the TX buffer
302  n = w5100sReadReg16(interface, W5100S_S0_TX_FSR0);
303 
304  //Check whether the TX buffer is available for writing
305  if(n >= ETH_MAX_FRAME_SIZE)
306  {
307  //The transmitter can accept another packet
308  osSetEvent(&interface->nicTxEvent);
309  }
310  }
311 
312  //Packet received?
313  if((isr & W5100S_Sn_IR_RECV) != 0)
314  {
315  //Set event flag
316  interface->nicEvent = TRUE;
317  //Notify the TCP/IP stack of the event
318  flag |= osSetEventFromIsr(&netEvent);
319  }
320 
321  //Clear interrupt flags
322  w5100sWriteReg8(interface, W5100S_S0_IR, isr &
324  }
325 
326  //Re-enable interrupts once the interrupt has been serviced
328 
329  //A higher priority task must be woken?
330  return flag;
331 }
332 
333 
334 /**
335  * @brief W5100S event handler
336  * @param[in] interface Underlying network interface
337  **/
338 
340 {
341  error_t error;
342 
343  //Process all pending packets
344  do
345  {
346  //Read incoming packet
347  error = w5100sReceivePacket(interface);
348 
349  //No more data in the receive buffer?
350  } while(error != ERROR_BUFFER_EMPTY);
351 }
352 
353 
354 /**
355  * @brief Send a packet
356  * @param[in] interface Underlying network interface
357  * @param[in] buffer Multi-part buffer containing the data to send
358  * @param[in] offset Offset to the first data byte
359  * @param[in] ancillary Additional options passed to the stack along with
360  * the packet
361  * @return Error code
362  **/
363 
365  const NetBuffer *buffer, size_t offset, NetTxAncillary *ancillary)
366 {
367  static uint8_t temp[W5100S_ETH_TX_BUFFER_SIZE];
368  uint16_t n;
369  size_t length;
370 
371  //Retrieve the length of the packet
372  length = netBufferGetLength(buffer) - offset;
373 
374  //Check the frame length
376  {
377  //The transmitter can accept another packet
378  osSetEvent(&interface->nicTxEvent);
379  //Report an error
380  return ERROR_INVALID_LENGTH;
381  }
382 
383  //Get the amount of free memory available in the TX buffer
384  n = w5100sReadReg16(interface, W5100S_S0_TX_FSR0);
385 
386  //Make sure the TX buffer is available for writing
387  if(n < length)
388  return ERROR_FAILURE;
389 
390  //Copy user data
391  netBufferRead(temp, buffer, offset, length);
392 
393  //Write packet data
394  w5100sWriteData(interface, temp, length);
395 
396  //Get the amount of free memory available in the TX buffer
397  n = w5100sReadReg16(interface, W5100S_S0_TX_FSR0);
398 
399  //Check whether the TX buffer is available for writing
400  if(n >= ETH_MAX_FRAME_SIZE)
401  {
402  //The transmitter can accept another packet
403  osSetEvent(&interface->nicTxEvent);
404  }
405 
406  //Successful processing
407  return NO_ERROR;
408 }
409 
410 
411 /**
412  * @brief Receive a packet
413  * @param[in] interface Underlying network interface
414  * @return Error code
415  **/
416 
418 {
419  static uint8_t temp[W5100S_ETH_RX_BUFFER_SIZE];
420  error_t error;
421  size_t length;
422 
423  //Get the amount of data in the RX buffer
425 
426  //Any packet pending in the receive buffer?
427  if(length > 0)
428  {
429  //Read packet header
430  w5100sReadData(interface, temp, 2);
431 
432  //Retrieve the length of the received packet
433  length = LOAD16BE(temp);
434 
435  //Ensure the packet size is acceptable
436  if(length >= 2 && length <= (ETH_MAX_FRAME_SIZE + 2))
437  {
438  //Read packet data
439  w5100sReadData(interface, temp, length - 2);
440  //Successful processing
441  error = NO_ERROR;
442  }
443  else
444  {
445  //The packet length is not valid
446  error = ERROR_INVALID_LENGTH;
447  }
448  }
449  else
450  {
451  //No more data in the receive buffer
452  error = ERROR_BUFFER_EMPTY;
453  }
454 
455  //Check whether a valid packet has been received
456  if(!error)
457  {
458  NetRxAncillary ancillary;
459 
460  //Additional options can be passed to the stack along with the packet
461  ancillary = NET_DEFAULT_RX_ANCILLARY;
462 
463  //Pass the packet to the upper layer
464  nicProcessPacket(interface, temp, length, &ancillary);
465  }
466 
467  //Return status code
468  return error;
469 }
470 
471 
472 /**
473  * @brief Configure MAC address filtering
474  * @param[in] interface Underlying network interface
475  * @return Error code
476  **/
477 
479 {
480  //Not implemented
481  return NO_ERROR;
482 }
483 
484 
485 /**
486  * @brief Write 8-bit register
487  * @param[in] interface Underlying network interface
488  * @param[in] address Register address
489  * @param[in] data Register value
490  **/
491 
492 void w5100sWriteReg8(NetInterface *interface, uint16_t address, uint8_t data)
493 {
494  //Pull the CS pin low
495  interface->spiDriver->assertCs();
496 
497  //Control phase
498  interface->spiDriver->transfer(W5100S_CTRL_WRITE);
499 
500  //Address phase
501  interface->spiDriver->transfer(MSB(address));
502  interface->spiDriver->transfer(LSB(address));
503 
504  //Data phase
505  interface->spiDriver->transfer(data);
506 
507  //Terminate the operation by raising the CS pin
508  interface->spiDriver->deassertCs();
509 }
510 
511 
512 /**
513  * @brief Read 8-bit register
514  * @param[in] interface Underlying network interface
515  * @param[in] address Register address
516  * @return Register value
517  **/
518 
519 uint8_t w5100sReadReg8(NetInterface *interface, uint16_t address)
520 {
521  uint8_t data;
522 
523  //Pull the CS pin low
524  interface->spiDriver->assertCs();
525 
526  //Control phase
527  interface->spiDriver->transfer(W5100S_CTRL_READ);
528 
529  //Address phase
530  interface->spiDriver->transfer(MSB(address));
531  interface->spiDriver->transfer(LSB(address));
532 
533  //Data phase
534  data = interface->spiDriver->transfer(0x00);
535 
536  //Terminate the operation by raising the CS pin
537  interface->spiDriver->deassertCs();
538 
539  //Return register value
540  return data;
541 }
542 
543 
544 /**
545  * @brief Write 16-bit register
546  * @param[in] interface Underlying network interface
547  * @param[in] address Register address
548  * @param[in] data Register value
549  **/
550 
551 void w5100sWriteReg16(NetInterface *interface, uint16_t address, uint16_t data)
552 {
553  //Pull the CS pin low
554  interface->spiDriver->assertCs();
555 
556  //Control phase
557  interface->spiDriver->transfer(W5100S_CTRL_WRITE);
558 
559  //Address phase
560  interface->spiDriver->transfer(MSB(address));
561  interface->spiDriver->transfer(LSB(address));
562 
563  //Data phase
564  interface->spiDriver->transfer(MSB(data));
565  interface->spiDriver->transfer(LSB(data));
566 
567  //Terminate the operation by raising the CS pin
568  interface->spiDriver->deassertCs();
569 }
570 
571 
572 /**
573  * @brief Read 16-bit register
574  * @param[in] interface Underlying network interface
575  * @param[in] address Register address
576  * @return Register value
577  **/
578 
579 uint16_t w5100sReadReg16(NetInterface *interface, uint16_t address)
580 {
581  uint16_t data;
582 
583  //Pull the CS pin low
584  interface->spiDriver->assertCs();
585 
586  //Control phase
587  interface->spiDriver->transfer(W5100S_CTRL_READ);
588 
589  //Address phase
590  interface->spiDriver->transfer(MSB(address));
591  interface->spiDriver->transfer(LSB(address));
592 
593  //Data phase
594  data = interface->spiDriver->transfer(0x00) << 8;
595  data |= interface->spiDriver->transfer(0x00);
596 
597  //Terminate the operation by raising the CS pin
598  interface->spiDriver->deassertCs();
599 
600  //Return register value
601  return data;
602 }
603 
604 
605 /**
606  * @brief Write data
607  * @param[in] interface Underlying network interface
608  * @param[in] data Pointer to the data being written
609  * @param[in] length Number of data to write
610  **/
611 
612 void w5100sWriteData(NetInterface *interface, const uint8_t *data,
613  size_t length)
614 {
615  size_t p;
616  size_t size;
617  size_t offset;
618 
619  //Get TX buffer size
620  size = w5100sReadReg8(interface, W5100S_S0_TXBUF_SIZE) * 1024;
621  //Get TX write pointer
622  p = w5100sReadReg16(interface, W5100S_S0_TX_WR0);
623 
624  //Retrieve current offset
625  offset = p & (size - 1);
626 
627  //Check whether the data crosses buffer boundaries
628  if((offset + length) < size)
629  {
630  //Write data
631  w5100sWriteBuffer(interface, W5100S_TX_BUFFER + offset, data, length);
632  }
633  else
634  {
635  //Write the first part of the data
636  w5100sWriteBuffer(interface, W5100S_TX_BUFFER + offset, data,
637  size - offset);
638 
639  //Wrap around to the beginning of the circular buffer
641  data + size - offset, offset + length - size);
642  }
643 
644  //Increment TX write pointer
645  w5100sWriteReg16(interface, W5100S_S0_TX_WR0, p + length);
646 
647  //Start packet transmission
649 }
650 
651 
652 /**
653  * @brief Read data
654  * @param[in] interface Underlying network interface
655  * @param[out] data Buffer where to store the incoming data
656  * @param[in] length Number of data to read
657  **/
658 
659 void w5100sReadData(NetInterface *interface, uint8_t *data, size_t length)
660 {
661  size_t p;
662  size_t size;
663  size_t offset;
664 
665  //Get RX buffer size
666  size = w5100sReadReg8(interface, W5100S_S0_RXBUF_SIZE) * 1024;
667  //Get RX read pointer
668  p = w5100sReadReg16(interface, W5100S_S0_RX_RD0);
669 
670  //Retrieve current offset
671  offset = p & (size - 1);
672 
673  //Check whether the data crosses buffer boundaries
674  if((offset + length) < size)
675  {
676  //Read data
677  w5100sReadBuffer(interface, W5100S_RX_BUFFER + offset, data, length);
678  }
679  else
680  {
681  //Read the first part of the data
682  w5100sReadBuffer(interface, W5100S_RX_BUFFER + offset, data,
683  size - offset);
684 
685  //Wrap around to the beginning of the circular buffer
687  data + size - offset, offset + length - size);
688  }
689 
690  //Increment RX read pointer
691  w5100sWriteReg16(interface, W5100S_S0_RX_RD0, p + length);
692 
693  //Complete the processing of the receive data
695 }
696 
697 
698 /**
699  * @brief Write TX buffer
700  * @param[in] interface Underlying network interface
701  * @param[in] address Buffer address
702  * @param[in] data Pointer to the data being written
703  * @param[in] length Number of data to write
704  **/
705 
706 void w5100sWriteBuffer(NetInterface *interface, uint16_t address,
707  const uint8_t *data, size_t length)
708 {
709  size_t i;
710 
711  //Pull the CS pin low
712  interface->spiDriver->assertCs();
713 
714  //Control phase
715  interface->spiDriver->transfer(W5100S_CTRL_WRITE);
716 
717  //Address phase
718  interface->spiDriver->transfer(MSB(address));
719  interface->spiDriver->transfer(LSB(address));
720 
721  //Data phase
722  for(i = 0; i < length; i++)
723  {
724  interface->spiDriver->transfer(data[i]);
725  }
726 
727  //Terminate the operation by raising the CS pin
728  interface->spiDriver->deassertCs();
729 }
730 
731 
732 /**
733  * @brief Read RX buffer
734  * @param[in] interface Underlying network interface
735  * @param[in] address Buffer address
736  * @param[out] data Buffer where to store the incoming data
737  * @param[in] length Number of data to read
738  **/
739 
740 void w5100sReadBuffer(NetInterface *interface, uint16_t address, uint8_t *data,
741  size_t length)
742 {
743  size_t i;
744 
745  //Pull the CS pin low
746  interface->spiDriver->assertCs();
747 
748  //Control phase
749  interface->spiDriver->transfer(W5100S_CTRL_READ);
750 
751  //Address phase
752  interface->spiDriver->transfer(MSB(address));
753  interface->spiDriver->transfer(LSB(address));
754 
755  //Data phase
756  for(i = 0; i < length; i++)
757  {
758  data[i] = interface->spiDriver->transfer(0x00);
759  }
760 
761  //Terminate the operation by raising the CS pin
762  interface->spiDriver->deassertCs();
763 }
764 
765 
766 /**
767  * @brief Dump registers for debugging purpose
768  * @param[in] interface Underlying network interface
769  **/
770 
771 void w5100sDumpReg(NetInterface *interface)
772 {
773  uint16_t i;
774 
775  //Loop through registers
776  for(i = 0; i < 64; i++)
777  {
778  //Display current host MAC register
779  TRACE_DEBUG("%02" PRIX16 ": 0x%02" PRIX8 "\r\n", i,
780  w5100sReadReg8(interface, i));
781  }
782 
783  //Terminate with a line feed
784  TRACE_DEBUG("\r\n");
785 }
unsigned int uint_t
Definition: compiler_port.h:50
int bool_t
Definition: compiler_port.h:53
#define LOAD16BE(p)
Definition: cpu_endian.h:186
Debugging facilities.
#define TRACE_DEBUG(...)
Definition: debug.h:107
#define TRACE_INFO(...)
Definition: debug.h:95
uint8_t n
error_t
Error codes.
Definition: error.h:43
@ ERROR_BUFFER_EMPTY
Definition: error.h:141
@ NO_ERROR
Success.
Definition: error.h:44
@ ERROR_INVALID_LENGTH
Definition: error.h:111
@ ERROR_FAILURE
Generic error code.
Definition: error.h:45
#define ETH_MTU
Definition: ethernet.h:116
uint8_t data[]
Definition: ethernet.h:222
#define ETH_MAX_FRAME_SIZE
Definition: ethernet.h:110
Ipv6Addr address[]
Definition: ipv6.h:316
uint8_t p
Definition: ndp.h:300
TCP/IP stack core.
#define NetInterface
Definition: net.h:36
#define netEvent
Definition: net_legacy.h:196
size_t netBufferGetLength(const NetBuffer *buffer)
Get the actual length of a multi-part buffer.
Definition: net_mem.c:297
size_t netBufferRead(void *dest, const NetBuffer *src, size_t srcOffset, size_t length)
Read data from a multi-part buffer.
Definition: net_mem.c:674
const NetRxAncillary NET_DEFAULT_RX_ANCILLARY
Definition: net_misc.c:101
#define NetRxAncillary
Definition: net_misc.h:40
#define NetTxAncillary
Definition: net_misc.h:36
void nicProcessPacket(NetInterface *interface, uint8_t *packet, size_t length, NetRxAncillary *ancillary)
Handle a packet received by the network controller.
Definition: nic.c:391
void nicNotifyLinkChange(NetInterface *interface)
Process link state change notification.
Definition: nic.c:548
@ NIC_TYPE_ETHERNET
Ethernet interface.
Definition: nic.h:83
@ NIC_FULL_DUPLEX_MODE
Definition: nic.h:125
@ NIC_HALF_DUPLEX_MODE
Definition: nic.h:124
@ NIC_LINK_SPEED_100MBPS
Definition: nic.h:112
@ NIC_LINK_SPEED_10MBPS
Definition: nic.h:111
#define LSB(x)
Definition: os_port.h:55
#define TRUE
Definition: os_port.h:50
#define FALSE
Definition: os_port.h:46
#define MSB(x)
Definition: os_port.h:59
bool_t osSetEventFromIsr(OsEvent *event)
Set an event object to the signaled state from an interrupt service routine.
void osSetEvent(OsEvent *event)
Set the specified event object to the signaled state.
Structure describing a buffer that spans multiple chunks.
Definition: net_mem.h:89
NIC driver.
Definition: nic.h:283
uint8_t length
Definition: tcp.h:368
uint8_t value[]
Definition: tcp.h:369
uint16_t w5100sReadReg16(NetInterface *interface, uint16_t address)
Read 16-bit register.
const NicDriver w5100sDriver
W5100S driver.
Definition: w5100s_driver.c:44
void w5100sDumpReg(NetInterface *interface)
Dump registers for debugging purpose.
void w5100sReadBuffer(NetInterface *interface, uint16_t address, uint8_t *data, size_t length)
Read RX buffer.
error_t w5100sSendPacket(NetInterface *interface, const NetBuffer *buffer, size_t offset, NetTxAncillary *ancillary)
Send a packet.
void w5100sWriteReg8(NetInterface *interface, uint16_t address, uint8_t data)
Write 8-bit register.
void w5100sWriteData(NetInterface *interface, const uint8_t *data, size_t length)
Write data.
uint8_t w5100sReadReg8(NetInterface *interface, uint16_t address)
Read 8-bit register.
void w5100sEnableIrq(NetInterface *interface)
Enable interrupts.
void w5100sReadData(NetInterface *interface, uint8_t *data, size_t length)
Read data.
error_t w5100sReceivePacket(NetInterface *interface)
Receive a packet.
__weak_func void w5100sInitHook(NetInterface *interface)
W5100S custom configuration.
void w5100sDisableIrq(NetInterface *interface)
Disable interrupts.
error_t w5100sUpdateMacAddrFilter(NetInterface *interface)
Configure MAC address filtering.
void w5100sWriteReg16(NetInterface *interface, uint16_t address, uint16_t data)
Write 16-bit register.
void w5100sTick(NetInterface *interface)
W5100S timer handler.
error_t w5100sInit(NetInterface *interface)
W5100S controller initialization.
Definition: w5100s_driver.c:71
void w5100sEventHandler(NetInterface *interface)
W5100S event handler.
void w5100sWriteBuffer(NetInterface *interface, uint16_t address, const uint8_t *data, size_t length)
Write TX buffer.
bool_t w5100sIrqHandler(NetInterface *interface)
W5100S interrupt service routine.
WIZnet W5100S Ethernet controller.
#define W5100S_Sn_CR_OPEN
#define W5100S_S0_CR
#define W5100S_CTRL_READ
Definition: w5100s_driver.h:52
#define W5100S_IMR
Definition: w5100s_driver.h:78
#define W5100S_S0_RX_RSR0
#define W5100S_PHYSR0
#define W5100S_Sn_IMR_RECV
#define W5100S_Sn_TXBUF_SIZE(n)
#define W5100S_Sn_TXBUF_SIZE_8KB
#define W5100S_S0_TX_WR0
#define W5100S_IMR_S0_INT
#define W5100S_Sn_MR_MF
#define W5100S_SHAR0
Definition: w5100s_driver.h:65
#define W5100S_SHAR4
Definition: w5100s_driver.h:69
#define W5100S_IR
Definition: w5100s_driver.h:77
#define W5100S_IR_S0_INT
#define W5100S_S0_IR
#define W5100S_MR_RST
#define W5100S_S0_RXBUF_SIZE
#define W5100S_Sn_IR_SENDOK
#define W5100S_SHAR2
Definition: w5100s_driver.h:67
#define W5100S_CTRL_WRITE
Definition: w5100s_driver.h:53
#define W5100S_Sn_RXBUF_SIZE(n)
#define W5100S_Sn_TXBUF_SIZE_0KB
#define W5100S_VERR_DEFAULT
#define W5100S_NETLCKR
#define W5100S_Sn_CR_RECV
#define W5100S_S0_TXBUF_SIZE
#define W5100S_ETH_TX_BUFFER_SIZE
Definition: w5100s_driver.h:39
#define W5100S_SHAR5
Definition: w5100s_driver.h:70
#define W5100S_Sn_IMR_SENDOK
#define W5100S_PHYSR0_SPD
#define W5100S_S0_SR
#define W5100S_PHYSR0_LINK
#define W5100S_Sn_SR_SOCK_MACRAW
#define W5100S_Sn_RXBUF_SIZE_0KB
#define W5100S_ETH_RX_BUFFER_SIZE
Definition: w5100s_driver.h:46
#define W5100S_Sn_RXBUF_SIZE_8KB
#define W5100S_SHAR1
Definition: w5100s_driver.h:66
#define W5100S_S0_TX_FSR0
#define W5100S_TX_BUFFER
#define W5100S_S0_MR
#define W5100S_Sn_MR_PROTOCOL_MACRAW
#define W5100S_S0_IMR
#define W5100S_RX_BUFFER
#define W5100S_PHYSR0_DPX
#define W5100S_VERR
#define W5100S_MR
Definition: w5100s_driver.h:56
#define W5100S_S0_RX_RD0
#define W5100S_NETLCKR_UNLOCK
#define W5100S_SHAR3
Definition: w5100s_driver.h:68
#define W5100S_Sn_CR_SEND
#define W5100S_Sn_IR_RECV