Client applications interact with ECROS using an Application Programming Interface (API). This consists of types, functions and global variables defined and declared in the header file ECROS.h. Application source files that need to access ECROS facilities must therefore #include this header file.
For compactness and portability, ECROS defines a number of types derived from basic C language types. For example, the type UInt8T, an unsigned 8-bit integer, is derived from the basic type unsigned char. Using these types avoids some ambiguities in the C language specification, which, for example, permits the basic type char to be either signed or unsigned at the discretion of the implementation. These types are used in API functions. A client application may also use these types independently of ECROS.
Types are also defined with a specific semantic in mind. For example, the type OsTicksT, an unsigned 16-bit integer, is used for variables that represent a number of time ticks. When such types are used for function arguments and variables, they make the program text somewhat self-documenting.
Many ECROS functions return a value from the enumeration OsResultE. The value OsResult_SUCCESS, which is equal to zero, is returned when a function succeeds in its purpose. When a function fails, it returns an error result code, all of which are negative. For example, if the failure is due to running out of memory, the value OsResult_OUT_OF_MEMORY is returned.
The type OsHndlT is used as a handle or abstract reference to operating system internal objects. API functions that create such objects return a value of this type. To inspect or modify the object, you must pass the handle back to an API function. For example, to create a task, call OsNewTask() and save the returned value of type OsHndlT which represents the task. To bind a task function to the task, you must call OsTaskBindFunction(), passing the handle as the first argument. The value OsHndl_NONE represents an invalid handle.
API functions are grouped in the following sections in this API Reference:
ECROS has very few global variables. They are discussed in the appropriate sections along with the API functions related to their purpose. For example, the global variable TickCount records the number of time ticks since starting the ECROS scheduler. It is therefore discussed in the overview of timers.