2 FreeRTOS V8.2.0rc1 - Copyright (C) 2014 Real Time Engineers Ltd.
\r
5 VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
\r
7 This file is part of the FreeRTOS distribution.
\r
9 FreeRTOS is free software; you can redistribute it and/or modify it under
\r
10 the terms of the GNU General Public License (version 2) as published by the
\r
11 Free Software Foundation >>!AND MODIFIED BY!<< the FreeRTOS exception.
\r
13 >>! NOTE: The modification to the GPL is included to allow you to !<<
\r
14 >>! distribute a combined work that includes FreeRTOS without being !<<
\r
15 >>! obliged to provide the source code for proprietary components !<<
\r
16 >>! outside of the FreeRTOS kernel. !<<
\r
18 FreeRTOS is distributed in the hope that it will be useful, but WITHOUT ANY
\r
19 WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
\r
20 FOR A PARTICULAR PURPOSE. Full license text is available on the following
\r
21 link: http://www.freertos.org/a00114.html
\r
25 ***************************************************************************
\r
27 * Having a problem? Start by reading the FAQ "My application does *
\r
28 * not run, what could be wrong?". Have you defined configASSERT()? *
\r
30 * http://www.FreeRTOS.org/FAQHelp.html *
\r
32 ***************************************************************************
\r
34 ***************************************************************************
\r
36 * FreeRTOS provides completely free yet professionally developed, *
\r
37 * robust, strictly quality controlled, supported, and cross *
\r
38 * platform software that is more than just the market leader, it *
\r
39 * is the industry's de facto standard. *
\r
41 * Help yourself get started quickly while simultaneously helping *
\r
42 * to support the FreeRTOS project by purchasing a FreeRTOS *
\r
43 * tutorial book, reference manual, or both: *
\r
44 * http://www.FreeRTOS.org/Documentation *
\r
46 ***************************************************************************
\r
48 ***************************************************************************
\r
50 * Investing in training allows your team to be as productive as *
\r
51 * possible as early as possible, lowering your overall development *
\r
52 * cost, and enabling you to bring a more robust product to market *
\r
53 * earlier than would otherwise be possible. Richard Barry is both *
\r
54 * the architect and key author of FreeRTOS, and so also the world's *
\r
55 * leading authority on what is the world's most popular real time *
\r
56 * kernel for deeply embedded MCU designs. Obtaining your training *
\r
57 * from Richard ensures your team will gain directly from his in-depth *
\r
58 * product knowledge and years of usage experience. Contact Real Time *
\r
59 * Engineers Ltd to enquire about the FreeRTOS Masterclass, presented *
\r
60 * by Richard Barry: http://www.FreeRTOS.org/contact
\r
62 ***************************************************************************
\r
64 ***************************************************************************
\r
66 * You are receiving this top quality software for free. Please play *
\r
67 * fair and reciprocate by reporting any suspected issues and *
\r
68 * participating in the community forum: *
\r
69 * http://www.FreeRTOS.org/support *
\r
73 ***************************************************************************
\r
75 http://www.FreeRTOS.org - Documentation, books, training, latest versions,
\r
76 license and Real Time Engineers Ltd. contact details.
\r
78 http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,
\r
79 including FreeRTOS+Trace - an indispensable productivity tool, a DOS
\r
80 compatible FAT file system, and our tiny thread aware UDP/IP stack.
\r
82 http://www.FreeRTOS.org/labs - Where new FreeRTOS products go to incubate.
\r
83 Come and try FreeRTOS+TCP, our new open source TCP/IP stack for FreeRTOS.
\r
85 http://www.OpenRTOS.com - Real Time Engineers ltd license FreeRTOS to High
\r
86 Integrity Systems ltd. to sell under the OpenRTOS brand. Low cost OpenRTOS
\r
87 licenses offer ticketed support, indemnification and commercial middleware.
\r
89 http://www.SafeRTOS.com - High Integrity Systems also provide a safety
\r
90 engineered and independently SIL3 certified version for use in safety and
\r
91 mission critical applications that require provable dependability.
\r
96 /* WinPCap includes. */
\r
100 /* FreeRTOS includes. */
\r
101 #include "FreeRTOS.h"
\r
105 /* lwIP includes. */
\r
106 #include "lwip/opt.h"
\r
107 #include "lwip/def.h"
\r
108 #include "lwip/mem.h"
\r
109 #include "lwip/pbuf.h"
\r
110 #include "lwip/sys.h"
\r
111 #include <lwip/stats.h>
\r
112 #include <lwip/snmp.h>
\r
113 #include "netif/etharp.h"
\r
115 /* Define those to better describe your network interface. */
\r
116 #define IFNAME0 'w'
\r
117 #define IFNAME1 'p'
\r
119 #define netifMAX_MTU 1500
\r
123 struct eth_addr *ethaddr;
\r
124 /* Add whatever per-interface state that is needed here. */
\r
128 * Place received packet in a pbuf and send a message to the tcpip task to let
\r
129 * it know new data has arrived.
\r
131 static void prvEthernetInput( const unsigned char * const pucInputData, long lInputLength );
\r
134 * Copy the received data into a pbuf.
\r
136 static struct pbuf *prvLowLevelInput( const unsigned char * const pucInputData, long lDataLength );
\r
139 * Send data from a pbuf to the hardware.
\r
141 static err_t prvLowLevelOutput( struct netif *pxNetIf, struct pbuf *p );
\r
144 * Perform any hardware and/or driver initialisation necessary.
\r
146 static void prvLowLevelInit( struct netif *pxNetIf );
\r
149 * Query the computer the simulation is being executed on to find the network
\r
150 * interfaces it has installed.
\r
152 static pcap_if_t * prvPrintAvailableNetworkInterfaces( void );
\r
155 * Open the network interface. The number of the interface to be opened is set
\r
156 * by the configNETWORK_INTERFACE_TO_USE constant in FreeRTOSConfig.h.
\r
158 static void prvOpenSelectedNetworkInterface( pcap_if_t *pxAllNetworkInterfaces );
\r
161 * Interrupts cannot truely be simulated using WinPCap. In reality this task
\r
162 * just polls the interface.
\r
164 static void prvInterruptSimulator( void *pvParameters );
\r
167 * Configure the capture filter to allow blocking reads, and to filter out
\r
168 * packets that are not of interest to this demo.
\r
170 static void prvConfigureCaptureBehaviour( void );
\r
172 /*-----------------------------------------------------------*/
\r
174 /* The WinPCap interface being used. */
\r
175 static pcap_t *pxOpenedInterfaceHandle = NULL;
\r
177 /* Parameter required for WinPCap API functions. */
\r
178 static char cErrorBuffer[ PCAP_ERRBUF_SIZE ];
\r
180 /* The network interface that was opened. */
\r
181 static struct netif *pxlwIPNetIf = NULL;
\r
183 /*-----------------------------------------------------------*/
\r
186 * In this function, the hardware should be initialized.
\r
187 * Called from ethernetif_init().
\r
189 * @param pxNetIf the already initialized lwip network interface structure
\r
190 * for this ethernetif.
\r
192 static void prvLowLevelInit( struct netif *pxNetIf )
\r
194 pcap_if_t *pxAllNetworkInterfaces;
\r
196 /* set MAC hardware address length */
\r
197 pxNetIf->hwaddr_len = ETHARP_HWADDR_LEN;
\r
199 /* set MAC hardware address */
\r
200 pxNetIf->hwaddr[ 0 ] = configMAC_ADDR0;
\r
201 pxNetIf->hwaddr[ 1 ] = configMAC_ADDR1;
\r
202 pxNetIf->hwaddr[ 2 ] = configMAC_ADDR2;
\r
203 pxNetIf->hwaddr[ 3 ] = configMAC_ADDR3;
\r
204 pxNetIf->hwaddr[ 4 ] = configMAC_ADDR4;
\r
205 pxNetIf->hwaddr[ 5 ] = configMAC_ADDR5;
\r
207 /* device capabilities */
\r
208 /* don't set pxNetIf_FLAG_ETHARP if this device is not an ethernet one */
\r
209 pxNetIf->flags = NETIF_FLAG_BROADCAST | NETIF_FLAG_ETHARP | NETIF_FLAG_LINK_UP;
\r
211 /* Query the computer the simulation is being executed on to find the
\r
212 network interfaces it has installed. */
\r
213 pxAllNetworkInterfaces = prvPrintAvailableNetworkInterfaces();
\r
215 /* Open the network interface. The number of the interface to be opened is
\r
216 set by the configNETWORK_INTERFACE_TO_USE constant in FreeRTOSConfig.h.
\r
217 Calling this function will set the pxOpenedInterfaceHandle variable. If,
\r
218 after calling this function, pxOpenedInterfaceHandle is equal to NULL, then
\r
219 the interface could not be opened. */
\r
220 if( pxAllNetworkInterfaces != NULL )
\r
222 prvOpenSelectedNetworkInterface( pxAllNetworkInterfaces );
\r
225 /* Remember which interface was opened as it is used in the interrupt
\r
227 pxlwIPNetIf = pxNetIf;
\r
231 * This function should do the actual transmission of the packet. The packet is
\r
232 * contained in the pbuf that is passed to the function. This pbuf
\r
233 * might be chained.
\r
235 * @param pxNetIf the lwip network interface structure for this ethernetif
\r
236 * @param p the MAC packet to send (e.g. IP packet including MAC addresses and type)
\r
237 * @return ERR_OK if the packet could be sent
\r
238 * an err_t value if the packet couldn't be sent
\r
240 * @note Returning ERR_MEM here if a DMA queue of your MAC is full can lead to
\r
241 * strange results. You might consider waiting for space in the DMA queue
\r
242 * to become availale since the stack doesn't retry to send a packet
\r
243 * dropped because of memory failure (except for the TCP timers).
\r
246 static err_t prvLowLevelOutput( struct netif *pxNetIf, struct pbuf *p )
\r
249 /* This is taken from lwIP example code and therefore does not conform
\r
250 to the FreeRTOS coding standard. */
\r
253 static unsigned char ucBuffer[ 1520 ];
\r
254 unsigned char *pucBuffer = ucBuffer;
\r
255 unsigned char *pucChar;
\r
256 struct eth_hdr *pxHeader;
\r
257 u16_t usTotalLength = p->tot_len - ETH_PAD_SIZE;
\r
258 err_t xReturn = ERR_OK;
\r
262 #if defined(LWIP_DEBUG) && LWIP_NETIF_TX_SINGLE_PBUF
\r
263 LWIP_ASSERT("p->next == NULL && p->len == p->tot_len", p->next == NULL && p->len == p->tot_len);
\r
266 /* Initiate transfer. */
\r
267 if( p->len == p->tot_len )
\r
269 /* No pbuf chain, don't have to copy -> faster. */
\r
270 pucBuffer = &( ( unsigned char * ) p->payload )[ ETH_PAD_SIZE ];
\r
274 /* pbuf chain, copy into contiguous ucBuffer. */
\r
275 if( p->tot_len >= sizeof( ucBuffer ) )
\r
277 LINK_STATS_INC( link.lenerr );
\r
278 LINK_STATS_INC( link.drop );
\r
279 snmp_inc_ifoutdiscards( pxNetIf );
\r
284 pucChar = ucBuffer;
\r
286 for( q = p; q != NULL; q = q->next )
\r
288 /* Send the data from the pbuf to the interface, one pbuf at a
\r
289 time. The size of the data in each pbuf is kept in the ->len
\r
291 /* send data from(q->payload, q->len); */
\r
292 LWIP_DEBUGF( NETIF_DEBUG, ("NETIF: send pucChar %p q->payload %p q->len %i q->next %p\n", pucChar, q->payload, ( int ) q->len, ( void* ) q->next ) );
\r
295 memcpy( pucChar, &( ( char * ) q->payload )[ ETH_PAD_SIZE ], q->len - ETH_PAD_SIZE );
\r
296 pucChar += q->len - ETH_PAD_SIZE;
\r
300 memcpy( pucChar, q->payload, q->len );
\r
307 if( xReturn == ERR_OK )
\r
309 /* signal that packet should be sent */
\r
310 if( pcap_sendpacket( pxOpenedInterfaceHandle, pucBuffer, usTotalLength ) < 0 )
\r
312 LINK_STATS_INC( link.memerr );
\r
313 LINK_STATS_INC( link.drop );
\r
314 snmp_inc_ifoutdiscards( pxNetIf );
\r
319 LINK_STATS_INC( link.xmit );
\r
320 snmp_add_ifoutoctets( pxNetIf, usTotalLength );
\r
321 pxHeader = ( struct eth_hdr * )p->payload;
\r
323 if( ( pxHeader->dest.addr[ 0 ] & 1 ) != 0 )
\r
325 /* broadcast or multicast packet*/
\r
326 snmp_inc_ifoutnucastpkts( pxNetIf );
\r
330 /* unicast packet */
\r
331 snmp_inc_ifoutucastpkts( pxNetIf );
\r
340 * Should allocate a pbuf and transfer the bytes of the incoming
\r
341 * packet from the interface into the pbuf.
\r
343 * @param pxNetIf the lwip network interface structure for this ethernetif
\r
344 * @return a pbuf filled with the received packet (including MAC header)
\r
345 * NULL on memory error
\r
347 static struct pbuf *prvLowLevelInput( const unsigned char * const pucInputData, long lDataLength )
\r
349 struct pbuf *p = NULL, *q;
\r
351 if( lDataLength > 0 )
\r
354 len += ETH_PAD_SIZE; /* allow room for Ethernet padding */
\r
357 /* We allocate a pbuf chain of pbufs from the pool. */
\r
358 p = pbuf_alloc( PBUF_RAW, lDataLength, PBUF_POOL );
\r
363 pbuf_header( p, -ETH_PAD_SIZE ); /* drop the padding word */
\r
366 /* We iterate over the pbuf chain until we have read the entire
\r
367 * packet into the pbuf. */
\r
369 for( q = p; q != NULL; q = q->next )
\r
371 /* Read enough bytes to fill this pbuf in the chain. The
\r
372 * available data in the pbuf is given by the q->len
\r
374 * This does not necessarily have to be a memcpy, you can also preallocate
\r
375 * pbufs for a DMA-enabled MAC and after receiving truncate it to the
\r
376 * actually received size. In this case, ensure the usTotalLength member of the
\r
377 * pbuf is the sum of the chained pbuf len members.
\r
379 memcpy( q->payload, &( pucInputData[ lDataLength ] ), q->len );
\r
380 lDataLength += q->len;
\r
384 pbuf_header( p, ETH_PAD_SIZE ); /* reclaim the padding word */
\r
387 LINK_STATS_INC( link.recv );
\r
395 * This function should be called when a packet is ready to be read
\r
396 * from the interface. It uses the function prvLowLevelInput() that
\r
397 * should handle the actual reception of bytes from the network
\r
398 * interface. Then the type of the received packet is determined and
\r
399 * the appropriate input function is called.
\r
401 * @param pxNetIf the lwip network interface structure for this ethernetif
\r
403 static void prvEthernetInput( const unsigned char * const pucInputData, long lInputLength )
\r
405 /* This is taken from lwIP example code and therefore does not conform
\r
406 to the FreeRTOS coding standard. */
\r
408 struct eth_hdr *pxHeader;
\r
411 /* move received packet into a new pbuf */
\r
412 p = prvLowLevelInput( pucInputData, lInputLength );
\r
414 /* no packet could be read, silently ignore this */
\r
417 /* points to packet payload, which starts with an Ethernet header */
\r
418 pxHeader = p->payload;
\r
420 switch( htons( pxHeader->type ) )
\r
422 /* IP or ARP packet? */
\r
425 /* full packet send to tcpip_thread to process */
\r
426 if( pxlwIPNetIf->input( p, pxlwIPNetIf ) != ERR_OK )
\r
428 LWIP_DEBUGF(NETIF_DEBUG, ( "ethernetif_input: IP input error\n" ) );
\r
443 * Should be called at the beginning of the program to set up the
\r
444 * network interface. It calls the function prvLowLevelInit() to do the
\r
445 * actual setup of the hardware.
\r
447 * This function should be passed as a parameter to netif_add().
\r
449 * @param pxNetIf the lwip network interface structure for this ethernetif
\r
450 * @return ERR_OK if the loopif is initialized
\r
451 * ERR_MEM if private data couldn't be allocated
\r
452 * any other err_t on error
\r
454 err_t ethernetif_init( struct netif *pxNetIf )
\r
456 err_t xReturn = ERR_OK;
\r
458 /* This is taken from lwIP example code and therefore does not conform
\r
459 to the FreeRTOS coding standard. */
\r
461 struct xEthernetIf *pxEthernetIf;
\r
463 LWIP_ASSERT( "pxNetIf != NULL", ( pxNetIf != NULL ) );
\r
465 pxEthernetIf = mem_malloc( sizeof( struct xEthernetIf ) );
\r
466 if( pxEthernetIf == NULL )
\r
468 LWIP_DEBUGF(NETIF_DEBUG, ( "ethernetif_init: out of memory\n" ) );
\r
473 #if LWIP_NETIF_HOSTNAME
\r
475 /* Initialize interface hostname */
\r
476 pxNetIf->hostname = "lwip";
\r
478 #endif /* LWIP_NETIF_HOSTNAME */
\r
480 pxNetIf->state = pxEthernetIf;
\r
481 pxNetIf->name[ 0 ] = IFNAME0;
\r
482 pxNetIf->name[ 1 ] = IFNAME1;
\r
484 /* We directly use etharp_output() here to save a function call.
\r
485 * You can instead declare your own function an call etharp_output()
\r
486 * from it if you have to do some checks before sending (e.g. if link
\r
487 * is available...) */
\r
488 pxNetIf->output = etharp_output;
\r
489 pxNetIf->flags = NETIF_FLAG_BROADCAST | NETIF_FLAG_ETHARP | NETIF_FLAG_IGMP;
\r
490 pxNetIf->hwaddr_len = ETHARP_HWADDR_LEN;
\r
491 pxNetIf->mtu = netifMAX_MTU;
\r
492 pxNetIf->linkoutput = prvLowLevelOutput;
\r
494 pxEthernetIf->ethaddr = ( struct eth_addr * ) &( pxNetIf->hwaddr[ 0 ] );
\r
496 /* initialize the hardware */
\r
497 prvLowLevelInit( pxNetIf );
\r
499 /* Was an interface opened? */
\r
500 if( pxOpenedInterfaceHandle == NULL )
\r
502 /* Probably an invalid adapter number was defined in
\r
503 FreeRTOSConfig.h. */
\r
505 configASSERT( pxOpenedInterfaceHandle );
\r
511 /*-----------------------------------------------------------*/
\r
513 static pcap_if_t * prvPrintAvailableNetworkInterfaces( void )
\r
515 pcap_if_t * pxAllNetworkInterfaces = NULL, *xInterface;
\r
516 long lInterfaceNumber = 1;
\r
518 if( pcap_findalldevs_ex( PCAP_SRC_IF_STRING, NULL, &pxAllNetworkInterfaces, cErrorBuffer ) == -1 )
\r
520 printf( "\r\nCould not obtain a list of network interfaces\r\n%s\r\n", cErrorBuffer );
\r
521 pxAllNetworkInterfaces = NULL;
\r
524 if( pxAllNetworkInterfaces != NULL )
\r
526 /* Print out the list of network interfaces. The first in the list
\r
527 is interface '1', not interface '0'. */
\r
528 for( xInterface = pxAllNetworkInterfaces; xInterface != NULL; xInterface = xInterface->next )
\r
530 printf( "%d. %s", lInterfaceNumber, xInterface->name );
\r
532 if( xInterface->description != NULL )
\r
534 printf( " (%s)\r\n", xInterface->description );
\r
538 printf( " (No description available)\r\n") ;
\r
541 lInterfaceNumber++;
\r
545 if( lInterfaceNumber == 1 )
\r
547 /* The interface number was never incremented, so the above for() loop
\r
548 did not execute meaning no interfaces were found. */
\r
549 printf( " \r\nNo network interfaces were found.\r\n" );
\r
550 pxAllNetworkInterfaces = NULL;
\r
553 printf( "\r\nThe interface that will be opened is set by configNETWORK_INTERFACE_TO_USE which should be defined in FreeRTOSConfig.h\r\n" );
\r
554 printf( "Attempting to open interface number %d.\r\n", configNETWORK_INTERFACE_TO_USE );
\r
556 if( ( configNETWORK_INTERFACE_TO_USE < 1L ) || ( configNETWORK_INTERFACE_TO_USE > lInterfaceNumber ) )
\r
558 printf("\r\nconfigNETWORK_INTERFACE_TO_USE is not in the valid range.\r\n" );
\r
560 if( pxAllNetworkInterfaces != NULL )
\r
562 /* Free the device list, as no devices are going to be opened. */
\r
563 pcap_freealldevs( pxAllNetworkInterfaces );
\r
564 pxAllNetworkInterfaces = NULL;
\r
568 return pxAllNetworkInterfaces;
\r
570 /*-----------------------------------------------------------*/
\r
572 static void prvOpenSelectedNetworkInterface( pcap_if_t *pxAllNetworkInterfaces )
\r
574 pcap_if_t *xInterface;
\r
577 /* Walk the list of devices until the selected device is located. */
\r
578 xInterface = pxAllNetworkInterfaces;
\r
579 for( x = 0L; x < ( configNETWORK_INTERFACE_TO_USE - 1L ); x++ )
\r
581 xInterface = xInterface->next;
\r
584 /* Open the selected interface. */
\r
585 pxOpenedInterfaceHandle = pcap_open( xInterface->name, /* The name of the selected interface. */
\r
586 netifMAX_MTU, /* The size of the packet to capture. */
\r
587 PCAP_OPENFLAG_PROMISCUOUS, /* Open in promiscious mode as the MAC and
\r
588 IP address is going to be "simulated", and
\r
589 not be the real MAC and IP address. This allows
\r
590 trafic to the simulated IP address to be routed
\r
591 to uIP, and trafic to the real IP address to be
\r
592 routed to the Windows TCP/IP stack. */
\r
593 0L, /* The read time out. This is going to block
\r
594 until data is available. */
\r
595 NULL, /* No authentication is required as this is
\r
596 not a remote capture session. */
\r
600 if ( pxOpenedInterfaceHandle == NULL )
\r
602 printf( "\r\n%s is not supported by WinPcap and cannot be opened\r\n", xInterface->name );
\r
606 /* Configure the capture filter to allow blocking reads, and to filter
\r
607 out packets that are not of interest to this demo. */
\r
608 prvConfigureCaptureBehaviour();
\r
611 /* The device list is no longer required. */
\r
612 pcap_freealldevs( pxAllNetworkInterfaces );
\r
614 /*-----------------------------------------------------------*/
\r
616 static void prvInterruptSimulator( void *pvParameters )
\r
618 static struct pcap_pkthdr *pxHeader;
\r
619 const unsigned char *pucPacketData;
\r
620 extern QueueHandle_t xEMACEventQueue;
\r
623 /* Just to kill the compiler warning. */
\r
624 ( void ) pvParameters;
\r
628 /* Get the next packet. */
\r
629 lResult = pcap_next_ex( pxOpenedInterfaceHandle, &pxHeader, &pucPacketData );
\r
632 if( pxlwIPNetIf != NULL )
\r
634 prvEthernetInput( pucPacketData, pxHeader->len );
\r
639 /* There is no real way of simulating an interrupt.
\r
640 Make sure other tasks can run. */
\r
645 /*-----------------------------------------------------------*/
\r
647 static void prvConfigureCaptureBehaviour( void )
\r
649 struct bpf_program xFilterCode;
\r
650 const long lMinBytesToCopy = 10L, lBlocking = 1L;
\r
651 unsigned long ulNetMask;
\r
653 /* Unblock a read as soon as anything is received. */
\r
654 pcap_setmintocopy( pxOpenedInterfaceHandle, lMinBytesToCopy );
\r
656 /* Allow blocking. */
\r
657 pcap_setnonblock( pxOpenedInterfaceHandle, lBlocking, cErrorBuffer );
\r
659 /* Set up a filter so only the packets of interest are passed to the lwIP
\r
660 stack. cErrorBuffer is used for convenience to create the string. Don't
\r
661 confuse this with an error message. */
\r
662 sprintf( cErrorBuffer, "broadcast or multicast or host %d.%d.%d.%d", configIP_ADDR0, configIP_ADDR1, configIP_ADDR2, configIP_ADDR3 );
\r
664 ulNetMask = ( configNET_MASK3 << 24UL ) | ( configNET_MASK2 << 16UL ) | ( configNET_MASK1 << 8L ) | configNET_MASK0;
\r
666 if( pcap_compile(pxOpenedInterfaceHandle, &xFilterCode, cErrorBuffer, 1, ulNetMask ) < 0 )
\r
668 printf( "\r\nThe packet filter string is invalid\r\n" );
\r
672 if( pcap_setfilter( pxOpenedInterfaceHandle, &xFilterCode ) < 0 )
\r
674 printf( "\r\nAn error occurred setting the packet filter.\r\n" );
\r
678 /* Create a task that simulates an interrupt in a real system. This will
\r
679 block waiting for packets, then send a message to the uIP task when data
\r
681 xTaskCreate( prvInterruptSimulator, "MAC_ISR", configMINIMAL_STACK_SIZE, NULL, configMAC_ISR_SIMULATOR_PRIORITY, NULL );
\r