4.7. Function Calling Convention
All input and output function variables are passed in registers. The function calling convention and parameter
passing is a Keil convention. It is also used by Raisonance toolchain. Maximum 3 parameters can be passed to
functions in registers. When more input data is needed within the function, a data structure is used and only a
pointer to the structure is passed to the function.
Generic pointers (3 byte pointer) are not used in the API and if the pointer is passed as an input to a function, the
storage location where it points to is always specified. The table below shows the order of the function parameter
and what registers store them. Note that unsigned types are passed the same way as signed (
unsigned char
, for example).
Argument
Order
Number
1.
2.
3.
If the registers required by subsequent parameters are taken by the previous arguments, then the subsequent
arguments cannot be passed in the registers. For example, passing two
Similarly, passing
first and
long
Function return values are always passed in registers. Note that unsigned types are passed the same way as
signed (
char
and
unsigned char
bit
char
or
1-byte pointer (*DATA, *IDATA)
int
or
2-byte pointer
(*XDATA)
long
or
float
The user should also assume that all the functions are modifying all the registers in the current register bank.
Argument Type and Passing Registers
char
or
1-byte pointer (*DATA,
*IDATA)
R7
R5
R3
second is not possible, while passing
int
, for example).
Return Type
CY
R7
R6 .. MSB
R7 .. LSB
R4–R7 (R4 .. MSB)
int
or
2-byte pointer
(*XDATA)
R6 .. MSB
R7 .. LSB
R4 .. MSB
R5 .. LSB
R2 .. MSB
R3 .. LSB
long
variables in registers is not possible.
int
Passing Registers
.. carry flag
Rev. 1.0
AN370
char
long
or
float
R4-R7
(R4 .. MSB)
R4-R7
(R4 .. MSB)
N/A
first and
second is possible.
int
and
15
Need help?
Do you have a question about the Si4010 and is the answer not in the manual?
Questions and answers