www.beck-ipc.com

@CHIP-RTOS C Library - TCP/IP API


Dev_Config_Iface

This API sets the IPv4 configuration of an interface for particular multihome index.

int Dev_Config_Iface(DevIpv4IfaceCfg far * devcfg, int *error);

Parameters

devcfg

DevIpv4IfaceCfg filled by the caller. Contains the device handle,IPv4 configuration and the multihome index number.

error

Output parameter:  Failure code,   0 on success.

Return Value

0: success,
-1: failed

Comments

This functions provides the means for configuring a device interface (e.g. the standard internal Ethernet interface) with multiple IP addresses.   A multihome index is specified to designate which IP address is being configured.

If an interface is already configured at the specified multihome index number, the user must first unconfigure it with Dev_UnConfig_Iface().

DHCP configuration of a device is only possible at multihomeindex 0.

This API is recommended only for changing IP configuration on your own device interfaces or the internal Ethernet interface for multihome index 1..4 (SC1x 1 ..3).

Here is an example for adding an IP address to the internal Ethernet device at multihome index 1 on a SC1x3/SC2x system (for SC1x, the LAN device name would instead be "NE2000"):

            
DevUserIfaceHandle DevHandlePtr;
DevIpv4IfaceCfg  devcfg;
int error;
//Get the driver handle by name
if(-1==Dev_Get_Handle_By_Name("Lance0",&DevHandlePtr,&error))
{
  printf("\r\nError: Cannot detect driver handle, code %d",error);
  return 0;
}
//Set ip configuration
devcfg.IfaceHandle    = DevHandlePtr;
devcfg.flags          = 0;
devcfg.multiHomeIndex = 1;  // configure multihome index 1
inet_addr("192.168.200.59",&devcfg.IpAddr);
inet_addr("255.255.255.0"",&devcfg.Netmask)

if(-1==Dev_Config_Iface(&devcfg,&error))
{
     printf("Error %d\r\n",error);
}

RTOS API

This library function invokes a RTOS software interrupt. Refer to this RTOS API function's documentation for more details.

On SC1x3/SC2x (RTOS version >=1.13, CLIB version >=2.10) there's also a version of this function which uses dynamic linking instead of a software interrupt, which reduces the function's overhead and thus speeds up your application. This function's name is Dev_Config_Iface_Dyn. You should however not use this function directly. Instead you should add the define TCPIP_DYN_LINK_DEV to your program before including the CLIB's header file(s):

    #define TCPIP_DYN_LINK_DEV
    #include <clib.h>


This will map the original function's name to the dynamic linking version. This way you can also easily switch existing programs to dynamic linking.

Related Topics

TCP/IP Device Driver overview

Supported since or modified in @CHIP-RTOS version

    SC12SC13SC11SC1x3SC2x
    V1.20V1.20V1.20V1.05V1.00

Supported by @CHIP-RTOS C Library since version

    CLIB
    V2.04

This API List
List of C Libraries
@CHIP-RTOS Main Index


End of document