adin1110_driver.c
Go to the documentation of this file.
1 /**
2  * @file adin1110_driver.c
3  * @brief ADIN1110 10Base-T1L 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 ADIN1110 driver
42  **/
43 
45 {
47  ETH_MTU,
55  NULL,
56  NULL,
57  NULL,
58  FALSE,
59  TRUE,
60  TRUE,
61  FALSE
62 };
63 
64 
65 /**
66  * @brief ADIN1110 controller initialization
67  * @param[in] interface Underlying network interface
68  * @return Error code
69  **/
70 
72 {
73  uint32_t value;
74 
75  //Debug message
76  TRACE_INFO("Initializing ADIN1110 Ethernet controller...\r\n");
77 
78  //Initialize SPI interface
79  interface->spiDriver->init();
80 
81  //Initialize external interrupt line driver
82  if(interface->extIntDriver != NULL)
83  {
84  interface->extIntDriver->init();
85  }
86 
87  //A full chip software reset can be initiated by writing 1 to the SWRESET
88  //field of the RESET register
90 
91  //Wait for the MAC to exit reset
92  do
93  {
94  //To confirm that the MAC has exited reset, read the PHY identification
95  //register
96  value = adin1110ReadReg(interface, ADIN1110_PHYID);
97 
98  //If the reset value of the register can be read, the device has exited
99  //reset and is ready for configuration
102 
103  //Next, the host must read the STATUS0 register and confirm that the RESETC
104  //field is 1
105  do
106  {
107  //Read the status register 0
108  value = adin1110ReadReg(interface, ADIN1110_STATUS0);
109 
110  //Check the value of the RESETC bit
111  } while((value & ADIN1110_STATUS0_RESETC) == 0);
112 
113  //Write 1 to the RESETC field in the STATUS0 register to clear this field
115 
116  //The system ready bit can also be read to verify that the start-up sequence
117  //is complete and the system is ready for normal operation
118  do
119  {
120  //Read the CRSM status register
122 
123  //Check the value of the CRSM_SYS_RDY bit
124  } while((value & ADIN1110_CRSM_STAT_CRSM_SYS_RDY) == 0);
125 
126  //Dump SPI registers for debugging purpose
127  adin1110DumpReg(interface);
128  //Dump PHY registers for debugging purpose
129  adin1110DumpPhyReg(interface);
130 
131  //Configure MAC address filtering
132  adin1110UpdateMacAddrFilter(interface);
133 
134 #if (ADIN1110_OA_SPI_SUPPORT == ENABLED)
135  //Configure the SPI protocol engine
139 #else
140  //Enable store and forward mode
141  value = adin1110ReadReg(interface, ADIN1110_CONFIG0);
144 #endif
145 
146  //Enable CRC append in the MAC TX path
147  value = adin1110ReadReg(interface, ADIN1110_CONFIG2);
150 
151  //Clear IMASK0 register
152  adin1110WriteReg(interface, ADIN1110_IMASK0, 0xFFFFFFFF);
153 
154 #if (ADIN1110_OA_SPI_SUPPORT == ENABLED)
155  //Disable generic SPI protocol interrupts
156  adin1110WriteReg(interface, ADIN1110_IMASK1, 0xFFFFFFFF);
157 #else
158  //Write the IMASK1 register to enable interrupts as required
161 #endif
162 
163  //When the MAC is configured, write 1 to the SYNC field in the CONFIG0
164  //register to indicate that the MAC configuration is complete
165  value = adin1110ReadReg(interface, ADIN1110_CONFIG0);
168 
169  //Enable LED1 output
174 
175  //Configure LED0 and LED1 function
181 
182  //Set LED0 and LED1 polarity
186 
187  //Perform custom configuration
188  adin1110InitHook(interface);
189 
190  //Clear the CRSM_SFT_PD bit to exit software power-down mode. At this point,
191  //the MAC-PHY starts autonegotiation and attempts to bring up a link after
192  //autonegotiation completes
196 
197  //Accept any packets from the upper layer
198  osSetEvent(&interface->nicTxEvent);
199 
200  //Force the TCP/IP stack to poll the link state at startup
201  interface->nicEvent = TRUE;
202  //Notify the TCP/IP stack of the event
204 
205  //Successful initialization
206  return NO_ERROR;
207 }
208 
209 
210 /**
211  * @brief ADIN1110 custom configuration
212  * @param[in] interface Underlying network interface
213  **/
214 
215 __weak_func void adin1110InitHook(NetInterface *interface)
216 {
217 }
218 
219 
220 /**
221  * @brief ADIN1110 timer handler
222  * @param[in] interface Underlying network interface
223  **/
224 
225 void adin1110Tick(NetInterface *interface)
226 {
227 #if (ADIN1110_OA_SPI_SUPPORT == ENABLED)
228  uint32_t value;
229  bool_t linkState;
230 
231  //Read PHY status register
232  value = adin1110ReadReg(interface, ADIN1110_STATUS1);
233  //Retrieve current link state
234  linkState = (value & ADIN1110_STATUS1_P1_LINK_STATUS) ? TRUE : FALSE;
235 
236  //Link up event?
237  if(linkState && !interface->linkState)
238  {
239  //The PHY is only able to operate in 10 Mbps mode
240  interface->linkSpeed = NIC_LINK_SPEED_10MBPS;
241  interface->duplexMode = NIC_FULL_DUPLEX_MODE;
242 
243  //Update link state
244  interface->linkState = TRUE;
245 
246  //Process link state change event
247  nicNotifyLinkChange(interface);
248  }
249  //Link down event?
250  else if(!linkState && interface->linkState)
251  {
252  //Update link state
253  interface->linkState = FALSE;
254 
255  //Process link state change event
256  nicNotifyLinkChange(interface);
257  }
258 #endif
259 }
260 
261 
262 /**
263  * @brief Enable interrupts
264  * @param[in] interface Underlying network interface
265  **/
266 
268 {
269  //Enable interrupts
270  if(interface->extIntDriver != NULL)
271  {
272  interface->extIntDriver->enableIrq();
273  }
274 }
275 
276 
277 /**
278  * @brief Disable interrupts
279  * @param[in] interface Underlying network interface
280  **/
281 
283 {
284  //Disable interrupts
285  if(interface->extIntDriver != NULL)
286  {
287  interface->extIntDriver->disableIrq();
288  }
289 }
290 
291 
292 /**
293  * @brief ADIN1110 interrupt service routine
294  * @param[in] interface Underlying network interface
295  * @return TRUE if a higher priority task must be woken. Else FALSE is returned
296  **/
297 
299 {
300 #if (ADIN1110_OA_SPI_SUPPORT == ENABLED)
301  //When the SPI host detects an asserted IRQn from the MACPHY, it should
302  //initiate a data chunk transfer to obtain the current data footer
303  interface->nicEvent = TRUE;
304 
305  //Notify the TCP/IP stack of the event
306  return osSetEventFromIsr(&netEvent);
307 #else
308  bool_t flag;
309  size_t n;
310  uint32_t mask;
311  uint32_t status;
312 
313  //This flag will be set if a higher priority task must be woken
314  flag = FALSE;
315 
316  //Save interrupt mask register value
317  mask = adin1110ReadReg(interface, ADIN1110_IMASK1);
318  //Disable interrupts to release the interrupt line
319  adin1110WriteReg(interface, ADIN1110_IMASK1, 0xFFFFFFFF);
320 
321  //Read interrupt status register
322  status = adin1110ReadReg(interface, ADIN1110_STATUS1);
323 
324  //Link status changed interrupt?
325  if((status & ADIN1110_STATUS1_LINK_CHANGE) != 0)
326  {
327  //Disable link status changed interrupt
329 
330  //Set event flag
331  interface->nicEvent = TRUE;
332  //Notify the TCP/IP stack of the event
333  flag |= osSetEventFromIsr(&netEvent);
334  }
335 
336  //Packet transmission complete?
337  if((status & ADIN1110_STATUS1_TX_RDY) != 0)
338  {
339  //Clear interrupt flag
341 
342  //The TX_SPACE register indicates the remaining space in the TX FIFO
343  n = adin1110ReadReg(interface, ADIN1110_TX_SPACE) &
345 
346  //Verify that there is space for a new frame
348  {
349  //Notify the TCP/IP stack that the transmitter is ready to send
350  flag |= osSetEventFromIsr(&interface->nicTxEvent);
351  }
352  }
353 
354  //Packet received?
355  if((status & ADIN1110_STATUS1_P1_RX_RDY) != 0)
356  {
357  //Disable P1_RX_RDY interrupt
359 
360  //Set event flag
361  interface->nicEvent = TRUE;
362  //Notify the TCP/IP stack of the event
363  flag |= osSetEventFromIsr(&netEvent);
364  }
365 
366  //Re-enable interrupts once the interrupt has been serviced
368 
369  //A higher priority task must be woken?
370  return flag;
371 #endif
372 }
373 
374 
375 /**
376  * @brief ADIN1110 event handler
377  * @param[in] interface Underlying network interface
378  **/
379 
381 {
382 #if (ADIN1110_OA_SPI_SUPPORT == ENABLED)
383  uint32_t status;
384 
385  //Read buffer status register
386  status = adin1110ReadReg(interface, ADIN1110_BUFSTS);
387 
388  //Process all the data chunks currently available
389  while((status & ADIN1110_BUFSTS_RCA) != 0)
390  {
391  //Read incoming packet
392  adin1110ReceivePacket(interface);
393 
394  //Read buffer status register
395  status = adin1110ReadReg(interface, ADIN1110_BUFSTS);
396  }
397 #else
398  uint32_t status;
399 
400  //When an interrupt occurs, the system can poll the MAC status registers
401  //(STATUS0 and STATUS1) to determine the origin of the interrupt
402  status = adin1110ReadReg(interface, ADIN1110_STATUS1);
403 
404  //Link status changed interrupt?
405  if((status & ADIN1110_STATUS1_LINK_CHANGE) != 0)
406  {
407  //Clear interrupt flag
410 
411  //Check link state
412  if((status & ADIN1110_STATUS1_P1_LINK_STATUS) != 0)
413  {
414  //The PHY is only able to operate in 10 Mbps mode
415  interface->linkSpeed = NIC_LINK_SPEED_10MBPS;
416  interface->duplexMode = NIC_FULL_DUPLEX_MODE;
417 
418  //Link is up
419  interface->linkState = TRUE;
420  }
421  else
422  {
423  //Link is down
424  interface->linkState = FALSE;
425  }
426 
427  //Process link state change event
428  nicNotifyLinkChange(interface);
429  }
430 
431  //Packet received?
432  if((status & ADIN1110_STATUS1_P1_RX_RDY) != 0)
433  {
434  //Process all pending packets
435  do
436  {
437  //Read incoming packet
438  adin1110ReceivePacket(interface);
439 
440  //Read STATUS1 again
441  status = adin1110ReadReg(interface, ADIN1110_STATUS1);
442 
443  //If the P1_RX_RDY bit is set, another frame is available to read
444  } while((status & ADIN1110_STATUS1_P1_RX_RDY) != 0);
445  }
446 
447  //Re-enable interrupts
450 #endif
451 }
452 
453 
454 /**
455  * @brief Send a packet
456  * @param[in] interface Underlying network interface
457  * @param[in] buffer Multi-part buffer containing the data to send
458  * @param[in] offset Offset to the first data byte
459  * @param[in] ancillary Additional options passed to the stack along with
460  * the packet
461  * @return Error code
462  **/
463 
465  const NetBuffer *buffer, size_t offset, NetTxAncillary *ancillary)
466 {
467 #if (ADIN1110_OA_SPI_SUPPORT == ENABLED)
468  static uint8_t chunk[ADIN1110_CHUNK_PAYLOAD_SIZE + 4];
469  size_t i;
470  size_t j;
471  size_t n;
472  size_t length;
473  uint32_t status;
474  uint32_t header;
475  uint32_t footer;
476 
477  //Retrieve the length of the packet
478  length = netBufferGetLength(buffer) - offset;
479 
480  //Read buffer status register
481  status = adin1110ReadReg(interface, ADIN1110_BUFSTS);
482  //Get the number of data chunks available in the transmit buffer
483  n = (status & ADIN1110_BUFSTS_TXC) >> 8;
484 
485  //Check the number of transmit credits available
487  {
488  //A data transaction consists of multiple chunks
489  for(i = 0; i < length; i += n)
490  {
491  //The default size of the data chunk payload is 64 bytes
493 
494  //Set up a data transfer
497 
498  //Start of packet?
499  if(i == 0)
500  {
501  //The SPI host shall set the SV bit when the beginning of an
502  //Ethernet frame is present in the current transmit data chunk
503  //payload
504  header |= ADIN1110_TX_HEADER_SV;
505  }
506 
507  //End of packet?
508  if((i + n) == length)
509  {
510  //The SPI host shall set the EV bit when the end of an Ethernet
511  //frame is present in the current transmit data chunk payload
512  header |= ADIN1110_TX_HEADER_EV;
513 
514  //When EV is 1, the EBO field shall contain the byte offset into
515  //the transmit data chunk payload that points to the last byte of
516  //the Ethernet frame to transmit
517  header |= ((n - 1) << 8) & ADIN1110_TX_HEADER_EBO;
518  }
519 
520  //The parity bit is calculated over the transmit data header
521  if(adin1110CalcParity(header) != 0)
522  {
523  header |= ADIN1110_CTRL_HEADER_P;
524  }
525 
526  //A chunk is composed of 4 bytes of overhead plus the configured
527  //payload size
528  STORE32BE(header, chunk);
529 
530  //Copy data chunk payload
531  netBufferRead(chunk + 4, buffer, offset + i, n);
532 
533  //Pad frames shorter than the data chunk payload
535  {
536  osMemset(chunk + 4 + n, 0, ADIN1110_CHUNK_PAYLOAD_SIZE - n);
537  }
538 
539  //Pull the CS pin low
540  interface->spiDriver->assertCs();
541 
542  //Perform data transfer
543  for(j = 0; j < (ADIN1110_CHUNK_PAYLOAD_SIZE + 4); j++)
544  {
545  chunk[j] = interface->spiDriver->transfer(chunk[j]);
546  }
547 
548  //Terminate the operation by raising the CS pin
549  interface->spiDriver->deassertCs();
550 
551  //Receive data chunks consist of the receive data chunk payload followed
552  //by a 4-byte footer
553  footer = LOAD32BE(chunk + ADIN1110_CHUNK_PAYLOAD_SIZE);
554 
555  //The RCA field indicates the number of receive data chunks available
556  if((footer & ADIN1110_RX_FOOTER_RCA) != 0)
557  {
558  //Some data chunks are available for reading
559  interface->nicEvent = TRUE;
560  //Notify the TCP/IP stack of the event
562  }
563  }
564  }
565  else
566  {
567  //No sufficient credits available
568  }
569 
570  //The transmitter can accept another packet
571  osSetEvent(&interface->nicTxEvent);
572 
573  //Successful processing
574  return NO_ERROR;
575 #else
576  static uint8_t temp[ADIN1110_ETH_TX_BUFFER_SIZE];
577  size_t n;
578  size_t length;
579 
580  //Retrieve the length of the packet
581  length = netBufferGetLength(buffer) - offset;
582 
583  //Check the frame length
585  {
586  //The transmitter can accept another packet
587  osSetEvent(&interface->nicTxEvent);
588  //Report an error
589  return ERROR_INVALID_LENGTH;
590  }
591 
592  //The TX_SPACE register indicates the remaining space in the TX FIFO
593  n = adin1110ReadReg(interface, ADIN1110_TX_SPACE) &
595 
596  //Ensure that there is sufficient space for the Ethernet frame plus 2-byte
597  //header plus 2-byte size field
598  if((n * 2) < (length + ADIN1110_TX_FRAME_OVERHEAD))
599  {
600  return ERROR_FAILURE;
601  }
602 
603  //Copy user data
604  netBufferRead(temp, buffer, offset, length);
605 
606  //TX_FSIZE is still written with the original frame size + 2 bytes for the
607  //frame header
610 
611  //Write frame data
612  adin1110WriteFifo(interface, 0, temp, length);
613 
614  //The TX_SPACE register indicates the remaining space in the TX FIFO
615  n = adin1110ReadReg(interface, ADIN1110_TX_SPACE) &
617 
618  //Verify that there is space for a new frame
620  {
621  //The transmitter can accept another packet
622  osSetEvent(&interface->nicTxEvent);
623  }
624 
625  //Successful processing
626  return NO_ERROR;
627 #endif
628 }
629 
630 
631 /**
632  * @brief Receive a packet
633  * @param[in] interface Underlying network interface
634  * @return Error code
635  **/
636 
638 {
639 #if (ADIN1110_OA_SPI_SUPPORT == ENABLED)
640  static uint8_t buffer[ADIN1110_ETH_RX_BUFFER_SIZE];
641  static uint8_t chunk[ADIN1110_CHUNK_PAYLOAD_SIZE + 4];
642  error_t error;
643  size_t i;
644  size_t n;
645  size_t length;
646  uint32_t header;
647  uint32_t footer;
648 
649  //Initialize variable
650  length = 0;
651 
652  //A data transaction consists of multiple chunks
653  while(1)
654  {
655  //Check the length of the received packet
657  {
658  error = ERROR_BUFFER_OVERFLOW;
659  break;
660  }
661 
662  //The SPI host sets NORX to 0 to indicate that it accepts and process
663  //any receive frame data within the current chunk
664  header = ADIN1110_TX_HEADER_DNC;
665 
666  //The parity bit is calculated over the transmit data header
667  if(adin1110CalcParity(header) != 0)
668  {
669  header |= ADIN1110_CTRL_HEADER_P;
670  }
671 
672  //Transmit data chunks consist of a 4-byte header followed by the
673  //transmit data chunk payload,
674  STORE32BE(header, chunk);
675 
676  //Clear data chunk payload
677  osMemset(chunk + 4, 0, ADIN1110_CHUNK_PAYLOAD_SIZE);
678 
679  //Pull the CS pin low
680  interface->spiDriver->assertCs();
681 
682  //Perform data transfer
683  for(i = 0; i < (ADIN1110_CHUNK_PAYLOAD_SIZE + 4); i++)
684  {
685  chunk[i] = interface->spiDriver->transfer(chunk[i]);
686  }
687 
688  //Terminate the operation by raising the CS pin
689  interface->spiDriver->deassertCs();
690 
691  //Receive data chunks consist of the receive data chunk payload followed
692  //by a 4-byte footer
693  footer = LOAD32BE(chunk + ADIN1110_CHUNK_PAYLOAD_SIZE);
694 
695  //When the DV bit is 0, the SPI host ignores the chunk payload
696  if((footer & ADIN1110_RX_FOOTER_DV) == 0)
697  {
698  error = ERROR_BUFFER_EMPTY;
699  break;
700  }
701 
702  //When the SV bit is 1, the beginning of an Ethernet frame is present in
703  //the current transmit data chunk payload
704  if(length == 0)
705  {
706  if((footer & ADIN1110_RX_FOOTER_SV) == 0)
707  {
708  error = ERROR_INVALID_PACKET;
709  break;
710  }
711  }
712  else
713  {
714  if((footer & ADIN1110_RX_FOOTER_SV) != 0)
715  {
716  error = ERROR_INVALID_PACKET;
717  break;
718  }
719  }
720 
721  //When EV is 1, the EBO field contains the byte offset into the
722  //receive data chunk payload that points to the last byte of the
723  //received Ethernet frame
724  if((footer & ADIN1110_RX_FOOTER_EV) != 0)
725  {
726  n = ((footer & ADIN1110_RX_FOOTER_EBO) >> 8) + 1;
727  }
728  else
729  {
731  }
732 
733  //Copy data chunk payload
734  osMemcpy(buffer + length, chunk, n);
735  //Adjust the length of the packet
736  length += n;
737 
738  //When the EV bit is 1, the end of an Ethernet frame is present in the
739  //current receive data chunk payload
740  if((footer & ADIN1110_RX_FOOTER_EV) != 0)
741  {
742  NetRxAncillary ancillary;
743 
744  //Additional options can be passed to the stack along with the packet
745  ancillary = NET_DEFAULT_RX_ANCILLARY;
746  //Pass the packet to the upper layer
747  nicProcessPacket(interface, buffer, length, &ancillary);
748 
749  //Successful processing
750  error = NO_ERROR;
751  break;
752  }
753  }
754 
755  //Return status code
756  return error;
757 #else
758  static uint8_t temp[ADIN1110_ETH_RX_BUFFER_SIZE];
759  error_t error;
760  size_t length;
761  uint16_t header;
762 
763  //Get the size of the frame at the head of the RX FIFO in bytes
766 
767  //Any packet pending in the receive buffer?
769  {
770  NetRxAncillary ancillary;
771 
772  //The size of the frame includes the appended header
774  //Read frame data
775  adin1110ReadFifo(interface, &header, temp, length);
776 
777  //Limit the length of the payload
779  //Additional options can be passed to the stack along with the packet
780  ancillary = NET_DEFAULT_RX_ANCILLARY;
781 
782  //Pass the packet to the upper layer
783  nicProcessPacket(interface, temp, length, &ancillary);
784 
785  //Successful processing
786  error = NO_ERROR;
787  }
788  else
789  {
790  //The RX FIFO is empty
791  error = ERROR_BUFFER_EMPTY;
792  }
793 
794  //Return status code
795  return error;
796 #endif
797 }
798 
799 
800 /**
801  * @brief Configure MAC address filtering
802  * @param[in] interface Underlying network interface
803  * @return Error code
804  **/
805 
807 {
808  uint_t i;
809  uint_t j;
810  MacFilterEntry *entry;
811 
812  //Debug message
813  TRACE_DEBUG("Updating MAC filter...\r\n");
814 
815  //Set the upper 16 bits of the broadcast MAC address
819 
820  //Set the lower 32 bits of the broadcast MAC address
823 
824  //Set the upper 16 bits of the station MAC address
827  (interface->macAddr.b[0] << 8) | interface->macAddr.b[1]);
828 
829  //Set the lower 32 bits of the station MAC address
831  (interface->macAddr.b[2] << 24) | (interface->macAddr.b[3] << 16) |
832  (interface->macAddr.b[4] << 8) | interface->macAddr.b[5]);
833 
834  //The MAC address filter contains the list of MAC addresses to accept
835  //when receiving an Ethernet frame
836  for(i = 0, j = 2; i < MAC_ADDR_FILTER_SIZE &&
837  j < ADIN1110_ADDR_TABLE_SIZE; i++)
838  {
839  //Point to the current entry
840  entry = &interface->macAddrFilter[i];
841 
842  //Valid entry?
843  if(entry->refCount > 0)
844  {
845  //Set the upper 16 bits of the current MAC address
848  (entry->addr.b[0] << 8) | entry->addr.b[1]);
849 
850  //Set the lower 32 bits of the current MAC address
852  (entry->addr.b[2] << 24) | (entry->addr.b[3] << 16) |
853  (entry->addr.b[4] << 8) | entry->addr.b[5]);
854 
855  //Increment index
856  j++;
857  }
858  }
859 
860  //Clear unused table entries
861  for(; j < ADIN1110_ADDR_TABLE_SIZE; j++)
862  {
863  //Clear current MAC address
864  adin1110WriteReg(interface, ADIN1110_ADDR_FILT_UPRn(j), 0);
865  adin1110WriteReg(interface, ADIN1110_ADDR_FILT_LWRn(j), 0);
866  }
867 
868  //Successful processing
869  return NO_ERROR;
870 }
871 
872 
873 /**
874  * @brief Write SPI register
875  * @param[in] interface Underlying network interface
876  * @param[in] address Register address
877  * @param[in] data System register value
878  **/
879 
880 void adin1110WriteReg(NetInterface *interface, uint16_t address,
881  uint32_t data)
882 {
883 #if (ADIN1110_OA_SPI_SUPPORT == ENABLED)
884  uint32_t header;
885 
886  //Set up a register write operation
888 
889  //The MMS field selects the specific register memory map to access
890  if(address < 0x30)
891  {
892  header |= (ADIN1110_MMS_STD << 24) & ADIN1110_CTRL_HEADER_MMS;
893  }
894  else
895  {
896  header |= (ADIN1110_MMS_MAC << 24) & ADIN1110_CTRL_HEADER_MMS;
897  }
898 
899  //Address of the first register to access
900  header |= (address << 8) & ADIN1110_CTRL_HEADER_ADDR;
901  //Specifies the number of registers to write
902  header |= (0 << 1) & ADIN1110_CTRL_HEADER_LEN;
903 
904  //The parity bit is calculated over the control command header
905  if(adin1110CalcParity(header) != 0)
906  {
907  header |= ADIN1110_CTRL_HEADER_P;
908  }
909 
910  //Pull the CS pin low
911  interface->spiDriver->assertCs();
912 
913  //Write control command header
914  interface->spiDriver->transfer((header >> 24) & 0xFF);
915  interface->spiDriver->transfer((header >> 16) & 0xFF);
916  interface->spiDriver->transfer((header >> 8) & 0xFF);
917  interface->spiDriver->transfer(header & 0xFF);
918 
919  //Write data
920  interface->spiDriver->transfer((data >> 24) & 0xFF);
921  interface->spiDriver->transfer((data >> 16) & 0xFF);
922  interface->spiDriver->transfer((data >> 8) & 0xFF);
923  interface->spiDriver->transfer(data & 0xFF);
924 
925 #if (ADIN1110_PROTECTION_SUPPORT == ENABLED)
926  //Protection is accomplished by duplication of each 32-bit word containing
927  //register data with its ones' complement
928  data = ~data;
929 
930  //Write complement
931  interface->spiDriver->transfer((data >> 24) & 0xFF);
932  interface->spiDriver->transfer((data >> 16) & 0xFF);
933  interface->spiDriver->transfer((data >> 8) & 0xFF);
934  interface->spiDriver->transfer(data & 0xFF);
935 #endif
936 
937  //Send 32 bits of dummy data at the end of the control write command
938  interface->spiDriver->transfer(0x00);
939  interface->spiDriver->transfer(0x00);
940  interface->spiDriver->transfer(0x00);
941  interface->spiDriver->transfer(0x00);
942 
943  //Terminate the operation by raising the CS pin
944  interface->spiDriver->deassertCs();
945 #else
946  //Pull the CS pin low
947  interface->spiDriver->assertCs();
948 
949  //Write command
950  interface->spiDriver->transfer(ADIN1110_SPI_CMD_WRITE | (address >> 8));
951  interface->spiDriver->transfer(address & 0xFF);
952 
953  //Write data
954  interface->spiDriver->transfer((data >> 24) & 0xFF);
955  interface->spiDriver->transfer((data >> 16) & 0xFF);
956  interface->spiDriver->transfer((data >> 8) & 0xFF);
957  interface->spiDriver->transfer(data & 0xFF);
958 
959  //Terminate the operation by raising the CS pin
960  interface->spiDriver->deassertCs();
961 #endif
962 }
963 
964 
965 /**
966  * @brief Read SPI register
967  * @param[in] interface Underlying network interface
968  * @param[in] address System register address
969  * @return Register value
970  **/
971 
972 uint32_t adin1110ReadReg(NetInterface *interface, uint16_t address)
973 {
974 #if (ADIN1110_OA_SPI_SUPPORT == ENABLED)
975  uint32_t data;
976  uint32_t header;
977 
978  //Set up a register read operation
979  header = ADIN1110_CTRL_HEADER_AID;
980 
981  //The MMS field selects the specific register memory map to access
982  if(address < 0x30)
983  {
984  header |= (ADIN1110_MMS_STD << 24) & ADIN1110_CTRL_HEADER_MMS;
985  }
986  else
987  {
988  header |= (ADIN1110_MMS_MAC << 24) & ADIN1110_CTRL_HEADER_MMS;
989  }
990 
991  //Address of the first register to access
992  header |= (address << 8) & ADIN1110_CTRL_HEADER_ADDR;
993  //Specifies the number of registers to read
994  header |= (0 << 1) & ADIN1110_CTRL_HEADER_LEN;
995 
996  //The parity bit is calculated over the control command header
997  if(adin1110CalcParity(header) != 0)
998  {
999  header |= ADIN1110_CTRL_HEADER_P;
1000  }
1001 
1002  //Pull the CS pin low
1003  interface->spiDriver->assertCs();
1004 
1005  //Write control command header
1006  interface->spiDriver->transfer((header >> 24) & 0xFF);
1007  interface->spiDriver->transfer((header >> 16) & 0xFF);
1008  interface->spiDriver->transfer((header >> 8) & 0xFF);
1009  interface->spiDriver->transfer(header & 0xFF);
1010 
1011  //Discard the echoed control header
1012  interface->spiDriver->transfer(0x00);
1013  interface->spiDriver->transfer(0x00);
1014  interface->spiDriver->transfer(0x00);
1015  interface->spiDriver->transfer(0x00);
1016 
1017  //Read data
1018  data = interface->spiDriver->transfer(0x00) << 24;
1019  data |= interface->spiDriver->transfer(0x00) << 16;
1020  data |= interface->spiDriver->transfer(0x00) << 8;
1021  data |= interface->spiDriver->transfer(0x00);
1022 
1023 #if (ADIN1110_PROTECTION_SUPPORT == ENABLED)
1024  //Protection is accomplished by duplication of each 32-bit word containing
1025  //register data with its ones' complement
1026  interface->spiDriver->transfer(0x00);
1027  interface->spiDriver->transfer(0x00);
1028  interface->spiDriver->transfer(0x00);
1029  interface->spiDriver->transfer(0x00);
1030 #endif
1031 
1032  //Terminate the operation by raising the CS pin
1033  interface->spiDriver->deassertCs();
1034 
1035  //Return register value
1036  return data;
1037 #else
1038  uint32_t data;
1039 
1040  //Pull the CS pin low
1041  interface->spiDriver->assertCs();
1042 
1043  //Write command
1044  interface->spiDriver->transfer(ADIN1110_SPI_CMD_READ | (address >> 8));
1045  interface->spiDriver->transfer(address & 0xFF);
1046 
1047  //Turn around
1048  interface->spiDriver->transfer(0x00);
1049 
1050  //Read data
1051  data = interface->spiDriver->transfer(0x00) << 24;
1052  data |= interface->spiDriver->transfer(0x00) << 16;
1053  data |= interface->spiDriver->transfer(0x00) << 8;
1054  data |= interface->spiDriver->transfer(0x00);
1055 
1056  //Terminate the operation by raising the CS pin
1057  interface->spiDriver->deassertCs();
1058 
1059  //Return register value
1060  return data;
1061 #endif
1062 }
1063 
1064 
1065 /**
1066  * @brief Dump SPI registers for debugging purpose
1067  * @param[in] interface Underlying network interface
1068  **/
1069 
1071 {
1072  uint16_t i;
1073 
1074  //Loop through system registers
1075  for(i = 0; i < 256; i++)
1076  {
1077  //Display current SPI register
1078  TRACE_DEBUG("0x%02" PRIX16 ": 0x%08" PRIX32 "\r\n", i,
1079  adin1110ReadReg(interface, i));
1080  }
1081 
1082  //Terminate with a line feed
1083  TRACE_DEBUG("\r\n");
1084 }
1085 
1086 
1087 /**
1088  * @brief Write PHY register
1089  * @param[in] interface Underlying network interface
1090  * @param[in] address PHY register address
1091  * @param[in] data Register value
1092  **/
1093 
1094 void adin1110WritePhyReg(NetInterface *interface, uint8_t address,
1095  uint16_t data)
1096 {
1097  uint32_t value;
1098 
1099  //Perform a Clause 22 write operation
1101  //Set PHY address
1103  //Set register address
1105  //Set register value
1107 
1108  //Write MDIOACC0 register
1110 
1111  //Poll MDIOACC0.TRDONE to determine that the write operation has completed
1112  do
1113  {
1114  //Read MDIOACC0 register
1115  value = adin1110ReadReg(interface, ADIN1110_MDIOACC0);
1116 
1117  //When the MDIO transaction completes, the TRDONE bit is set to 1
1118  } while((value & ADIN1110_MDIOACC_MDIO_TRDONE) == 0);
1119 }
1120 
1121 
1122 /**
1123  * @brief Read PHY register
1124  * @param[in] interface Underlying network interface
1125  * @param[in] address PHY register address
1126  * @return Register value
1127  **/
1128 
1129 uint16_t adin1110ReadPhyReg(NetInterface *interface, uint8_t address)
1130 {
1131  uint32_t value;
1132 
1133  //Perform a Clause 22 read operation
1135  //Set PHY address
1137  //Set register address
1139 
1140  //Write MDIOACC0 register
1142 
1143  //Poll MDIOACC0.TRDONE to determine that the read operation has completed
1144  do
1145  {
1146  //Read MDIOACC0 register
1147  value = adin1110ReadReg(interface, ADIN1110_MDIOACC0);
1148 
1149  //When the MDIO transaction completes, the TRDONE bit is set to 1
1150  } while((value & ADIN1110_MDIOACC_MDIO_TRDONE) == 0);
1151 
1152  //MDIOACC0.MDIO_DATA reflects the content of register
1154 }
1155 
1156 
1157 /**
1158  * @brief Dump PHY registers for debugging purpose
1159  * @param[in] interface Underlying network interface
1160  **/
1161 
1163 {
1164  uint8_t i;
1165 
1166  //Loop through PHY registers
1167  for(i = 0; i < 32; i++)
1168  {
1169  //Display current PHY register
1170  TRACE_DEBUG("%02" PRIu8 ": 0x%04" PRIX16 "\r\n", i,
1171  adin1110ReadPhyReg(interface, i));
1172  }
1173 
1174  //Terminate with a line feed
1175  TRACE_DEBUG("\r\n");
1176 }
1177 
1178 
1179 /**
1180  * @brief Write MMD register
1181  * @param[in] interface Underlying network interface
1182  * @param[in] devAddr Device address
1183  * @param[in] regAddr Register address
1184  * @param[in] data MMD register value
1185  **/
1186 
1187 void adin1110WriteMmdReg(NetInterface *interface, uint8_t devAddr,
1188  uint16_t regAddr, uint16_t data)
1189 {
1190  uint32_t value;
1191 
1192  //Perform a Clause 45 address write operation
1194  //MDIO_PRTAD is always written to 1
1196  //Set device address
1197  value |= (devAddr << 16) & ADIN1110_MDIOACC_MDIO_DEVAD;
1198  //Set register address
1200 
1201  //Write MDIOACC0 register
1203 
1204  //Perform a Clause 45 write operation
1206  //MDIO_PRTAD is always written to 1
1208  //Set device address
1209  value |= (devAddr << 16) & ADIN1110_MDIOACC_MDIO_DEVAD;
1210  //Set register value
1212 
1213  //Write MDIOACC1 register
1215 
1216  //Poll MDIOACC1.TRDONE to determine that the write operation has completed
1217  do
1218  {
1219  //Read MDIOACC1 register
1220  value = adin1110ReadReg(interface, ADIN1110_MDIOACC1);
1221 
1222  //When the MDIO transaction completes, the TRDONE bit is set to 1
1223  } while((value & ADIN1110_MDIOACC_MDIO_TRDONE) == 0);
1224 }
1225 
1226 
1227 /**
1228  * @brief Read MMD register
1229  * @param[in] interface Underlying network interface
1230  * @param[in] devAddr Device address
1231  * @param[in] regAddr Register address
1232  * @return MMD register value
1233  **/
1234 
1235 uint16_t adin1110ReadMmdReg(NetInterface *interface, uint8_t devAddr,
1236  uint16_t regAddr)
1237 {
1238  uint32_t value;
1239 
1240  //Perform a Clause 45 address write operation
1242  //MDIO_PRTAD is always written to 1
1244  //Set device address
1245  value |= (devAddr << 16) & ADIN1110_MDIOACC_MDIO_DEVAD;
1246  //Set register address
1248 
1249  //Write MDIOACC0 register
1251 
1252  //Perform a Clause 45 read operation
1254  //MDIO_PRTAD is always written to 1
1256  //Set device address
1257  value |= (devAddr << 16) & ADIN1110_MDIOACC_MDIO_DEVAD;
1258 
1259  //Write MDIOACC1 register
1261 
1262  //Poll MDIOACC1.TRDONE to determine that the read operation has completed
1263  do
1264  {
1265  //Read MDIOACC1 register
1266  value = adin1110ReadReg(interface, ADIN1110_MDIOACC1);
1267 
1268  //When the MDIO transaction completes, the TRDONE bit is set to 1
1269  } while((value & ADIN1110_MDIOACC_MDIO_TRDONE) == 0);
1270 
1271  //MDIOACC1.MDIO_DATA reflects the content of register
1273 }
1274 
1275 
1276 /**
1277  * @brief Write TX FIFO
1278  * @param[in] interface Underlying network interface
1279  * @param[in] header Frame header
1280  * @param[in] data Pointer to the data being written
1281  * @param[in] length Number of data to write
1282  **/
1283 
1284 void adin1110WriteFifo(NetInterface *interface, uint16_t header,
1285  const uint8_t *data, size_t length)
1286 {
1287 #if (ADIN1110_OA_SPI_SUPPORT == DISABLED)
1288  size_t i;
1289 
1290  //Pull the CS pin low
1291  interface->spiDriver->assertCs();
1292 
1293  //Write command
1294  interface->spiDriver->transfer(ADIN1110_SPI_CMD_WRITE | (ADIN1110_TX >> 8));
1295  interface->spiDriver->transfer(ADIN1110_TX & 0xFF);
1296 
1297  //The 2-byte frame header is appended to all transmitted frames. This always
1298  //precedes the frame data
1299  interface->spiDriver->transfer((header >> 8) & 0xFF);
1300  interface->spiDriver->transfer(header & 0xFF);
1301 
1302  //Write frame data
1303  for(i = 0; i < length; i++)
1304  {
1305  interface->spiDriver->transfer(data[i]);
1306  }
1307 
1308  //The burst write data must always be in multiples of 4 bytes
1309  for(; ((i + ADIN1110_FRAME_HEADER_SIZE) % 4) != 0; i++)
1310  {
1311  interface->spiDriver->transfer(0x00);
1312  }
1313 
1314  //Terminate the operation by raising the CS pin
1315  interface->spiDriver->deassertCs();
1316 #endif
1317 }
1318 
1319 
1320 /**
1321  * @brief Read RX FIFO
1322  * @param[in] interface Underlying network interface
1323  * @param[out] header Frame header
1324  * @param[out] data Buffer where to store the incoming data
1325  * @param[in] length Number of data to read
1326  **/
1327 
1328 void adin1110ReadFifo(NetInterface *interface, uint16_t *header,
1329  uint8_t *data, size_t length)
1330 {
1331 #if (ADIN1110_OA_SPI_SUPPORT == DISABLED)
1332  size_t i;
1333 
1334  //Pull the CS pin low
1335  interface->spiDriver->assertCs();
1336 
1337  //Write command
1338  interface->spiDriver->transfer(ADIN1110_SPI_CMD_READ | (ADIN1110_P1_RX >> 8));
1339  interface->spiDriver->transfer(ADIN1110_P1_RX & 0xFF);
1340 
1341  //Turn around
1342  interface->spiDriver->transfer(0x00);
1343 
1344  //The 2-byte frame header is appended to all received frames. This always
1345  //precedes the frame data
1346  *header = interface->spiDriver->transfer(0x00) << 16;
1347  *header |= interface->spiDriver->transfer(0x00);
1348 
1349  //Read frame data
1350  for(i = 0; i < length && i < ADIN1110_ETH_RX_BUFFER_SIZE; i++)
1351  {
1352  data[i] = interface->spiDriver->transfer(0x00);
1353  }
1354 
1355  //Discard extra bytes
1356  for(; i < length; i++)
1357  {
1358  interface->spiDriver->transfer(0x00);
1359  }
1360 
1361  //The burst read data must always be in multiples of 4 bytes
1362  for(; ((i + ADIN1110_FRAME_HEADER_SIZE) % 4) != 0; i++)
1363  {
1364  interface->spiDriver->transfer(0x00);
1365  }
1366 
1367  //Terminate the operation by raising the CS pin
1368  interface->spiDriver->deassertCs();
1369 #endif
1370 }
1371 
1372 
1373 /**
1374  * @brief Calculate parity bit over a 32-bit data
1375  * @param[in] data 32-bit bit stream
1376  * @return Odd parity bit computed over the supplied data
1377  **/
1378 
1379 uint32_t adin1110CalcParity(uint32_t data)
1380 {
1381  //Calculate the odd parity bit computed over the supplied bit stream
1382  data ^= data >> 1;
1383  data ^= data >> 2;
1384  data ^= data >> 4;
1385  data ^= data >> 8;
1386  data ^= data >> 16;
1387 
1388  //Return '1' when the number of bits set to one in the supplied bit
1389  //stream is even (resulting in an odd number of ones when the parity is
1390  //included), otherwise return '0'
1391  return ~data & 0x01;
1392 }
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
void adin1110EventHandler(NetInterface *interface)
ADIN1110 event handler.
ADIN1110 10Base-T1L Ethernet controller.
error_t adin1110ReceivePacket(NetInterface *interface)
Receive a packet.
int bool_t
Definition: compiler_port.h:53
#define ADIN1110_CHUNK_PAYLOAD_SIZE
error_t adin1110Init(NetInterface *interface)
ADIN1110 controller initialization.
#define ADIN1110_MDIOACC_MDIO_ST_CLAUSE_45
#define netEvent
Definition: net_legacy.h:196
#define ADIN1110_MDIOACC_MDIO_DATA
#define ADIN1110_CRSM_STAT_CRSM_SYS_RDY
#define ADIN1110_RX_FOOTER_DV
@ NIC_FULL_DUPLEX_MODE
Definition: nic.h:125
#define LOAD32BE(p)
Definition: cpu_endian.h:210
#define ADIN1110_TX_HEADER_EBO
#define ADIN1110_CONFIG2
@ ERROR_BUFFER_OVERFLOW
Definition: error.h:142
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 ADIN1110_STATUS1
Structure describing a buffer that spans multiple chunks.
Definition: net_mem.h:89
#define MAC_ADDR_FILTER_SIZE
Definition: ethernet.h:95
#define TRUE
Definition: os_port.h:50
uint8_t data[]
Definition: ethernet.h:222
void adin1110WriteMmdReg(NetInterface *interface, uint8_t devAddr, uint16_t regAddr, uint16_t data)
Write MMD register.
#define ADIN1110_ADDR_FILT_LWRn(index)
uint32_t adin1110CalcParity(uint32_t data)
Calculate parity bit over a 32-bit data.
#define ADIN1110_STATUS1_LINK_CHANGE
uint_t refCount
Reference count for the current entry.
Definition: ethernet.h:264
#define ADIN1110_ADDR_FILT_UPR_MAC_ADDR_47_32
void adin1110EnableIrq(NetInterface *interface)
Enable interrupts.
void adin1110Tick(NetInterface *interface)
ADIN1110 timer handler.
#define ADIN1110_LED_CNTRL_LED0_EN
#define ADIN1110_TX_SPACE
#define ADIN1110_MDIOACC1
#define ADIN1110_MDIOACC_MDIO_DEVAD
#define ADIN1110_CTRL_HEADER_AID
#define ADIN1110_TX_FRAME_OVERHEAD
#define ADIN1110_MDIOACC_MDIO_ST_CLAUSE_22
#define ADIN1110_CTRL_HEADER_ADDR
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 ADIN1110_SPI_CMD_WRITE
void adin1110DisableIrq(NetInterface *interface)
Disable interrupts.
#define ADIN1110_CONFIG0_RXCTE
#define ADIN1110_CONFIG0
#define ADIN1110_BUFSTS_TXC
#define FALSE
Definition: os_port.h:46
#define osMemcpy(dest, src, length)
Definition: os_port.h:141
#define ADIN1110_BUFSTS
#define ADIN1110_ADDR_FILT_LWR_MAC_ADDR_31_0
error_t
Error codes.
Definition: error.h:43
#define ADIN1110_LED_POLARITY_LED0_POLARITY_AUTOSENSE
error_t adin1110UpdateMacAddrFilter(NetInterface *interface)
Configure MAC address filtering.
#define ADIN1110_MDIOACC_MDIO_OP_READ
#define ADIN1110_RX_FOOTER_SV
const NetRxAncillary NET_DEFAULT_RX_ANCILLARY
Definition: net_misc.c:104
#define ADIN1110_TX_HEADER_EV
@ ERROR_FAILURE
Generic error code.
Definition: error.h:45
#define ADIN1110_MDIOACC_MDIO_OP_WRITE
const NicDriver adin1110Driver
ADIN1110 driver.
#define ADIN1110_RESET
#define ADIN1110_BUFSTS_RCA
#define ADIN1110_ADDR_FILT_UPRn(index)
void adin1110WriteFifo(NetInterface *interface, uint16_t header, const uint8_t *data, size_t length)
Write TX FIFO.
#define NetRxAncillary
Definition: net_misc.h:40
uint16_t adin1110ReadMmdReg(NetInterface *interface, uint8_t devAddr, uint16_t regAddr)
Read MMD register.
@ ERROR_INVALID_PACKET
Definition: error.h:140
#define NetInterface
Definition: net.h:36
#define ADIN1110_ADDR_FILT_UPR_TO_HOST
MacAddr addr
MAC address.
Definition: ethernet.h:263
@ NIC_LINK_SPEED_10MBPS
Definition: nic.h:111
#define ADIN1110_LED_CNTRL_LED0_FUNCTION_LINKUP_TXRX_ACTIVITY
@ ERROR_INVALID_LENGTH
Definition: error.h:111
@ ERROR_BUFFER_EMPTY
Definition: error.h:141
#define ADIN1110_STATUS1_P1_LINK_STATUS
#define NetTxAncillary
Definition: net_misc.h:36
uint8_t mask
Definition: web_socket.h:319
#define ADIN1110_CTRL_HEADER_P
void adin1110WritePhyReg(NetInterface *interface, uint8_t address, uint16_t data)
Write PHY register.
#define ADIN1110_P1_RX_FSIZE
#define ADIN1110_LED_CNTRL_LED1_FUNCTION_MASTER
#define ADIN1110_FRAME_HEADER_SIZE
#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
void adin1110DumpPhyReg(NetInterface *interface)
Dump PHY registers for debugging purpose.
uint32_t adin1110ReadReg(NetInterface *interface, uint16_t address)
Read SPI register.
#define MIN(a, b)
Definition: os_port.h:63
#define ADIN1110_CTRL_HEADER_LEN
#define ADIN1110_STATUS1_P1_RX_RDY
#define ADIN1110_IMASK1
#define ADIN1110_DIGIO_PINMUX
#define ADIN1110_RX_FOOTER_EBO
#define ADIN1110_STATUS0_RESETC
#define ADIN1110_TX
#define ADIN1110_TX_FSIZE
#define ADIN1110_ETH_TX_BUFFER_SIZE
#define ADIN1110_MMS_STD
#define TRACE_DEBUG(...)
Definition: debug.h:107
#define ADIN1110_TX_HEADER_DNC
#define ADIN1110_CONFIG2_CRC_APPEND
#define ADIN1110_CRSM_SFT_PD_CNTRL
#define ADIN1110_IMASK1_P1_RX_RDY_MASK
#define ADIN1110_IMASK1_TX_RDY_MASK
#define ADIN1110_LED_POLARITY
uint16_t regAddr
#define ADIN1110_CONFIG0_ZARFE
#define ADIN1110_TX_HEADER_DV
#define ETH_MTU
Definition: ethernet.h:116
void adin1110WriteReg(NetInterface *interface, uint16_t address, uint32_t data)
Write SPI register.
uint8_t n
#define ADIN1110_TX_SPACE_TX_SPACE
MAC filter table entry.
Definition: ethernet.h:262
bool_t adin1110IrqHandler(NetInterface *interface)
ADIN1110 interrupt service routine.
#define ADIN1110_ADDR_FILT_UPR_APPLY2PORT1
#define ADIN1110_RESET_SWRESET
Ipv6Addr address[]
Definition: ipv6.h:325
void adin1110ReadFifo(NetInterface *interface, uint16_t *header, uint8_t *data, size_t length)
Read RX FIFO.
#define ADIN1110_CONFIG0_TXCTHRESH_16_CREDITS
#define ADIN1110_MDIOACC0
void adin1110DumpReg(NetInterface *interface)
Dump SPI registers for debugging purpose.
uint16_t adin1110ReadPhyReg(NetInterface *interface, uint8_t address)
Read PHY register.
#define ADIN1110_CRSM_STAT
uint8_t value[]
Definition: tcp.h:369
#define ADIN1110_RX_FOOTER_EV
#define ADIN1110_MDIOACC_MDIO_PRTAD_DEFAULT
#define ADIN1110_TX_HEADER_SV
#define ADIN1110_CONFIG0_SYNC
#define ADIN1110_MDIOACC_MDIO_TRDONE
#define ADIN1110_CTRL_HEADER_WNR
#define ADIN1110_PHYID_MODEL_DEFAULT
void osSetEvent(OsEvent *event)
Set the specified event object to the signaled state.
#define ADIN1110_SPI_CMD_READ
#define ADIN1110_P1_RX
#define ADIN1110_DIGIO_PINMUX_DIGIO_LED1_PINMUX
#define ADIN1110_CRSM_SFT_PD_CNTRL_CRSM_SFT_PD
#define ADIN1110_PHYID
#define ADIN1110_CTRL_HEADER_MMS
#define ADIN1110_IMASK1_LINK_CHANGE_MASK
#define ADIN1110_MMS_MAC
#define ADIN1110_STATUS1_TX_RDY
#define ADIN1110_ADDR_TABLE_SIZE
unsigned int uint_t
Definition: compiler_port.h:50
#define ADIN1110_IMASK0
#define osMemset(p, value, length)
Definition: os_port.h:135
TCP/IP stack core.
#define ADIN1110_MDIOACC_MDIO_OP_ADDR
#define ADIN1110_CONFIG0_CSARFE
#define ADIN1110_LED_CNTRL
NIC driver.
Definition: nic.h:286
#define ADIN1110_PHYID_OUI_DEFAULT
error_t adin1110SendPacket(NetInterface *interface, const NetBuffer *buffer, size_t offset, NetTxAncillary *ancillary)
Send a packet.
#define ADIN1110_TX_HEADER_NORX
#define ADIN1110_ETH_RX_BUFFER_SIZE
#define ADIN1110_DIGIO_PINMUX_DIGIO_LED1_PINMUX_LED_1
__weak_func void adin1110InitHook(NetInterface *interface)
ADIN1110 custom configuration.
#define STORE32BE(a, p)
Definition: cpu_endian.h:286
#define ADIN1110_RX_FOOTER_RCA
#define ADIN1110_P1_RX_FSIZE_P1_RX_FRM_SIZE
@ NO_ERROR
Success.
Definition: error.h:44
#define ADIN1110_STATUS0
Debugging facilities.
#define ADIN1110_LED_POLARITY_LED1_POLARITY_AUTOSENSE
#define ADIN1110_LED_CNTRL_LED1_EN
#define ADIN1110_PHYID_REVISION_DEFAULT
#define ADIN1110_CONFIG0_TXCTE
#define ADIN1110_CONFIG0_CPS_64B
@ NIC_TYPE_ETHERNET
Ethernet interface.
Definition: nic.h:83