Advanced: Creating Customized OSIs : Customizing API Definitions : Customizing Memory Management : Code—Task/ISR and Related Activities

Code—Task/ISR and Related Activities
 
Sample Definition
Task/ISR Opening(nameid)
?<begin>$<CK_memSegment>?<!=>?<?>#if defined __HC12__ || defined __HC08__
#pragma CODE_SEG $<CK_memSegment>
#elif defined(COSMIC12)
#pragma section ($<CK_memSegment>)
Controls the specific Task/ISR entry function body definition.
It will be added just before the function body begins, in <module>.c file. It will be added, as well, to all related activities functions.
These API's enable insertion of user code before and after the Task's/ISR's body code function, and before and after every function which is related to the Task/ISR.
Such functions may be the functions for the Activities in the Task's/ISR's hierarchy.
The code related to these API's is generated in <module>.c
For an Activity named T1, defined to be an TASK, with Activity named ACT1 inside:
Design-Attribute: CK_memSegment = CODE_SEG_1
#pragma CODE_SEG CODE_SEG_1
#pragma CODE_SEG DEFAULT
#pragma CODE_SEG CODE_SEG_1
cgActivity_ACT1();
#pragma CODE_SEG DEFAULT
Task/ISR Closure(nameid)
?<begin>$<CK_memSegment>?<!=>?<?>#if defined __HC12__ || defined __HC08__
#pragma CODE_SEG DEFAULT
#elif defined(COSMIC12)
Controls the specific Task/ISR entry function body definition.
It will be added just after the function body end, in <module>.c file. It will be added, as well, to all related activities functions.
Task/ISR Beginning Code(nameid, profileName)
/* Task/ISR Beginning Code */
Controls the code that can be added at the beginning of a Task/ISR body. It will be added at the beginning of the Task/ISR body, in the file <module>.c
These API's enable insertion of user code in specific locations of the Task's/ISR's body code function.
The code related to these API's is generated in <module>.c
For an Activity named T1, defined to be a TASK, with Activity named ACT1 inside:
/* Task beginning */
<Enter Task API definition>
/* Task beginning 2 */
cgActivity_AC1();
/* Task Ending */
<Terminate Task API definition>
Task/ISR Beginning Code Entry 2(nameid, profileName)
/* Task/ISR Beginning Code Entry 2*/
Controls the code that can be added at the beginning of a Task/ISR body. It will be added at the beginning of the Task/ISR body, after the 'Task/ISR Beginning Code' API definition, in the file <module>.c
Task/ISR Ending Code(nameid, profileName)
Controls the code that can be added at the end of a Task/ISR body. It will be added just at the end of the Task/ISR body, in the file <module>.c
Related Function Declaration Style(nameid, returntype, arglist)
$<returntype>
$<nameid>($<arglist>)
Controls the declaration style of functions which are related to the Task/ISR and related activities, such as "cgEnterActions_..." and "cgExitActions_...".
Used in the file <module>.c with the functions related to Tasks/ISRs
For an Activity named T1, defined to be a TASK, with a Control Activity named ACT_CTRL:
Related Function Call(nameid, arglist)
Controls the call style of functions which are related to the Task/ISR and related activities, such as "cgEnterActions_..." and "cgExitActions_...".
Used in the file <module>.c with the functions related to Tasks/ISRs
For an Activity named T1, defined to be a TASK, with a Control Activity named ACT_CTRL:
cgDo_ACT_CTRL();
Forward Related Function Declaration(nameid, returntype, arglist)
#if defined __HC12__ || defined __HC08__
extern ?<begin> $<CK_memSegment> ?<!=> ?<?>far ?<:> ?<end>$<returntype> $<nameid>($<arglist>);
extern $<returntype> $<nameid>($<arglist>);
Controls the forward (extern) declaration of functions related to the Task/ISR and related activities, such as "cgEnterActions_..." and "cgExitActions_..."; by default, in the file 'type_def.h'
Used in the file type_def.h with the functions related to Tasks/ISRs
For an Activity named T1, defined to be a TASK, with a Control Activity named
ACT_CTRL with entering reactions in it.
#if defined __HC12__ || defined __HC08__
extern void cgEnterActions_GENERAL_CONTROL(...);
extern void cgEnterActions_GENERAL_CONTROL(...);
Activity Function Opening(nameid)
?<begin> $<CK_compilationFlag> ?<!=> (none) ?<&&> $<CK_compilationFlag> ?<!=> ?<?>#ifdef $<CK_compilationFlag>
?<:>?<end>
Controls the specific function body definition. It will be added just before the function body begins, in the file <module>.c
Used in the file <module>.c with the functions related to Tasks/ISRs
Design-Attribute: CK_compilationFlag = CODE_SEG_1
#ifdef CODE_SEG_1
Activity Function Closure(nameid)
"?<begin> $<CK_compilationFlag> ?<!=> (none) ?<&&> $<CK_compilationFlag> ?<!=> ?<?>#endif
Controls the specific function body definition. It will be added just after the function body end, in the file <module>.c
Used in the file <module>.c with the functions related to Tasks/ISRs
Design-Attribute: CK_compilationFlag = CODE_SEG_1
Activity Function Call Opening(nameid)
?<begin> $<CK_compilationFlag> ?<!=> (none) ?<&&> $<CK_compilationFlag> ?<!=> ?<?>#ifdef $<CK_compilationFlag>
?<:>?<end>
Controls the specific call to the function implementing the activity. It will be added just before calling the function, in the file <module>.c
Used in the file <module>.c with the functions related to Tasks/ISRs
Design-Attribute: CK_compilationFlag = CODE_SEG_1
#ifdef CODE_SEG_1
cgActivity_AC1();
Activity Function Call Closure(nameid)
?<begin> $<CK_compilationFlag> ?<!=> (none) ?<&&> $<CK_compilationFlag> ?<!=> ?<?>#endif
?<:>?<end>
Controls the specific call to the function implementing the activity. It will be added just after calling the function, in the file <module>.c
Used in the file <module>.c with the functions related to Tasks/ISRs
Design-Attribute: CK_compilationFlag = CODE_SEG_1
#ifdef CODE_SEG_1
cgActivity_AC1();
Statechart Beginning Code(nameid)
if((currentState_$<nameid> & $<nameid>_BITS_RANGE) != 0){
/* Error: $<nameid> State Variable out of Range. */
Controls the code at the beginning of the Statechart. It will be added as the first executable statement in the Statechart function.
These API's enable insertion of user code in specific locations of the Statechart function (cgDo_…).
The code related to these API's is generated in <module>.c
For a Control Activity named ACT_CTRL:
if((currentState_ACT_CTRL & ACT_CTRL_BITS_RANGE) != 0){
/* Error: ACT_CTRL State Variable out of Range. */
/* Statechart Ending Code */
Statechart Ending Code(nameid)
Controls the code at the end of the Statechart. It will be added as the last executable statement in the Statechart function.