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