wilc1000_driver.c
Go to the documentation of this file.
1 /**
2  * @file wilc1000_driver.c
3  * @brief WILC1000 Wi-Fi controller
4  *
5  * @section License
6  *
7  * SPDX-License-Identifier: GPL-2.0-or-later
8  *
9  * Copyright (C) 2010-2026 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.6.0
29  **/
30 
31 //Switch to the appropriate trace level
32 #define TRACE_LEVEL NIC_TRACE_LEVEL
33 
34 //Dependencies
35 #include "driver/include/m2m_wifi.h"
36 #include "core/net.h"
38 #include "wilc1000_config.h"
39 #include "debug.h"
40 
41 //Underlying network interface
44 
45 //Transmit buffer
46 static uint8_t txBuffer[WILC1000_TX_BUFFER_SIZE];
47 //Receive buffer
48 static uint8_t rxBuffer[WILC1000_RX_BUFFER_SIZE];
49 
50 
51 /**
52  * @brief WILC1000 driver (STA mode)
53  **/
54 
56 {
58  ETH_MTU,
66  NULL,
67  NULL,
68  NULL,
69  TRUE,
70  TRUE,
71  TRUE,
72  TRUE
73 };
74 
75 
76 /**
77  * @brief WILC1000 driver (AP mode)
78  **/
79 
81 {
83  ETH_MTU,
91  NULL,
92  NULL,
93  NULL,
94  TRUE,
95  TRUE,
96  TRUE,
97  TRUE
98 };
99 
100 
101 /**
102  * @brief WILC1000 initialization
103  * @param[in] interface Underlying network interface
104  * @return Error code
105  **/
106 
108 {
109  int8_t status;
110  tstrWifiInitParam param;
111 #if (M2M_FIRMWARE_VERSION_MAJOR_NO == 4)
112  MacAddr staMacAddr;
113  MacAddr apMacAddr;
114 #endif
115 
116  //STA or AP mode?
117  if(interface->nicDriver == &wilc1000StaDriver)
118  {
119  //Debug message
120  TRACE_INFO("Initializing WILC1000 (STA mode)...\r\n");
121  //Save underlying network interface
122  wilc1000StaInterface = interface;
123  }
124  else
125  {
126  //Debug message
127  TRACE_INFO("Initializing WILC1000 (AP mode)...\r\n");
128  //Save underlying network interface
129  wilc1000ApInterface = interface;
130  }
131 
132  //Start of exception handling block
133  do
134  {
135  //Initialization sequence is performed once
136  if(wilc1000StaInterface == NULL || wilc1000ApInterface == NULL)
137  {
138  //Low-level initialization
139  status = nm_bsp_init();
140  //Check status code
141  if(status != M2M_SUCCESS)
142  {
143  break;
144  }
145 
146  //Set default parameters
147  osMemset(&param, 0, sizeof(param));
148 
149  //Register callback functions
150  param.pfAppWifiCb = wilc1000AppWifiEvent;
151  param.pfAppMonCb = NULL;
152 #if (M2M_FIRMWARE_VERSION_MAJOR_NO == 3)
153  param.strEthInitParam.pfAppWifiCb = NULL;
154 #endif
155  param.strEthInitParam.pfAppEthCb = wilc1000AppEthEvent;
156 
157  //Set receive buffer
158  param.strEthInitParam.au8ethRcvBuf = rxBuffer;
159  param.strEthInitParam.u16ethRcvBufSize = WILC1000_RX_BUFFER_SIZE;
160 
161  //Initialize WILC1000 controller
162  status = m2m_wifi_init(&param);
163  //Check status code
164  if(status != M2M_SUCCESS)
165  {
166  break;
167  }
168 
169 #if (M2M_FIRMWARE_VERSION_MAJOR_NO == 3)
170  //Optionally set the station MAC address
171  if(macCompAddr(&interface->macAddr, &MAC_UNSPECIFIED_ADDR))
172  {
173  //Use the factory preprogrammed station address
174  status = m2m_wifi_get_mac_address(interface->macAddr.b);
175  //Check status code
176  if(status != M2M_SUCCESS)
177  {
178  break;
179  }
180 
181  //Generate the 64-bit interface identifier
182  macAddrToEui64(&interface->macAddr, &interface->eui64);
183  }
184  else
185  {
186  //Override the factory preprogrammed address
187  status = m2m_wifi_set_mac_address(interface->macAddr.b);
188  //Check status code
189  if(status != M2M_SUCCESS)
190  {
191  break;
192  }
193  }
194 #endif
195  }
196  else
197  {
198  //Initialization was already done
199  status = M2M_SUCCESS;
200  }
201 
202 #if (M2M_FIRMWARE_VERSION_MAJOR_NO == 3)
203  //STA or AP mode?
204  if(interface->nicDriver == &wilc1000StaDriver)
205  {
206  //Check whether the AP interface has been initialized first
207  if(wilc1000ApInterface != NULL)
208  {
209  //Copy MAC address
210  interface->macAddr = wilc1000ApInterface->macAddr;
211  interface->eui64 = wilc1000ApInterface->eui64;
212  }
213  }
214  else
215  {
216  //Check whether the STA interface has been initialized first
217  if(wilc1000StaInterface != NULL)
218  {
219  //Copy MAC
220  interface->macAddr = wilc1000StaInterface->macAddr;
221  interface->eui64 = wilc1000StaInterface->eui64;
222  }
223  }
224 
225 #elif (M2M_FIRMWARE_VERSION_MAJOR_NO == 4)
226  //Retrieve current MAC addresses
227  status = m2m_wifi_get_mac_address(apMacAddr.b, staMacAddr.b);
228  //Check status code
229  if(status != M2M_SUCCESS)
230  {
231  break;
232  }
233 
234  //Optionally set the MAC address
235  if(macCompAddr(&interface->macAddr, &MAC_UNSPECIFIED_ADDR))
236  {
237  //Use the factory preprogrammed MAC address
238  if(interface == wilc1000StaInterface)
239  {
240  interface->macAddr = staMacAddr;
241  }
242  else
243  {
244  interface->macAddr = apMacAddr;
245  }
246 
247  //Generate the 64-bit interface identifier
248  macAddrToEui64(&interface->macAddr, &interface->eui64);
249  }
250  else
251  {
252  //Override the factory preprogrammed address
253  if(interface == wilc1000StaInterface)
254  {
255  staMacAddr = interface->macAddr;
256  }
257  else
258  {
259  apMacAddr = interface->macAddr;
260  }
261 
262  //Assign MAC addresses
263  status = m2m_wifi_set_mac_address(staMacAddr.b, apMacAddr.b);
264  //Check status code
265  if(status != M2M_SUCCESS)
266  {
267  break;
268  }
269  }
270 #endif
271 
272  //End of exception handling block
273  } while(0);
274 
275  //WILC1000 is now ready to send
276  osSetEvent(&interface->nicTxEvent);
277 
278  //Return status code
279  if(status == M2M_SUCCESS)
280  {
281  return NO_ERROR;
282  }
283  else
284  {
285  return ERROR_FAILURE;
286  }
287 }
288 
289 
290 /**
291  * @brief WILC1000 timer handler
292  *
293  * This routine is periodically called by the TCP/IP stack to handle periodic
294  * operations such as polling the link state
295  *
296  * @param[in] interface Underlying network interface
297  **/
298 
299 void wilc1000Tick(NetInterface *interface)
300 {
301 }
302 
303 
304 /**
305  * @brief Enable interrupts
306  * @param[in] interface Underlying network interface
307  **/
308 
310 {
311 }
312 
313 
314 /**
315  * @brief Disable interrupts
316  * @param[in] interface Underlying network interface
317  **/
318 
320 {
321 }
322 
323 
324 /**
325  * @brief WILC1000 interrupt service routine
326  * @return TRUE if a higher priority task must be woken. Else FALSE is returned
327  **/
328 
330 {
331  bool_t flag;
332 
333  //This flag will be set if a higher priority task must be woken
334  flag = FALSE;
335 
336  //STA and/or AP mode?
337  if(wilc1000StaInterface != NULL)
338  {
339  //Notify the TCP/IP stack of the event
340  wilc1000StaInterface->nicEvent = TRUE;
341  flag = osSetEventFromIsr(&wilc1000StaInterface->netContext->event);
342  }
343  else if(wilc1000ApInterface != NULL)
344  {
345  //Notify the TCP/IP stack of the event
346  wilc1000ApInterface->nicEvent = TRUE;
347  flag = osSetEventFromIsr(&wilc1000ApInterface->netContext->event);
348  }
349 
350  //A higher priority task must be woken?
351  return flag;
352 }
353 
354 
355 /**
356  * @brief WILC1000 event handler
357  * @param[in] interface Underlying network interface
358  **/
359 
361 {
362  //Process Wi-Fi events
363  m2m_wifi_handle_events(NULL);
364 }
365 
366 
367 /**
368  * @brief Send a packet
369  * @param[in] interface Underlying network interface
370  * @param[in] buffer Multi-part buffer containing the data to send
371  * @param[in] offset Offset to the first data byte
372  * @param[in] ancillary Additional options passed to the stack along with
373  * the packet
374  * @return Error code
375  **/
376 
378  const NetBuffer *buffer, size_t offset, NetTxAncillary *ancillary)
379 {
380  int8_t status;
381  size_t length;
382 
383  //Retrieve the length of the packet
384  length = netBufferGetLength(buffer) - offset;
385 
386  //Check the frame length
388  {
389  //The transmitter can accept another packet
390  osSetEvent(&interface->nicTxEvent);
391  //Report an error
392  return ERROR_INVALID_LENGTH;
393  }
394 
395  //Make sure the link is up before transmitting the frame
396  if(!interface->linkState)
397  {
398  //The transmitter can accept another packet
399  osSetEvent(&interface->nicTxEvent);
400  //Drop current packet
401  return NO_ERROR;
402  }
403 
404 #if (M2M_FIRMWARE_VERSION_MAJOR_NO == 3)
405  //Copy user data to the transmit buffer
406  netBufferRead(txBuffer, buffer, offset, length);
407 #elif (M2M_FIRMWARE_VERSION_MAJOR_NO == 4)
408  //Copy user data to the transmit buffer
409  netBufferRead(txBuffer + M2M_ETHERNET_HDR_OFFSET + M2M_ETH_PAD_SIZE,
410  buffer, offset, length);
411 #endif
412 
413  //STA or AP mode?
414  if(interface == wilc1000StaInterface)
415  {
416  //Send packet
417 #if (M2M_FIRMWARE_VERSION_MAJOR_NO == 4 && M2M_FIRMWARE_VERSION_MINOR_NO >= 2)
418  status = m2m_wifi_send_ethernet_pkt(txBuffer, length, STATION_INTERFACE);
419 #else
420  status = m2m_wifi_send_ethernet_pkt(txBuffer, length);
421 #endif
422  }
423  else
424  {
425  //Send packet
426 #if (M2M_FIRMWARE_VERSION_MAJOR_NO == 4 && M2M_FIRMWARE_VERSION_MINOR_NO >= 2)
427  status = m2m_wifi_send_ethernet_pkt(txBuffer, length, AP_INTERFACE);
428 #else
429  status = m2m_wifi_send_ethernet_pkt_ifc1(txBuffer, length);
430 #endif
431  }
432 
433  //The transmitter can accept another packet
434  osSetEvent(&interface->nicTxEvent);
435 
436  //Return status code
437  if(status == M2M_SUCCESS)
438  {
439  return NO_ERROR;
440  }
441  else
442  {
443  return ERROR_FAILURE;
444  }
445 }
446 
447 
448 /**
449  * @brief Configure MAC address filtering
450  * @param[in] interface Underlying network interface
451  * @return Error code
452  **/
453 
455 {
456  uint_t i;
457  uint_t refCount;
458  MacFilterEntry *entry;
459 
460  //Debug message
461  TRACE_INFO("Updating WILC1000 multicast filter...\r\n");
462 
463  //The MAC address filter contains the list of MAC addresses to accept
464  //when receiving an Ethernet frame
465  for(i = 0; i < MAC_ADDR_FILTER_SIZE; i++)
466  {
467  //Point to the current entry
468  entry = &interface->macAddrFilter[i];
469 
470  //Valid entry?
471  if(!macCompAddr(&entry->addr, &MAC_UNSPECIFIED_ADDR))
472  {
473  //Check whether the multicast MAC address has already been registered
474  //on the alternate interface
475  if(interface == wilc1000StaInterface)
476  {
477  refCount = wilc1000GetAddrRefCount(wilc1000ApInterface, &entry->addr);
478  }
479  else
480  {
482  }
483 
484  //Ensure that there are no duplicate address entries in the table
485  if(refCount == 0)
486  {
487  //Update MAC filter table only if necessary
488  if(entry->addFlag)
489  {
490  //Add a new entry to the MAC filter table
491  m2m_wifi_enable_mac_mcast(entry->addr.b, TRUE);
492  }
493  else if(entry->deleteFlag)
494  {
495  //Remove the current entry from the MAC filter table
496  m2m_wifi_enable_mac_mcast(entry->addr.b, FALSE);
497  }
498  }
499  }
500  }
501 
502  //Successful processing
503  return NO_ERROR;
504 }
505 
506 
507 /**
508  * @brief Get reference count for the specified multicast MAC address
509  * @param[in] interface Underlying network interface
510  * @param[in] macAddr MAC address
511  * @return Reference count
512  **/
513 
515 {
516  uint_t i;
517  uint_t refCount;
518  MacFilterEntry *entry;
519 
520  //Clear reference count
521  refCount = 0;
522 
523  //Valid network interface?
524  if(interface != NULL)
525  {
526  //Go through the multicast filter table
527  for(i = 0; i < MAC_ADDR_FILTER_SIZE; i++)
528  {
529  //Point to the current entry
530  entry = &interface->macAddrFilter[i];
531 
532  //Valid entry?
533  if(entry->refCount > 0)
534  {
535  //Check whether the specified MAC address matches
536  //a multicast address in the table
537  if(macCompAddr(&entry->addr, macAddr))
538  {
539  //Get reference count
540  refCount = entry->refCount;
541  //We are done
542  break;
543  }
544  }
545  }
546  }
547 
548  //Return reference count
549  return refCount;
550 }
551 
552 
553 /**
554  * @brief Callback function that handles Wi-Fi events
555  * @param[in] msgType Type of notification
556  * @param[in] msg Pointer to the buffer containing the notification parameters
557  **/
558 
559 void wilc1000AppWifiEvent(uint8_t msgType, void *msg)
560 {
561  tstrM2mWifiStateChanged *stateChangedMsg;
562 
563  //Debug message
564  TRACE_INFO("WILC1000 Wi-Fi event callback\r\n");
565 
566  //Check message type
567  if(msgType == M2M_WIFI_RESP_FIRMWARE_STRTED)
568  {
569  //Debug message
570  TRACE_INFO(" M2M_WIFI_RESP_FIRMWARE_STRTED\r\n");
571  }
572  else if(msgType == M2M_WIFI_RESP_CON_STATE_CHANGED)
573  {
574  //Debug message
575  TRACE_INFO(" M2M_WIFI_RESP_CON_STATE_CHANGED\r\n");
576 
577  //Connection state
578  stateChangedMsg = (tstrM2mWifiStateChanged *) msg;
579 
580  //Check interface identifier
581 #if (M2M_FIRMWARE_VERSION_MAJOR_NO == 4 && M2M_FIRMWARE_VERSION_MINOR_NO >= 2)
582  if(stateChangedMsg->u8IfcId == STATION_INTERFACE)
583 #else
584  if(stateChangedMsg->u8IfcId == INTERFACE_1)
585 #endif
586  {
587  //Check whether STA mode is enabled
588  if(wilc1000StaInterface != NULL)
589  {
590  //Check connection state
591  if(stateChangedMsg->u8CurrState == M2M_WIFI_CONNECTED)
592  {
593  //Link is up
594  wilc1000StaInterface->linkState = TRUE;
595  }
596  else
597  {
598  //Link is down
599  wilc1000StaInterface->linkState = FALSE;
600  }
601 
602  //Process link state change event
604  }
605  }
606 #if (M2M_FIRMWARE_VERSION_MAJOR_NO == 4 && M2M_FIRMWARE_VERSION_MINOR_NO >= 2)
607  else if(stateChangedMsg->u8IfcId == AP_INTERFACE)
608 #else
609  else if(stateChangedMsg->u8IfcId == INTERFACE_2)
610 #endif
611  {
612  //Check whether AP mode is enabled
613  if(wilc1000ApInterface != NULL)
614  {
615  //Check connection state
616  if(stateChangedMsg->u8CurrState == M2M_WIFI_CONNECTED)
617  {
618  //Check link state
619  if(!wilc1000ApInterface->linkState)
620  {
621  //Link is up
622  wilc1000ApInterface->linkState = TRUE;
623  //Process link state change event
625  }
626  }
627  }
628  }
629  }
630 
631 #if defined(CONF_WILC_EVENT_HOOK)
632  //Release exclusive access
633  if(wilc1000StaInterface != NULL)
634  {
635  netUnlock(wilc1000StaInterface->netContext);
636  }
637  else if(wilc1000ApInterface != NULL)
638  {
639  netUnlock(wilc1000ApInterface->netContext);
640  }
641  else
642  {
643  }
644 
645  //Invoke user callback function
646  CONF_WILC_EVENT_HOOK(msgType, msg);
647 
648  //Get exclusive access
649  if(wilc1000StaInterface != NULL)
650  {
651  netLock(wilc1000StaInterface->netContext);
652  }
653  else if(wilc1000ApInterface != NULL)
654  {
655  netLock(wilc1000ApInterface->netContext);
656  }
657  else
658  {
659  }
660 #endif
661 }
662 
663 
664 /**
665  * @brief Callback function that handles events in bypass mode
666  * @param[in] msgType Type of notification
667  * @param[in] msg Pointer to the buffer containing the notification parameters
668  * @param[in] ctrlBuf Pointer to the control buffer
669  **/
670 
671 void wilc1000AppEthEvent(uint8_t msgType, void *msg, void *ctrlBuf)
672 {
673  size_t length;
674  uint8_t *packet;
675  NetRxAncillary ancillary;
676 #if (M2M_FIRMWARE_VERSION_MAJOR_NO == 4 && M2M_FIRMWARE_VERSION_MINOR_NO >= 2)
677  tstrM2MDataBufCtrl *ctrl;
678 #else
679  tstrM2mIpCtrlBuf *ctrl;
680 #endif
681 
682  //Debug message
683  TRACE_DEBUG("WILC1000 RX event callback\r\n");
684 
685  //Point to the control buffer
686 #if (M2M_FIRMWARE_VERSION_MAJOR_NO == 4 && M2M_FIRMWARE_VERSION_MINOR_NO >= 2)
687  ctrl = (tstrM2MDataBufCtrl *) ctrlBuf;
688 #else
689  ctrl = (tstrM2mIpCtrlBuf *) ctrlBuf;
690 #endif
691 
692  //Check message type
693  if(msgType == M2M_WIFI_RESP_ETHERNET_RX_PACKET)
694  {
695  //Debug message
696  TRACE_DEBUG(" M2M_WIFI_RESP_ETHERNET_RX_PACKET\r\n");
697 
698 #if (M2M_FIRMWARE_VERSION_MAJOR_NO == 3)
699  //Point to the beginning of the packet
700  packet = rxBuffer;
701 #elif (M2M_FIRMWARE_VERSION_MAJOR_NO == 4)
702  //Point to the beginning of the packet
703  packet = rxBuffer + ctrl->u8DataOffset;
704 #endif
705 
706  //Retrieve the length of the packet
707  length = ctrl->u16DataSize;
708 
709  //Check interface identifier
710 #if (M2M_FIRMWARE_VERSION_MAJOR_NO == 4 && M2M_FIRMWARE_VERSION_MINOR_NO >= 2)
711  if(ctrl->u8IfcId == STATION_INTERFACE)
712 #else
713  if(ctrl->u8IfcId == INTERFACE_1)
714 #endif
715  {
716  //Valid interface?
717  if(wilc1000StaInterface != NULL)
718  {
719  //Check destination MAC address
720  if(wilc1000ApInterface != NULL)
721  {
722  if(macCompAddr(packet, wilc1000ApInterface->macAddr.b))
723  {
724  macCopyAddr(packet, wilc1000StaInterface->macAddr.b);
725  }
726  }
727 
728  //Additional options can be passed to the stack along with the packet
729  ancillary = NET_DEFAULT_RX_ANCILLARY;
730 
731  //Pass the packet to the upper layer
732  nicProcessPacket(wilc1000StaInterface, packet, length, &ancillary);
733  }
734  }
735 #if (M2M_FIRMWARE_VERSION_MAJOR_NO == 4 && M2M_FIRMWARE_VERSION_MINOR_NO >= 2)
736  else if(ctrl->u8IfcId == AP_INTERFACE)
737 #else
738  else if(ctrl->u8IfcId == INTERFACE_2)
739 #endif
740  {
741  //Valid interface?
742  if(wilc1000ApInterface != NULL)
743  {
744  //Check destination MAC address
745  if(wilc1000StaInterface != NULL)
746  {
747  if(macCompAddr(packet, wilc1000StaInterface->macAddr.b))
748  {
749  macCopyAddr(packet, wilc1000ApInterface->macAddr.b);
750  }
751  }
752 
753  //Additional options can be passed to the stack along with the packet
754  ancillary = NET_DEFAULT_RX_ANCILLARY;
755 
756  //Pass the packet to the upper layer
757  nicProcessPacket(wilc1000ApInterface, packet, length, &ancillary);
758  }
759  }
760  }
761 }
762 
763 
764 /**
765  * @brief Get exclusive access to the Wi-Fi controller
766  **/
767 
768 void wilc1000Lock(void)
769 {
770  //Get exclusive access
771  if(wilc1000StaInterface != NULL)
772  {
773  netLock(wilc1000StaInterface->netContext);
774  }
775  else if(wilc1000ApInterface != NULL)
776  {
777  netLock(wilc1000ApInterface->netContext);
778  }
779  else
780  {
781  }
782 }
783 
784 
785 /**
786  * @brief Release exclusive access to the Wi-Fi controller
787  **/
788 
789 void wilc1000Unlock(void)
790 {
791  //Release exclusive access
792  if(wilc1000StaInterface != NULL)
793  {
794  netUnlock(wilc1000StaInterface->netContext);
795  }
796  else if(wilc1000ApInterface != NULL)
797  {
798  netUnlock(wilc1000ApInterface->netContext);
799  }
800  else
801  {
802  }
803 }
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:601
error_t wilc1000Init(NetInterface *interface)
WILC1000 initialization.
void netUnlock(NetContext *context)
Release exclusive access to the core of the TCP/IP stack.
Definition: net.c:319
int bool_t
Definition: compiler_port.h:63
void macAddrToEui64(const MacAddr *macAddr, Eui64 *interfaceId)
Map a MAC address to the IPv6 modified EUI-64 identifier.
Definition: ethernet.c:953
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
bool_t wilc1000GetAddrRefCount(NetInterface *interface, const MacAddr *macAddr)
Get reference count for the specified multicast MAC address.
void wilc1000Lock(void)
Get exclusive access to the Wi-Fi controller.
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
const NicDriver wilc1000StaDriver
WILC1000 driver (STA mode)
bool_t addFlag
Definition: ethernet.h:267
error_t wilc1000SendPacket(NetInterface *interface, const NetBuffer *buffer, size_t offset, NetTxAncillary *ancillary)
Send a packet.
uint_t refCount
Reference count for the current entry.
Definition: ethernet.h:266
void wilc1000AppWifiEvent(uint8_t msgType, void *msg)
Callback function that handles Wi-Fi events.
NetInterface * wilc1000ApInterface
void nicProcessPacket(NetInterface *interface, uint8_t *packet, size_t length, NetRxAncillary *ancillary)
Handle a packet received by the network controller.
Definition: nic.c:418
#define macCopyAddr(destMacAddr, srcMacAddr)
Definition: ethernet.h:127
#define WILC1000_RX_BUFFER_SIZE
#define FALSE
Definition: os_port.h:46
void wilc1000DisableIrq(NetInterface *interface)
Disable interrupts.
error_t
Error codes.
Definition: error.h:43
const NetRxAncillary NET_DEFAULT_RX_ANCILLARY
Definition: net_misc.c:103
@ ERROR_FAILURE
Generic error code.
Definition: error.h:45
#define txBuffer
#define NetRxAncillary
Definition: net_misc.h:40
#define NetInterface
Definition: net.h:40
MacAddr addr
MAC address.
Definition: ethernet.h:265
@ ERROR_INVALID_LENGTH
Definition: error.h:111
#define NetTxAncillary
Definition: net_misc.h:36
error_t wilc1000UpdateMacAddrFilter(NetInterface *interface)
Configure MAC address filtering.
#define TRACE_INFO(...)
Definition: debug.h:105
uint8_t length
Definition: tcp.h:375
size_t netBufferGetLength(const NetBuffer *buffer)
Get the actual length of a multi-part buffer.
Definition: net_mem.c:297
WILC1000 Wi-Fi controller.
bool_t wilc1000IrqHandler(void)
WILC1000 interrupt service routine.
#define rxBuffer
MacAddr
Definition: ethernet.h:197
#define TRACE_DEBUG(...)
Definition: debug.h:119
void wilc1000Tick(NetInterface *interface)
WILC1000 timer handler.
uint8_t msgType
#define ETH_MTU
Definition: ethernet.h:116
MAC filter table entry.
Definition: ethernet.h:264
const NicDriver wilc1000ApDriver
WILC1000 driver (AP mode)
void wilc1000EnableIrq(NetInterface *interface)
Enable interrupts.
#define macCompAddr(macAddr1, macAddr2)
Definition: ethernet.h:130
void wilc1000AppEthEvent(uint8_t msgType, void *msg, void *ctrlBuf)
Callback function that handles events in bypass mode.
void netLock(NetContext *context)
Get exclusive access to the core of the TCP/IP stack.
Definition: net.c:307
void osSetEvent(OsEvent *event)
Set the specified event object to the signaled state.
bool_t deleteFlag
Definition: ethernet.h:268
unsigned int uint_t
Definition: compiler_port.h:57
#define osMemset(p, value, length)
Definition: os_port.h:138
TCP/IP stack core.
void wilc1000EventHandler(NetInterface *interface)
WILC1000 event handler.
NIC driver.
Definition: nic.h:286
void wilc1000Unlock(void)
Release exclusive access to the Wi-Fi controller.
NetInterface * wilc1000StaInterface
#define WILC1000_TX_BUFFER_SIZE
const MacAddr MAC_UNSPECIFIED_ADDR
Definition: ethernet.c:51
@ NO_ERROR
Success.
Definition: error.h:44
Debugging facilities.
@ NIC_TYPE_ETHERNET
Ethernet interface.
Definition: nic.h:83