Advanced: Creating Customized OSIs : Customizing API Definitions : General API Definitions : Synchronization APIs

Synchronization APIs
 
Sample Definition
Code Generated
Declare Semaphore(nameid)
extern SEM_H $<nameid>;
Defines the code for declaring a Semaphone (OS Object).
This API is used when generating the code for declaring a Timer
This code is generated in the file type_def.h
For a Condition defined to be a Semaphore:
API definition: extern SEM_H $<nameid>;
Generated Code: extern SEM_H COND1;
Define Semaphore(nameid)
SEM_H $<nameid>;
Defines the code for defining a Semaphone (OS Object).
This API is used when generating the code for defining a Software Timer.
This code is generated in the file glob_dat.c
For a Condition defined to be a Semaphore:
API definition: extern SEM_H $<nameid>;
Generated Code: DECLARE_TIMER(timer_10ms);
Create Semaphore(nameid)
$<nameid> = CreateSemaphore();
Defines the code for creating a Semaphone (OS Object).
This API is used when generating the code for creating a Software Timer.
This code is generated in the file glob_dat.c, in the function: on_startup_code.
The function on_startup_code is called at the startup of the generated application.
For a Condition defined to be a Semaphore:
API definition: $<nameid> = CreateSemaphore();
Generated Code: COND1 = CreateSemaphore();
Destroy Semaphore(nameid)
DestroySemaphore($<nameid>);
Defines the code for destroying a Semaphone (OS Object).
This API is used when generating the code for destroying a Software Timer.
This code is generated in the file glob_dat.c, in the function: on_exit_code.
The function on_exit_code is called at the end of the generated application.
For a Condition defined to be a Semaphore:
API definition: DestroySemaphore($<nameid>);
Generated Code: DestroySemaphore(COND1 );
Wait Semaphore(nameid)
Defines the code for waiting on a Semaphore (OS Object).
This API's definition is used as the generated code for the operator: "get" on a Condition defined to be a Semaphore.
For a Condition defined to be a Semaphore:
API definition: WaitSemaphore($<nameid>);
Generated Code: WaitSemaphore(COND1 );
Release Semaphore(nameid)
ReleaseSemaphore($<nameid>);
Defines the code for releasing a Semaphore (OS Object).
This API's definition is used as the generated code for the operator: "release" on a Condition defined to be a Semaphore.
For a Condition defined to be a Semaphore:
API definition: ReleaseSemaphore($<nameid>);
Generated Code: ReleaseSemaphore(COND1 );