1.11.5. Component interfaces and dependencies¶
- Calling another component interface function must always be called with the CAL_ prefix.. note:: The CAL_ macro must not be used for calling functions within the same component!**
Optional dependent interface functions must be checked with the check function CHK_Fct the availability before calling CAL_Fct !
Usually all interface (*Itf.h) and dependency files (*Dep.h) should be created from m4 compiler. This enables changes to the component link process to be carried out easily.
- CDECL must precede each function prototype (*Itf.h) and also the implementation of each function, e.g.:int CDECL Test(int i); /* prototype in *.itf.h */int CDECL Test(int i){…}
- CDECL_EXT is created automatically before each function prototype of an external library function. Is used in all prototypes of external library functions in order to attach huge casts to these functions.Therefore this macro must also be used for every implementation, thus:int CDECL CDECL_EXT __testlibfct (int i); /* prototype in *.itf.h */int CDECL CDECL_EXT __testlibfct(int i) {…}
- Only use standard ANSI-C functions and headers (no strcmpi() or similar)!Don’t use any operating system–specific functions in kernel components!!!Always use the Sys-API or CMUtils functions for this purpose.
Declare all local functions as static (name collisions in the case of static linking)
All interface functions of the components should:
usually returns RTS_RESULT as a standard return value
always use RTS_HANDLE as handle and **RTS_INVALID_HANDLE** as invalid handle value
if RTS_HANDLE is returned, then always include **RTS_RESULT *pResult** as a parameter in the prototype. Hence the exact failure cause can be determined in case the RTS_INVALID_HANDLE is returned.
To specify a task, use always one of the following m4-Macros in the Dep.m4 file:
- TASK(`Name’, `Priority):‘This macro is to specify a normal task. Please specify a comment for the documentation:/*** <category>Task</category>* <description>* Block driver communication task.* </description>*/TASK(`BlkDrv’dp’, `TASKPRIO_HIGH_’ND’)
- TASKPREFIX(`Name’, `Priority):Task prefix is used, if specified task name is extended by some additional information (like a channel number, etc.).
- TASKPLACEHOLDER(`Name’, `Priority):Placeholder of a task that is replace by the configured name (e.g. by the user defined name of an IEC-task).

