Socket function calling conventions, Input parameter buffer, Output return values – Maxim Integrated High-Speed Microcontroller Users Guide: Network Microcontroller Supplement User Manual

Page 195

Advertising
background image

High-Speed Microcontroller User’s

Guide: Network Microcontroller

Supplement

195

SOCKET FUNCTION CALLING CONVENTIONS

The DS80C400 silicon software socket functions conform to the MxTNI Native Library calling (NatLib) conventions. The NatLib calling
conventions are described as follows.

Input Parameter Buffer

The input parameter buffer consists of up to six parameters (or arguments). Each parameter is 4 bytes wide; thus, a parameter buffer
spans 24 total bytes. Parameter 0 would be at offset 0 in the parameter buffer, parameter 1 at offset 4, etc., as shown below:

Parameter buffer:

Parameter0 (4 bytes)

Param0[0], Param0[1], Param0[2], Param0[3]

Parameter1 (4 bytes)

….

Parameter2 (4 bytes)

….

Parameter3 (4 bytes)

….

Parameter4 (4 bytes)

….

Parameter5 (4 bytes)

Param5[0], Param5[1], Param5[2], Param5[3]

Each argument passed to a socket function, no matter whether it is an 8-bit byte or 24-bit pointer, occupies a single parameter of the
parameter buffer as described:

Integer representation. 8-bit, 16-bit, and 32-bit values are stored LSB first in the corresponding parameter.

Pointer representation. Pointers are stored LSB first in bytes 0, 1, and 2 of the corresponding parameter. When a pointer to
an array is given, that data array should be of the format: type (one byte:

ignored), array length (two bytes: LSB, MSB), and

array data (MSB: LSB bytes).

Prior to calling a given socket function, a parameter buffer should be loaded accordingly and a pointer to that parameter buffer should
be placed in working registers R7, R6, and R5 of working register bank 2 (R7_B2:R5_B2).

Output Return Values

Every socket function returns a success/failure indication in the accumulator (ACC). Success is signaled by ACC = 0. Socket functions
that return 8-bit, 16-bit, or 32-bit values store this value/pointer most significant byte first in working registers R3, R2, R1, and R0 of
working register bank 0 (R3_B0:R0_B0). The following registers potentially are used by the socket functions: ACC, B, DPTR0
(DPX:DPH:DPL), DPTR1 (DPX1:DPH1:DPL1), DPTR2 (DPX2:DPH2:DPL2), DPS, PSW, and register banks 0, 1, 2, and 3 (i.e., the user
must take care to save these registers across socket function calls when necessary).

Maxim Integrated

Advertising