Dhcp functions – Maxim Integrated High-Speed Microcontroller Users Guide: Network Microcontroller Supplement User Manual

Page 203

Advertising
background image

High-Speed Microcontroller User’s

Guide: Network Microcontroller

Supplement

203

DHCP FUNCTIONS

dhcp_init

Description:

int dhcp_init(void);

The

dhcp_init function initializes the DHCP client. dhcp_init starts a DHCP client task and returns to the caller. This function

returns 0 in the accumulator if successful, nonzero otherwise. To read the address DHCP has configured (only valid if DHCP

is in bound, renewing or rebinding state—see

dhcp_status), use the socket layer function getnetworkparams.

DHCP is implemented for IPv4 only. The IPv6 portion of the network stack uses neighbor discovery.

The DHCP client calls DHCPnotify from the function redirect table when it acquires or loses an IP. The default DHCPnotify rou-

tine supplied in the function redirect table (when

ROM_redirect_init is executed by the DS80C400 silicon software) is

rom_dhcp_notify.

dhcp_setup

Description:

The

dhcp_setup function is used by dhcp_init and dhcp_stop.

dhcp_startup

Description:

The

dhcp_startup function is used by dhcp_init.

dhcp_run

Description:

The

dhcp_run function is used by dhcp_init.

dhcp_status

Description:

int dhcp_status(void);

The

dhcp_status function returns the DHCP state. The possible DHCP state return values are listed as follows. See the

RFC2131 for a description of these DHCP states.

DHCP STATE

RETURN VALUE

INIT

0

SELECTING

1

REQUESTING 2

INITREBOOT 3

REBOOTING

4

BOUND 5

RENEWING 6

REBINDING 7

INPUT

DESCRIPTION

OUTPUT

DESCRIPTION

ACC

Return value

Example:

ROMCALL dhcp_status

INPUT

PARAMETER#–DESCRIPTION

OUTPUT

DESCRIPTION

ACC

R0

Return value (= 0 for success)

Return value (bit-wise OR of flags)

Example:

ROMCALL dhcp_init

Maxim Integrated

Advertising