Real time embedded FreeRTOS RSS feed 
Homepage FreeRTOS+ Products FreeRTOS Labs Support Forum Contact / Enquiries
FreeRTOS+UDP was removed from the FreeRTOS kernel download from FreeRTOS V10.1.0. See the FreeRTOS+TCP stack, which can be configured for UDP only use, as an alternative.

FreeRTOS_IPInit()

[FreeRTOS Embedded IP Stack API]

FreeRTOS_sockets.h
BaseType_t 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 ] );
		

Initialises the FreeRTOS+UDP stack. FreeRTOS_IPInit() must be called before any other FreeRTOS+UDP function.

ipIP_ADDRESS_LENGTH_BYTES is defined as 4. ipMAC_ADDRESS_LENGTH_BYTES is defined as 6.

Parameters:

ucIPAddress   If ipconfigUSE_DHCP is set to 0 (in FreeRTOSIPConfig.h) then the IP address of the network node is static and configured by the value of ucIPAddress.

If ipconfigUSE_DHCP is set to 1 then FreeRTOS+UDP will attempt to obtain an IP address from a DHCP sever. If an IP address cannot be obtained then the network node will revert to using the static IP address configured by the value of ucIPAddress.

The IP address is specified as a four byte array, where index 0 holds the first octet of the IP address and index 3 holds the last octet of the IP address. See the example below.

ucNetmask   If ipconfigUSE_DHCP is set to 0 (in FreeRTOSIPConfig.h) then the net mask of the network node is static and configured by the value of ucNetmask.

If ipconfigUSE_DHCP is set to 1 then FreeRTOS+UDP will attempt to obtain a net mask from a DHCP sever. If a net mask cannot be obtained then the network node will revert to using the static net mask configured by the value of ucNetMask.

The net mask is specified as a four byte array, where index 0 holds the first octet of the mask and index 3 holds the last octet of the mask. See the example below.

ucGatewayAddress   If ipconfigUSE_DHCP is set to 0 (in FreeRTOSIPConfig.h) then the IP address of the network gateway is static and configured by the value of ucGatewayAddress.

If ipconfigUSE_DHCP is set to 1 then FreeRTOS+UDP will attempt to obtain the IP address of the network gateway from a DHCP sever. If a gateway IP address cannot be obtained then the network node will revert to using the static IP address configured by the value of ucGatewayAddress as the gateway address.

The IP address is specified as a four byte array, where index 0 holds the first octet of the IP address and index 3 holds the last octet of the IP address. See the example below.

ucDNSServerAddress   If ipconfigUSE_DHCP is set to 0 (in FreeRTOSIPConfig.h) then the IP address of the DNS server is static and configured by the value of ucDNSServerAddress.

If ipconfigUSE_DHCP is set to 1 then FreeRTOS+UDP will attempt to obtain the IP address of the DNS server from a DHCP sever. If a DNS server IP address cannot be obtained then the network node will revert to using the static IP address configured by the value of ucDNSServerAddress as the DNS server address.

The IP address is specified as a four byte array, where index 0 holds the first octet of the IP address and index 3 holds the last octet of the IP address. See the example below.

ucMACAddress   The MAC address of the network node.

The MAC IP address is specified as a six byte array, where index 0 holds the first octet of the MAC address and index 5 holds the last octet of the MAC address. See the example below.

Returns:

pdPASS is returned if the IP stack was initialised successfully. pdFAIL is returned if the IP stack was not initialised - either because FreeRTOS_IPInit() has already been called previously or because either the network buffers or the IP task could not be created.

Example usage:


/* FreeRTOS+UDP sockets include */
#include "FreeRTOS_sockets.h"

/* Define the network addressing.  These parameters will be used if either
ipconfigUDE_DHCP is 0 or if ipconfigUSE_DHCP is 1 but DHCP auto configuration
failed. */
static const uint8_t ucIPAddress[ 4 ] = { 192, 168, 0, 200 };
static const uint8_t ucNetMask[ 4 ] = { 255, 255, 255, 255 };
static const uint8_t ucGatewayAddress[ 4 ] = { 192, 168, 0, 1 };

/* The following is the address of an OpenDNS server. */
static const uint8_t ucDNSServerAddress[ 4 ] = { 208, 67, 222, 222 };

/* The MAC address array is not declared const as the MAC address will normally
be read from an EEPROM and not hard coded (in real deployed applications).*/
static uint8_t ucMACAddress[ 6 ] = { 0x00, 0x11, 0x22, 0x33, 0x44, 0x55 };

void aFunction( void )
{
    /* Initialise the IP stack. */
    FreeRTOS_IPInit( ucIPAddress,
                     ucNetMask,
                     ucGatewayAddress,
                     ucDNSServerAddress,
                     ucMACAddress );
}

						
Example use of the FreeRTOS_IPInit() API function


[ Back to the top ]    [ About FreeRTOS ]    [ Privacy ]    [ FreeRTOS+ Sitemap ]    [ Main FreeRTOS Sitemap ]    [ ]


Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.