2 * FreeRTOS+UDP V1.0.0 (C) 2013 Real Time Engineers ltd.
\r
4 * This file is part of the FreeRTOS+UDP distribution. The FreeRTOS+UDP license
\r
5 * terms are different to the FreeRTOS license terms.
\r
7 * FreeRTOS+UDP uses a dual license model that allows the software to be used
\r
8 * under a pure GPL open source license (as opposed to the modified GPL license
\r
9 * under which FreeRTOS is distributed) or a commercial license. Details of
\r
10 * both license options follow:
\r
12 * - Open source licensing -
\r
13 * FreeRTOS+UDP is a free download and may be used, modified, evaluated and
\r
14 * distributed without charge provided the user adheres to version two of the
\r
15 * GNU General Public License (GPL) and does not remove the copyright notice or
\r
16 * this text. The GPL V2 text is available on the gnu.org web site, and on the
\r
17 * following URL: http://www.FreeRTOS.org/gpl-2.0.txt.
\r
19 * - Commercial licensing -
\r
20 * Businesses and individuals that for commercial or other reasons cannot comply
\r
21 * with the terms of the GPL V2 license must obtain a commercial license before
\r
22 * incorporating FreeRTOS+UDP into proprietary software for distribution in any
\r
23 * form. Commercial licenses can be purchased from http://shop.freertos.org/udp
\r
24 * and do not require any source files to be changed.
\r
26 * FreeRTOS+UDP is distributed in the hope that it will be useful. You cannot
\r
27 * use FreeRTOS+UDP unless you agree that you use the software 'as is'.
\r
28 * FreeRTOS+UDP is provided WITHOUT ANY WARRANTY; without even the implied
\r
29 * warranties of NON-INFRINGEMENT, MERCHANTABILITY or FITNESS FOR A PARTICULAR
\r
30 * PURPOSE. Real Time Engineers Ltd. disclaims all conditions and terms, be they
\r
31 * implied, expressed, or statutory.
\r
33 * 1 tab == 4 spaces!
\r
35 * http://www.FreeRTOS.org
\r
36 * http://www.FreeRTOS.org/udp
\r
40 #ifndef FREERTOS_IP_H
\r
41 #define FREERTOS_IP_H
\r
43 /* Use in FreeRTOSIPConfig.h. */
\r
44 #define FREERTOS_LITTLE_ENDIAN 0
\r
45 #define FREERTOS_BIG_ENDIAN 1
\r
47 /* Application level configuration options. */
\r
48 #include "FreeRTOSIPConfig.h"
\r
49 #include "FreeRTOSIPConfigDefaults.h"
\r
50 #include "IPTraceMacroDefaults.h"
\r
52 /* The number of octets in the MAC and IP addresses respectively. */
\r
53 #define ipMAC_ADDRESS_LENGTH_BYTES ( 6 )
\r
54 #define ipIP_ADDRESS_LENGTH_BYTES ( 4 )
\r
56 #include "pack_struct_start.h"
\r
59 uint8_t ucBytes[ ipMAC_ADDRESS_LENGTH_BYTES ];
\r
61 #include "pack_struct_end.h"
\r
62 typedef struct xMAC_ADDRESS xMACAddress_t;
\r
64 typedef enum eNETWORK_EVENTS
\r
66 eNetworkUp, /* The network is configured. */
\r
67 eNetworkDown /* The network connection has been lost. */
\r
68 } eIPCallbackEvent_t;
\r
70 typedef enum ePING_REPLY_STATUS
\r
72 eSuccess = 0, /* A correct reply has been received for an outgoing ping. */
\r
73 eInvalidChecksum, /* A reply was received for an outgoing ping but the checksum of the reply was incorrect. */
\r
74 eInvalidData /* A reply was received to an outgoing ping but the payload of the reply was not correct. */
\r
75 } ePingReplyStatus_t;
\r
77 /* Endian related definitions. */
\r
78 #if( ipconfigBYTE_ORDER == FREERTOS_LITTLE_ENDIAN )
\r
80 uint16_t FreeRTOS_htons( uint16_t usIn );
\r
81 uint32_t FreeRTOS_htonl( uint32_t ulIn );
\r
85 #define FreeRTOS_htons( x ) ( x )
\r
86 #define FreeRTOS_htonl( x ) ( x )
\r
88 #endif /* ipconfigBYTE_ORDER == FREERTOS_LITTLE_ENDIAN */
\r
90 #define FreeRTOS_ntohs( x ) FreeRTOS_htons( x )
\r
91 #define FreeRTOS_ntohl( x ) FreeRTOS_htonl( x )
\r
94 * FULL, UP-TO-DATE AND MAINTAINED REFERENCE DOCUMENTATION FOR ALL THESE
\r
95 * FUNCTIONS IS AVAILABLE ON THE FOLLOWING URL:
\r
96 * http://www.FreeRTOS.org/FreeRTOS-Plus/FreeRTOS_Plus_UDP/FreeRTOS_UDP_API_Functions.shtml
\r
98 portBASE_TYPE FreeRTOS_IPInit( const uint8_t ucIPAddress[ ipIP_ADDRESS_LENGTH_BYTES ], const uint8_t ucNetMask[ ipIP_ADDRESS_LENGTH_BYTES ], const uint8_t ucGatewayAddress[ ipIP_ADDRESS_LENGTH_BYTES ], const uint8_t ucDNSServerAddress[ ipIP_ADDRESS_LENGTH_BYTES ], const uint8_t ucMACAddress[ ipMAC_ADDRESS_LENGTH_BYTES ] );
\r
99 void * FreeRTOS_GetUDPPayloadBuffer( size_t xRequestedSizeBytes, portTickType xBlockTimeTicks );
\r
100 void FreeRTOS_GetAddressConfiguration( uint32_t *pulIPAddress, uint32_t *pulNetMask, uint32_t *pulGatewayAddress, uint32_t *pulDNSServerAddress );
\r
101 portBASE_TYPE FreeRTOS_SendPingRequest( uint32_t ulIPAddress, size_t xNumberOfBytesToSend, portTickType xBlockTimeTicks );
\r
102 void vApplicationIPNetworkEventHook( eIPCallbackEvent_t eNetworkEvent );
\r
103 void vApplicationPingReplyHook( ePingReplyStatus_t eStatus, uint16_t usIdentifier );
\r
104 void FreeRTOS_ReleaseUDPPayloadBuffer( void *pvBuffer );
\r
105 uint8_t * FreeRTOS_GetMACAddress( void );
\r
107 #endif /* FREERTOS_IP_H */
\r