w5500_driver.c
Go to the documentation of this file.
1 /**
2  * @file w5500_driver.c
3  * @brief WIZnet W5500 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 W5500 driver
42  **/
43 
45 {
47  ETH_MTU,
48  w5500Init,
49  w5500Tick,
55  NULL,
56  NULL,
57  NULL,
58  TRUE,
59  TRUE,
60  TRUE,
61  TRUE
62 };
63 
64 
65 /**
66  * @brief W5500 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 W5500 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  //Perform software reset
90  W5500_MR_RST);
91 
92  //Wait for reset completion
93  do
94  {
95  //Read mode register
97 
98  //The RST bit is automatically cleared after reset completion
99  } while((value & W5500_MR_RST) != 0);
100 
101  //Set the MAC address of the station
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]);
114 
115  //Set TX and RX buffer size for socket 0
120 
121  //Sockets 1 to 7 are not used
122  for(i = 1; i <= 7; i++)
123  {
126 
129  }
130 
131  //Configure socket 0 in MACRAW mode
134 
135  //Open socket 0
138 
139  //Wait for command completion
140  do
141  {
142  //Read status register
144 
145  //Check the status of the socket
146  } while(value != W5500_Sn_SR_SOCK_MACRAW);
147 
148  //Configure socket 0 interrupts
151 
152  //Enable socket 0 interrupts
155 
156  //Disable unused interrupts
158 
159  //Perform custom configuration
160  w5500InitHook(interface);
161 
162  //Dump registers for debugging purpose
163  w5500DumpReg(interface);
164 
165  //Accept any packets from the upper layer
166  osSetEvent(&interface->nicTxEvent);
167 
168  //Force the TCP/IP stack to poll the link state at startup
169  interface->nicEvent = TRUE;
170  //Notify the TCP/IP stack of the event
172 
173  //Successful initialization
174  return NO_ERROR;
175 }
176 
177 
178 /**
179  * @brief W5500 custom configuration
180  * @param[in] interface Underlying network interface
181  **/
182 
183 __weak_func void w5500InitHook(NetInterface *interface)
184 {
185 }
186 
187 
188 /**
189  * @brief W5500 timer handler
190  * @param[in] interface Underlying network interface
191  **/
192 
193 void w5500Tick(NetInterface *interface)
194 {
195  uint8_t value;
196  bool_t linkState;
197 
198  //Read PHY configuration register
200  //Retrieve current link state
201  linkState = (value & W5500_PHYCFGR_LNK) ? TRUE : FALSE;
202 
203  //Check link state
204  if(linkState && !interface->linkState)
205  {
206  //Get current speed
207  if((value & W5500_PHYCFGR_SPD) != 0)
208  {
209  interface->linkSpeed = NIC_LINK_SPEED_100MBPS;
210  }
211  else
212  {
213  interface->linkSpeed = NIC_LINK_SPEED_10MBPS;
214  }
215 
216  //Determine the new duplex mode
217  if((value & W5500_PHYCFGR_DPX) != 0)
218  {
219  interface->duplexMode = NIC_FULL_DUPLEX_MODE;
220  }
221  else
222  {
223  interface->duplexMode = NIC_HALF_DUPLEX_MODE;
224  }
225 
226  //Link is up
227  interface->linkState = TRUE;
228  //Process link state change event
229  nicNotifyLinkChange(interface);
230  }
231  else if(!linkState && interface->linkState)
232  {
233  //Link is down
234  interface->linkState = FALSE;
235  //Process link state change event
236  nicNotifyLinkChange(interface);
237  }
238  else
239  {
240  //No link change detected
241  }
242 }
243 
244 
245 /**
246  * @brief Enable interrupts
247  * @param[in] interface Underlying network interface
248  **/
249 
250 void w5500EnableIrq(NetInterface *interface)
251 {
252  //Enable interrupts
253  if(interface->extIntDriver != NULL)
254  {
255  interface->extIntDriver->enableIrq();
256  }
257 }
258 
259 
260 /**
261  * @brief Disable interrupts
262  * @param[in] interface Underlying network interface
263  **/
264 
266 {
267  //Disable interrupts
268  if(interface->extIntDriver != NULL)
269  {
270  interface->extIntDriver->disableIrq();
271  }
272 }
273 
274 
275 /**
276  * @brief W5500 interrupt service routine
277  * @param[in] interface Underlying network interface
278  * @return TRUE if a higher priority task must be woken. Else FALSE is returned
279  **/
280 
282 {
283  bool_t flag;
284  uint16_t n;
285  uint8_t isr;
286 
287  //This flag will be set if a higher priority task must be woken
288  flag = FALSE;
289 
290  //Read socket interrupt register
292  //Disable interrupts to release the interrupt line
294 
295  //Socket 0 interrupt?
296  if((isr & W5500_SIR_S0_INT) != 0)
297  {
298  //Read socket 0 interrupt register
300 
301  //Packet transmission complete?
302  if((isr & W5500_Sn_IR_SEND_OK) != 0)
303  {
304  //Get the amount of free memory available in the TX buffer
306 
307  //Check whether the TX buffer is available for writing
308  if(n >= ETH_MAX_FRAME_SIZE)
309  {
310  //The transmitter can accept another packet
311  osSetEvent(&interface->nicTxEvent);
312  }
313  }
314 
315  //Packet received?
316  if((isr & W5500_Sn_IR_RECV) != 0)
317  {
318  //Set event flag
319  interface->nicEvent = TRUE;
320  //Notify the TCP/IP stack of the event
321  flag |= osSetEventFromIsr(&netEvent);
322  }
323 
324  //Clear interrupt flags
327  }
328 
329  //Re-enable interrupts once the interrupt has been serviced
332 
333  //A higher priority task must be woken?
334  return flag;
335 }
336 
337 
338 /**
339  * @brief W5500 event handler
340  * @param[in] interface Underlying network interface
341  **/
342 
344 {
345  error_t error;
346 
347  //Process all pending packets
348  do
349  {
350  //Read incoming packet
351  error = w5500ReceivePacket(interface);
352 
353  //No more data in the receive buffer?
354  } while(error != ERROR_BUFFER_EMPTY);
355 }
356 
357 
358 /**
359  * @brief Send a packet
360  * @param[in] interface Underlying network interface
361  * @param[in] buffer Multi-part buffer containing the data to send
362  * @param[in] offset Offset to the first data byte
363  * @param[in] ancillary Additional options passed to the stack along with
364  * the packet
365  * @return Error code
366  **/
367 
369  const NetBuffer *buffer, size_t offset, NetTxAncillary *ancillary)
370 {
371  static uint8_t temp[W5500_ETH_TX_BUFFER_SIZE];
372  uint16_t n;
373  uint16_t p;
374  size_t length;
375 
376  //Retrieve the length of the packet
377  length = netBufferGetLength(buffer) - offset;
378 
379  //Check the frame length
381  {
382  //The transmitter can accept another packet
383  osSetEvent(&interface->nicTxEvent);
384  //Report an error
385  return ERROR_INVALID_LENGTH;
386  }
387 
388  //Get the amount of free memory available in the TX buffer
390 
391  //Make sure the TX buffer is available for writing
392  if(n < length)
393  return ERROR_FAILURE;
394 
395  //Copy user data
396  netBufferRead(temp, buffer, offset, length);
397 
398  //Get TX write pointer
400 
401  //Write TX buffer
403 
404  //Increment TX write pointer
406  p + length);
407 
408  //Start packet transmission
411 
412  //Get the amount of free memory available in the TX buffer
414 
415  //Check whether the TX buffer is available for writing
416  if(n >= ETH_MAX_FRAME_SIZE)
417  {
418  //The transmitter can accept another packet
419  osSetEvent(&interface->nicTxEvent);
420  }
421 
422  //Successful processing
423  return NO_ERROR;
424 }
425 
426 
427 /**
428  * @brief Receive a packet
429  * @param[in] interface Underlying network interface
430  * @return Error code
431  **/
432 
434 {
435  static uint8_t temp[W5500_ETH_RX_BUFFER_SIZE];
436  error_t error;
437  uint16_t p;
438  size_t length;
439 
440  //Get the amount of data in the RX buffer
442 
443  //Any packet pending in the receive buffer?
444  if(length > 0)
445  {
446  //Get RX read pointer
448 
449  //Read packet header
450  w5500ReadBuffer(interface, W5500_CTRL_BSB_S0_RX_BUFFER, p, temp, 2);
451 
452  //Retrieve the length of the received packet
453  length = LOAD16BE(temp);
454 
455  //Ensure the packet size is acceptable
456  if(length >= 2 && length <= (ETH_MAX_FRAME_SIZE + 2))
457  {
458  //Calculate the length of the packet data
459  length -= 2;
460 
461  //Read packet data
462  w5500ReadBuffer(interface, W5500_CTRL_BSB_S0_RX_BUFFER, p + 2, temp,
463  length);
464 
465  //Increment RX read pointer
467  p + length + 2);
468 
469  //Complete the processing of the receive data
472 
473  //Successful processing
474  error = NO_ERROR;
475  }
476  else
477  {
478  //The packet length is not valid
479  error = ERROR_INVALID_LENGTH;
480  }
481  }
482  else
483  {
484  //No more data in the receive buffer
485  error = ERROR_BUFFER_EMPTY;
486  }
487 
488  //Check whether a valid packet has been received
489  if(!error)
490  {
491  NetRxAncillary ancillary;
492 
493  //Additional options can be passed to the stack along with the packet
494  ancillary = NET_DEFAULT_RX_ANCILLARY;
495 
496  //Pass the packet to the upper layer
497  nicProcessPacket(interface, temp, length, &ancillary);
498  }
499 
500  //Return status code
501  return error;
502 }
503 
504 
505 /**
506  * @brief Configure MAC address filtering
507  * @param[in] interface Underlying network interface
508  * @return Error code
509  **/
510 
512 {
513  //Not implemented
514  return NO_ERROR;
515 }
516 
517 
518 /**
519  * @brief Write 8-bit register
520  * @param[in] interface Underlying network interface
521  * @param[in] control Control byte
522  * @param[in] address Register address
523  * @param[in] data Register value
524  **/
525 
526 void w5500WriteReg8(NetInterface *interface, uint8_t control,
527  uint16_t address, uint8_t data)
528 {
529  //Pull the CS pin low
530  interface->spiDriver->assertCs();
531 
532  //Address phase
533  interface->spiDriver->transfer(MSB(address));
534  interface->spiDriver->transfer(LSB(address));
535 
536  //Control phase
537  interface->spiDriver->transfer(control | W5500_CTRL_RWB_WRITE |
539 
540  //Data phase
541  interface->spiDriver->transfer(data);
542 
543  //Terminate the operation by raising the CS pin
544  interface->spiDriver->deassertCs();
545 }
546 
547 
548 /**
549  * @brief Read 8-bit register
550  * @param[in] interface Underlying network interface
551  * @param[in] control Control byte
552  * @param[in] address Register address
553  * @return Register value
554  **/
555 
556 uint8_t w5500ReadReg8(NetInterface *interface, uint8_t control,
557  uint16_t address)
558 {
559  uint8_t data;
560 
561  //Pull the CS pin low
562  interface->spiDriver->assertCs();
563 
564  //Address phase
565  interface->spiDriver->transfer(MSB(address));
566  interface->spiDriver->transfer(LSB(address));
567 
568  //Control phase
569  interface->spiDriver->transfer(control | W5500_CTRL_RWB_READ |
571 
572  //Data phase
573  data = interface->spiDriver->transfer(0x00);
574 
575  //Terminate the operation by raising the CS pin
576  interface->spiDriver->deassertCs();
577 
578  //Return register value
579  return data;
580 }
581 
582 
583 /**
584  * @brief Write 16-bit register
585  * @param[in] interface Underlying network interface
586  * @param[in] control Control byte
587  * @param[in] address Register address
588  * @param[in] data Register value
589  **/
590 
591 void w5500WriteReg16(NetInterface *interface, uint8_t control,
592  uint16_t address, uint16_t data)
593 {
594  //Pull the CS pin low
595  interface->spiDriver->assertCs();
596 
597  //Address phase
598  interface->spiDriver->transfer(MSB(address));
599  interface->spiDriver->transfer(LSB(address));
600 
601  //Control phase
602  interface->spiDriver->transfer(control | W5500_CTRL_RWB_WRITE |
604 
605  //Data phase
606  interface->spiDriver->transfer(MSB(data));
607  interface->spiDriver->transfer(LSB(data));
608 
609  //Terminate the operation by raising the CS pin
610  interface->spiDriver->deassertCs();
611 }
612 
613 
614 /**
615  * @brief Read 16-bit register
616  * @param[in] interface Underlying network interface
617  * @param[in] control Control byte
618  * @param[in] address Register address
619  * @return Register value
620  **/
621 
622 uint16_t w5500ReadReg16(NetInterface *interface, uint8_t control,
623  uint16_t address)
624 {
625  uint16_t data;
626 
627  //Pull the CS pin low
628  interface->spiDriver->assertCs();
629 
630  //Address phase
631  interface->spiDriver->transfer(MSB(address));
632  interface->spiDriver->transfer(LSB(address));
633 
634  //Control phase
635  interface->spiDriver->transfer(control | W5500_CTRL_RWB_READ |
637 
638  //Data phase
639  data = interface->spiDriver->transfer(0x00) << 8;
640  data |= interface->spiDriver->transfer(0x00);
641 
642  //Terminate the operation by raising the CS pin
643  interface->spiDriver->deassertCs();
644 
645  //Return register value
646  return data;
647 }
648 
649 
650 /**
651  * @brief Write TX buffer
652  * @param[in] interface Underlying network interface
653  * @param[in] control Control byte
654  * @param[in] address Buffer address
655  * @param[in] data Pointer to the data being written
656  * @param[in] length Number of data to write
657  **/
658 
659 void w5500WriteBuffer(NetInterface *interface, uint8_t control,
660  uint16_t address, const uint8_t *data, size_t length)
661 {
662  size_t i;
663 
664  //Pull the CS pin low
665  interface->spiDriver->assertCs();
666 
667  //Address phase
668  interface->spiDriver->transfer(MSB(address));
669  interface->spiDriver->transfer(LSB(address));
670 
671  //Control phase
672  interface->spiDriver->transfer(control | W5500_CTRL_RWB_WRITE |
674 
675  //Data phase
676  for(i = 0; i < length; i++)
677  {
678  interface->spiDriver->transfer(data[i]);
679  }
680 
681  //Terminate the operation by raising the CS pin
682  interface->spiDriver->deassertCs();
683 }
684 
685 
686 /**
687  * @brief Read RX buffer
688  * @param[in] interface Underlying network interface
689  * @param[in] control Control byte
690  * @param[in] address Buffer address
691  * @param[out] data Buffer where to store the incoming data
692  * @param[in] length Number of data to read
693  **/
694 
695 void w5500ReadBuffer(NetInterface *interface, uint8_t control,
696  uint16_t address, uint8_t *data, size_t length)
697 {
698  size_t i;
699 
700  //Pull the CS pin low
701  interface->spiDriver->assertCs();
702 
703  //Address phase
704  interface->spiDriver->transfer(MSB(address));
705  interface->spiDriver->transfer(LSB(address));
706 
707  //Control phase
708  interface->spiDriver->transfer(control | W5500_CTRL_RWB_READ |
710 
711  //Data phase
712  for(i = 0; i < length; i++)
713  {
714  data[i] = interface->spiDriver->transfer(0x00);
715  }
716 
717  //Terminate the operation by raising the CS pin
718  interface->spiDriver->deassertCs();
719 }
720 
721 
722 /**
723  * @brief Dump registers for debugging purpose
724  * @param[in] interface Underlying network interface
725  **/
726 
727 void w5500DumpReg(NetInterface *interface)
728 {
729  uint16_t i;
730 
731  //Loop through registers
732  for(i = 0; i < 64; i++)
733  {
734  //Display current host MAC register
735  TRACE_DEBUG("%02" PRIX16 ": 0x%02" PRIX8 "\r\n", i,
737  }
738 
739  //Terminate with a line feed
740  TRACE_DEBUG("\r\n");
741 }
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.
Definition: nic.c:559
#define W5500_SHAR1
Definition: w5500_driver.h:98
#define W5500_Sn_CR_RECV
Definition: w5500_driver.h:260
#define W5500_SHAR2
Definition: w5500_driver.h:99
#define W5500_MR
Definition: w5500_driver.h:88
int bool_t
Definition: compiler_port.h:53
#define netEvent
Definition: net_legacy.h:196
#define W5500_Sn_SR_SOCK_MACRAW
Definition: w5500_driver.h:282
@ NIC_FULL_DUPLEX_MODE
Definition: nic.h:125
#define W5500_CTRL_BSB_Sn_REG(n)
Definition: w5500_driver.h:308
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 W5500_Sn_TX_FSR0
Definition: w5500_driver.h:162
uint8_t w5500ReadReg8(NetInterface *interface, uint8_t control, uint16_t address)
Read 8-bit register.
Definition: w5500_driver.c:556
uint8_t control
Definition: ethernet.h:234
uint8_t p
Definition: ndp.h:300
#define W5500_SHAR5
Definition: w5500_driver.h:102
Structure describing a buffer that spans multiple chunks.
Definition: net_mem.h:89
#define TRUE
Definition: os_port.h:50
void w5500Tick(NetInterface *interface)
W5500 timer handler.
Definition: w5500_driver.c:193
uint8_t data[]
Definition: ethernet.h:222
#define ETH_MAX_FRAME_SIZE
Definition: ethernet.h:110
#define W5500_PHYCFGR_DPX
Definition: w5500_driver.h:229
#define W5500_SHAR3
Definition: w5500_driver.h:100
#define W5500_ETH_RX_BUFFER_SIZE
Definition: w5500_driver.h:46
void w5500DisableIrq(NetInterface *interface)
Disable interrupts.
Definition: w5500_driver.c:265
#define W5500_Sn_RXBUF_SIZE_16KB
Definition: w5500_driver.h:290
#define W5500_CTRL_BSB_COMMON_REG
Definition: w5500_driver.h:53
void nicProcessPacket(NetInterface *interface, uint8_t *packet, size_t length, NetRxAncillary *ancillary)
Handle a packet received by the network controller.
Definition: nic.c:392
#define W5500_CTRL_BSB_S0_TX_BUFFER
Definition: w5500_driver.h:55
#define W5500_CTRL_RWB_WRITE
Definition: w5500_driver.h:80
#define W5500_SIMR
Definition: w5500_driver.h:112
#define W5500_Sn_MR_MFEN
Definition: w5500_driver.h:238
error_t w5500Init(NetInterface *interface)
W5500 controller initialization.
Definition: w5500_driver.c:71
#define W5500_MR_RST
Definition: w5500_driver.h:180
#define FALSE
Definition: os_port.h:46
#define W5500_Sn_IR_RECV
Definition: w5500_driver.h:265
#define W5500_Sn_IMR_SEND_OK
Definition: w5500_driver.h:301
error_t
Error codes.
Definition: error.h:43
#define W5500_Sn_IR
Definition: w5500_driver.h:140
#define W5500_Sn_RX_RD0
Definition: w5500_driver.h:170
void w5500DumpReg(NetInterface *interface)
Dump registers for debugging purpose.
Definition: w5500_driver.c:727
#define W5500_Sn_IMR_RECV
Definition: w5500_driver.h:303
const NetRxAncillary NET_DEFAULT_RX_ANCILLARY
Definition: net_misc.c:104
@ ERROR_FAILURE
Generic error code.
Definition: error.h:45
#define W5500_Sn_IR_SEND_OK
Definition: w5500_driver.h:263
#define W5500_ETH_TX_BUFFER_SIZE
Definition: w5500_driver.h:39
#define NetRxAncillary
Definition: net_misc.h:40
#define NetInterface
Definition: net.h:36
@ NIC_LINK_SPEED_10MBPS
Definition: nic.h:111
@ ERROR_INVALID_LENGTH
Definition: error.h:111
#define W5500_CTRL_RWB_READ
Definition: w5500_driver.h:79
#define W5500_SIR_S0_INT
Definition: w5500_driver.h:206
error_t w5500ReceivePacket(NetInterface *interface)
Receive a packet.
Definition: w5500_driver.c:433
@ ERROR_BUFFER_EMPTY
Definition: error.h:141
#define W5500_SIMR_S0_IMR
Definition: w5500_driver.h:216
__weak_func void w5500InitHook(NetInterface *interface)
W5500 custom configuration.
Definition: w5500_driver.c:183
#define NetTxAncillary
Definition: net_misc.h:36
#define MSB(x)
Definition: os_port.h:59
#define W5500_Sn_CR
Definition: w5500_driver.h:139
#define W5500_Sn_MR_PROTOCOL_MACRAW
Definition: w5500_driver.h:249
#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
#define W5500_CTRL_OM_FDM2
Definition: w5500_driver.h:84
error_t w5500SendPacket(NetInterface *interface, const NetBuffer *buffer, size_t offset, NetTxAncillary *ancillary)
Send a packet.
Definition: w5500_driver.c:368
#define W5500_Sn_CR_SEND
Definition: w5500_driver.h:257
#define W5500_Sn_TXBUF_SIZE_0KB
Definition: w5500_driver.h:293
#define W5500_CTRL_OM_FDM1
Definition: w5500_driver.h:83
#define W5500_Sn_CR_OPEN
Definition: w5500_driver.h:252
#define W5500_Sn_RXBUF_SIZE_0KB
Definition: w5500_driver.h:285
#define W5500_PHYCFGR_SPD
Definition: w5500_driver.h:230
#define TRACE_DEBUG(...)
Definition: debug.h:107
void w5500EventHandler(NetInterface *interface)
W5500 event handler.
Definition: w5500_driver.c:343
const NicDriver w5500Driver
W5500 driver.
Definition: w5500_driver.c:44
#define W5500_CTRL_OM_VDM
Definition: w5500_driver.h:82
error_t w5500UpdateMacAddrFilter(NetInterface *interface)
Configure MAC address filtering.
Definition: w5500_driver.c:511
#define W5500_Sn_TXBUF_SIZE_16KB
Definition: w5500_driver.h:298
#define ETH_MTU
Definition: ethernet.h:116
#define W5500_Sn_TXBUF_SIZE
Definition: w5500_driver.h:161
uint8_t n
Ipv6Addr address[]
Definition: ipv6.h:325
@ NIC_HALF_DUPLEX_MODE
Definition: nic.h:124
bool_t w5500IrqHandler(NetInterface *interface)
W5500 interrupt service routine.
Definition: w5500_driver.c:281
uint8_t value[]
Definition: tcp.h:369
void w5500WriteReg8(NetInterface *interface, uint8_t control, uint16_t address, uint8_t data)
Write 8-bit register.
Definition: w5500_driver.c:526
#define W5500_Sn_RX_RSR0
Definition: w5500_driver.h:168
uint16_t w5500ReadReg16(NetInterface *interface, uint8_t control, uint16_t address)
Read 16-bit register.
Definition: w5500_driver.c:622
#define W5500_SHAR0
Definition: w5500_driver.h:97
#define W5500_CTRL_BSB_S0_REG
Definition: w5500_driver.h:54
void osSetEvent(OsEvent *event)
Set the specified event object to the signaled state.
#define W5500_Sn_TX_WR0
Definition: w5500_driver.h:166
void w5500WriteReg16(NetInterface *interface, uint8_t control, uint16_t address, uint16_t data)
Write 16-bit register.
Definition: w5500_driver.c:591
#define W5500_PHYCFGR
Definition: w5500_driver.h:134
#define W5500_SHAR4
Definition: w5500_driver.h:101
void w5500WriteBuffer(NetInterface *interface, uint8_t control, uint16_t address, const uint8_t *data, size_t length)
Write TX buffer.
Definition: w5500_driver.c:659
@ NIC_LINK_SPEED_100MBPS
Definition: nic.h:112
#define W5500_Sn_MR
Definition: w5500_driver.h:138
#define W5500_Sn_RXBUF_SIZE
Definition: w5500_driver.h:160
unsigned int uint_t
Definition: compiler_port.h:50
#define LOAD16BE(p)
Definition: cpu_endian.h:186
TCP/IP stack core.
void w5500EnableIrq(NetInterface *interface)
Enable interrupts.
Definition: w5500_driver.c:250
NIC driver.
Definition: nic.h:286
#define W5500_PHYCFGR_LNK
Definition: w5500_driver.h:231
#define W5500_Sn_IMR
Definition: w5500_driver.h:174
#define W5500_CTRL_BSB_S0_RX_BUFFER
Definition: w5500_driver.h:56
#define W5500_IMR
Definition: w5500_driver.h:110
WIZnet W5500 Ethernet controller.
#define W5500_Sn_SR
Definition: w5500_driver.h:141
@ NO_ERROR
Success.
Definition: error.h:44
Debugging facilities.
void w5500ReadBuffer(NetInterface *interface, uint8_t control, uint16_t address, uint8_t *data, size_t length)
Read RX buffer.
Definition: w5500_driver.c:695
@ NIC_TYPE_ETHERNET
Ethernet interface.
Definition: nic.h:83
#define W5500_SIR
Definition: w5500_driver.h:111