OSI Definition ToolAPI Syntax Definition
Each OSI (Operating System Implementation) contains a predefined list of API definitions. Each such API definition is intend to define the structure of the generated code that will result from use of that API. An API definition is often referred to as an OSI. OSIs are managed using the OSDT (Operating System Definition Tool) utility that is supplied with MicroC.
Each API definition might have predefined values that it would use, similar to the formal parameters of a function. To use predefined values in the API definition, you must use the predefined value name wrapped with the “$<” prefix and “>” postfix delimiters. Note that this notation is standard throughout the OSDT utility.
For example, consider the following API definition:
The resulting generated code, for a Task named “T1,” will be:
This is illustrated in the following figure.
Another way to parameterize the API definition is to use the property value of the element itself, as defined in the Data Dictionary for it. For example, suppose the element has a design attribute named Create Mode that uses the attribute key word CK_createdMode, which then evaluates to:
For the following API definition:
The resulting generated code, for a Task named “T1,” will be:
t_T1. hndl = CreateThread ( NULL , 0 ,
( LPTHREAD_START_ROUTINE ) T1, NULL ,
CREATE_SUSPENDED, &t_T1.tid );
A third way to parameterize the API definition is to use the property value of the element itself (as defined in the DataDictionary for it) as the API definition itself. For example, suppose the element has a design attribute, possibly hidden, that uses the attribute key word:
For the following API definition:
And design attribute definition:
The resulting generated code, for a data item named DI1, will be:
assuming that the CK_MessagePriority property evaluates to 1.
This third method is illustrated in the following figure.
Note: A good use for this approach is to modify the API definition just for a local implementation requirement.Note: Browsing of the defined key word, in the data dictionary, is supported in the tool. When in the definition field of the API, you can enter either of the following sequences, which will result in a list popping up with the predefined keys. The sequences are:“$<” and “$<<”. While in this list, pressing space, enter or “>” will close it.