1 /* Include Unity header */
2 #include <unity.h>
3
4 /* Include standard libraries */
5 #include <stdlib.h>
6 #include <string.h>
7 #include <stdint.h>
8 #include "FreeRTOS.h"
9 #include "task.h"
10 #include "list.h"
11
12 #include "FreeRTOS_IP.h"
13 #include "FreeRTOS_IP_Private.h"
14
15 volatile BaseType_t xInsideInterrupt = pdFALSE;
16
17 /** @brief The expected IP version and header length coded into the IP header itself. */
18 #define ipIP_VERSION_AND_HEADER_LENGTH_BYTE ( ( uint8_t ) 0x45 )
19
20 UDPPacketHeader_t xDefaultPartUDPPacketHeader =
21 {
22 /* .ucBytes : */
23 {
24 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, /* Ethernet source MAC address. */
25 0x08, 0x00, /* Ethernet frame type. */
26 ipIP_VERSION_AND_HEADER_LENGTH_BYTE, /* ucVersionHeaderLength. */
27 0x00, /* ucDifferentiatedServicesCode. */
28 0x00, 0x00, /* usLength. */
29 0x00, 0x00, /* usIdentification. */
30 0x00, 0x00, /* usFragmentOffset. */
31 ipconfigUDP_TIME_TO_LIVE, /* ucTimeToLive */
32 ipPROTOCOL_UDP, /* ucProtocol. */
33 0x00, 0x00, /* usHeaderChecksum. */
34 0x00, 0x00, 0x00, 0x00 /* Source IP address. */
35 }
36 };
37
38
39 /*
40 * IP-clash detection is currently only used internally. When DHCP doesn't respond, the
41 * driver can try out a random LinkLayer IP address (169.254.x.x). It will send out a
42 * gratuitous ARP message and, after a period of time, check the variables here below:
43 */
44 #if ( ipconfigARP_USE_CLASH_DETECTION != 0 )
45 /* Becomes non-zero if another device responded to a gratuitous ARP message. */
46 BaseType_t xARPHadIPClash;
47 /* MAC-address of the other device containing the same IP-address. */
48 MACAddress_t xARPClashMacAddress;
49 #endif /* ipconfigARP_USE_CLASH_DETECTION */
50
51
52 /** @brief For convenience, a MAC address of all 0xffs is defined const for quick
53 * reference. */
54 const MACAddress_t xBroadcastMACAddress = { { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff } };
55
56 /** @brief Structure that stores the netmask, gateway address and DNS server addresses. */
57 NetworkAddressingParameters_t xNetworkAddressing =
58 {
59 0xC0C0C0C0, /* 192.192.192.192 - Default IP address. */
60 0xFFFFFF00, /* 255.255.255.0 - Netmask. */
61 0xC0C0C001, /* 192.192.192.1 - Gateway Address. */
62 0x01020304, /* 1.2.3.4 - DNS server address. */
63 0xC0C0C0FF
64 }; /* 192.192.192.255 - Broadcast address. */
65
66 /** @brief Structure that stores the netmask, gateway address and DNS server addresses. */
67 NetworkAddressingParameters_t xDefaultAddressing =
68 {
69 0xC0C0C0C0, /* 192.192.192.192 - Default IP address. */
70 0xFFFFFF00, /* 255.255.255.0 - Netmask. */
71 0xC0C0C001, /* 192.192.192.1 - Gateway Address. */
72 0x01020304, /* 1.2.3.4 - DNS server address. */
73 0xC0C0C0FF
74 };
75
xPortGetMinimumEverFreeHeapSize(void)76 size_t xPortGetMinimumEverFreeHeapSize( void )
77 {
78 return 0;
79 }
80
81
xApplicationDNSQueryHook(const char * pcName)82 BaseType_t xApplicationDNSQueryHook( const char * pcName )
83 {
84 }
85
pxPortInitialiseStack(StackType_t * pxTopOfStack,StackType_t * pxEndOfStack,TaskFunction_t pxCode,void * pvParameters)86 StackType_t * pxPortInitialiseStack( StackType_t * pxTopOfStack,
87 StackType_t * pxEndOfStack,
88 TaskFunction_t pxCode,
89 void * pvParameters )
90 {
91 }
92
ulApplicationGetNextSequenceNumber(uint32_t ulSourceAddress,uint16_t usSourcePort,uint32_t ulDestinationAddress,uint16_t usDestinationPort)93 uint32_t ulApplicationGetNextSequenceNumber( uint32_t ulSourceAddress,
94 uint16_t usSourcePort,
95 uint32_t ulDestinationAddress,
96 uint16_t usDestinationPort )
97 {
98 }
xNetworkInterfaceInitialise(void)99 BaseType_t xNetworkInterfaceInitialise( void )
100 {
101 }
vApplicationIPNetworkEventHook(eIPCallbackEvent_t eNetworkEvent)102 void vApplicationIPNetworkEventHook( eIPCallbackEvent_t eNetworkEvent )
103 {
104 }
vApplicationDaemonTaskStartupHook(void)105 void vApplicationDaemonTaskStartupHook( void )
106 {
107 }
vApplicationGetTimerTaskMemory(StaticTask_t ** ppxTimerTaskTCBBuffer,StackType_t ** ppxTimerTaskStackBuffer,uint32_t * pulTimerTaskStackSize)108 void vApplicationGetTimerTaskMemory( StaticTask_t ** ppxTimerTaskTCBBuffer,
109 StackType_t ** ppxTimerTaskStackBuffer,
110 uint32_t * pulTimerTaskStackSize )
111 {
112 }
vPortDeleteThread(void * pvTaskToDelete)113 void vPortDeleteThread( void * pvTaskToDelete )
114 {
115 }
vApplicationIdleHook(void)116 void vApplicationIdleHook( void )
117 {
118 }
vApplicationTickHook(void)119 void vApplicationTickHook( void )
120 {
121 }
ulGetRunTimeCounterValue(void)122 unsigned long ulGetRunTimeCounterValue( void )
123 {
124 }
vPortEndScheduler(void)125 void vPortEndScheduler( void )
126 {
127 }
xPortStartScheduler(void)128 BaseType_t xPortStartScheduler( void )
129 {
130 }
vPortEnterCritical(void)131 void vPortEnterCritical( void )
132 {
133 }
vPortExitCritical(void)134 void vPortExitCritical( void )
135 {
136 }
137
138 /*void * pvPortMalloc( size_t xWantedSize ) */
139 /*{ */
140 /* return malloc( xWantedSize ); */
141 /*} */
142
143 /*void vPortFree( void * pv ) */
144 /*{ */
145 /* free( pv ); */
146 /*} */
147
vPortGenerateSimulatedInterrupt(uint32_t ulInterruptNumber)148 void vPortGenerateSimulatedInterrupt( uint32_t ulInterruptNumber )
149 {
150 }
vPortCloseRunningThread(void * pvTaskToDelete,volatile BaseType_t * pxPendYield)151 void vPortCloseRunningThread( void * pvTaskToDelete,
152 volatile BaseType_t * pxPendYield )
153 {
154 }
vApplicationGetIdleTaskMemory(StaticTask_t ** ppxIdleTaskTCBBuffer,StackType_t ** ppxIdleTaskStackBuffer,uint32_t * pulIdleTaskStackSize)155 void vApplicationGetIdleTaskMemory( StaticTask_t ** ppxIdleTaskTCBBuffer,
156 StackType_t ** ppxIdleTaskStackBuffer,
157 uint32_t * pulIdleTaskStackSize )
158 {
159 }
vConfigureTimerForRunTimeStats(void)160 void vConfigureTimerForRunTimeStats( void )
161 {
162 }
163
164
xNetworkInterfaceOutput(NetworkBufferDescriptor_t * const pxNetworkBuffer,BaseType_t bReleaseAfterSend)165 BaseType_t xNetworkInterfaceOutput( NetworkBufferDescriptor_t * const pxNetworkBuffer,
166 BaseType_t bReleaseAfterSend )
167 {
168 return pdPASS;
169 }
170 /*-----------------------------------------------------------*/
171