dm9000_driver.c
Go to the documentation of this file.
1 /**
2  * @file dm9000_driver.c
3  * @brief DM9000A/B 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"
36 #include "core/ethernet.h"
38 #include "debug.h"
39 
40 
41 /**
42  * @brief DM9000 driver
43  **/
44 
46 {
48  ETH_MTU,
49  dm9000Init,
50  dm9000Tick,
56  NULL,
57  NULL,
58  NULL,
59  TRUE,
60  TRUE,
61  TRUE,
62  FALSE
63 };
64 
65 
66 /**
67  * @brief DM9000 controller initialization
68  * @param[in] interface Underlying network interface
69  * @return Error code
70  **/
71 
73 {
74  uint_t i;
75  uint16_t vendorId;
76  uint16_t productId;
77  uint8_t chipRev;
78  Dm9000Context *context;
79 
80  //Debug message
81  TRACE_INFO("Initializing DM9000 Ethernet controller...\r\n");
82 
83  //Initialize external interrupt line driver
84  if(interface->extIntDriver != NULL)
85  {
86  interface->extIntDriver->init();
87  }
88 
89  //Point to the driver context
90  context = (Dm9000Context *) interface->nicContext;
91 
92  //Initialize driver specific variables
93  context->queuedPackets = 0;
94 
95  //Retrieve vendorID, product ID and chip revision
96  vendorId = (dm9000ReadReg(DM9000_VIDH) << 8) | dm9000ReadReg(DM9000_VIDL);
97  productId = (dm9000ReadReg(DM9000_PIDH) << 8) | dm9000ReadReg(DM9000_PIDL);
98  chipRev = dm9000ReadReg(DM9000_CHIPR);
99 
100  //Check vendor ID and product ID
101  if(vendorId != DM9000_VID || productId != DM9000_PID)
102  {
103  return ERROR_WRONG_IDENTIFIER;
104  }
105 
106  //Check chip revision
107  if(chipRev != DM9000_CHIPR_REV_A && chipRev != DM9000_CHIPR_REV_B)
108  {
109  return ERROR_WRONG_IDENTIFIER;
110  }
111 
112  //Power up the internal PHY by clearing PHYPD
113  dm9000WriteReg(DM9000_GPR, 0x00);
114  //Wait for the PHY to be ready
115  sleep(10);
116 
117  //Software reset
119  //Wait for the reset to complete
120  while((dm9000ReadReg(DM9000_NCR) & DM9000_NCR_RST) != 0)
121  {
122  }
123 
124  //PHY software reset
126  //Wait for the PHY reset to complete
128  {
129  }
130 
131  //Debug message
132  TRACE_INFO(" VID = 0x%04" PRIX16 "\r\n", vendorId);
133  TRACE_INFO(" PID = 0x%04" PRIX16 "\r\n", productId);
134  TRACE_INFO(" CHIPR = 0x%02" PRIX8 "\r\n", chipRev);
135  TRACE_INFO(" PHYIDR1 = 0x%04" PRIX16 "\r\n", dm9000ReadPhyReg(DM9000_PHYIDR1));
136  TRACE_INFO(" PHYIDR2 = 0x%04" PRIX16 "\r\n", dm9000ReadPhyReg(DM9000_PHYIDR2));
137 
138  //Enable loopback mode?
139 #if (DM9000_LOOPBACK_MODE == ENABLED)
140  //Enable loopback mode
142 
143  //Set operation mode
146 #endif
147 
148  //Set host MAC address
149  for(i = 0; i < 6; i++)
150  {
151  dm9000WriteReg(DM9000_PAR0 + i, interface->macAddr.b[i]);
152  }
153 
154  //Initialize hash table
155  for(i = 0; i < 8; i++)
156  {
157  dm9000WriteReg(DM9000_MAR0 + i, 0x00);
158  }
159 
160  //Always accept broadcast packets
162 
163  //Enable the Pointer Auto Return function
165 
166  //Clear NSR status bits
169 
170  //Clear interrupt flags
173 
174  //Enable interrupts
177 
178  //Enable the receiver by setting RXEN
181 
182  //Perform custom configuration
183  dm9000InitHook(interface);
184 
185  //Accept any packets from the upper layer
186  osSetEvent(&interface->nicTxEvent);
187 
188  //Force the TCP/IP stack to poll the link state at startup
189  interface->nicEvent = TRUE;
190  //Notify the TCP/IP stack of the event
192 
193  //Successful initialization
194  return NO_ERROR;
195 }
196 
197 
198 /**
199  * @brief DM9000 custom configuration
200  * @param[in] interface Underlying network interface
201  **/
202 
203 __weak_func void dm9000InitHook(NetInterface *interface)
204 {
205 }
206 
207 
208 /**
209  * @brief DM9000 timer handler
210  * @param[in] interface Underlying network interface
211  **/
212 
213 void dm9000Tick(NetInterface *interface)
214 {
215 }
216 
217 
218 /**
219  * @brief Enable interrupts
220  * @param[in] interface Underlying network interface
221  **/
222 
224 {
225  //Enable interrupts
226  if(interface->extIntDriver != NULL)
227  {
228  interface->extIntDriver->enableIrq();
229  }
230 }
231 
232 
233 /**
234  * @brief Disable interrupts
235  * @param[in] interface Underlying network interface
236  **/
237 
239 {
240  //Disable interrupts
241  if(interface->extIntDriver != NULL)
242  {
243  interface->extIntDriver->disableIrq();
244  }
245 }
246 
247 
248 /**
249  * @brief DM9000 interrupt service routine
250  * @param[in] interface Underlying network interface
251  * @return TRUE if a higher priority task must be woken. Else FALSE is returned
252  **/
253 
255 {
256  bool_t flag;
257  uint8_t status;
258  uint8_t mask;
259  Dm9000Context *context;
260 
261  //This flag will be set if a higher priority task must be woken
262  flag = FALSE;
263 
264  //Point to the driver context
265  context = (Dm9000Context *) interface->nicContext;
266 
267  //Read interrupt status register
268  status = dm9000ReadReg(DM9000_ISR);
269 
270  //Link status change?
271  if((status & DM9000_ISR_LNKCHG) != 0)
272  {
273  //Read interrupt mask register
275  //Disable LNKCHGI interrupt
277 
278  //Set event flag
279  interface->nicEvent = TRUE;
280  //Notify the TCP/IP stack of the event
281  flag |= osSetEventFromIsr(&netEvent);
282  }
283 
284  //Packet transmission complete?
285  if((status & DM9000_ISR_PT) != 0)
286  {
287  //Check TX complete status bits
289  {
290  //The transmission of the current packet is complete
291  if(context->queuedPackets > 0)
292  {
293  context->queuedPackets--;
294  }
295 
296  //Notify the TCP/IP stack that the transmitter is ready to send
297  flag |= osSetEventFromIsr(&interface->nicTxEvent);
298  }
299 
300  //Clear interrupt flag
302  }
303 
304  //Packet received?
305  if((status & DM9000_ISR_PR) != 0)
306  {
307  //Read interrupt mask register
309  //Disable PRI interrupt
311 
312  //Set event flag
313  interface->nicEvent = TRUE;
314  //Notify the TCP/IP stack of the event
315  flag |= osSetEventFromIsr(&netEvent);
316  }
317 
318  //A higher priority task must be woken?
319  return flag;
320 }
321 
322 
323 /**
324  * @brief DM9000 event handler
325  * @param[in] interface Underlying network interface
326  **/
327 
329 {
330  error_t error;
331  uint8_t status;
332 
333  //Read interrupt status register
334  status = dm9000ReadReg(DM9000_ISR);
335 
336  //Link status change?
337  if((status & DM9000_ISR_LNKCHG) != 0)
338  {
339  //Clear interrupt flag
341  //Read network status register
342  status = dm9000ReadReg(DM9000_NSR);
343 
344  //Check link state
345  if((status & DM9000_NSR_LINKST) != 0)
346  {
347  //Get current speed
348  if((status & DM9000_NSR_SPEED) != 0)
349  {
350  interface->linkSpeed = NIC_LINK_SPEED_10MBPS;
351  }
352  else
353  {
354  interface->linkSpeed = NIC_LINK_SPEED_100MBPS;
355  }
356 
357  //Read network control register
358  status = dm9000ReadReg(DM9000_NCR);
359 
360  //Determine the new duplex mode
361  if((status & DM9000_NCR_FDX) != 0)
362  {
363  interface->duplexMode = NIC_FULL_DUPLEX_MODE;
364  }
365  else
366  {
367  interface->duplexMode = NIC_HALF_DUPLEX_MODE;
368  }
369 
370  //Link is up
371  interface->linkState = TRUE;
372  }
373  else
374  {
375  //Link is down
376  interface->linkState = FALSE;
377  }
378 
379  //Process link state change event
380  nicNotifyLinkChange(interface);
381  }
382 
383  //Packet received?
384  if((status & DM9000_ISR_PR) != 0)
385  {
386  //Clear interrupt flag
388 
389  //Process all pending packets
390  do
391  {
392  //Read incoming packet
393  error = dm9000ReceivePacket(interface);
394 
395  //No more data in the receive buffer?
396  } while(error != ERROR_BUFFER_EMPTY);
397  }
398 
399  //Re-enable LNKCHGI and PRI interrupts
402 }
403 
404 
405 /**
406  * @brief Send a packet
407  * @param[in] interface Underlying network interface
408  * @param[in] buffer Multi-part buffer containing the data to send
409  * @param[in] offset Offset to the first data byte
410  * @param[in] ancillary Additional options passed to the stack along with
411  * the packet
412  * @return Error code
413  **/
414 
416  const NetBuffer *buffer, size_t offset, NetTxAncillary *ancillary)
417 {
418  static uint8_t temp[DM9000_ETH_TX_BUFFER_SIZE];
419  size_t i;
420  size_t length;
421  uint16_t *p;
422  Dm9000Context *context;
423 
424  //Point to the driver context
425  context = (Dm9000Context *) interface->nicContext;
426 
427  //Retrieve the length of the packet
428  length = netBufferGetLength(buffer) - offset;
429 
430  //Check the frame length
432  {
433  //The transmitter can accept another packet
434  osSetEvent(&interface->nicTxEvent);
435  //Report an error
436  return ERROR_INVALID_LENGTH;
437  }
438 
439  //Copy user data
440  netBufferRead(temp, buffer, offset, length);
441 
442  //A dummy write is required before accessing FIFO
444  //Select MWCMD register
446 
447  //Point to the beginning of the buffer
448  p = (uint16_t *) temp;
449 
450  //Write data to the FIFO using 16-bit mode
451  for(i = length; i > 1; i -= 2)
452  {
453  DM9000_DATA_REG = *(p++);
454  }
455 
456  //Odd number of bytes?
457  if(i > 0)
458  {
459  DM9000_DATA_REG = *((uint8_t *) p);
460  }
461 
462  //Write the number of bytes to send
465 
466  //Clear interrupt flag
468  //Start data transfer
470 
471  //The packet was successfully written to FIFO
472  context->queuedPackets++;
473 
474  //Successful processing
475  return NO_ERROR;
476 }
477 
478 
479 /**
480  * @brief Receive a packet
481  * @param[in] interface Underlying network interface
482  * @return Error code
483  **/
484 
486 {
487  static uint8_t temp[DM9000_ETH_RX_BUFFER_SIZE];
488  error_t error;
489  size_t i;
490  size_t n;
491  size_t length;
492  volatile uint8_t status;
493  volatile uint16_t data;
494 
495  //A dummy read is required before accessing the 4-byte header
497 
498  //Select MRCMDX1 register
500  //Read the first byte of the header
501  status = LSB(DM9000_DATA_REG);
502 
503  //The first byte indicates if a packet has been received
504  if(status == 0x01)
505  {
506  //Select MRCMD register
508  //The second byte is the RX status byte
509  status = MSB(DM9000_DATA_REG);
510 
511  //Retrieve packet length
513  //Limit the number of data to read
515 
516  //Point to the beginning of the buffer
517  i = 0;
518 
519  //Make sure no error occurred
520  if((status & (DM9000_RSR_LCS | DM9000_RSR_RWTO | DM9000_RSR_PLE |
522  {
523  //Read data from FIFO using 16-bit mode
524  while((i + 1) < n)
525  {
527  temp[i++] = LSB(data);
528  temp[i++] = MSB(data);
529  }
530 
531  //Odd number of bytes to read?
532  if((i + 1) == n)
533  {
535  temp[i] = LSB(data);
536  i += 2;
537  }
538 
539  //Valid packet received
540  error = NO_ERROR;
541  }
542  else
543  {
544  //The received packet contains an error
545  error = ERROR_INVALID_PACKET;
546  }
547 
548  //Flush remaining bytes
549  while(i < length)
550  {
552  i += 2;
553  }
554  }
555  else
556  {
557  //No more data in the receive buffer
558  error = ERROR_BUFFER_EMPTY;
559  }
560 
561  //Check whether a valid packet has been received
562  if(!error)
563  {
564  NetRxAncillary ancillary;
565 
566  //Additional options can be passed to the stack along with the packet
567  ancillary = NET_DEFAULT_RX_ANCILLARY;
568 
569  //Pass the packet to the upper layer
570  nicProcessPacket(interface, temp, n, &ancillary);
571  }
572 
573  //Return status code
574  return error;
575 }
576 
577 
578 /**
579  * @brief Configure MAC address filtering
580  * @param[in] interface Underlying network interface
581  * @return Error code
582  **/
583 
585 {
586  uint_t i;
587  uint_t k;
588  uint32_t crc;
589  uint8_t hashTable[8];
590  MacFilterEntry *entry;
591 
592  //Debug message
593  TRACE_DEBUG("Updating MAC filter...\r\n");
594 
595  //Clear hash table
596  osMemset(hashTable, 0, sizeof(hashTable));
597  //Always accept broadcast packets regardless of the MAC filter table
598  hashTable[7] = 0x80;
599 
600  //The MAC address filter contains the list of MAC addresses to accept
601  //when receiving an Ethernet frame
602  for(i = 0; i < MAC_ADDR_FILTER_SIZE; i++)
603  {
604  //Point to the current entry
605  entry = &interface->macAddrFilter[i];
606 
607  //Valid entry?
608  if(entry->refCount > 0)
609  {
610  //Compute CRC over the current MAC address
611  crc = dm9000CalcCrc(&entry->addr, sizeof(MacAddr));
612  //Calculate the corresponding index in the table
613  k = crc & 0x3F;
614  //Update hash table contents
615  hashTable[k / 8] |= (1 << (k % 8));
616  }
617  }
618 
619  //Write the hash table to the DM9000 controller
620  for(i = 0; i < 8; i++)
621  {
622  dm9000WriteReg(DM9000_MAR0 + i, hashTable[i]);
623  }
624 
625  //Debug message
626  TRACE_DEBUG(" MAR = %02" PRIX8 " %02" PRIX8 " %02" PRIX8 " %02" PRIX8 " "
627  "%02" PRIX8 " %02" PRIX8 " %02" PRIX8 " %02" PRIX8 "\r\n",
632 
633  //Successful processing
634  return NO_ERROR;
635 }
636 
637 
638 /**
639  * @brief Write DM9000 register
640  * @param[in] address Register address
641  * @param[in] data Register value
642  **/
643 
644 void dm9000WriteReg(uint8_t address, uint8_t data)
645 {
646  //Write register address to INDEX register
648  //Write register value to DATA register
650 }
651 
652 
653 /**
654  * @brief Read DM9000 register
655  * @param[in] address Register address
656  * @return Register value
657  **/
658 
659 uint8_t dm9000ReadReg(uint8_t address)
660 {
661  //Write register address to INDEX register
663  //Read register value from DATA register
664  return DM9000_DATA_REG;
665 }
666 
667 
668 /**
669  * @brief Write DM9000 PHY register
670  * @param[in] address PHY register address
671  * @param[in] data Register value
672  **/
673 
674 void dm9000WritePhyReg(uint8_t address, uint16_t data)
675 {
676  //Write PHY register address
678 
679  //Write register value
682 
683  //Start the write operation
685 
686  //PHY access is still in progress?
688  {
689  }
690 
691  //Wait 5us minimum
692  usleep(5);
693  //Clear command register
695 }
696 
697 
698 /**
699  * @brief Read DM9000 PHY register
700  * @param[in] address PHY register address
701  * @return Register value
702  **/
703 
704 uint16_t dm9000ReadPhyReg(uint8_t address)
705 {
706  //Write PHY register address
708 
709  //Start the read operation
711 
712  //PHY access is still in progress?
714  {
715  }
716 
717  //Clear command register
719  //Wait 5us minimum
720  usleep(5);
721 
722  //Return register value
724 }
725 
726 
727 /**
728  * @brief CRC calculation
729  * @param[in] data Pointer to the data over which to calculate the CRC
730  * @param[in] length Number of bytes to process
731  * @return Resulting CRC value
732  **/
733 
734 uint32_t dm9000CalcCrc(const void *data, size_t length)
735 {
736  uint_t i;
737  uint_t j;
738  uint32_t crc;
739  const uint8_t *p;
740 
741  //Point to the data over which to calculate the CRC
742  p = (uint8_t *) data;
743  //CRC preset value
744  crc = 0xFFFFFFFF;
745 
746  //Loop through data
747  for(i = 0; i < length; i++)
748  {
749  //Update CRC value
750  crc ^= p[i];
751 
752  //The message is processed bit by bit
753  for(j = 0; j < 8; j++)
754  {
755  //Update CRC value
756  if((crc & 0x01) != 0)
757  {
758  crc = (crc >> 1) ^ 0xEDB88320;
759  }
760  else
761  {
762  crc = crc >> 1;
763  }
764  }
765  }
766 
767  //Return CRC value
768  return crc;
769 }
unsigned int uint_t
Definition: compiler_port.h:50
int bool_t
Definition: compiler_port.h:53
Debugging facilities.
#define TRACE_DEBUG(...)
Definition: debug.h:107
#define TRACE_INFO(...)
Definition: debug.h:95
uint8_t n
error_t dm9000ReceivePacket(NetInterface *interface)
Receive a packet.
__weak_func void dm9000InitHook(NetInterface *interface)
DM9000 custom configuration.
void dm9000WriteReg(uint8_t address, uint8_t data)
Write DM9000 register.
error_t dm9000SendPacket(NetInterface *interface, const NetBuffer *buffer, size_t offset, NetTxAncillary *ancillary)
Send a packet.
uint16_t dm9000ReadPhyReg(uint8_t address)
Read DM9000 PHY register.
void dm9000DisableIrq(NetInterface *interface)
Disable interrupts.
void dm9000EventHandler(NetInterface *interface)
DM9000 event handler.
const NicDriver dm9000Driver
DM9000 driver.
Definition: dm9000_driver.c:45
void dm9000WritePhyReg(uint8_t address, uint16_t data)
Write DM9000 PHY register.
error_t dm9000UpdateMacAddrFilter(NetInterface *interface)
Configure MAC address filtering.
void dm9000Tick(NetInterface *interface)
DM9000 timer handler.
uint32_t dm9000CalcCrc(const void *data, size_t length)
CRC calculation.
void dm9000EnableIrq(NetInterface *interface)
Enable interrupts.
bool_t dm9000IrqHandler(NetInterface *interface)
DM9000 interrupt service routine.
uint8_t dm9000ReadReg(uint8_t address)
Read DM9000 register.
error_t dm9000Init(NetInterface *interface)
DM9000 controller initialization.
Definition: dm9000_driver.c:72
DM9000A/B Ethernet controller.
#define DM9000_ETH_RX_BUFFER_SIZE
Definition: dm9000_driver.h:53
#define DM9000_MAR7
#define DM9000_EPCR_ERPRW
#define DM9000_NSR
Definition: dm9000_driver.h:74
#define DM9000_BMCR_SPEED_SEL
#define DM9000_EPCR_ERPRR
#define DM9000_BMCR_AN_EN
#define DM9000_MAR5
#define DM9000_MWCMD
#define DM9000_BMCR
#define DM9000_ISR_ROS
#define DM9000_NSR_LINKST
#define DM9000_ISR_PR
#define DM9000_EPAR
Definition: dm9000_driver.h:85
#define DM9000_IMR_LNKCHGI
#define DM9000_RSR_LCS
#define DM9000_NCR_FDX
#define DM9000_IMR_PTI
#define DM9000_ISR_PT
#define DM9000_BMCR_RST
#define DM9000_INDEX_REG
Definition: dm9000_driver.h:60
#define DM9000_EPDRL
Definition: dm9000_driver.h:86
#define DM9000_EPDRH
Definition: dm9000_driver.h:87
#define DM9000_ISR_ROO
#define DM9000_DATA_REG
Definition: dm9000_driver.h:65
#define DM9000_PIDH
#define DM9000_BMCR_DUPLEX_MODE
#define DM9000_NSR_WAKEST
#define DM9000_NCR
Definition: dm9000_driver.h:73
#define DM9000_PHYIDR1
#define DM9000_PHYIDR2
#define DM9000_CHIPR
#define DM9000_TXPLL
#define DM9000_IMR_PRI
#define DM9000_ETH_TX_BUFFER_SIZE
Definition: dm9000_driver.h:46
#define DM9000_RSR_FOE
#define DM9000_MAR6
#define DM9000_TCR
Definition: dm9000_driver.h:75
#define DM9000_PAR0
Definition: dm9000_driver.h:89
#define DM9000_CHIPR_REV_B
#define DM9000_MAR2
Definition: dm9000_driver.h:97
#define DM9000_MRCMDX1
#define DM9000_RSR_CE
#define DM9000_VID
Definition: dm9000_driver.h:69
#define DM9000_MAR3
Definition: dm9000_driver.h:98
#define DM9000_RCR_RXEN
#define DM9000_GPR
#define DM9000_MWCMDX
#define DM9000_NSR_TX2END
#define DM9000_MAR1
Definition: dm9000_driver.h:96
#define DM9000_NSR_SPEED
#define DM9000_RCR_DIS_CRC
#define DM9000_RCR
Definition: dm9000_driver.h:78
#define DM9000_PID
Definition: dm9000_driver.h:70
#define DM9000_CHIPR_REV_A
#define DM9000_MRCMDX
#define DM9000_NSR_TX1END
#define DM9000_IMR_PAR
#define DM9000_RSR_RWTO
#define DM9000_VIDL
#define DM9000_ISR_LNKCHG
#define DM9000_PIDL
#define DM9000_ISR_UDRUN
#define DM9000_ISR
#define DM9000_EPCR
Definition: dm9000_driver.h:84
#define DM9000_BMCR_LOOPBACK
#define DM9000_TXPLH
#define DM9000_NCR_LBK_PHY
#define DM9000_IMR
#define DM9000_TCR_TXREQ
#define DM9000_VIDH
#define DM9000_RSR_PLE
#define DM9000_RCR_DIS_LONG
#define DM9000_RSR_AE
#define DM9000_EPCR_EPOS
#define DM9000_MAR0
Definition: dm9000_driver.h:95
#define DM9000_MRCMD
#define DM9000_MAR4
Definition: dm9000_driver.h:99
#define DM9000_EPCR_ERRE
#define DM9000_NCR_RST
error_t
Error codes.
Definition: error.h:43
@ ERROR_WRONG_IDENTIFIER
Definition: error.h:89
@ ERROR_BUFFER_EMPTY
Definition: error.h:141
@ NO_ERROR
Success.
Definition: error.h:44
@ ERROR_INVALID_PACKET
Definition: error.h:140
@ ERROR_INVALID_LENGTH
Definition: error.h:111
Ethernet.
#define ETH_MTU
Definition: ethernet.h:116
uint8_t data[]
Definition: ethernet.h:222
MacAddr
Definition: ethernet.h:195
#define MAC_ADDR_FILTER_SIZE
Definition: ethernet.h:95
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 osMemset(p, value, length)
Definition: os_port.h:135
#define LSB(x)
Definition: os_port.h:55
#define MIN(a, b)
Definition: os_port.h:63
#define TRUE
Definition: os_port.h:50
#define FALSE
Definition: os_port.h:46
#define usleep(delay)
Definition: os_port.h:297
#define MSB(x)
Definition: os_port.h:59
#define sleep(delay)
Definition: os_port.h:301
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.
DM9000 driver context.
uint_t queuedPackets
Number of packets in transmission buffer.
MAC filter table entry.
Definition: ethernet.h:262
MacAddr addr
MAC address.
Definition: ethernet.h:263
uint_t refCount
Reference count for the current entry.
Definition: ethernet.h:264
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 mask
Definition: web_socket.h:319