Functions

int32_t net_init (char *ip, char *subnet, char *gateway, uint32_t(*dhcp_func)(char *, uint16_t), char *dns, uint32_t(*dns_func)(void))
 Main network initialization function. More...
 

Detailed Description

Software Initialization

Function Documentation

int32_t net_init ( char *  ip,
char *  subnet,
char *  gateway,
uint32_t(*)(char *, uint16_t dhcp_func,
char *  dns,
uint32_t(*)(void)  dns_func 
)

Initialize ARP table, sockets, timers and protocol specific handlers and assign the unique IP address (static or dynamic)

Parameters
ip
  • fixed IP address or
  • fully qualified host name if DHCP is used
subnet
  • local subnet mask
gateway
  • gateway address
dhcp_func
  • NULL if fixed IP address is used,
  • DHCP_ENABLE if DHCP is used
dns
  • empty string or NULL if DNS not used or
  • IP address of the DNS server
  • if DHCP and DNS are used, a NULL will select the DHCP server machine for name resolution
dns_func
  • NULL if DNS is not used or
  • DNS_ENABLE if DNS is used
Returns
  • TRUE => success
  • FALSE => out of memory
Note
This function MUST be called prior to any other net_lib function calls (except for the board initialization d91c111_ext_init() or DM2_EmacInit() respectively)
If option DHCP_ENABLE is used, net_init() is a blocking call until the IP address is assigned
Library:
net.lib
Prototype:
net.h
See also
Software Initialization
DHCP Dynamic Host Configuration Protocol, DHCP_ENABLE
DNS Domain Name System, DNS_ENABLE
1 Examples: a) static IP address 192.168.1.100
2  DNS server = 192.168.1.1
3  -> net_init ("192.168.1.100", "255.255.255.0", NULL, NULL, "192.168.1.1", DNS_ENABLE);
4 
5  b) obtain IP address from DHCP server,
6  DSP host name = dsp
7  domain name = system.net
8  DNS server = DCHP server machine
9  -> net_init ("dsp.system.net", NULL, NULL, DHCP_ENABLE, NULL, DNS_ENABLE);
Examples:
BoardSpecific.c.