User`s guide

User Functions Called by DSP/BIOS
Program Generation 2-27
2.8 User Functions Called by DSP/BIOS
User functions called by DSP/BIOS objects (IDL, TSK, SWI, PIP, PRD, and
CLK objects) need to follow specific conventions in order to ensure that
registers are used properly and that values are preserved across function
calls.
On the C6x and C55x platforms, all user functions called by DSP/BIOS
objects need to conform to C compiler register conventions for their
respective platforms. This applies to functions written both in C and
assembly languages.
The compiler distinguishes between C and assembly functions by assuming
that all C function names are preceded by an underscore, and assembly
function names are not preceded by an underscore. On the C54x platform,
this distinction becomes especially important because C and assembly
functions conform to two different sets of rules. Functions that are preceded
by an underscore (this includes C functions and any assembly functions
whose names are preceded by an underscore) must conform to the C
compiler conventions. On the C54x platform, assembly functions (functions
that are not preceded by an underscore) must conform to the following rules:
The first argument is passed in register AR2
The second argument is passed in register A
The return value is passed in register A
Note:
The above rules do not apply to user functions called by TSK objects. All
user functions (both C and assembly) called by TSK objects follow C
register conventions.
On the C54x platform when a C function (or an assembly function whose
function name is preceded by an underscore) is executing, the CPL
(Compiler Mode) bit is required to be set. When an assembly function (one
whose name is not preceded by an underscore) begins executing, the CPL
bit is clear and must be clear upon return.
For more information on C register conventions, see the optimizing compiler
user’s guide for your platform.