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

Page 214

Advertising
background image

High-Speed Microcontroller User’s

Guide: Network Microcontroller

Supplement

214

ip_checkheader

(IPv4 only) This function checks to see if the network stack is interested in the incoming IPv4 datagram. The function also checks basic

packet correctness.

Note: Before calling this function, the caller must ensure that:

1) the buffer contains at least 20 + 8 bytes (header + protocol) of IPv4 data

2) the total packet length reported in the IP header is smaller than or equal to the size of the buffer (minus frame length)

This function does not verify the header checksum.

ip_packetreceived

(IPv4 only) This function is called by network interface drivers when an IP datagram has been received. At least the IP header is

assumed to have been unloaded.

Note: It is assumed that IP_CheckHeader has been called and returned 0.

INITIALIZATION FUNCTIONS

Before using any DS80C400 silicon software function, the system must have a valid interrupt vector table and function redirect table,

and all memory must be cleared (directs, RAM). Additionally, other initialization functions for the memory manager, scheduler, and net-

working hardware/software drivers must be executed. The

rom_init call takes care of required initialization. It is expected that using

the

rom_init call is the preferred method for initializing the system; therefore, only high-level descriptions are given for the functions

called by

rom_init.

rom_init

The

rom_init function performs the initialization that provides functionality to the exported DS80C400 silicon software functions.

Supplying a lower address bound (R2:R0) of 000000h results in a default heap-memory allocation that afterward can be assessed by

examining the BOOT_MEMBEGIN and BOOT_MEMEND parameters. The

rom_init function is automatically executed with default heap-

memory allocation when NetBoot is selected. Otherwise, the user code should supply the lower and upper address bounds for heap-

memory allocation when calling

rom_init. The basic rom_init execution flow is given following the input/output parameter definition.

Init Function

Description*

1.

rom_copyivt

Copies a default interrupt vector table from ROM to the external memory starting at 000000h. The

default interrupt vector table executes a RETI for all interrupts except for the following:

• Timer 0 (000Bh)—WOS_tick routine

• Power-Fail (0033h)—Loops until the PFI bit can be cleared, signaling that power has returned to

a good state. Once PFI can be cleared, a jump is made to the start of ROM as if power had

been lost.

• Ethernet Act (0073h)—ETH_ProcessInterrupt routine

INPUT

DESCRIPTION

OUTPUT

DESCRIPTION

R2:R0

Lower address bound for heap memory allocation

ACC

return value (0 = success)

R5:R3

Upper address bound for heap memory allocation

INPUT

DESCRIPTION

OUTPUT

DESCRIPTION

DPTR0

Address of IPv4 header

R3:R2

Kernel memory buffer handle

for datagram

INPUT

DESCRIPTION

OUTPUT

DESCRIPTION

DPTR0

IPv4 header

ACC

0: Packet passes verification

B

(if ACC = 0): 0 for directed

datagram, non-zero for

broadcast/multicast

Maxim Integrated

Advertising