<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-GB">
	<id>https://wiki.ocetechnology.com/mediawiki/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Bkavanagh</id>
	<title>wiki - User contributions [en-gb]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.ocetechnology.com/mediawiki/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Bkavanagh"/>
	<link rel="alternate" type="text/html" href="https://wiki.ocetechnology.com/mediawiki/index.php/Special:Contributions/Bkavanagh"/>
	<updated>2026-10-21T21:18:05Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.36.1</generator>
	<entry>
		<id>https://wiki.ocetechnology.com/mediawiki/index.php?title=OCEOSmp/introduction&amp;diff=1719</id>
		<title>OCEOSmp/introduction</title>
		<link rel="alternate" type="text/html" href="https://wiki.ocetechnology.com/mediawiki/index.php?title=OCEOSmp/introduction&amp;diff=1719"/>
		<updated>2024-12-05T12:42:29Z</updated>

		<summary type="html">&lt;p&gt;Bkavanagh: /* Introduction */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= &amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;'''Introduction'''&amp;lt;/span&amp;gt; =&lt;br /&gt;
&lt;br /&gt;
__NOTOC__&lt;br /&gt;
&lt;br /&gt;
OCEOSmp is a multicore real-time pre-emptive fixed priority operating system that can be used in applications that require European Cooperation for Space Standardization Category B or ISO 26262 standards. It has a small memory footprint (&amp;lt;20 kBytes), requires only one system stack per CPU rather than a stack for each task, and provides support for precisely timed data outputs independent of task scheduling. OCEOS supports applications running on RISC-V, ARM, &amp;amp; SPARC based hardware. &lt;br /&gt;
&lt;br /&gt;
OCEOSmp is designed to be suitable for high reliability embedded systems. It is not started initially on power up but is started by the main application code, to which it may return if a fatal error is detected. It is designed to be transparent with information stored at statically allocated locations and accessible both while OCEOSmp is running and after it exits.&lt;br /&gt;
In addition to deterministic scheduling the qualities most important in designing OCEOSmp were (i) robustness (ii) efficiency (iii) compactness.&lt;br /&gt;
&lt;br /&gt;
[[File:Wikioceosmp.png|1000px]]&lt;br /&gt;
&lt;br /&gt;
== &amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;Robustness&amp;lt;/span&amp;gt; ==&lt;br /&gt;
This is a primary objective in the design of OCEOSmp.&lt;br /&gt;
For a system design to be robust it must be possible to identify the range of problems with which it should deal and how it does so.&lt;br /&gt;
Such problems fall into three main categories, those excluded by the design, those that provide an advance warning that something is going wrong, and those that can occur without warning.&lt;br /&gt;
&lt;br /&gt;
== &amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;Excluded by design&amp;lt;/span&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
The design of OCEOSmp is based on the stack resource policy (https://www.math.unipd.it/~tullio/RTS/2009/Baker-1991.pdf). This has a number of advantages and excludes a number of potential problems. &lt;br /&gt;
*Unbounded priority inversion cannot occur in OCEOSmp.&lt;br /&gt;
*Deadlocks cannot occur if there is only one CPU.&lt;br /&gt;
*(With more than one CPU, deadlocks cannot occur if tasks always follow the same order in acquiring mutexes. OCEOSmp detects when this is not the case and automatically makes a system log entry, updates the state variable, and optionally calls a user defined problem handling function.)&lt;br /&gt;
*When a task is created an allowance of from 1 to 15 execution instances is specified. This can be set so that unexpected task start requests do not cause a problem. (It also allows the work of a task be split and done concurrently on multiple CPUs, or the same processing be done on multiple CPUs and results compared to check CPU behaviour.) &lt;br /&gt;
*With OCEOSmp no CPU in a multi-core system is a single point of failure once scheduling has begun, use of CPUs is then symmetric.&lt;br /&gt;
&lt;br /&gt;
== &amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;Advance warning – problem anticipation&amp;lt;/span&amp;gt; ==&lt;br /&gt;
Some problems give advance warnings that things are going wrong, allowing preventive action be taken before the problem becomes critical. All software design involves assumptions and the ability to do run-time checks of how close these are to being violated allows preventative actions, or at least notification of what is happening, to be carried out before a critical situation develops.&lt;br /&gt;
&lt;br /&gt;
OCEOSmp will be designed to facilitate noticing advance warnings. All memory is statically allocated with information on all aspects of operations at predetermined locations that can be checked at any time.&lt;br /&gt;
&lt;br /&gt;
For software this information includes:&lt;br /&gt;
For each CPU:&lt;br /&gt;
*Maximum stack usage (OCEOSmp does not require a separate stack for each task)&lt;br /&gt;
*Currently executing and pending tasks&lt;br /&gt;
For each task:&lt;br /&gt;
*Minimum time between task start requests.&lt;br /&gt;
*Maximum time to completion.&lt;br /&gt;
*Maximum number of concurrent execution instances (jobs).&lt;br /&gt;
*Whether deadline (if specified) has been missed&lt;br /&gt;
For the system:&lt;br /&gt;
*System log&lt;br /&gt;
*Context switch log (if enabled)&lt;br /&gt;
*System state variable (reset on restart)&lt;br /&gt;
*System state variable backup (not reset on restart)&lt;br /&gt;
*System state variable action mask (selects automatic call of application defined problem handler)&lt;br /&gt;
&lt;br /&gt;
Hardware problem warnings include:&lt;br /&gt;
For CPU problems:&lt;br /&gt;
*OCEOSmp allows simultaneous running of the same task on up to 15 different CPUs, with results stored on a per CPU basis and available for comparison.&lt;br /&gt;
*This can provide protection against CPU malfunction in carrying out critical tasks.&lt;br /&gt;
*It also allows background checks that can warn that a CPU has developed a problem.&lt;br /&gt;
*If a CPU is found to be faulty it can be taken out of use and the termination functions of its currently executing and pending tasks called from another CPU.&lt;br /&gt;
For memory problems:&lt;br /&gt;
*A memory scrubber task can be scheduled to start periodically to ensure single bit errors do not accumulate (assuming EDAC).&lt;br /&gt;
For peripheral hardware:&lt;br /&gt;
*The minimum time between task start requests can warn that a peripheral is malfunctioning.&lt;br /&gt;
&lt;br /&gt;
== &amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;No warning&amp;lt;/span&amp;gt; ==&lt;br /&gt;
Software errors can arise suddenly due to unforeseen circumstances. The phrase ‘a failure mode we did not think of’ is not unknown among software developers. The resulting error typically occurs without warning.&lt;br /&gt;
Hardware errors can also occur without warning due to radiation or other factors.&lt;br /&gt;
Some protection against hardware CPU failures can be obtained by exploiting redundancy and running the same task on multiple CPUs, and OCEOSmp supports this.&lt;br /&gt;
Protection against memory errors is usually provided by EDAC. It is expected that an appropriate trap handler is put in place by the application to handle uncorrectable errors signalled by an EDAC system. The timed actions feature of OCEOSmp simplifies restarting a memory scrubber task at set time intervals, and allows the time interval be changed at run time depending on the error rate.&lt;br /&gt;
Memory protection may also be provided by memory protection units which restrict defined memory address ranges to use only for execution code or for reading but not writing. The fixed address ranges used by OCEOSmp simplify configuring these units.&lt;br /&gt;
OCEOSmp provides further protection against software and hardware errors by protecting data areas with fixed sentinels and automatically checking these, and checking other factors for consistency, whenever an OCEOSmp directive is used.&lt;br /&gt;
Similar checks can also be done by the application software, which can also check the fixed area checksum (this is not done automatically by OCEOSmp for reasons of efficiency). As the fixed data area does not change once scheduling begins it is possible to create it in advance and store it in ROM for use if it is necessary to restart scheduling.&lt;br /&gt;
&lt;br /&gt;
== &amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;Fault isolation&amp;lt;/span&amp;gt; ==&lt;br /&gt;
When OCEOSmp detects a fault it can isolate it in a number of ways.&lt;br /&gt;
For software problems it can&lt;br /&gt;
*terminate the currently execution instance of a task&lt;br /&gt;
*disable a task so that it will not be put into execution again&lt;br /&gt;
*terminate all current execution instances of the task&lt;br /&gt;
If a CPU is found to be faulty&lt;br /&gt;
*OCEOSmp can take the CPU out of use by OCEOSmp&lt;br /&gt;
*OCEOSmp can put the CPU in sleep mode&lt;br /&gt;
*OCEOSmp can terminate all jobs pending or in execution on that CPU&lt;br /&gt;
The response usually involves&lt;br /&gt;
*Updating the system state flags&lt;br /&gt;
*Updating the system log&lt;br /&gt;
*If the action mask matches the system state flags calling the application defined problem handling function &lt;br /&gt;
In extreme cases where corruption of its internal structure is detected OCEOSmp will return to the main application with an appropriate system code. The system log, task information, and all other data are still available for analysis, and the main application code may restart OCEOSmp.&lt;br /&gt;
&lt;br /&gt;
== &amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;Fault reporting&amp;lt;/span&amp;gt; ==&lt;br /&gt;
A system state variable contains flags that indicate what problems have been detected.&lt;br /&gt;
A backup of this variable that is not reset on start-up allows a record of past events be kept across start cycles.&lt;br /&gt;
An action mask variable allows an application defined function be called to handle certain problems. &lt;br /&gt;
The system log is automatically updated when OCEOSmp detects certain problems, and may be updated by the application if it detects problems. A range of system log codes are reserved for OCEOSmp, others are available for application use.&lt;br /&gt;
The system log size is set in the initial configuration. It is structured as a circular buffer and an optional function can be defined that is called when the system log becomes ¾ full.&lt;br /&gt;
A context switch log can be enabled and its size set in the initial configuration. Structured as a circular buffer, it can be read by an external debugger such as DMON, or its content output by a task.&lt;br /&gt;
&lt;br /&gt;
== &amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;Fault recovery&amp;lt;/span&amp;gt; ==&lt;br /&gt;
As mentioned above under ‘Fault Isolation’, OCEOSmp can enable and disable tasks, terminate execution instances of tasks, put a CPU out of use by OCEOSmp, and put a CPU into sleep mode.&lt;br /&gt;
In most cases these actions will be taken by an application defined problem handling function. This is automatically called when a change in the system state corresponds to one of the action flags set by the application, and can then access the system log and system state variables and other information and use OCEOSmp directives to take the appropriate actions.&lt;br /&gt;
When an OCEOSmp task is created a termination function for the task is usually defined and this allows tasks that have already started be terminated in an orderly way if the CPU on which they are executing is found to be faulty.&lt;br /&gt;
An OCEOSmp directive causes an exit from OCEOSmp and return with an appropriate status code to the main application code that started OCEOSmp. This directive is used automatically by OCEOSmp if it detects a fatal error, and can be used by the application code. As well as the returned status code the main application code can readily access the system state variable, system logs, and all task and other information, and can use an OCEOSmp directive to restart scheduling.&lt;br /&gt;
&lt;br /&gt;
== &amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;Implementation&amp;lt;/span&amp;gt; ==&lt;br /&gt;
The core aspects of OCEOSmp are written in C. This includes the code for initialising OCEOSmp data structures, for scheduling, and for mutexes, read-write mutexes, counting semaphores, data queues and timed actions.&lt;br /&gt;
CPU specific code is written in C and in assembly language for that CPU. This includes spin-lock mechanisms and interrupt control.&lt;br /&gt;
All OCEOSmp code is re-entrant and can be run in parallel on multiple CPUs. Spin locks and interrupt disabling are used to allow updating of shared data. Interrupts disabled times are kept to a minimum.&lt;br /&gt;
Use of the stack resource policy means that only a single system stack is needed for each CPU rather than a stack for each task. Context switch operations are basically function calls and done quickly.&lt;br /&gt;
A central priority queue of CPUs is used where CPU priority is based on having sufficient remaining stack space to allow pre-emption and on the pre-emption threshold of the currently executing task. If the highest priority pending task has higher priority than the threshold and the CPU has stack space then context switch processing is started on that CPU and its current task is pre-empted.&lt;br /&gt;
CPUs can be reserved for use only by tasks above a certain priority.&lt;br /&gt;
Behaviour is deterministic. The highest priority waiting task will always be run if sufficient stack space has been allocated.&lt;br /&gt;
OCEOSmp uses a log area, fixed data area, dynamic data area and stack area. The stack area is divided equally between the CPUs and initialised with a filler, allowing the maximum stack use by each CPU be readily determined. The other areas are typically set up as static arrays of 32-bit words with sentinels at each end and a size immediately after the first sentinel. The fixed data area contains pointers to the main components of all areas to simplify access and a checksum set when initialisation is complete.&lt;br /&gt;
The Misra-C standard is automatically applied to all C code and any exceptions justified.&lt;br /&gt;
The Eclipse IDE is used for development in conjunction with a Subversion code repository, and OCE’s DMON tool and other tools used in debugging. &lt;br /&gt;
&lt;br /&gt;
== &amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;Efficiency&amp;lt;/span&amp;gt; ==&lt;br /&gt;
The use of the stack resource policy greatly simplifies context switching, allowing it be treated as essentially a function call to the start function of a task. Context switch times are expected to be significantly faster than for other RTOS.&lt;br /&gt;
&lt;br /&gt;
== &amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;Compactness&amp;lt;/span&amp;gt; ==&lt;br /&gt;
In traditional RTOS each task must be allocated its own stack, and this must be done relatively generously. With many tasks, considerable RAM can be required.&lt;br /&gt;
With just one stack required per CPU the stack requirements in OCEOSmp are much less, perhaps making it possible to reduce the number of memory chips in a system.&lt;br /&gt;
OCEOSmp does not use virtual addressing, allowing further savings in memory as page tables are not required.&lt;br /&gt;
The code for OCEOSmp core components is small, about 20KiB.&lt;br /&gt;
&lt;br /&gt;
[[Category:backup]]&lt;/div&gt;</summary>
		<author><name>Bkavanagh</name></author>
	</entry>
	<entry>
		<id>https://wiki.ocetechnology.com/mediawiki/index.php?title=OCEOSmp/directive_reference&amp;diff=1718</id>
		<title>OCEOSmp/directive reference</title>
		<link rel="alternate" type="text/html" href="https://wiki.ocetechnology.com/mediawiki/index.php?title=OCEOSmp/directive_reference&amp;diff=1718"/>
		<updated>2024-06-24T16:16:12Z</updated>

		<summary type="html">&lt;p&gt;Bkavanagh: /* oceos_timed_output_number() */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Introduction =&lt;br /&gt;
&lt;br /&gt;
To be added&lt;br /&gt;
&lt;br /&gt;
= Directives =&lt;br /&gt;
&lt;br /&gt;
== Initialisation directives ==&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_init()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''initialisation.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Initialises OCEOS and  must be the first directive used.&lt;br /&gt;
&lt;br /&gt;
Initialises the OCEOS system meta data using the information supplied in the application configuration and prepares for creation of tasks etc.&lt;br /&gt;
&lt;br /&gt;
The values provided in the application configuration are checked as much as possible before being used.&lt;br /&gt;
&lt;br /&gt;
The system log also is created here.&lt;br /&gt;
&lt;br /&gt;
This function sets up sysMetaPtr and init_meta_ptr and must have completed successfully before tasks etc. can be created.&lt;br /&gt;
&lt;br /&gt;
It disables interrupts and leaves them disabled, they will be re-enabled to the previous level after all tasks etc. have been created and [[OCEOSmp/directive_reference#oceos_init_finish()|oceos_init_finish()]] has completed successfully.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Initialises OCEOS and  must be the first directive used.&lt;br /&gt;
 *&lt;br /&gt;
 * Initialises the OCEOS system meta data using the information supplied in&lt;br /&gt;
 * the application configuration and prepares for creation of tasks etc.&lt;br /&gt;
 *&lt;br /&gt;
 * The values provided in the application configuration are checked as much&lt;br /&gt;
 * as possible before being used.&lt;br /&gt;
 *&lt;br /&gt;
 * The system log also is created here.&lt;br /&gt;
 *&lt;br /&gt;
 * This function sets up sysMetaPtr and init_meta_ptr and must have completed&lt;br /&gt;
 * successfully before tasks etc. can be created.&lt;br /&gt;
 *&lt;br /&gt;
 * It disables interrupts and leaves them disabled, they will be re-enabled to&lt;br /&gt;
 * the previous level after all tasks etc. have been created and&lt;br /&gt;
 * oceos_init_finish() has completed successfully.&lt;br /&gt;
 *&lt;br /&gt;
 * @param app_config Pointer to configuration struct&lt;br /&gt;
 * @return SUCCESSFUL                        All OK&lt;br /&gt;
 *         WARN_LOG_SIZE_DEFAULT             Warning, log size is set to default value of 64 entries&lt;br /&gt;
 *         WARN_NO_ERROR_FUNCTION            Warning, user defined function for ERROR handling is not provided&lt;br /&gt;
 *         ERR_CPU_FIRST_CORE_INVALID        Start CPU not in a range of available cores for this target; or greater than end CPU&lt;br /&gt;
 *         ERR_CPU_LAST_CORE_INVALID         Last CPU not in a range of available cores for this target&lt;br /&gt;
 *         ERR_NOT_START_CPU_CORE            Executing oceos_init on wrong CPU&lt;br /&gt;
 *         ERR_STACK_START_MISALIGNED        Stack start address is not set by user misaligned&lt;br /&gt;
 *         ERR_STACK_PER_CORE_INVALID        Stack per CPU size is zero, or not 8byte aligned, or less then min require&lt;br /&gt;
 *         ERR_LOG_ADDR_MISALIGNED           Log start address is not 8 byte aligned&lt;br /&gt;
 *         ERR_FIX_ADDR_MISALIGNED           Fixed area start address is not 8 byte aligned&lt;br /&gt;
 *         ERR_DYN_ADDR_MISALIGNED           Dynamic area start address is not 8 byte aligned&lt;br /&gt;
 *         ERR_CPU_CORE_RANGE_WRONG          CPU cores in use exceed available CPUs on the SoC&lt;br /&gt;
 *         ERR_STACK_SPACE_WRONG             Current CPU SP is not within user provided stack range&lt;br /&gt;
 *         ERR_LOG_SIZE_INVALID              Log size outside expected range&lt;br /&gt;
 *         ERR_CS_LOG_SIZE_INVALID           Context switch log size invalid&lt;br /&gt;
 *         ERR_TASK_NUMBER_INVALID           Number of tasks invalid&lt;br /&gt;
 *         ERR_MUTEX_NUMBER_INVALID          Number of mutexes invalid&lt;br /&gt;
 *         ERR_RWMUTEX_NUMBER_INVALID        Number of rwmutexes invalid&lt;br /&gt;
 *         ERR_SEM_NUMBER_INVALID            Number of semaphores invalid&lt;br /&gt;
 *         ERR_DATAQ_NUMBER_INVALID          Number of datqs invalid&lt;br /&gt;
 *         ERR_TIMED_ACTIONS_NUMBER_INVALID  Number of timed actions invalid&lt;br /&gt;
 *         ERR_OVERLAP_STACK                 Overlap stack end address with (two overlap areas are set)&lt;br /&gt;
 *         ERR_OVERLAP_LOG                   Overlap log with (two overlap areas are set)&lt;br /&gt;
 *         ERR_OVERLAP_FIXED                 Overlap fixed area with (two overlap areas are set)&lt;br /&gt;
 *         ERR_OVERLAP_DYNAMIC               Overlap dynamic area with (two overlap areas are set)&lt;br /&gt;
 *         ERR_FIXED_MEMORY_FAILED           Fixed area memory write fail&lt;br /&gt;
 *         ERR_DYNAMIC_MEMORY_FAILED         Dynamic area memory write fail&lt;br /&gt;
 *         ERR_TIMER_ADDR_INVALID            Timer address not provided by user (null). SPARC only&lt;br /&gt;
 *         ERR_SYS_TIMER_INDEX_INVALID       System timer index of subtimer invalid; SPARC only; Subtimers start from index 1; Need index of subtimer plus one in front&lt;br /&gt;
 *         ERR_PERIPHERAL_CLOCK_INVALID      System peripheral code invalid&lt;br /&gt;
 *&lt;br /&gt;
 */&lt;br /&gt;
S32_t   oceos_init(&lt;br /&gt;
    const struct application_configuration app_config&lt;br /&gt;
);&lt;br /&gt;
 &amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| app_config || Pointer to configuration struct.  struct application_configuration defined in '''''basic_structs.h'''''&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| WARN_LOG_SIZE_DEFAULT             || Warning, log size is set to default value of 64 entries&lt;br /&gt;
|-&lt;br /&gt;
| WARN_NO_ERROR_FUNCTION            || Warning, user defined function for ERROR handling is not provided&lt;br /&gt;
|-&lt;br /&gt;
| ERR_CPU_FIRST_CORE_INVALID        || Start CPU not in a range of available cores for this target; or greater than end CPU&lt;br /&gt;
|-&lt;br /&gt;
| ERR_CPU_LAST_CORE_INVALID         || Last CPU not in a range of available cores for this target&lt;br /&gt;
|-&lt;br /&gt;
| ERR_NOT_START_CPU_CORE            || Executing oceos_init on wrong CPU&lt;br /&gt;
|-&lt;br /&gt;
| ERR_STACK_START_MISALIGNED        || Stack start address is not set by user misaligned&lt;br /&gt;
|-&lt;br /&gt;
| ERR_STACK_PER_CORE_INVALID        || Stack per CPU size is zero, or not 8byte aligned, or less then min require&lt;br /&gt;
|-&lt;br /&gt;
| ERR_LOG_ADDR_MISALIGNED           || Log start address is not 8 byte aligned&lt;br /&gt;
|-&lt;br /&gt;
| ERR_FIX_ADDR_MISALIGNED           || Fixed area start address is not 8 byte aligned&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DYN_ADDR_MISALIGNED           || Dynamic area start address is not 8 byte aligned&lt;br /&gt;
|-&lt;br /&gt;
| ERR_CPU_CORE_RANGE_WRONG          || CPU cores in use exceed available CPUs on the SoC&lt;br /&gt;
|-&lt;br /&gt;
| ERR_STACK_SPACE_WRONG             || Current CPU SP is not within user provided stack range&lt;br /&gt;
|-&lt;br /&gt;
| ERR_LOG_SIZE_INVALID              || Log size outside expected range&lt;br /&gt;
|-&lt;br /&gt;
| ERR_CS_LOG_SIZE_INVALID           || Context switch log size invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TASK_NUMBER_INVALID           || Number of tasks invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_MUTEX_NUMBER_INVALID          || Number of mutexes invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_RWMUTEX_NUMBER_INVALID        || Number of rwmutexes invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SEM_NUMBER_INVALID            || Number of semaphores invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DATAQ_NUMBER_INVALID          || Number of datqs invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TIMED_ACTIONS_NUMBER_INVALID  || Number of timed actions invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_OVERLAP_STACK                 || Overlap stack end address with (two overlap areas are set)&lt;br /&gt;
|-&lt;br /&gt;
| ERR_OVERLAP_LOG                   || Overlap log with (two overlap areas are set)&lt;br /&gt;
|-&lt;br /&gt;
| ERR_OVERLAP_FIXED                 || Overlap fixed area with (two overlap areas are set)&lt;br /&gt;
|-&lt;br /&gt;
| ERR_OVERLAP_DYNAMIC               || Overlap dynamic area with (two overlap areas are set)&lt;br /&gt;
|-&lt;br /&gt;
| ERR_FIXED_MEMORY_FAILED           || Fixed area memory write fail&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DYNAMIC_MEMORY_FAILED         || Dynamic area memory write fail&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TIMER_ADDR_INVALID            || Timer address not provided by user (null). SPARC only&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_TIMER_INDEX_INVALID       || System timer index of subtimer invalid; SPARC only; Subtimers start from index 1; Need index of subtimer plus one in front&lt;br /&gt;
|-&lt;br /&gt;
| ERR_PERIPHERAL_CLOCK_INVALID      || System peripheral code invalid&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
    /*&lt;br /&gt;
     * Create the application configuration structure&lt;br /&gt;
     */&lt;br /&gt;
    struct application_configuration           app_config = {0};&lt;br /&gt;
&lt;br /&gt;
    /*&lt;br /&gt;
     * Fill in the application parameters&lt;br /&gt;
     */&lt;br /&gt;
    app_config.log_address                   = (log_t)log_data;              // required&lt;br /&gt;
    app_config.fixed_data_address            = (adrs_t)fixed_data;            // required&lt;br /&gt;
    app_config.dynamic_data_address          = (adrs_t)dynamic_data;          // required&lt;br /&gt;
&lt;br /&gt;
    app_config.stack_start_address           = start_stack_array[OCEOS_START_CPU_INDEX];// OCEOSMP_STACK_START_ADDRESS;&lt;br /&gt;
    app_config.stack_size_per_cpu            = (U32_t)&amp;amp;__oceos_stack_size_per_cpu;  // OCEOSMP_STACK_LOW_BOUND_ADDRESS;&lt;br /&gt;
&lt;br /&gt;
    app_config.system_error_function         = oceosmp_on_error;               // NULL =&amp;gt; ignore&lt;br /&gt;
    app_config.log_full_function             = oceosmp_on_full_log;            // NULL =&amp;gt; ignore&lt;br /&gt;
&lt;br /&gt;
    // used in setting up system log and fixed data array&lt;br /&gt;
    app_config.log_number_of_entries         = NUMBER_OF_LOG_ENTRIES;          // 0 =&amp;gt; use default&lt;br /&gt;
&lt;br /&gt;
    app_config.number_of_tasks               = NUMBER_OF_TASKS;                // &amp;gt;= 1&lt;br /&gt;
&lt;br /&gt;
    app_config.number_of_mutexes             = NUMBER_OF_MUTEXES;&lt;br /&gt;
	app_config.number_of_rwmutexes			 = NUMBER_OF_RWMUTEXES;&lt;br /&gt;
    app_config.number_of_counting_semaphores = NUMBER_OF_SEMAPHORES;&lt;br /&gt;
    app_config.number_of_data_queues         = NUMBER_OF_DATAQS;&lt;br /&gt;
&lt;br /&gt;
    /**&lt;br /&gt;
     * FOR SPARC TARGET ONLY.&lt;br /&gt;
     */&lt;br /&gt;
    app_config.sys_time_timer_index          = SYS_TIME_TIMER_INDEX;           // 0 =&amp;gt; invalid index&lt;br /&gt;
    /**&lt;br /&gt;
     * FOR SPARC TARGET ONLY.&lt;br /&gt;
     * Not Used for ARM. Always Nested&lt;br /&gt;
     */&lt;br /&gt;
    app_config.interrupt_nesting_enabled     = TRUE;                           // TRUE =&amp;gt; single vector&lt;br /&gt;
    app_config.oceos_cpu_switch_int_number   = OCEOS_CPU_INTER_COM_INT_NUMBER; // User should provide SGI ID (0-15)&lt;br /&gt;
&lt;br /&gt;
    app_config.timed_actions_queue_size      = NUMBER_OF_ACTION_ENTRIES;&lt;br /&gt;
    app_config.CS_log_entries_base2          = CS_LOG_DEF_ENTRIES_BASE2;&lt;br /&gt;
    /**&lt;br /&gt;
     * Set starting index of CPU that will be used by OCEOSMP&lt;br /&gt;
     */&lt;br /&gt;
    app_config.oceos_cpu_start_index         = OCEOS_START_CPU_INDEX;&lt;br /&gt;
    /**&lt;br /&gt;
     * Set last index of CPU that will be used by OCEOSMP&lt;br /&gt;
     */&lt;br /&gt;
    app_config.oceos_cpu_last_index          = OCEOS_LAST_CPU_INDEX;&lt;br /&gt;
    /*&lt;br /&gt;
     * Set system/peripheral clock used to initialise system timer&lt;br /&gt;
     */&lt;br /&gt;
    app_config.soc_peripheral_clck           = BSP_SYSFREQ * 1000 * 1000;&lt;br /&gt;
&lt;br /&gt;
    // initialise OCEOSMP&lt;br /&gt;
    S32_t status;&lt;br /&gt;
    status = oceos_init(app_config);&lt;br /&gt;
    if (OCEOS_SUCCESS &amp;gt; status) {&lt;br /&gt;
      oceosmp_print(&amp;quot;\n oceos_init failure\n\r&amp;quot;);&lt;br /&gt;
      return 0;&lt;br /&gt;
    } else {&lt;br /&gt;
      return 1;&lt;br /&gt;
    }   // else&lt;br /&gt;
 &amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_init_finish()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''initialisation.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Finalizes the fixed data array after all tasks etc. have been created&lt;br /&gt;
&lt;br /&gt;
All information needed to start OCEOS can be found in the fixed data area&lt;br /&gt;
when oceos_init_finish() has completed.&lt;br /&gt;
&lt;br /&gt;
Once all tasks etc. have been created oceos_init_finish() checks the&lt;br /&gt;
accumulated information against the application configuration data&lt;br /&gt;
stored in the fixed meta structure.&lt;br /&gt;
&lt;br /&gt;
oceos_init_finish also calculates the size of the dynamic data area and&lt;br /&gt;
checks it does not overlap with the system stack, the system log, or the&lt;br /&gt;
fixed data, and if all ok sets up pointers to the various dynamic area&lt;br /&gt;
components in the fixed data.&lt;br /&gt;
&lt;br /&gt;
It then adds an XOR checksum to the fixed data area, and checks that this&lt;br /&gt;
is followed by FILLER, which it replaces with the end sentinel.&lt;br /&gt;
&lt;br /&gt;
On successful completion it restores the interrupt level to its value&lt;br /&gt;
before oceos_init() was called, otherwise interrupts remain disabled.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Finalizes the fixed data array after all tasks etc. have been created&lt;br /&gt;
 *&lt;br /&gt;
 * All information needed to start OCEOS can be found in the fixed data area&lt;br /&gt;
 * when oceos_init_finish() has completed.&lt;br /&gt;
 *&lt;br /&gt;
 * Once all tasks etc. have been created oceos_init_finish() checks the&lt;br /&gt;
 * accumulated information against the application configuration data&lt;br /&gt;
 * stored in the fixed meta structure.&lt;br /&gt;
 *&lt;br /&gt;
 * oceos_init_finish also calculates the size of the dynamic data area and&lt;br /&gt;
 * checks it does not overlap with the system stack, the system log, or the&lt;br /&gt;
 * fixed data, and if all ok sets up pointers to the various dynamic area&lt;br /&gt;
 * components in the fixed data.&lt;br /&gt;
 *&lt;br /&gt;
 * It then adds an XOR checksum to the fixed data area, and checks that this&lt;br /&gt;
 * is followed by FILLER, which it replaces with the end sentinel.&lt;br /&gt;
 *&lt;br /&gt;
 * On successful completion it restores the interrupt level to its value&lt;br /&gt;
 * before oceos_init() was called, otherwise interrupts remain disabled.&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS                             All OK&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT               System Meta data is NULL or corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT                 System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_CPU_CORE                  Executing directive on wrong CPU&lt;br /&gt;
 *          ERR_WRONG_PHASE                     Called before oceos_init()&lt;br /&gt;
 *          ERR_TASKS_INCOMPLETE                Created wrong number of tasks&lt;br /&gt;
 *          ERR_MUTEX_INCOMPLETE                Created wrong number of mutexes&lt;br /&gt;
 *          ERR_RWMUTEX_INCOMPLETE              Created wrong number of rwmutexes&lt;br /&gt;
 *          ERR_SEM_INCOMPLETE                  Created wrong number of semaphores&lt;br /&gt;
 *          ERR_DATAQ_INCOMPLETE                Created wrong number of dataqs&lt;br /&gt;
 *          ERR_TASK_MAX_ID_INVALID             Task's max id invalid&lt;br /&gt;
 *          ERR_MUTEX_MAX_ID_INVALID            Mutexe's max id invalid&lt;br /&gt;
 *          ERR_RWMUTEX_MAX_ID_INVALID          Rwmutexe's max id invalid&lt;br /&gt;
 *          ERR_SEM_MAX_ID_INVALID              Semaphore's max id invalid&lt;br /&gt;
 *          ERR_DATAQ_MAX_ID_INVALID            Dataq's max id invalid&lt;br /&gt;
 *          ERR_TOTAL_JOBS_NUMBER_WRONG         Wrong number of total jobs created&lt;br /&gt;
 *          ERR_ORDER_ARRAY_PTR_INVALID         Order array pointer is NULL or mis-aligned&lt;br /&gt;
 *          ERR_FIXED_AREA_TOO_SMALL            Not enough space for fixed data area&lt;br /&gt;
 */&lt;br /&gt;
S32_t   oceos_init_finish(void);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
There are no input parameters to this function.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit  || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT               || System Meta data is NULL or corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT                 || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_CPU_CORE                  || Executing directive on wrong CPU&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE                     || Called before oceos_init()&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TASKS_INCOMPLETE                || Created wrong number of tasks&lt;br /&gt;
|-&lt;br /&gt;
| ERR_MUTEX_INCOMPLETE                || Created wrong number of mutexes&lt;br /&gt;
|-&lt;br /&gt;
| ERR_RWMUTEX_INCOMPLETE              || Created wrong number of rwmutexes&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SEM_INCOMPLETE                  || Created wrong number of semaphores&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DATAQ_INCOMPLETE                || Created wrong number of dataqs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TASK_MAX_ID_INVALID             || Task's max id invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_MUTEX_MAX_ID_INVALID            || Mutexe's max id invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_RWMUTEX_MAX_ID_INVALID          || Rwmutexe's max id invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SEM_MAX_ID_INVALID              || Semaphore's max id invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DATAQ_MAX_ID_INVALID            || Dataq's max id invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TOTAL_JOBS_NUMBER_WRONG         || Wrong number of total jobs created&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ORDER_ARRAY_PTR_INVALID         || Order array pointer is NULL or mis-aligned&lt;br /&gt;
|-&lt;br /&gt;
| ERR_FIXED_AREA_TOO_SMALL            || Not enough space for fixed data area&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
    /*&lt;br /&gt;
     * Finish initialising OCEOS and setting up the fixed data&lt;br /&gt;
     */&lt;br /&gt;
    status = oceos_init_finish();&lt;br /&gt;
    if(OCEOS_SUCCESS &amp;gt; status){&lt;br /&gt;
        // LOG&lt;br /&gt;
      oceosmp_print(&amp;quot;\nAbandoning, problem ending OCEOS initialisation\n\r&amp;quot;);&lt;br /&gt;
        return -1;&lt;br /&gt;
    }   // if&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_start()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''initialisation.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Starts OCEOS scheduling.&amp;lt;br&amp;gt;&lt;br /&gt;
Create dynamic OCEOS structures and start scheduling.&amp;lt;br&amp;gt;&lt;br /&gt;
This function should only be called once and only after [[OCEOSmp/directive_reference#oceos_init()|oceos_init()]] and [[OCEOSmp/directive_reference#oceos_init_finish()|oceos_init_finish()]] have been called successfully.&amp;lt;br&amp;gt;&lt;br /&gt;
Normally this function does not return. &amp;lt;br&amp;gt;&lt;br /&gt;
If a problem is detected the function terminates and returns an appropriate DIRECTIVE_STATUS code, with interrupts disabled.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Starts OCEOS scheduling&lt;br /&gt;
 *&lt;br /&gt;
 * Create dynamic OCEOS structures and start scheduling&lt;br /&gt;
 *&lt;br /&gt;
 * This function should only be called once&lt;br /&gt;
 * and only after oceos_init()&lt;br /&gt;
 * and oceos_init_finish() have&lt;br /&gt;
 *  been called successfully.&lt;br /&gt;
 * Normally this function does not return.&lt;br /&gt;
 * If a problem is detected the function&lt;br /&gt;
 * terminates and returns an appropriate&lt;br /&gt;
 * DIRECTIVE_STATUS code, with interrupts disabled.&lt;br /&gt;
 *&lt;br /&gt;
 * @param fixed_array_ptr   Pointer to fixed data array&lt;br /&gt;
 * @param start_task        Task ID&lt;br /&gt;
 * @param data_ptr          Pointer to data to be passed to the task&lt;br /&gt;
 * @return  OCEOSMP_EXIT                        OCEOSMP return from scheduling and exit&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT               Fixed area pointer is null or bad sentinel&lt;br /&gt;
 *          ERR_FIXED_AREA_SIZE_WRONG           Fixed area size is zero&lt;br /&gt;
 *          ERR_FIXED_AREA_END_SENTINEL_BAD     Fixed data end sentinel corrupt&lt;br /&gt;
 *          ERR_FIXED_AREA_BAD_XOR              Fixed area bad checksum or checksum mis-match&lt;br /&gt;
 *          ERR_INIT_NOT_DONE                   oceos_start() called without initialisation&lt;br /&gt;
 *          ERR_DYN_AREA_PTR_BAD                Dynamic area pointer invalid in sysMetaPtr&lt;br /&gt;
 *          ERR_INT_HANDLER_BAD                 IRQ controller pointer provided by BCC is NULL;or OCEOS handler is not set&lt;br /&gt;
 *          ERR_DYN_JOB_PTR_BAD                 Job array pointer is NULL&lt;br /&gt;
 *          ERR_FIXED_TASK_PTR_BAD              Tasks array pointer is NULL&lt;br /&gt;
 *          ERR_JOB_COUNT_WRONG                 Total job count inconsistent&lt;br /&gt;
 *          ERR_DYN_MUTEX_PTR_BAD               Mutex dynamic pointer is NULL&lt;br /&gt;
 *          ERR_DYN_LOCK_PTR_BAD                Mutex lock array pointer is NULL&lt;br /&gt;
 *          ERR_DYN_RWMUTEX_PTR_BAD             Rwmutex dynamic pointer is NULL&lt;br /&gt;
 *          ERR_DYN_RWLOCK_PTR_BAD              Rwmutex lock array pointer is NULL&lt;br /&gt;
 *          ERR_FIXED_SEM_PTR_BAD               Semaphore fixed pointer is NULL&lt;br /&gt;
 *          ERR_DYN_SEM_PTR_BAD                 Semaphore dynamic pointer is NULL&lt;br /&gt;
 *          ERR_SEM_PEND_PTR_BAD                Semaphore pending queue pointer is NULL&lt;br /&gt;
 *          ERR_FIXED_DATAQ_PTR_BAD             Dataq fixed pointer is NULL&lt;br /&gt;
 *          ERR_DYN_DATAQ_PTR_BAD               Dataq dynamic pointer is NULL&lt;br /&gt;
 *          ERR_DATAQ_PEND_PTR_BAD              Dataq pending queue pointer is NULL&lt;br /&gt;
 *          ERR_DATAQ_DATA_PTR_BAD              Dataq data pointer is NULL&lt;br /&gt;
 *          ERR_CPU_INT_NUMBER_INVALID          SPARC only.IRQ number for CPU inter-comunication invalid(zero or used by timer)&lt;br /&gt;
 *          ERR_REGISTER_CPU_IRQ_FAILED         SPARC only. Failed to set CPU IRQ handler in BCC&lt;br /&gt;
 *          ERR_CPU_STACK_INVALID               Current CPU stack not within specified range&lt;br /&gt;
 *          ERR_CPU_PRIORITY_STACK_INVALID      Per CPU priority stack invalid&lt;br /&gt;
 *          ERR_LOG_AREA_END_SENTINEL_BAD       Log area end sentinel override&lt;br /&gt;
 *          ERR_TA_CONFIG_PTR_BAD               SPARC only; Timed action configuration data pointer is NULL&lt;br /&gt;
 *          ERR_TA_TIMER_INDEX_INVALID          SPARC only; Timed action sub-timer index in timer unit is invalid&lt;br /&gt;
 *          ERR_TA_IRQ_NUMBER_INVALID           SPARC only; Timer action timer IRQ number is invalid&lt;br /&gt;
 *          ERR_TA_BCC_IRQ_REGISTER_FAILED      SPARC only; Timed action timer IRQ handler failed to register&lt;br /&gt;
 */&lt;br /&gt;
S32_t   oceos_start(&lt;br /&gt;
    const U32_t * const fixed_array_ptr,// pointer to fixed data array&lt;br /&gt;
    const U32_t start_task,             // taskID&lt;br /&gt;
    void * const data_ptr               // pointer to data to be passed to task&lt;br /&gt;
);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| fixed_array_ptr || Pointer to fixed data array&lt;br /&gt;
|-&lt;br /&gt;
| start_task      || Task ID&lt;br /&gt;
|-&lt;br /&gt;
| data_ptr        || Pointer to data to be passed to the task&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit  || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT               || Fixed area pointer is null or bad sentinel&lt;br /&gt;
|-&lt;br /&gt;
| ERR_FIXED_AREA_SIZE_WRONG           || Fixed area size is zero&lt;br /&gt;
|-&lt;br /&gt;
| ERR_FIXED_AREA_END_SENTINEL_BAD     || Fixed data end sentinel corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_FIXED_AREA_BAD_XOR              || Fixed area bad checksum or checksum mis-match&lt;br /&gt;
|-&lt;br /&gt;
| ERR_INIT_NOT_DONE                   || oceos_start() called without initialisation&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DYN_AREA_PTR_BAD                || Dynamic area pointer invalid in sysMetaPtr&lt;br /&gt;
|-&lt;br /&gt;
| ERR_INT_HANDLER_BAD                 || IRQ controller pointer provided by BCC is NULL;or OCEOS handler is not set&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DYN_JOB_PTR_BAD                 || Job array pointer is NULL&lt;br /&gt;
|-&lt;br /&gt;
| ERR_FIXED_TASK_PTR_BAD              || Tasks array pointer is NULL&lt;br /&gt;
|-&lt;br /&gt;
| ERR_JOB_COUNT_WRONG                 || Total job count inconsistent&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DYN_MUTEX_PTR_BAD               || Mutex dynamic pointer is NULL&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DYN_LOCK_PTR_BAD                || Mutex lock array pointer is NULL&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DYN_RWMUTEX_PTR_BAD             || Rwmutex dynamic pointer is NULL&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DYN_RWLOCK_PTR_BAD              || Rwmutex lock array pointer is NULL&lt;br /&gt;
|-&lt;br /&gt;
| ERR_FIXED_SEM_PTR_BAD               || Semaphore fixed pointer is NULL&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DYN_SEM_PTR_BAD                 || Semaphore dynamic pointer is NULL&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SEM_PEND_PTR_BAD                || Semaphore pending queue pointer is NULL&lt;br /&gt;
|-&lt;br /&gt;
| ERR_FIXED_DATAQ_PTR_BAD             || Dataq fixed pointer is NULL&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DYN_DATAQ_PTR_BAD               || Dataq dynamic pointer is NULL&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DATAQ_PEND_PTR_BAD              || Dataq pending queue pointer is NULL&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DATAQ_DATA_PTR_BAD              || Dataq data pointer is NULL&lt;br /&gt;
|-&lt;br /&gt;
| ERR_CPU_INT_NUMBER_INVALID          || SPARC only.IRQ number for CPU inter-comunication invalid(zero or used by timer)&lt;br /&gt;
|-&lt;br /&gt;
| ERR_REGISTER_CPU_IRQ_FAILED         || SPARC only. Failed to set CPU IRQ handler in BCC&lt;br /&gt;
|-&lt;br /&gt;
| ERR_CPU_STACK_INVALID               || Current CPU stack not within specified range&lt;br /&gt;
|-&lt;br /&gt;
| ERR_CPU_PRIORITY_STACK_INVALID      || Per CPU priority stack invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_LOG_AREA_END_SENTINEL_BAD       || Log area end sentinel override&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_CONFIG_PTR_BAD               || SPARC only; Timed action configuration data pointer is NULL&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_TIMER_INDEX_INVALID          || SPARC only; Timed action sub-timer index in timer unit is invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_IRQ_NUMBER_INVALID           || SPARC only; Timer action timer IRQ number is invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_BCC_IRQ_REGISTER_FAILED      || SPARC only; Timed action timer IRQ handler failed to register&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/* Sample Task names - all here start with t_ to help avoid name confusion */&lt;br /&gt;
enum TASK_NAME{&lt;br /&gt;
    t_tom,                      // will have task ID 0&lt;br /&gt;
    t_dick,                     // will have task ID 1&lt;br /&gt;
};&lt;br /&gt;
extern U32_t fixed_data[];&lt;br /&gt;
...&lt;br /&gt;
S32_t status;&lt;br /&gt;
&lt;br /&gt;
status = oceos_start(fixed_data, t_tom, NULL);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_exit()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''initialisation.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Ends scheduling and exit from [[OCEOSmp/directive_reference#oceos_start()|oceos_start()]].&lt;br /&gt;
No task can be started after this.&amp;lt;br&amp;gt;&lt;br /&gt;
OCEOS will exit when the current job ends.&amp;lt;br&amp;gt;&lt;br /&gt;
An idle task in an endless loop should check that scheduling is enabled.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Ends scheduling and exit from oceos_start.&lt;br /&gt;
 * No task can be started after this.&lt;br /&gt;
 * OCEOS will exit when the current job ends.&lt;br /&gt;
 * An idle task in an endless loop should check that scheduling is enabled.&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Called before scheduling started&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_exit(void);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
There are no input parameters to this function.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit  || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Called before scheduling started&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
// Exit OCEOS&lt;br /&gt;
oceos_exit();&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_CPU_sleep()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''initialisation.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
 Puts CPU in sleep mode.&amp;lt;br&amp;gt;&lt;br /&gt;
 User must to be sure that interrupts are enabled.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Puts CPU in sleep mode.&lt;br /&gt;
 * User must to be sure that interrupts are enabled.&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_CPU_sleep(void);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
There are no input parameters to this function.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
// Put CPU to sleep&lt;br /&gt;
oceos_CPU_sleep();&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceosmp_cpu_disable()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''initialisation.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function ends execution of all tasks running on particular CPU and removes the CPU from scheduling.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Ends execution of all tasks running on particular CPU and removes this CPU from scheduling.&lt;br /&gt;
 * @param cpu_id&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              CPU ID outside allowed range 0 to 254&lt;br /&gt;
 *          ERR_ID_WRONG                CPU ID &amp;gt;= number of available CPUs&lt;br /&gt;
 *          ERR_CPU_ALREADY_DISABLED    CPU already disabled&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceosmp_cpu_disable(&lt;br /&gt;
    U32_t cpu_id&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| cpu_id || ID of CPU core to be disabled.&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit  || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || CPU ID outside allowed range 0 to 254&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || CPU ID &amp;gt;= number of available CPUs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_CPU_ALREADY_DISABLED    || CPU already disabled&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, faulty_cpu;&lt;br /&gt;
...&lt;br /&gt;
// Disable faulty CPU core&lt;br /&gt;
status = oceosmp_cpu_disable(faulty_cpu));&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceosmp_cpu_enable()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''initialisation.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function adds a disabled CPU core to the OCEOSmp scheduler. It should only be called after scheduling has started&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 *  Adds disabled CPU to OCEOSmp scheduler&lt;br /&gt;
 *&lt;br /&gt;
 *  N.B. This function should only be called after scheduling has started&lt;br /&gt;
 *&lt;br /&gt;
 * @param cpu_id&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              CPU ID outside allowed range 0 to 254&lt;br /&gt;
 *          ERR_ID_WRONG                CPU ID &amp;gt;= number of available CPUs; or the same as currently running&lt;br /&gt;
 *          ERR_CPU_ALREADY_ENABLED     CPU already enabled&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceosmp_cpu_enable(&lt;br /&gt;
    U32_t cpu_id&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| cpu_id || ID of CPU core to be enabled.&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit  || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || CPU ID outside allowed range 0 to 254&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || CPU ID &amp;gt;= number of available CPUs; or the same as currently running&lt;br /&gt;
|-&lt;br /&gt;
| ERR_CPU_ALREADY_ENABLED     || CPU already enabled&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, good_cpu;&lt;br /&gt;
...&lt;br /&gt;
// Enable CPU core&lt;br /&gt;
status = oceosmp_cpu_enable(good_cpu));&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceosmp_cpu_terminate()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''initialisation.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function removes a CPU core from the OCEOSmp scheduler and marks it so it cannot be restarted. It puts CPU to sleep with interrupts disabled. It should only be called after scheduling has started.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 *  Removes CPU from OCEOSMP scheduler and terminates, cannot be restarted.&lt;br /&gt;
 *  Puts CPU to sleep with interrupts disabled&lt;br /&gt;
 *&lt;br /&gt;
 *  N.B. This function should only be called after scheduling has started&lt;br /&gt;
 *  Steps:&lt;br /&gt;
 *     1. Set terminate flag on this CPU;&lt;br /&gt;
 *     2. Trigger software interrupt to transfer execution to IRQ handler;&lt;br /&gt;
 *     3. Check flag and if set =&amp;gt; put CPU to sleep in while loop with interrupts disabled;&lt;br /&gt;
 *     4. Set MAX priority on this CPU priority stack;&lt;br /&gt;
 *     5. Remove CPU from scheduling;&lt;br /&gt;
 *     6. Clean up all the tasks by calling task terminate function and free up all the&lt;br /&gt;
 *        preempted jobs by this CPU;&lt;br /&gt;
 *&lt;br /&gt;
 * @param cpu_id&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              CPU ID outside allowed range 0 to 254&lt;br /&gt;
 *          ERR_ID_WRONG                CPU ID &amp;gt;= number of available CPUs; or the same as currently running&lt;br /&gt;
 *          ERR_CPU_ALREADY_TERMINATED  CPU already terminated&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceosmp_cpu_terminate(&lt;br /&gt;
    U32_t cpu_id&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| cpu_id || ID of CPU core to be terminated.&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit  || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || CPU ID outside allowed range 0 to 254&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || CPU ID &amp;gt;= number of available CPUs; or the same as currently running&lt;br /&gt;
|-&lt;br /&gt;
| ERR_CPU_ALREADY_TERMINATED  || CPU already terminated&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, faulty_cpu;&lt;br /&gt;
...&lt;br /&gt;
// Terminate CPU core&lt;br /&gt;
status = oceosmp_cpu_terminate(faulty_cpu));&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;Task directives&amp;lt;/span&amp;gt;==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ API Functions&lt;br /&gt;
|-&lt;br /&gt;
| Directive                                                                     || Description                          || main || task || IRQ handler&lt;br /&gt;
|-&lt;br /&gt;
| [[OCEOSmp/directive reference#oceos_task_create()| oceos_task_create()]]             || Create Task                        || *    ||      || &lt;br /&gt;
|-&lt;br /&gt;
| [[OCEOSmp/directive reference#oceos_task_start()| oceos_task_start()]]               || Start Task                         ||      ||  *   || *&lt;br /&gt;
|-&lt;br /&gt;
| [[OCEOSmp/directive reference#oceos_task_timed_start()| oceos_task_timed_start()]]   || Schedule a task to start execution at a given system time||      ||  *   || *&lt;br /&gt;
|-&lt;br /&gt;
| [[OCEOSmp/directive reference#oceos_task_disable()| oceos_task_disable()]]           || Disable Task                       ||      ||  *   || *&lt;br /&gt;
|-&lt;br /&gt;
| [[OCEOSmp/directive reference#oceos_task_enable()| oceos_task_enable()]]             || Enable Task                        ||      ||  *   || *&lt;br /&gt;
|-&lt;br /&gt;
| [[OCEOSmp/directive reference#oceos_task_self()| oceos_task_self()]]                 || Returns the task ID of the currently executing task ||    ||  *   || *&lt;br /&gt;
|-&lt;br /&gt;
| [[OCEOSmp/directive reference#oceos_task_get_priority()| oceos_task_get_priority()]] || Get priority of a task             ||      ||  *   || *&lt;br /&gt;
|-&lt;br /&gt;
| [[OCEOSmp/directive reference#oceos_task_get_status()| oceos_task_get_status()]]     || Get status of a task               ||      ||  *   || *&lt;br /&gt;
|-&lt;br /&gt;
| [[OCEOSmp/directive reference#oceos_task_kill()| oceos_task_kill()]]                 || Directive to terminate current task||      ||  *   || *&lt;br /&gt;
|-&lt;br /&gt;
| [[OCEOSmp/directive reference#oceos_task_get_info()| oceos_task_get_info()]]         || Get task information               ||      ||  *   || *&lt;br /&gt;
|-&lt;br /&gt;
| [[OCEOSmp/directive reference#oceosmp_task_kill()| oceosmp_task_kill()]]                 || Directive to terminate current task||      ||  *   || *&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;Task data structures&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''tasks.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The following data structures are used by some of the task directives.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Data structures'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * A pointer to this structure is passed to oceos_task_create().&lt;br /&gt;
 * The structure is first initialised according to a tasks's parameters,&lt;br /&gt;
 * and is not used again after the task is created and may then be discarded.&lt;br /&gt;
 */&lt;br /&gt;
struct task_descriptor {&lt;br /&gt;
&lt;br /&gt;
	void (*function_start)(void*);	// name of task start function&lt;br /&gt;
	void (*function_end)(void*);	// optional, NULL or task end function&lt;br /&gt;
&lt;br /&gt;
	U32_t task_id;					// 0 to 254, usually an enum&lt;br /&gt;
	U32_t task_jobs_max;			// 1 to 15, max concurrent 'jobs'&lt;br /&gt;
	U32_t task_priority;			// 1 (highest) to 254 (lowest)&lt;br /&gt;
	U32_t task_threshold;			// &amp;gt;=1, &amp;lt;= task_priority (higher or same priority)&lt;br /&gt;
	U32_t task_turned_on_initially;	// 0: disabled initially, else enabled&lt;br /&gt;
&lt;br /&gt;
	U32_t time_deadline_microsecs;	// start request to finish, 0 to ignore&lt;br /&gt;
	U32_t time_min_interval_microsecs;	// between start requests, 0 to ignore&lt;br /&gt;
&lt;br /&gt;
	U32_t uses_cpu_affinity;		// 0: not restricted, else core restricted&lt;br /&gt;
	U32_t uses_cpu_affinity_core_id;// core ID to which restricted if affinity used&lt;br /&gt;
}__attribute__ ((aligned (8)));&lt;br /&gt;
&lt;br /&gt;
/**&lt;br /&gt;
 * Task info used with oceos_task_get_info&lt;br /&gt;
 */&lt;br /&gt;
struct task_info {&lt;br /&gt;
  U64_t           time_max_delay;               // maximum time job is waiting on ready queue before becoming active&lt;br /&gt;
  U64_t           time_max_finish;              // maximum time to finish job execution after starting&lt;br /&gt;
  U64_t           time_max_exec;                // maximum time spent executing&lt;br /&gt;
  U64_t           time_total_exec;              // total CPU time used by this task&lt;br /&gt;
  U64_t           time_min_gap_starts;          // minimum time between job creations, can be reset&lt;br /&gt;
  U64_t           time_min_gap_finish_start;    // minimum time between job ending and new job creation, can be reset&lt;br /&gt;
&lt;br /&gt;
  U64_t           time_last_start;              // time of most recent job creation&lt;br /&gt;
  U64_t           time_last_finish;             // time of most recent job finish&lt;br /&gt;
&lt;br /&gt;
  unsigned int    jobs_current_max  :16;        // maximum number of current jobs for this task, no roll over, can be reset&lt;br /&gt;
  unsigned int    jobs_total        :16;        // number of times this task was started, no roll-over, can be reset&lt;br /&gt;
  U32_t           jobs_current;                 // Number of task instances currently in use by oceos&lt;br /&gt;
&lt;br /&gt;
  U32_t           preempt_max;                  // maximum times any job was pre-empted, no roll-over, can be reset&lt;br /&gt;
}__attribute__ ((aligned (8)));&lt;br /&gt;
&lt;br /&gt;
/* A task's status is returned as below if queried */&lt;br /&gt;
enum TASK_STATUS {&lt;br /&gt;
    TASK_DISABLED,      // cannot be scheduled, and no current jobs&lt;br /&gt;
    TASK_ENABLED,       // can be scheduled, but no current jobs&lt;br /&gt;
    TASK_INVALID,       // task does not exist&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_task_create()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''tasks.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Create a task.&lt;br /&gt;
Can only be use before OCEOS starts. Stores the task information in the OCEOS fixed data area.&lt;br /&gt;
This directive populates the data structures for a task. It should be called after [[OCEOSmp/directive_reference#oceos_init()|oceos_init()]] and before [[OCEOSmp/directive_reference#oceos_init_finish()|oceos_init_finish()]].&amp;lt;br&amp;gt;&lt;br /&gt;
It must be called for each task otherwise [[OCEOSmp/directive_reference#oceos_start()|oceos_start()]] will return an error.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Create a task using a task descriptor structure&lt;br /&gt;
 *&lt;br /&gt;
 * Can only be used in Initialisation Phase.&lt;br /&gt;
 *&lt;br /&gt;
 * A task has twelve constant parameters set when the task is created.&lt;br /&gt;
 * Rather than setting a list of these parameters the named fields of a&lt;br /&gt;
 * task_descriptor structure are set and a pointer to it passed here.&lt;br /&gt;
 *&lt;br /&gt;
 * The task_descriptor structure fields are described above.&lt;br /&gt;
 * Once the task has been created the structure can be discarded.&lt;br /&gt;
 *&lt;br /&gt;
 * To create a task:&lt;br /&gt;
 *		set up a task_descriptor structure,&lt;br /&gt;
 *		set its fields to the parameter values for the task,&lt;br /&gt;
 *		pass a pointer to the structure to this directive.&lt;br /&gt;
 *&lt;br /&gt;
 * The structure is checked for validity by oceos_task_create and its&lt;br /&gt;
 * information used to set the task details in the OCEOS fixed data area.&lt;br /&gt;
 *&lt;br /&gt;
 * @param  struct task_descriptor *	fields give task characteristics&lt;br /&gt;
 *&lt;br /&gt;
 * @return OCEOS_SUCCESS            No errors or warnings&lt;br /&gt;
 *         WARN_NO_END_FUNCTION     Warning, no end task function specified&lt;br /&gt;
 *&lt;br /&gt;
 *         ERR_SYS_FIXED_CORRUPT    System Fixed area corrupt&lt;br /&gt;
 *         ERR_WRONG_CPU_CORE       Executing directive on wrong CPU&lt;br /&gt;
 *         ERR_WRONG_PHASE          Called before oceos_init() is done&lt;br /&gt;
 *         ERR_TOO_MANY             MAX number of tasks already created&lt;br /&gt;
 *         ERR_ID_INVALID           Task ID outside allowed range 0 to 254&lt;br /&gt;
 *         ERR_ID_WRONG             Task ID outside &amp;gt;= number of tasks&lt;br /&gt;
 *         ERR_T_ALREADY_ALLOCATED  Task ID already in use&lt;br /&gt;
 *         ERR_T_PRIORITY_INVALID   Task priority outside allowed range 1 to 254&lt;br /&gt;
 *         ERR_THRESHOLD_INVALID    Task threshold outside range 1 to 254&lt;br /&gt;
 *         ERR_THRESHOLD_WRONG      Task threshold  higher priority than task priority&lt;br /&gt;
 *         ERR_JOBS_MAX_INVALID     Job number outside range 1 to 15&lt;br /&gt;
 *         ERR_JOBS_TOO_MANY        System capacity exceeded&lt;br /&gt;
 *         ERR_AFFINITY_WRONG       CPU core specified is outside chosen range&lt;br /&gt;
 *         ERR_START_FUNCTION_BAD   Task start function address either NULL or misaligned&lt;br /&gt;
 */&lt;br /&gt;
S32_t   oceos_task_create(&lt;br /&gt;
    const struct task_descriptor * const task_description_ptr&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter           || Description&lt;br /&gt;
|-&lt;br /&gt;
|struct task_descriptor * || Pointer to task descriptor which contains task attributes&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit     || Description&lt;br /&gt;
|-&lt;br /&gt;
|WARN_NO_END_FUNCTION     || Warning, no end task function specified&lt;br /&gt;
|-&lt;br /&gt;
|ERR_SYS_FIXED_CORRUPT    || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
|ERR_WRONG_CPU_CORE       || Executing directive on wrong CPU&lt;br /&gt;
|-&lt;br /&gt;
|ERR_WRONG_PHASE          || Called before oceos_init() is done&lt;br /&gt;
|-&lt;br /&gt;
|ERR_TOO_MANY             || MAX number of tasks already created&lt;br /&gt;
|-&lt;br /&gt;
|ERR_ID_INVALID           || Task ID outside allowed range 0 to 254&lt;br /&gt;
|-&lt;br /&gt;
|ERR_ID_WRONG             || Task ID outside &amp;gt;= number of tasks&lt;br /&gt;
|-&lt;br /&gt;
|ERR_T_ALREADY_ALLOCATED  || Task ID already in use&lt;br /&gt;
|-&lt;br /&gt;
|ERR_T_PRIORITY_INVALID   || Task priority outside allowed range 1 to 254&lt;br /&gt;
|-&lt;br /&gt;
|ERR_THRESHOLD_INVALID    || Task threshold outside range 1 to 254&lt;br /&gt;
|-&lt;br /&gt;
|ERR_THRESHOLD_WRONG      || Task threshold  higher priority than task priority&lt;br /&gt;
|-&lt;br /&gt;
|ERR_JOBS_MAX_INVALID     || Job number outside range 1 to 15&lt;br /&gt;
|-&lt;br /&gt;
|ERR_JOBS_TOO_MANY        || System capacity exceeded&lt;br /&gt;
|-&lt;br /&gt;
|ERR_AFFINITY_WRONG       || CPU core specified is outside chosen range&lt;br /&gt;
|-&lt;br /&gt;
|ERR_START_FUNCTION_BAD   || Task start function address either NULL or misaligned&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
/* Sample Task names - all here start with t_ to help avoid name confusion */&lt;br /&gt;
enum TASK_NAME{&lt;br /&gt;
      t_0,&lt;br /&gt;
      t_1,&lt;br /&gt;
      t_2&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
/*&lt;br /&gt;
 * APPLICATION FUNCTION DECLARATIONS&lt;br /&gt;
 */&lt;br /&gt;
void fun0(void *);&lt;br /&gt;
void fun1(void *);&lt;br /&gt;
void fun2(void *);&lt;br /&gt;
void end_function(void *);&lt;br /&gt;
&lt;br /&gt;
const struct task_descriptor tasks_data[NUMBER_OF_TASKS] = {&lt;br /&gt;
    {fun0, end_function, t_0, 2, 10, 8, TASK_ENABLED, 0, 0, 0, 0},&lt;br /&gt;
    {fun1, end_function, t_1, 2, 10, 8, TASK_ENABLED, 0, 0, 0, 0},&lt;br /&gt;
    {fun2, end_function, t_2, 2, 10, 8, TASK_ENABLED, 0, 0, 0, 0}&lt;br /&gt;
}; &lt;br /&gt;
&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
    // create tasks (names are defined in the application header)&lt;br /&gt;
    for (i=0; i&amp;lt;NUMBER_OF_TASKS; i++){&lt;br /&gt;
        if ( oceos_task_create(&amp;amp;tasks_data[i]) != OCEOS_SUCCESS ){&lt;br /&gt;
        	oceosmp_print(&amp;quot;\nFailed to create task\n\r&amp;quot;);&lt;br /&gt;
        	return -i;&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_task_start()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''tasks.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function starts an instance of a task. An instance of a task is called a job in OCEOS terminology.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 *  Starting a task involves three main stages&lt;br /&gt;
 *      1 setting up a job&lt;br /&gt;
 *          finding a free job entry if available&lt;br /&gt;
 *          setting up this entry including passing it the data void *&lt;br /&gt;
 *&lt;br /&gt;
 *      2 placing the job on readyQ&lt;br /&gt;
 *&lt;br /&gt;
 *      3 doing a context switch&lt;br /&gt;
 * This function should only be called after OCEOS is initialised&lt;br /&gt;
 *       and the dynamic task and job structures set up&lt;br /&gt;
 *&lt;br /&gt;
 *  When used from an interrupt handler,&lt;br /&gt;
 *  the context switch is only done&lt;br /&gt;
 *  after all nested interrupts have unwound&lt;br /&gt;
 *&lt;br /&gt;
 * @param task_id Task ID must be in range 0 to 254&lt;br /&gt;
 * @param ptr     Pointer to task data&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT    System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT      System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE          Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID           Task ID is invalid&lt;br /&gt;
 *          ERR_ID_WRONG             Task ID is wrong&lt;br /&gt;
 *          ERR_START_TASK_DISABLED  Starting task is disabled&lt;br /&gt;
 *          ERR_TOO_MANY             There is no free job&lt;br /&gt;
 *          ERR_SYS_BUSY             Failed to grab the lock&lt;br /&gt;
 */&lt;br /&gt;
S32_t   oceos_task_start(&lt;br /&gt;
    const U32_t task_id, // task ID, must be in range 0 to 254&lt;br /&gt;
    void * const ptr    // pointer to data&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| task_id || U32_t with Task ID in range 0 to 254.&lt;br /&gt;
|-&lt;br /&gt;
| ptr    || void * pointer to task data&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit  || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT    || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT      || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE          || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID           || Task ID is invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG             || Task ID is wrong&lt;br /&gt;
|-&lt;br /&gt;
| ERR_START_TASK_DISABLED  || Starting task is disabled&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TOO_MANY             || There is no free job&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY             || Failed to grab the lock&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
void *ptr;&lt;br /&gt;
...&lt;br /&gt;
// Start instance of task T_1 passing pointer ptr&lt;br /&gt;
status = oceos_task_start(t_1,ptr);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_task_timed_start()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''tasks.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function schedules a task to start execution at a given system time.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 *  Schedule a task to start execution at a given system time&lt;br /&gt;
 *&lt;br /&gt;
 *  The before and after offsets define a window around the selected time&lt;br /&gt;
 *  in which the task may be started.&lt;br /&gt;
 *&lt;br /&gt;
 *  If the current system time is before the start window a job is created&lt;br /&gt;
 *  and a corresponding action put on the timed action queue.&lt;br /&gt;
 *&lt;br /&gt;
 *  If the current system time is within the time window for starting the task,&lt;br /&gt;
 *  it is started immediately.&lt;br /&gt;
 *&lt;br /&gt;
 *  If the current system time is after the window, an error is reported.&lt;br /&gt;
 *&lt;br /&gt;
 *  Times are in microseconds.&lt;br /&gt;
 *&lt;br /&gt;
 *  This function should only be called after OCEOS is initialised&lt;br /&gt;
 *  and the dynamic task and job structures set up&lt;br /&gt;
 *&lt;br /&gt;
 * @param taskID        Task ID must be in range 0 to 254&lt;br /&gt;
 * @param ptr           Pointer to data&lt;br /&gt;
 * @param start_time    System time at which job should start&lt;br /&gt;
 * @param before        Forward tolerance for time&lt;br /&gt;
 * @param after         Backward tolerance for time&lt;br /&gt;
 * @param return_job_id Return job_id to the user, to remove this job from timed action if needed&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              Task ID invalid&lt;br /&gt;
 *          ERR_ID_WRONG                Task ID is wrong&lt;br /&gt;
 *          ERR_TA_NOT_INIT             Timed action inialisation is not done and tried to be used&lt;br /&gt;
 *          ERR_START_TASK_DISABLED     Starting task is disabled&lt;br /&gt;
 *          ERR_TOO_MANY                There is no free job&lt;br /&gt;
 *          ERR_TOO_LATE                Starting task is too late(out of time frame)&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to grab the lock&lt;br /&gt;
 *          ERR_TA_Q_FULL               Timed action queue is full&lt;br /&gt;
 *          ERR_TA_START_FAILED         Timed action execute failed; See log&lt;br /&gt;
 */&lt;br /&gt;
S32_t   oceos_task_timed_start(&lt;br /&gt;
    const U32_t task_id,     // task ID, must be in range 0 to 254&lt;br /&gt;
    void * const ptr,        // pointer to data&lt;br /&gt;
    const U64_t start_time,  // system time at which job should start&lt;br /&gt;
    const U32_t before,      // forward tolerance for time&lt;br /&gt;
    const U32_t after,       // backward tolerance for time&lt;br /&gt;
    U32_t * return_job_id    // return job_id to the user, to remove this job from timed action if needed&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| taskID        || U32_t task ID must be in range 0 to 254&lt;br /&gt;
|-&lt;br /&gt;
| ptr           || void * pointer to data&lt;br /&gt;
|-&lt;br /&gt;
| start_time    || U64_t system time at which job should start&lt;br /&gt;
|-&lt;br /&gt;
| before        || U32_t forward tolerance for time&lt;br /&gt;
|-&lt;br /&gt;
| after         || U32_t backward tolerance for time&lt;br /&gt;
|-&lt;br /&gt;
| return_job_id || U32_t return job_id to the user, to remove this job from timed action if needed&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit  || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || Task ID invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || Task ID is wrong&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_NOT_INIT             || Timed action inialisation is not done and tried to be used&lt;br /&gt;
|-&lt;br /&gt;
| ERR_START_TASK_DISABLED     || Starting task is disabled&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TOO_MANY                || There is no free job&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TOO_LATE                || Starting task is too late(out of time frame)&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to grab the lock&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_Q_FULL               || Timed action queue is full&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_START_FAILED         || Timed action execute failed; See log&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
U32_t job_id;&lt;br /&gt;
U64_t cur_sys_time;&lt;br /&gt;
...&lt;br /&gt;
  cur_sys_time = oceos_time_sys_get64();&lt;br /&gt;
&lt;br /&gt;
  // Start task 10,000 microseconds (us) from now and advise if started more than 1,000 us before or 2,000 us after.&lt;br /&gt;
  status = oceos_task_timed_start(t_2, ptr, cur_sys_time + 10000, 1000, 2000, &amp;amp;job_id);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_task_disable()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''initialisation.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function disables a task and removes any current pending jobs from the readyQ.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 *  Disable a task and remove any current pending jobs on readyQ.&lt;br /&gt;
 *&lt;br /&gt;
 *  A disabled task's jobs  will not be put into execution nor put on readyQ.&lt;br /&gt;
 *&lt;br /&gt;
 *  Note that where execution of a task has already commenced,&lt;br /&gt;
 *  disabling the task will not prevent it from completing.&lt;br /&gt;
 *&lt;br /&gt;
 *  This function should only be called after OCEOS is initialised&lt;br /&gt;
 *  and the dynamic task and job structures set up&lt;br /&gt;
 *&lt;br /&gt;
 * @param taskID  Task ID must be in range 0 to 254&lt;br /&gt;
 * @return: OCEOS_SUCCESS&lt;br /&gt;
 *          WARN_ALREADY_DISABLED        Task already disabled&lt;br /&gt;
 *          WARN_SEM_PEND_REMOVE_FAILED  Failed to remove job from semaphore pending queue&lt;br /&gt;
 *          WARN_DQ_PEND_REMOVE_FAILED   Failed to remove job from dataq pending queue&lt;br /&gt;
 *&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT        System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT          System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE              Directive was called before OCEOS init is finished&lt;br /&gt;
 *          ERR_ID_INVALID               Task ID is invalid&lt;br /&gt;
 *          ERR_ID_WRONG                 Task ID is wrong&lt;br /&gt;
 *          ERR_SYS_BUSY                 Failed to grab the lock&lt;br /&gt;
 */&lt;br /&gt;
S32_t   oceos_task_disable(&lt;br /&gt;
    const U32_t task_id // task ID, must be in range 0 to 254&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| taskID || U32_t task ID must be in range 0 to 254&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit  || Description&lt;br /&gt;
|-&lt;br /&gt;
| WARN_ALREADY_DISABLED        || Task already disabled&lt;br /&gt;
|-&lt;br /&gt;
| WARN_SEM_PEND_REMOVE_FAILED  || Failed to remove job from semaphore pending queue&lt;br /&gt;
|-&lt;br /&gt;
| WARN_DQ_PEND_REMOVE_FAILED   || Failed to remove job from dataq pending queue&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT        || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT          || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE              || Directive was called before OCEOS init is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID               || Task ID is invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                 || Task ID is wrong&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                 || Failed to grab the lock&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Disable task t_1&lt;br /&gt;
status = oceos_task_disable(t_1);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_task_enable()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''tasks.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function enables a task. Only enabled tasks may be started.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 *  Enable a task - only enabled tasks are placed on readyQ or started.&lt;br /&gt;
 *&lt;br /&gt;
 *  This function should only be called after OCEOS is initialised&lt;br /&gt;
 *  and the dynamic task and job structures set up&lt;br /&gt;
 *&lt;br /&gt;
 * @param taskID   Task ID must be in range 0 to 254&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          WARN_ALREADY_ENABLED     Task already enabled&lt;br /&gt;
 *&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT    System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT      System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE          Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID           Task ID is invalid&lt;br /&gt;
 *          ERR_ID_WRONG             Task ID is wrong&lt;br /&gt;
 *          ERR_SYS_BUSY             Failed to grab the lock&lt;br /&gt;
 */&lt;br /&gt;
S32_t   oceos_task_enable(&lt;br /&gt;
    const U32_t task_id // task ID, must be in range 0 to 254&lt;br /&gt;
);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| taskID  || U32_t task ID must be in range 0 to 254&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit  || Description&lt;br /&gt;
|-&lt;br /&gt;
| WARN_ALREADY_ENABLED     || Task already enabled&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT    || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT      || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE          || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID           || Task ID is invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG             || Task ID is wrong&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY             || Failed to grab the lock&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Enable task t_2&lt;br /&gt;
status = oceos_task_enable(t_2);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_task_self()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''tasks.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the task number of the currently running task on the calling CPU.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Get currently running task on calling CPU&lt;br /&gt;
 *&lt;br /&gt;
 * @param t_id  Task ID holder&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT        System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT          System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE              Directive was called before OCEOS init is finished&lt;br /&gt;
 *          ERR_CPU_DYN_PTR_BAD          CPU dynamic area pointer corrupt&lt;br /&gt;
 */&lt;br /&gt;
S32_t  oceos_task_self(&lt;br /&gt;
    U32_t *t_id&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| t_id || S32_t * pointer to variable where task ID will be written.&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit  || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT        || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT          || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE              || Directive was called before OCEOS init is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_CPU_DYN_PTR_BAD          || CPU dynamic area pointer corrupt&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, task_running;&lt;br /&gt;
...&lt;br /&gt;
// Return task ID that's running on this core&lt;br /&gt;
status = oceos_task_self(&amp;amp;task_running);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_task_get_priority()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''tasks.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the priority of the task ID passed to it.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Get priority of the task&lt;br /&gt;
 *&lt;br /&gt;
 * @param taskID        ID of task, must be in range 0 to 254&lt;br /&gt;
 * @param t_priority    Pointer to task priority holder&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT        System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT          System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE              Directive was called before OCEOS init is finished&lt;br /&gt;
 *          ERR_ID_INVALID               Task ID is invalid&lt;br /&gt;
 *          ERR_ID_WRONG                 Task ID is wrong&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_task_get_priority(&lt;br /&gt;
    const U32_t task_id, // task ID, must be in range 0 to 254&lt;br /&gt;
    U32_t *t_priority   // Pointer to task priority holder&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| task_id || S32_t task ID of task whose priority is required&lt;br /&gt;
|-&lt;br /&gt;
| t_priority || S32_t * pointer to variable where priority will be written&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit  || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT        || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT          || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE              || Directive was called before OCEOS init is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID               || Task ID is invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                 || Task ID is wrong&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
U32_t t_priority;&lt;br /&gt;
...&lt;br /&gt;
// Return the priority of task ID t_4 &lt;br /&gt;
status = oceos_task_get_priority(t_4, &amp;amp;t_priority);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_task_get_status()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''tasks.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the status of the task ID passed to it.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Get status of the task;&lt;br /&gt;
 * if OK t_status holds enum TASK_STATUS&lt;br /&gt;
 *&lt;br /&gt;
 * @param taskID    ID of task, must be in range 0 to 254&lt;br /&gt;
 * @param t_status  enum TASK_STATUS holder&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT        System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT          System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE              Directive was called before OCEOS init is finished&lt;br /&gt;
 *          ERR_ID_INVALID               Task ID is invalid&lt;br /&gt;
 *          ERR_ID_WRONG                 Task ID is wrong&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_task_get_status(&lt;br /&gt;
    const U32_t task_id,&lt;br /&gt;
    U32_t *t_status&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| task_id || S32_t task ID of task whose priority is required&lt;br /&gt;
|-&lt;br /&gt;
| t_status || S32_t * pointer to variable where status will be written&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit  || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT        || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT          || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE              || Directive was called before OCEOS init is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID               || Task ID is invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                 || Task ID is wrong&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
U32_t t_status;&lt;br /&gt;
...&lt;br /&gt;
// Return the status of task ID t_4 &lt;br /&gt;
status = oceos_task_get_status(t_4, &amp;amp;t_status);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_task_get_info()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''tasks.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the task information for the specified task.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Get task information for task with ID.&lt;br /&gt;
 *&lt;br /&gt;
 * User must pass pointer to struct task_info in order to retrieve data.&lt;br /&gt;
 *&lt;br /&gt;
 * @param task_id  Task ID&lt;br /&gt;
 * @param info     Pointer to struct task_info&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT    System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT      System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE          Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID           Task ID invalid&lt;br /&gt;
 *          ERR_ID_WRONG             Task ID wrong&lt;br /&gt;
 *          ERR_TASK_INFO_PTR_BAD    Task info pointer provided by user is NULL&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_task_get_info (&lt;br /&gt;
    const U32_t task_id,   // Task ID&lt;br /&gt;
    struct task_info *info // Pointer to struct task_info&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| task_id || ID of task for which information is required&lt;br /&gt;
|-&lt;br /&gt;
| task_info || struct task_info * pointer to the structure where task information is to be written&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit  || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT    || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT      || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE          || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID           || Task ID invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG             || Task ID wrong&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TASK_INFO_PTR_BAD    || Task info pointer provided by user is NULL&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
struct task_info info;&lt;br /&gt;
...&lt;br /&gt;
// Get information for task T3&lt;br /&gt;
status = oceos_task_get_info(t_3, &amp;amp;info);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceosmp_task_kill()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''tasks.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function kills the specified task running on the specified CPU.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 *  Function to kill currently running task on CPU;&lt;br /&gt;
 *  Can be used:&lt;br /&gt;
 *      From Mode_SVC  =&amp;gt; normal running mode for application&lt;br /&gt;
 *          If nesting level is zero and Mode_SVC&lt;br /&gt;
 *      From Mode_IRQ  =&amp;gt; from IRQ handler&lt;br /&gt;
 *          If nesting level is not zero, set flag to call this function within IRQ handler&lt;br /&gt;
 *      From Exception =&amp;gt; Mode_ABT and Mode_UND&lt;br /&gt;
 *          If nesting level is zero and NOT Mode_SVC, it is exception;&lt;br /&gt;
 *              Disable IRQs on current CPU;&lt;br /&gt;
 *              Set kill current task flag to TRUE;&lt;br /&gt;
 *              Issue SGI on current CPU, will be interrupted on return from Exception and&lt;br /&gt;
 *              this function will be called within IRQ handler&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT    System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT      System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE          Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_CPU_DYN_PTR_BAD      CPU dynamic area pointer corrupt&lt;br /&gt;
 *          ERR_ID_INVALID           Task ID invalid&lt;br /&gt;
 *          ERR_ID_WRONG             Task ID wrong&lt;br /&gt;
 *          ERR_CPU_ID_WRONG         CPU ID wrong&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceosmp_task_kill(&lt;br /&gt;
    U32_t task_id,&lt;br /&gt;
    U32_t cpu_id&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| task_id  || U32_t task ID to be killed (must be in range 0 to 254)&lt;br /&gt;
|-&lt;br /&gt;
| cpu_id  || U32_t CPU ID where task_id is to be killed&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT    || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT      || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE          || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_CPU_DYN_PTR_BAD      || CPU dynamic area pointer corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID           || Task ID invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG             || Task ID wrong&lt;br /&gt;
|-&lt;br /&gt;
| ERR_CPU_ID_WRONG         || CPU ID wrong&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Kill task t_2 on CPU cpu_1&lt;br /&gt;
status = oceosmp_task_kill(t_2, cpu_1);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;Mutex directives&amp;lt;/span&amp;gt;==&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_mutex_create()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''mutex.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function creates a mutex of specified ID with a specified priority ceiling.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Creates a mutex with priority ceiling&lt;br /&gt;
 *&lt;br /&gt;
 * NOTE: This function should only be called after OCEOSmp is initialised with&lt;br /&gt;
 *  oceos_init() and before initialisation ends with oceos_init_finish()&lt;br /&gt;
 *  and scheduling starts with oceos_start()&lt;br /&gt;
 *&lt;br /&gt;
 * @param mutex_id  mutex ID value 0 to 62&lt;br /&gt;
 * @param priority  mutex priority ceiling 1 to 254 (high to low task priority)&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_WRONG_CPU_CORE          Executing directive on wrong CPU&lt;br /&gt;
 *          ERR_WRONG_PHASE             Called before oceos_init() is done&lt;br /&gt;
 *          ERR_TOO_MANY                MAX number of MUTEXs already created&lt;br /&gt;
 *          ERR_ID_INVALID              MUTEX ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                MUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
 *          ERR_MX_ALREADY_ALLOCATED    MUTEX ID already used&lt;br /&gt;
 *          ERR_MX_PRIORITY_WRONG       MUTEX priority ceiling outside allowed range 1 to 254&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_mutex_create(&lt;br /&gt;
    const U32_t mutex_id,  // mutex ID, must be in range 0 to 62&lt;br /&gt;
    const U8_t  priority  // mutex priority ceiling&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| mutex_id  || u32_t mutex ID to be created (value 0 to 62).&lt;br /&gt;
|-&lt;br /&gt;
| priority_ceiling ||  U32_t mutex priority ceiling 1 to 254 (high to low task priority)&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_CPU_CORE          || Executing directive on wrong CPU&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Called before oceos_init() is done&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TOO_MANY                || MAX number of MUTEXs already created&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || MUTEX ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || MUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_MX_ALREADY_ALLOCATED    || MUTEX ID already used&lt;br /&gt;
|-&lt;br /&gt;
| ERR_MX_PRIORITY_WRONG       || MUTEX priority ceiling outside allowed range 1 to 254&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Create mutex with ID print_mutex and priority ceiling of 5&lt;br /&gt;
status = oceos_mutex_create(print_mutex, 5);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_mutex_wait()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''mutex.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function makes the task wait until the specified mutex is available.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
 /*&lt;br /&gt;
  * Wait on mutex with ID.&lt;br /&gt;
  * If task succeeds in grabbing mutex, system level priority rises to&lt;br /&gt;
  * priority of this mutex, so tasks with lower or equal priority will&lt;br /&gt;
  * not be able to start till mutex is released.&lt;br /&gt;
  *&lt;br /&gt;
  * This should only be called after OCEOSmp scheduling has started.&lt;br /&gt;
  *&lt;br /&gt;
  * @param mutex_id     const U32_t  : value 0 to 62&lt;br /&gt;
  *&lt;br /&gt;
  * @return  OCEOS_SUCCESS&lt;br /&gt;
  *          WARN_MX_INCORRECT_ORDER     MUTEX acquired in incorrect order&lt;br /&gt;
  *&lt;br /&gt;
  *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
  *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
  *          ERR_WRONG_PHASE             Directive was called before OCEOSmp initialisation is finished&lt;br /&gt;
  *          ERR_ID_INVALID              MUTEX ID outside allowed range 0 to 62&lt;br /&gt;
  *           ERR_ID_WRONG                MUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
  *          ERR_MX_CEILING_BAD          MUTEX ceiling not lower priority than job priority&lt;br /&gt;
  *          ERR_MX_ALREADY_HELD         MUTEX already held by this job&lt;br /&gt;
  *          ERR_SYS_BUSY                Failed to grab context switch guard&lt;br /&gt;
  */&lt;br /&gt;
S32_t oceos_mutex_wait(&lt;br /&gt;
    const U32_t  mutex_id      // mutex ID, must be in range 0 to 62&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| mutex_id  || u32_t mutex ID to be waited on (value 0 to 62).&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| WARN_MX_INCORRECT_ORDER     || MUTEX acquired in incorrect order&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOSmp initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || MUTEX ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || MUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_MX_CEILING_BAD          || MUTEX ceiling not lower priority than job priority&lt;br /&gt;
|-&lt;br /&gt;
| ERR_MX_ALREADY_HELD         || MUTEX already held by this job&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to grab context switch guard&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Wait on mutex m_2&lt;br /&gt;
status = oceos_mutex_wait(m_2);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_mutex_signal()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''mutex.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function signals the specified mutex.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Signal a mutex with ID&lt;br /&gt;
 *&lt;br /&gt;
 * N.B. :&lt;br /&gt;
 *      This function should not be called from an interrupt handler&lt;br /&gt;
 *      This should only be called after OCEOSmp scheduling has started.&lt;br /&gt;
 *&lt;br /&gt;
 * @param mutex_id     const U32_t  : value 0 to 62&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          WARN_MX_ALREADY_FREE        MUTEX is free already&lt;br /&gt;
 *          WARN_MX_NESTING_BAD         MUTEX nesting incorrect&lt;br /&gt;
 *&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOSmp initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              MUTEX ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                MUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
 *          ERR_MX_WRONG_JOB            MUTEX not held by this job&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to grab context switch guard&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_mutex_signal(&lt;br /&gt;
    const U32_t  mutex_id     // mutex ID, must be in range 0 to 62&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| mutex_id  || u32_t mutex ID to be signalled (value 0 to 62).&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| WARN_MX_ALREADY_FREE        || MUTEX is free already&lt;br /&gt;
|-&lt;br /&gt;
| WARN_MX_NESTING_BAD         || MUTEX nesting incorrect&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOSmp initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || MUTEX ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || MUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_MX_WRONG_JOB            || MUTEX not held by this job&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to grab context switch guard&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Signal mutex m_2&lt;br /&gt;
status = oceos_mutex_signal(m_2);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_mutex_get_value()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''mutex.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the value of the specified mutex.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Get current value of mutex with ID&lt;br /&gt;
 *&lt;br /&gt;
 * @param mutex_id      const U32_t  : value 0 to 62&lt;br /&gt;
 * @param m_value       pointer to MUTEX value holder&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOSmp initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              MUTEX ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                MUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
 *          ERR_MX_DATA_PTR_BAD         Pointer to MUTEX value return holder is null&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_mutex_get_value(&lt;br /&gt;
    const U32_t  mutex_id,      // mutex ID, must be in range 0 to 62&lt;br /&gt;
    U32_t *m_value              // Pointer to MUTEX value holder&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| mutex_id  || u32_t mutex ID to be signalled (value 0 to 62)&lt;br /&gt;
|-&lt;br /&gt;
| m_value  || u32_t * pointer where mutex value is to be written&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOSmp initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || MUTEX ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || MUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_MX_DATA_PTR_BAD         || Pointer to MUTEX value return holder is null&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
U32_t value;&lt;br /&gt;
...&lt;br /&gt;
// Get value of mutex m_2&lt;br /&gt;
status = oceos_mutex_get_value(m_2, &amp;amp;value);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;Read/write mutex directives&amp;lt;/span&amp;gt;==&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;Read/write mutex overview&amp;lt;/span&amp;gt;===&lt;br /&gt;
&lt;br /&gt;
Contents:&lt;br /&gt;
&lt;br /&gt;
 1.  Read/Write Mutex features&lt;br /&gt;
 2.  Read/Write Mutex data structures&lt;br /&gt;
 3.  Read/Write Mutex constants&lt;br /&gt;
 4.  Read/Write Mutex manager Directives&lt;br /&gt;
&lt;br /&gt;
==== Read/Write Mutex Features ====&lt;br /&gt;
&lt;br /&gt;
Read/Write Mutexes (rwmutexes) can be held for 'read' at the same time&lt;br /&gt;
by multiple jobs on different CPUs, but once held for 'write' by any job&lt;br /&gt;
cannot be obtained for 'read' or for 'write' by another job until released.&lt;br /&gt;
&lt;br /&gt;
They can be used to allow data be read simultaneously by multiple jobs when&lt;br /&gt;
the data is not being updated while ensuring that no updating can take&lt;br /&gt;
place while any job is reading the data.&lt;br /&gt;
&lt;br /&gt;
Pending write requests take precedence over pending read requests and are&lt;br /&gt;
done on a first come, first served basis. Once any job on a CPU has a&lt;br /&gt;
rwmutex for 'read' no other job on that CPU can acquire it so as to avoid&lt;br /&gt;
potential problems and minimise delays in servicing write requests by other&lt;br /&gt;
CPUs.&lt;br /&gt;
&lt;br /&gt;
While any job holds a rwmutex for reading any job on another CPU can also&lt;br /&gt;
acquire it for reading. Other jobs on the same CPU that may attempt to&lt;br /&gt;
acquire the rwmutex are delayed in starting until return of the rwmutex.&lt;br /&gt;
No job can acquire the rwmutex for writing until all read acquisitions&lt;br /&gt;
have been returned.&lt;br /&gt;
&lt;br /&gt;
No job will acquire a rwmutex for reading if any job is trying to acquire&lt;br /&gt;
it for writing, giving write precedence over read. Multiple write requests&lt;br /&gt;
waiting for existing read acquisitions to complete are serviced in the&lt;br /&gt;
order in which they were made when the current read acquisitions complete.&lt;br /&gt;
&lt;br /&gt;
If a task waits on a rwmutex that it already holds a system log entry is&lt;br /&gt;
made (LOG_RWMUTEX_ALREADY_HELD) and an INTERNAL_ERROR status code returned.&lt;br /&gt;
&lt;br /&gt;
If a task attempts to release a rwmutex it does not hold a system log entry&lt;br /&gt;
is made (LOG_RWMUTEX_ALREADY_FREE) and an INTERNAL_ERROR status code returned.&lt;br /&gt;
&lt;br /&gt;
If a job holds more than one rwmutex at the same time these must be&lt;br /&gt;
acquired and released in a nested manner&lt;br /&gt;
(e.g. wait 1, wait 2, wait 3, signal 3, signal 2, signal 1).&lt;br /&gt;
&lt;br /&gt;
If a task exits while holding one or more rwmutexes these are returned and&lt;br /&gt;
a system log entry made (LOG_RWMUTEX_NOT_RETURNED).&lt;br /&gt;
&lt;br /&gt;
==== Read/Write Mutex data structures ====&lt;br /&gt;
&lt;br /&gt;
In OCEOSmp each rwmutex has a priority ceiling, the priority of the highest&lt;br /&gt;
priority task that acquires the rwmutex for read or for write.&lt;br /&gt;
OCEOSmp uses this to ensure that once a job on a particular CPU has the&lt;br /&gt;
rwmutex for reading or for writing no other job on that CPU can be started&lt;br /&gt;
that might try to obtain that rwmutex.&lt;br /&gt;
&lt;br /&gt;
The priority ceiling of a rwmutex is specified when the rwmutex is created&lt;br /&gt;
and does not change subsequently. Priority ceilings are stored in the&lt;br /&gt;
fixed data area as an array U8_t rwmutexCeilings[] indexed by mutex ID.&lt;br /&gt;
This array is extended to be a whole number of 32-bit words.&lt;br /&gt;
&lt;br /&gt;
A rwmutex has a unique rwmutex ID, an unsigned integer usually defined in&lt;br /&gt;
the application header file as an enum RWMUTEX_NAME{} thus allowing a&lt;br /&gt;
user-friendly name be associated with each rwmutex ID.&lt;br /&gt;
&lt;br /&gt;
Using an enum is strongly recommended as it allows a user-friendly name be&lt;br /&gt;
associated with each ID, and helps ensure IDs are contiguous from 0.&lt;br /&gt;
&lt;br /&gt;
These rwmutex IDs are used as indices into both fixed and dynamic data&lt;br /&gt;
arrays and must cover the range 0 to ((number of rwmutexes) -1). Using&lt;br /&gt;
enum RWMUTEX_NAME{} automatically assigns names to IDs 0, 1, 2...&lt;br /&gt;
&lt;br /&gt;
Read write mutex dynamic data such as the current write requests and&lt;br /&gt;
current read count are stored in the dynamic data area in an array of&lt;br /&gt;
struct rwmutex_dyn_block also indexed by the rwmutex ID.&lt;br /&gt;
&lt;br /&gt;
A further dynamic area array of guard_t is used in providing mutual&lt;br /&gt;
exclusion when updating the rwmutex dynamic data.&lt;br /&gt;
&lt;br /&gt;
==== Read/Write Mutex constants ====&lt;br /&gt;
&lt;br /&gt;
In OCEOSmp there can be a maximum of 63 rwmutexes,&lt;br /&gt;
with IDs from 0 to 62 (the value 63 is used as an invalid ID).&lt;br /&gt;
&lt;br /&gt;
The rwmutexes can be created in any order, but OCEOSmp will return an error&lt;br /&gt;
and fail to start if the resulting IDs fail to be contiguous from 0 as IDs&lt;br /&gt;
are used by OCEOS as indices into arrays.&lt;br /&gt;
&lt;br /&gt;
Each rwmutex has a priority ceiling, the priority of the highest priority&lt;br /&gt;
task that uses the rwmutex for reading or for writing. This is specified&lt;br /&gt;
when the rwmutex is created, does not change subsequently, and must be in&lt;br /&gt;
the range 1 (TASK_MAX_PRIORITY) to 254 (TASK_MIN_PRIORITY).&lt;br /&gt;
The application developer must ensure that the correct rwmutex ceiling&lt;br /&gt;
is used. OCEOSmp will detect an attempt to acquire a rwmutex by a task&lt;br /&gt;
with higher priority than that rwmutex's priority ceiling, make a&lt;br /&gt;
system log entry (LOG_RWMUTEX_BAD_CEILING) and return an INTERNAL_ERROR&lt;br /&gt;
status code.&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_rwmutex_create()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''rwmutex.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function ees a read/write mutex.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Creates a Read/Write Mutex (RWMUTEX)&lt;br /&gt;
 *&lt;br /&gt;
 * This function should only be called after OCEOSmp is initialised with&lt;br /&gt;
 * oceos_init() and before initialisation ends with oceos_init_finish()&lt;br /&gt;
 * and scheduling starts with oceos_start()&lt;br /&gt;
 *&lt;br /&gt;
 * @param rwm_id    Read/Write RWMUTEX ID, must be in range 0 to 62&lt;br /&gt;
 * @param priority  Priority ceiling of highest priority task that uses the RWMUTEX&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_WRONG_CPU_CORE          Executing directive on wrong CPU&lt;br /&gt;
 *          ERR_WRONG_PHASE             Called before oceos_init() is done&lt;br /&gt;
 *          ERR_TOO_MANY                MAX number of RWMUTEXs already created&lt;br /&gt;
 *          ERR_ID_INVALID              RWMUTEX ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                RWMUTEX ID &amp;gt;= number of RWMUTEXs&lt;br /&gt;
 *          ERR_RWMX_ALREADY_ALLOCATED  RWMUTEX ID already used&lt;br /&gt;
 *          ERR_RWMX_PRIORITY_WRONG     RWMUTEX priority ceiling outside allowed range 1 to 254&lt;br /&gt;
 */&lt;br /&gt;
S32_t   oceos_rwmutex_create(&lt;br /&gt;
    const U32_t rwm_id,   // RWMUTEX ID, must be in range 0 to max rwm&lt;br /&gt;
    const U8_t priority   // RWMUTEX priority ceiling&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| rwm_id || Read/Write RWMUTEX ID, must be in range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| priority || Priority ceiling of highest priority task that uses the RWMUTEX&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_CPU_CORE          || Executing directive on wrong CPU&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Called before oceos_init() is done&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TOO_MANY                || MAX number of RWMUTEXs already created&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || RWMUTEX ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || RWMUTEX ID &amp;gt;= number of RWMUTEXs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_RWMX_ALREADY_ALLOCATED  || RWMUTEX ID already used&lt;br /&gt;
|-&lt;br /&gt;
| ERR_RWMX_PRIORITY_WRONG     || RWMUTEX priority ceiling outside allowed range 1 to 254&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Create read/write mutex with ID rwm_2 and priority ceiling of 100 &lt;br /&gt;
status = oceos_rwmutex_create(rwm_1, 100);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_rwmutex_read_wait()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''rwmutex.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function acquires a read/write mutex for read. If successful, jobs on other CPUs can also acquire it for read, but no job will be able to acquire it for write while any read is under way. If job already holds RWMUTEX for read or for write the appropriate status code is returned, a system log entry made, and the job continues. It will not succeed while any job is waiting to obtain RWMUTEX for write, and will loop waiting for all pending writes on this RWMUTEX to complete.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Read wait on RWMUTEX.&lt;br /&gt;
 *&lt;br /&gt;
 * If successful jobs on other CPUs can also acquire it for read, but no job&lt;br /&gt;
 * will be able to acquire it for write while any read is under way.&lt;br /&gt;
 * If job already holds RWMUTEX for read or for write appropriate status code&lt;br /&gt;
 * is returned, a system log entry made, and the job continues.&lt;br /&gt;
 * Will not succeed while any job is waiting to obtain RWMUTEX for write,&lt;br /&gt;
 * will loop waiting for all pending writes on this RWMUTEX to complete.&lt;br /&gt;
 *&lt;br /&gt;
 * This should only be called after OCEOS scheduling has started.&lt;br /&gt;
 *&lt;br /&gt;
 * N.B.	The returned status code must be checked and appropriate action&lt;br /&gt;
 * 		taken.&lt;br /&gt;
 *&lt;br /&gt;
 * @param rwm_id    const U32_t  : value 0 to 62&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          WARN_RWMX_NOT_HIGHEST       Already holds a RWMUTEX higher in the RWMUTEX order&lt;br /&gt;
 *                                      (there then may be a risk of deadlock)&lt;br /&gt;
 *&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              RWMUTEX ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                RWMUTEX ID &amp;gt;= number of RWMUTEXs&lt;br /&gt;
 *          ERR_RWMX_CEILING_BAD        RWMUTEX ceiling not lower priority than job priority&lt;br /&gt;
 *          ERR_RWMX_ALREADY_HELD       RWMUTEX already held by this job&lt;br /&gt;
 *          ERR_RWMX_CPU_STACK_FULL     CPU priority ceiling stack full&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_rwmutex_read_wait(&lt;br /&gt;
    const U32_t rwm_id  // RWMUTEX ID, must be in range 0 to 62&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| rwm_id || U32_t rwmutex to be acquired for read (value 0 to 62)&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| WARN_RWMX_NOT_HIGHEST       || Already holds a RWMUTEX higher in the RWMUTEX order (deadlock risk)&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || RWMUTEX ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || RWMUTEX ID &amp;gt;= number of RWMUTEXs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_RWMX_CEILING_BAD        || RWMUTEX ceiling not lower priority than job priority&lt;br /&gt;
|-&lt;br /&gt;
| ERR_RWMX_ALREADY_HELD       || RWMUTEX already held by this job&lt;br /&gt;
|-&lt;br /&gt;
| ERR_RWMX_CPU_STACK_FULL     || CPU priority ceiling stack full&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Acquire read/write mutex rwm_1 for read&lt;br /&gt;
status = oceos_rwmutex_read_wait(rwm_1);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_rwmutex_write_wait()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''rwmutex.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function acquires the specified read/write mutex for write.&lt;br /&gt;
If successful, no other job can also obtain it for reading or for writing. Will not succeed while any other job has acquired RWMUTEX for write,&lt;br /&gt;
or any jobs have obtained RWMUTEX for read. Will then loop until the RWMUTEX is released and for its turn in the sequence of jobs that have tried to acquire the RWMUTEX for writing. If already holds the RWMUTEX for writing or reading an appropriate status code is returned, a system log entry made, and the job continues. While there are any outstanding attempts to obtain the RWMUTEX for write no job will be able to acquire it for reading.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Write wait on RWMUTEX.&lt;br /&gt;
 *&lt;br /&gt;
 * If successful no other job can also obtain it for reading or for writing.&lt;br /&gt;
 * Will not succeed while any other job has acquired RWMUTEX for write,&lt;br /&gt;
 * or any jobs have obtained RWMUTEX for read. Will then loop until the&lt;br /&gt;
 * RWMUTEX is released and for its turn in the sequence of jobs that have&lt;br /&gt;
 * tried to acquire the RWMUTEX for writing.&lt;br /&gt;
 * If already holds the RWMUTEX for writing or reading an appropriate status&lt;br /&gt;
 * code is returned, a system log entry made, and the job continues.&lt;br /&gt;
 * While there are any outstanding attempts to obtain the RWMUTEX for write&lt;br /&gt;
 * no job will be able to acquire it for reading.&lt;br /&gt;
 *&lt;br /&gt;
 * This should only be called after OCEOS scheduling has started.&lt;br /&gt;
 *&lt;br /&gt;
 * N.B.	The returned status code must be checked and appropriate action&lt;br /&gt;
 * 		taken.&lt;br /&gt;
 *&lt;br /&gt;
 * @param rwm_id     const U32_t  : value 0 to 62&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          WARN_RWMX_NOT_HIGHEST       Already holds a RWMUTEX higher in the RWMUTEX order&lt;br /&gt;
 *                                      (there then may be a risk of deadlock)&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              RWMUTEX ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                RWMUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
 *          ERR_RWMX_CEILING_BAD        RWMUTEX ceiling not lower priority than job priority&lt;br /&gt;
 *          ERR_RWMX_ALREADY_HELD       RWMUTEX already held by this job&lt;br /&gt;
 *          ERR_RWMX_CPU_STACK_FULL     CPU priority ceiling stack full&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_rwmutex_write_wait(&lt;br /&gt;
    const U32_t rwm_id  // RWMUTEX ID, must be in range 0 to 62&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| rwm_id || U32_t rwmutex to be acquired for write(value 0 to 62)&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| WARN_RWMX_NOT_HIGHEST       || Already holds a RWMUTEX higher in the RWMUTEX order (deadlock risk)&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || RWMUTEX ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || RWMUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_RWMX_CEILING_BAD        || RWMUTEX ceiling not lower priority than job priority&lt;br /&gt;
|-&lt;br /&gt;
| ERR_RWMX_ALREADY_HELD       || RWMUTEX already held by this job&lt;br /&gt;
|-&lt;br /&gt;
| ERR_RWMX_CPU_STACK_FULL     || CPU priority ceiling stack full&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Acquire read/write mutex rwm_1 for write&lt;br /&gt;
status = oceos_rwmutex_read_wait(rwm_1);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_rwmutex_signal()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''rwmutex.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function signals the specified read/write mutex.&lt;br /&gt;
It frees the RWMUTEX for use by other jobs, irrespective of whether the RWMUTEX is held for reading or for writing. If the RWMUTEX is not held by the job then it returns an appropriate status code. It does not take into account how many times a job has obtained the RWMUTEX for read or for write.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Signal a RWMUTEX&lt;br /&gt;
 *&lt;br /&gt;
 * Frees the RWMUTEX for use by other jobs, irrespective of whether&lt;br /&gt;
 * RWMUTEX is held for reading or for writing.&lt;br /&gt;
 * if the RWMUTEX is not held by the job returns an appropriate status code.&lt;br /&gt;
 * Does not take into account how many times a job has obtained the RWMUTEX&lt;br /&gt;
 * for read or for write.&lt;br /&gt;
 *&lt;br /&gt;
 * This should only be called after OCEOS scheduling has started.&lt;br /&gt;
 *&lt;br /&gt;
 * N.B. The returned status code must be checked and appropriate action taken.&lt;br /&gt;
 *&lt;br /&gt;
 * @param rwm_id    const U32_t  : value 0 to 62&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          WARN_RWMX_ALREADY_FREE      RWMUTEX is free already&lt;br /&gt;
 *&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              RWMUTEX ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                RWMUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
 *          ERR_RWMX_CEILING_BAD        RWMUTEX ceiling not lower priority than job priority&lt;br /&gt;
 *          ERR_RWMX_CPU_STACK_EMPTY    CPU priority ceiling stack empty&lt;br /&gt;
 *          ERR_RWMX_CEILING_INVALID    CPU current priority ceiling on the priority stack is invalid&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_rwmutex_signal(&lt;br /&gt;
    const U32_t rwm_id // RWMUTEX ID, must be in range 0 to 62&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| rwm_id || U32_t rwmutex to be signaled(value 0 to 62)&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| WARN_RWMX_ALREADY_FREE      || RWMUTEX is free already&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || RWMUTEX ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || RWMUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_RWMX_CEILING_BAD        || RWMUTEX ceiling not lower priority than job priority&lt;br /&gt;
|-&lt;br /&gt;
| ERR_RWMX_CPU_STACK_EMPTY    || CPU priority ceiling stack empty&lt;br /&gt;
|-&lt;br /&gt;
| ERR_RWMX_CEILING_INVALID    || CPU current priority ceiling on the priority stack is invalid&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Signal read/write mutex number rwm_4&lt;br /&gt;
status = oceos_rwmutex_signal(rwm_4);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_rwmutex_check_status()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''rwmutex.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function checks the status of a read/write mutex. The possible states are free, in-use for read, and in-use for write.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Check whether RWMUTEX is free&lt;br /&gt;
 *&lt;br /&gt;
 * @param rwm_id        must be in range 0 to 62&lt;br /&gt;
 * @param m_status      pointer to RWMUTEX status holder;&lt;br /&gt;
 *                      if return code OCEOS_SUCCESS RWMUTEX status:&lt;br /&gt;
 *                          0 =&amp;gt; Free for use&lt;br /&gt;
 *                          1 =&amp;gt; In use for read&lt;br /&gt;
 *                          2 =&amp;gt; In use for write&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              RWMUTEX ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                RWMUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
 *          ERR_RWMX_DATA_PTR_BAD       Pointer to RWMUTEX status return holder is null&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_rwmutex_check_status(&lt;br /&gt;
    const U32_t rwm_id, // RWMUTEX ID, must be in range 0 to 62&lt;br /&gt;
    U32_t *m_status&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| rwm_id || read/write mutex number in range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| m_status || U32_t pointer to RWMUTEX status holder (0 = free, 1 = in-use for read, 2 = in-use for write &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || RWMUTEX ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || RWMUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_RWMX_DATA_PTR_BAD       || Pointer to RWMUTEX status return holder is null&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, rwm_status;&lt;br /&gt;
...&lt;br /&gt;
// Check the status of read/write mutex rwm_2&lt;br /&gt;
status = oceos_rwmutex_check_status(rwm_2, &amp;amp;rwm_status);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_rwmutex_reading_count()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''rwmutex.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the current number of jobs holding a specified read/write mutex for read.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 *&lt;br /&gt;
 * Get current number of jobs holding RWMUTEX for read&lt;br /&gt;
 *&lt;br /&gt;
 * @param rwm_id    must be in range 0 to 62&lt;br /&gt;
 * @param m_count   pointer to RWMUTEX count holder&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              RWMUTEX ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                RWMUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
 *          ERR_RWMX_DATA_PTR_BAD       Pointer to RWMUTEX count return holder is null&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_rwmutex_reading_count(&lt;br /&gt;
    const U32_t rwm_id, // RWMUTEX ID, must be in range 0 to 62&lt;br /&gt;
    U32_t *m_count&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| rwm_id || U32 value of read/write mutex (in range 0 to 62)&lt;br /&gt;
|-&lt;br /&gt;
| m_count || U32_t pointer to read/write mutex count holder&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || RWMUTEX ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || RWMUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_RWMX_DATA_PTR_BAD       || Pointer to RWMUTEX count return holder is null&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, rwm_count;&lt;br /&gt;
...&lt;br /&gt;
// Get the number of jobs holding the read/write mutex rwm_2 for read&lt;br /&gt;
status = oceos_rwmutex_reading_count(rwm_2, &amp;amp;rwm_count);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_rwmutex_write_reqs_count()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''header.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the current number of write requests for the specified read/write mutex .&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Get current RWMUTEX write requests count&lt;br /&gt;
 *&lt;br /&gt;
 * @param rwm_id    must be in range 0 to 62&lt;br /&gt;
 * @param m_count   pointer to RWMUTEX count holder&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              RWMUTEX ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                RWMUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
 *          ERR_RWMX_DATA_PTR_BAD       Pointer to RWMUTEX count return holder is null&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_rwmutex_write_reqs_count(&lt;br /&gt;
    const U32_t rwm_id, // RWMUTEX ID, must be in range 0 to 62&lt;br /&gt;
    U32_t *m_count&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| rwm_id || U32_t value of read/write mutex (must be in range 0 to 62)&lt;br /&gt;
|-&lt;br /&gt;
| m_count || U32_t pointer to read/write mutex count holder&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || RWMUTEX ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || RWMUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_RWMX_DATA_PTR_BAD       || Pointer to RWMUTEX count return holder is null&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, rwm_count;&lt;br /&gt;
...&lt;br /&gt;
// Get the count of cuurent write requests for read/write mutex rwm_1&lt;br /&gt;
status = oceos_rwmutex_write_reqs_count(rwm_1, &amp;amp;rwm_count);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_rwmutex_writes_pending_count()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''rwmutex.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the current number of pending writes for the specified read/write mutex.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Get current RWMUTEX writes pending count&lt;br /&gt;
 *&lt;br /&gt;
 * @param rwm_id    must be in range 0 to 62&lt;br /&gt;
 * @param m_count   pointer to RWMUTEX count holder&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              RWMUTEX ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                RWMUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
 *          ERR_RWMX_DATA_PTR_BAD       Pointer to RWMUTEX pending count return holder is null&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_rwmutex_writes_pending_count(&lt;br /&gt;
    const U32_t rwm_id, // RWMUTEX ID, must be in range 0 to 62&lt;br /&gt;
    U32_t *m_count&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| rwm_id || U32_t value of read/write mutex (must be in range 0 to 62)&lt;br /&gt;
|-&lt;br /&gt;
| m_count || U32_t pointer to read/write mutex count holder&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || RWMUTEX ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || RWMUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_RWMX_DATA_PTR_BAD       || Pointer to RWMUTEX count return holder is null&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, rwm_count;&lt;br /&gt;
...&lt;br /&gt;
// Get the count of cuurent write requests for read/write mutex rwm_1&lt;br /&gt;
status = oceos_rwmutex_writes_pending_count(rwm_1, &amp;amp;rwm_count);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_rwmutex_holding()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''header.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the read/write mutexes currently held by this instance of this task (job).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Get RWMUTEXs currently held by this instance of the task (job)&lt;br /&gt;
 *&lt;br /&gt;
 * @param m_data    U64_t pointer, each bit indicating RWMUTEX held by current task&lt;br /&gt;
 *                          0 =&amp;gt; Not held by job&lt;br /&gt;
 *                          1 =&amp;gt; Held by job&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_RWMX_DATA_PTR_BAD       Pointer to RWMUTEX status return holder is null&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_rwmutex_holding(&lt;br /&gt;
    U64_t *m_data&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| m_data || U64_t pointer, each bit indicating RWMUTEX held by current task, 0 =&amp;gt; not held, 1 =&amp;gt; held &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_RWMX_DATA_PTR_BAD       || Pointer to RWMUTEX status return holder is null&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
U64_t rwm_held;&lt;br /&gt;
...&lt;br /&gt;
// Which read/write mutexes does this job hold&lt;br /&gt;
status = oceos_rwmutex_holding(&amp;amp;rwm_held);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Semaphores directives ==&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_sem_create()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''semaphore.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function creates a semaphore.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Create a counting semaphore&lt;br /&gt;
 *&lt;br /&gt;
 * @param sem_id            SEMAPHORE ID (from 0 to 62)&lt;br /&gt;
 * @param max_permits       number of max permits allowed for this SEMAPHORE, 1 to 4095&lt;br /&gt;
 * @param count_permits     starting number of permits available 0 to 4095&lt;br /&gt;
 * @param pending_q_size    MAX Number of tasks on SEMAPHORE pending queue 1 to 253&lt;br /&gt;
 * @param use_timeout       if TRUE, directive oceos_sem_wait_restart_timeout can be used&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_WRONG_CPU_CORE          Executing directive on wrong CPU&lt;br /&gt;
 *          ERR_WRONG_PHASE             Called before oceos_init() is done&lt;br /&gt;
 *          ERR_TOO_MANY                MAX number of SEMAPHOREs already created&lt;br /&gt;
 *          ERR_ID_INVALID              SEMAPHORE ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                SEMAPHORE ID &amp;gt;= number of SEMAPHOREs&lt;br /&gt;
 *          ERR_SM_ALREADY_ALLOCATED    SEMAPHORE ID already used&lt;br /&gt;
 *          ERR_SM_MAX_PERMIT_WRONG     MAX permits outside allowed range 1 to 4095&lt;br /&gt;
 *          ERR_SM_COUNT_PERMIT_WRONG   Count permits outside allowed range 0 to 4095&lt;br /&gt;
 *          ERR_SM_COUNT_PERMIT_INVALID Count permits is greater than MAX permits for this SEMAPHORE&lt;br /&gt;
 *          ERR_SM_PENQ_SIZE_WRONG      SEMAPHORE pending queue size outside allowed range 1 to 253&lt;br /&gt;
 *          ERR_SM_TA_MAX_NUM_REACHED   Number of timed actions exceeds MAX allowed 255,&lt;br /&gt;
 *                                      each task on SEMAPHORE pending queue is timed action&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_sem_create(&lt;br /&gt;
    sem_t sem_id,         // counting semaphore ID (MAX 63)&lt;br /&gt;
    U16_t max_permits,    // max number of permits (MAX 4095)&lt;br /&gt;
    U16_t count_permits,  // initial number of permits (MAX 4095)&lt;br /&gt;
    U8_t  pending_q_size, // max number of pending queue jobs (MAX 253)&lt;br /&gt;
    BOOLE_t use_timeout   // whether timeout is used in oceos_sem_wait_restart_timeout&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| sem_id || Semaphore ID to be created (from 0 to 62)&lt;br /&gt;
|-&lt;br /&gt;
| max_permits || number of max permits allowed for this semaphore, 1 to 4095&lt;br /&gt;
|-&lt;br /&gt;
| count_permits || starting number of permits available 0 to 4095&lt;br /&gt;
|-&lt;br /&gt;
| pending_q_size || Maximum Number of tasks on SEMAPHORE pending queue 1 to 253&lt;br /&gt;
|-&lt;br /&gt;
| use_timeout || if TRUE, directive oceos_sem_wait_restart_timeout can be used&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_CPU_CORE          || Executing directive on wrong CPU&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Called before oceos_init() is done&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TOO_MANY                || MAX number of SEMAPHOREs already created&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || SEMAPHORE ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || SEMAPHORE ID &amp;gt;= number of SEMAPHOREs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SM_ALREADY_ALLOCATED    || SEMAPHORE ID already used&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SM_MAX_PERMIT_WRONG     || MAX permits outside allowed range 1 to 4095&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SM_COUNT_PERMIT_WRONG   || Count permits outside allowed range 0 to 4095&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SM_COUNT_PERMIT_INVALID || Count permits is greater than MAX permits for this SEMAPHORE&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SM_PENQ_SIZE_WRONG      || SEMAPHORE pending queue size outside allowed range 1 to 253&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SM_TA_MAX_NUM_REACHED   || Number of timed actions exceeds MAX allowed 255&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, param;&lt;br /&gt;
...&lt;br /&gt;
// Create semaphore called s_audi with max permits of 1000, starting permits of zero, max of 10 tasks on pending queue, and no timeouts &lt;br /&gt;
status = oceos_sem_create(s_audi, 1000, 0, 10, FALSE);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_sem_signal()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''semaphore.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function signals a semaphore, increments its count and transfers pending jobs to the ready queue.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Signals a semaphore, increments and transfers pending jobs to ready queue&lt;br /&gt;
 *&lt;br /&gt;
 * @param sem_id counting SEM ID&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          WARN_JOB_NOT_GUARDED&lt;br /&gt;
 *&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              SEM ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                SEM ID &amp;gt;= number of SEMs&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to grab SEM guard&lt;br /&gt;
 *          ERR_TOO_MANY                SEM max permits count already reached&lt;br /&gt;
 *          ERR_SM_JOB_ID_WRONG         Job ID of the task on SEM pending queue is wrong&lt;br /&gt;
 *          ERR_TA_NOT_FOUND            Timed action index to be removed for job not found&lt;br /&gt;
 *          ERR_TA_START_FAILED         Timed action re-start failed after job remove from timed action queue&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_sem_signal(&lt;br /&gt;
    sem_t sem_id // counting SEM ID&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| sem_id || U32_t value of semaphore to be signalled (incremented)&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| WARN_JOB_NOT_GUARDED        || job not guarded, application should check system log&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || SEM ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || SEM ID &amp;gt;= number of SEMs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to grab SEM guard&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TOO_MANY                || SEM max permits count already reached&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SM_JOB_ID_WRONG         || Job ID of the task on SEM pending queue is wrong&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_NOT_FOUND            || Timed action index to be removed for job not found&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_START_FAILED         || Timed action re-start failed after job remove from timed action queue&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Signal s_audi semaphore (increment its count)&lt;br /&gt;
status = oceos_sem_signal(s_audi);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_sem_wait_continue()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''semaphore.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function decrements the available permits of a sempahore otherwise returns an unsuccessful status code.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Wait on semaphore,&lt;br /&gt;
 * decrement the number of available permits for semaphore,&lt;br /&gt;
 * if no permits continue and task should handle unsuccessful result&lt;br /&gt;
 *&lt;br /&gt;
 * @param sem_id SEM ID&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              SEM ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                SEM ID &amp;gt;= number of SEMs&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to grab SEM guard&lt;br /&gt;
 *          ERR_SM_NOT_AVAILABLE        No more permits available for this SEM&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_sem_wait_continue(&lt;br /&gt;
    sem_t sem_id // counting SEM ID&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| sem_id || U32_t value of semaphore to be decremented&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || SEM ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || SEM ID &amp;gt;= number of SEMs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to grab SEM guard&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SM_NOT_AVAILABLE        || No more permits available for this SEM&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Decrement available permits on semaphore s_1&lt;br /&gt;
status = oceos_sem_wait_continue(s_1);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_sem_wait_restart()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''semaphore.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function decrements the available permits of a sempahore and if none available, the job is put on the pending queue.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Waits on semaphore,&lt;br /&gt;
 * if fail, put job on pending queue and exit task&lt;br /&gt;
 *&lt;br /&gt;
 * @param sem_id SEM ID&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              SEM ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                SEM ID &amp;gt;= number of SEMs&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to grab SEM guard&lt;br /&gt;
 *          ERR_SM_J_START_FROM_TIMOUT  Task started from timeout already, SEM no permits available second time&lt;br /&gt;
 *          ERR_FAILED                  Should never return this&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_sem_wait_restart(&lt;br /&gt;
    sem_t sem_id  // counting SEM ID&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| sem_id || U32_t value of semaphore to be decremented&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || SEM ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || SEM ID &amp;gt;= number of SEMs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to grab SEM guard&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SM_J_START_FROM_TIMOUT  || Task started from timeout already, SEM no permits available second time&lt;br /&gt;
|-&lt;br /&gt;
| ERR_FAILED                  || Should never return this&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Decrement available permits on semaphore s_1 otherwise job is put on pending queue&lt;br /&gt;
status = oceos_sem_wait_restart(s_1);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_sem_wait_restart_timeout()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''semaphore.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function decrements the available permits of a sempahore and if none available, the job is put on the pending queue with a timeout enabled. The job is restarted either when a permit is available to be decremented or when the timeout has expired. In order to use this directive, semaphore must be created with flag use_timeout is set to TRUE.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Waits on semaphore,&lt;br /&gt;
 * if fail, put job on pending queue with optional timeout.&lt;br /&gt;
 * In order to use this directive, semaphore must be created with&lt;br /&gt;
 * flag use_timeout is set to TRUE&lt;br /&gt;
 *&lt;br /&gt;
 * @param sem_id         SEM ID&lt;br /&gt;
 * @param U64_t timeout  Restart time if no permits, 0 =&amp;gt; ignore&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_TA_NOT_INIT             Timed action intialisation is not done and tried to be used; or SEM created without timeouts&lt;br /&gt;
 *          ERR_ID_INVALID              SEM ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                SEM ID &amp;gt;= number of SEMs&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to grab SEM guard&lt;br /&gt;
 *          ERR_SM_J_START_FROM_TIMOUT  Task started from timeout already, SEM no permits available second time&lt;br /&gt;
 *          ERR_TOO_MANY                SEM pending queue is full&lt;br /&gt;
 *          ERR_FAILED                  Should never return this&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_sem_wait_restart_timeout(&lt;br /&gt;
    sem_t sem_id, // counting SEM ID&lt;br /&gt;
    U64_t timeout // timeout, restart time if no permits, 0 =&amp;gt; ignore&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| sem_id || U32_t value of semaphore to be decremented&lt;br /&gt;
|-&lt;br /&gt;
| timeout | U64_t timeout in time units. A value of 0 causes timeout to be ignored.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_NOT_INIT             || Timed action intialisation is not done and tried to be used; or SEM created without&lt;br /&gt;
timeouts&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || SEM ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || SEM ID &amp;gt;= number of SEMs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to grab SEM guard&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SM_J_START_FROM_TIMOUT  || Task started from timeout already, SEM no permits available second time&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TOO_MANY                || SEM pending queue is full&lt;br /&gt;
|-&lt;br /&gt;
| ERR_FAILED                  || Should never return this&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Decrement available permits on semaphore s_1 otherwise job is put on pending queue with timeout of 10,000 time units (usually usecs)&lt;br /&gt;
status = oceos_sem_wait_restart_timeout(s_1);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_sem_get_value()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''semaphore.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the number of available permits for the specified semaphore.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Returns number of available permits&lt;br /&gt;
 * for SEM ID&lt;br /&gt;
 *&lt;br /&gt;
 * @param sem_id        SEM id&lt;br /&gt;
 * @param s_permits     pointer to permits count holder&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              SEM ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                SEM ID &amp;gt;= number of SEMs&lt;br /&gt;
 *          ERR_SM_DATA_BAD             Data holder pointer is null&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_sem_get_value(&lt;br /&gt;
    sem_t sem_id,    // counting SEM ID&lt;br /&gt;
    U32_t *s_permits // pointer to permits count holder&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| sem_id || U32_t value of semaphore whose permit count is required&lt;br /&gt;
|-&lt;br /&gt;
| s_permits || U32_t pointer to permits count holder&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || SEM ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || SEM ID &amp;gt;= number of SEMs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SM_DATA_BAD             || Data holder pointer is null&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, permit_count;&lt;br /&gt;
...&lt;br /&gt;
// Get the available permits for semaphore s_1&lt;br /&gt;
status = oceos_sem_get_value(s_1, &amp;amp;permit_count);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_sem_penq_get_size()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''semaphore.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the number of jobs on the specified semaphore pending queue.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Returns number of jobs on semaphore pending queue&lt;br /&gt;
 * for semaphore ID&lt;br /&gt;
 *&lt;br /&gt;
 * @param sem_id    SEM id&lt;br /&gt;
 * @param s_size    pointer to pending queue size holder&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              SEM ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                SEM ID &amp;gt;= number of SEMs&lt;br /&gt;
 *          ERR_SM_DATA_BAD             Data holder pointer is null&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_sem_penq_get_size(&lt;br /&gt;
    sem_t sem_id,   // counting SEM ID&lt;br /&gt;
    U32_t *s_size   // pointer to pending queue size holder&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| sem_id || U32_t value of semaphore whose permit count is required&lt;br /&gt;
|-&lt;br /&gt;
| s_size || U32_t pointer to pending queue jobs count holder&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || SEM ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || SEM ID &amp;gt;= number of SEMs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SM_DATA_BAD             || Data holder pointer is null&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, job_count;&lt;br /&gt;
...&lt;br /&gt;
// Get the available permits for semaphore s_1&lt;br /&gt;
status = oceos_sem_penq_get_size(s_1, &amp;amp;job_count);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_sem_reset()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''semaphore.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function restores the permits to the original semaphore initial value and removes any jobs from the pending queue.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Restore permits to original value and&lt;br /&gt;
 * remove jobs from pending queue&lt;br /&gt;
 *&lt;br /&gt;
 * @param sem_id    SEM ID&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              SEM ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                SEM ID &amp;gt;= number of SEMs&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to grab SEM guard&lt;br /&gt;
 *          ERR_SM_JOB_ID_WRONG         Job ID of the task on SEM pending queue is wrong&lt;br /&gt;
 *          ERR_TA_NOT_FOUND            Timed action index to be removed for job not found&lt;br /&gt;
 *          ERR_TA_START_FAILED         Timed action re-start failed after job remove from timed action queue&lt;br /&gt;
 */&lt;br /&gt;
S32_t   oceos_sem_reset(&lt;br /&gt;
    sem_t sem_id   // counting SEM ID&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| sem_id || U32_t value of semaphore to be reset&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || SEM ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || SEM ID &amp;gt;= number of SEMs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to grab SEM guard&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SM_JOB_ID_WRONG         || Job ID of the task on SEM pending queue is wrong&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_NOT_FOUND            || Timed action index to be removed for job not found&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_START_FAILED         || Timed action re-start failed after job remove from timed action queue&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Reset semaphore s_1&lt;br /&gt;
status = oceos_sem_reset(s_1);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Data Queues ==&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_dataq_create()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''dataq.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function creates a data queue with the specified characteristics.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Create data queue&lt;br /&gt;
 * If use_timeout = TRUE, timed actions must be initialised&lt;br /&gt;
 *&lt;br /&gt;
 * @param dataq_id      data queue ID&lt;br /&gt;
 * @param dataq_size    data queue size&lt;br /&gt;
 * @param pen_q_size    pending jobs queue size&lt;br /&gt;
 * @param roll_over     whether to roll over when full&lt;br /&gt;
 * @param use_timeout   if TRUE, directive oceos_dataq_read_restart_timeout can be used&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_WRONG_CPU_CORE          Executing directive on wrong CPU&lt;br /&gt;
 *          ERR_WRONG_PHASE             Called before oceos_init() is done&lt;br /&gt;
 *          ERR_TOO_MANY                MAX number of DATAQs already created&lt;br /&gt;
 *          ERR_ID_INVALID              DATAQ ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                DATAQ ID &amp;gt;= number of DATAQs&lt;br /&gt;
 *          ERR_DQ_ALREADY_ALLOCATED    DATAQ ID already used&lt;br /&gt;
 *          ERR_DQ_SIZE_WRONG           DATAQ size outside allowed range 1 to 255&lt;br /&gt;
 *          ERR_DQ_PENQ_SIZE_WRONG      DATAQ pending queue size outside allowed range 1 to 253&lt;br /&gt;
 *          ERR_DQ_TA_MAX_NUM_REACHED   Number of timed actions exceeds MAX allowed 255,&lt;br /&gt;
 *                                      each task on DATAQ pending queue is timed action&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_dataq_create(&lt;br /&gt;
                         dataq_t dataq_id,    // data queue ID&lt;br /&gt;
                         U16_t dataq_size,    // data queue size&lt;br /&gt;
                         U16_t pen_q_size,    // pending jobs queue size&lt;br /&gt;
                         BOOLE_t roll_over,   // whether to roll over when full&lt;br /&gt;
                         BOOLE_t use_timeout  // whether timeout is used oceos_dataq_read_restart_timeout&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| dataq_id ||   dataq_t data queue ID (number between 0 and 62)&lt;br /&gt;
|-&lt;br /&gt;
| dataq_size ||   data queue size (max number of pointers than can be added to the queue)&lt;br /&gt;
|-&lt;br /&gt;
| pen_q_size ||   pending jobs queue size&lt;br /&gt;
|-&lt;br /&gt;
| roll_over ||    whether to roll over when full (0 =&amp;gt; disabled, 1 =&amp;gt; enabled)&lt;br /&gt;
|-&lt;br /&gt;
| use_timeout ||  if TRUE, directive oceos_dataq_read_restart_timeout can be used&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_CPU_CORE          || Executing directive on wrong CPU&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Called before oceos_init() is done&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TOO_MANY                || MAX number of DATAQs already created&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || DATAQ ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || DATAQ ID &amp;gt;= number of DATAQs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DQ_ALREADY_ALLOCATED    || DATAQ ID already used&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DQ_SIZE_WRONG           || DATAQ size outside allowed range 1 to 255&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DQ_PENQ_SIZE_WRONG      || DATAQ pending queue size outside allowed range 1 to 253&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DQ_TA_MAX_NUM_REACHED   || Number of timed actions exceeds MAX allowed 255, each task on DATAQ pending queue is timed action&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Create data queue d_3 with size 20, max pending jobs of 10, rollover enabled, timeouts disabled &lt;br /&gt;
status = oceos_dataq_create(d_3, 20, 10, 1, 0));&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_dataq_write()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''dataq.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function puts a non-null pointer on the specified data queue.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Puts pointer to the data on data queue.&lt;br /&gt;
 * Pointer to the data must not be NULL&lt;br /&gt;
 *&lt;br /&gt;
 * @param dataq_t dataq_id Data queue ID&lt;br /&gt;
 * @param void* data       Non-null pointer to data&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          WARN_DQ_NOW_FULL            Warning, DATAQ is full now&lt;br /&gt;
 *          WARN_JOB_NOT_GUARDED&lt;br /&gt;
 *&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              DATAQ ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                DATAQ ID &amp;gt;= number of DATAQs&lt;br /&gt;
 *          ERR_DQ_DATA_BAD             Data pointer is null&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to acquire guard&lt;br /&gt;
 *          ERR_TOO_MANY                DATAQ is full&lt;br /&gt;
 *          ERR_DQ_JOB_ID_WRONG         Job ID of the task on pending queue is wrong&lt;br /&gt;
 *          ERR_TA_NOT_FOUND            Timed action index to be removed for job not found&lt;br /&gt;
 *          ERR_TA_START_FAILED         Timed action re-start failed after job remove from timed action queue&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_dataq_write(&lt;br /&gt;
    dataq_t dataq_id, // data queue ID&lt;br /&gt;
    void *data        // non-null pointer to data&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| dataq_id || dataq_t with value of Data queue ID&lt;br /&gt;
|-&lt;br /&gt;
| ptr || void* pointer to application data (non-null pointer)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| WARN_DQ_NOW_FULL            || Warning, DATAQ is full now&lt;br /&gt;
|-&lt;br /&gt;
| WARN_JOB_NOT_GUARDED        || &lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || DATAQ ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || DATAQ ID &amp;gt;= number of DATAQs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DQ_DATA_BAD             || Data pointer is null&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to acquire guard&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TOO_MANY                || DATAQ is full&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DQ_JOB_ID_WRONG         || Job ID of the task on pending queue is wrong&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_NOT_FOUND            || Timed action index to be removed for job not found&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_START_FAILED         || Timed action re-start failed after job remove from timed action queue&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
char[100] message_in;&lt;br /&gt;
...&lt;br /&gt;
// Put pointer to message_in on data queue s_2 &lt;br /&gt;
status = oceos_dataq_write(s_2, (void *)message_in);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_dataq_read_continue()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''dataq.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns a pointer from the specified data queue.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Read data queue&lt;br /&gt;
 *&lt;br /&gt;
 * @param dataq_t dataq_id  Data queue ID&lt;br /&gt;
 * @param void*   data      Pointer to data&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              DATAQ ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                DATAQ ID &amp;gt;= number of DATAQs&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to acquire guard&lt;br /&gt;
 *          ERR_DQ_EMPTY                DATAQ empty(count zero)&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_dataq_read_continue(&lt;br /&gt;
    dataq_t dataq_id, // data queue ID&lt;br /&gt;
    void* *data        // return data&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Descriptionn&lt;br /&gt;
|-&lt;br /&gt;
| dataq_id || dataq_t with value of Data queue ID&lt;br /&gt;
|-&lt;br /&gt;
| ptr || void* pointer to store returned data queue pointer removed from the queue&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || DATAQ ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || DATAQ ID &amp;gt;= number of DATAQs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to acquire guard&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DQ_EMPTY                || DATAQ empty(count zero)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
char *data_ptr;&lt;br /&gt;
...&lt;br /&gt;
// Read pointer from data queue s_2 &lt;br /&gt;
status = oceos_dataq_read_continue(s_2, (void *)data_ptr);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_dataq_read_restart()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''dataq.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns a pointer from the specified data queue. If the queue is empty, the job is added top the dataq pending queue. The job will be restarted when data is available. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Read data queue next item.&lt;br /&gt;
 * If dataq is empty, task is put on pending Q for dataq and&lt;br /&gt;
 * restarted by oceos_dataq_write&lt;br /&gt;
 *&lt;br /&gt;
 * @param dataq_id Data queue ID&lt;br /&gt;
 * @param data     Pointer to return data&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              DATAQ ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                DATAQ ID &amp;gt;= number of DATAQs&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to acquire guard&lt;br /&gt;
 *          ERR_DQ_J_START_FROM_TIMOUT  Job started from timeout already, DATAQ empty second time&lt;br /&gt;
 *          ERR_FAILED                  Should never return this&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_dataq_read_restart(&lt;br /&gt;
    dataq_t dataq_id,    // data queue ID&lt;br /&gt;
    void* *data           // pointer to return data&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| dataq_id || dataq_t with value of Data queue ID&lt;br /&gt;
|-&lt;br /&gt;
| ptr || void* pointer to store returned data queue pointer removed from the queue&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || DATAQ ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || DATAQ ID &amp;gt;= number of DATAQs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to acquire guard&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DQ_J_START_FROM_TIMOUT  || Job started from timeout already, DATAQ empty second time&lt;br /&gt;
|-&lt;br /&gt;
| ERR_FAILED                  || Should never return this&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
char *data_ptr;&lt;br /&gt;
...&lt;br /&gt;
// Read pointer from data queue s_2 with restart when data is available&lt;br /&gt;
status = oceos_dataq_read_restart(s_2, (void *)data_ptr);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_dataq_read_restart_timeout()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''dataq.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns a pointer from the specified data queue. If the queue is empty, the job is added top the dataq pending queue. The job will be restarted either when data is available or the timeout has expired. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Read data queue next item.&lt;br /&gt;
 * If dataq is empty, task is put on pending Q for dataq and&lt;br /&gt;
 * restarted by oceos_dataq_write or by timeout if timeout != 0&lt;br /&gt;
 * In order to use this feature timed actions must be configured and&lt;br /&gt;
 * dataq created with use timeout set to true&lt;br /&gt;
 *&lt;br /&gt;
 * @param dataq_id          Data queue ID&lt;br /&gt;
 * @param data              Pointer to return data&lt;br /&gt;
 * @param timeout           Timeout, restart time if no entry, 0 =&amp;gt; ignore&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_TA_NOT_INIT             Timed action intialisation is not done and tried to be used; or DATAQ created without timeouts&lt;br /&gt;
 *          ERR_ID_INVALID              DATAQ ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                DATAQ ID &amp;gt;= number of DATAQs&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to acquire guard&lt;br /&gt;
 *          ERR_DQ_EMPTY                DATAQ empty(count zero)&lt;br /&gt;
 *          ERR_DQ_J_START_FROM_TIMOUT  Job started from timeout already, DATAQ empty second time&lt;br /&gt;
 *          ERR_TOO_MANY                DATAQ pending queue is full&lt;br /&gt;
 *          ERR_FAILED                  Should never return this&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_dataq_read_restart_timeout(&lt;br /&gt;
    dataq_t dataq_id,   // data queue ID&lt;br /&gt;
    void* *data,         // Pointer to return data&lt;br /&gt;
    U64_t timeout       // timeout, restart time if no entry, 0 =&amp;gt; ignore&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| dataq_id || dataq_t with value of Data queue ID&lt;br /&gt;
|-&lt;br /&gt;
| ptr || void* pointer to store returned data queue pointer removed from the queue&lt;br /&gt;
|-&lt;br /&gt;
| timeout || U64_t containing timeout value, restart time if no entry, 0 =&amp;gt; ignore&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_NOT_INIT             || Timed action intialisation is not done and tried to be used; or DATAQ created without timeouts&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || DATAQ ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || DATAQ ID &amp;gt;= number of DATAQs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to acquire guard&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DQ_EMPTY                || DATAQ empty(count zero)&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DQ_J_START_FROM_TIMOUT  || Job started from timeout already, DATAQ empty second time&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TOO_MANY                || DATAQ pending queue is full&lt;br /&gt;
|-&lt;br /&gt;
| ERR_FAILED                  || Should never return this&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
char *data_ptr;&lt;br /&gt;
...&lt;br /&gt;
// Read pointer from data queue s_2 with timeout after 10,000 time units if no data is available&lt;br /&gt;
status = oceos_dataq_read_restart_timeout(s_2, (void *)data_ptr, 10000ull);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_dataq_get_size()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''dataq.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the number of items on the specified data queue.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Returns number of items on the data queue with ID&lt;br /&gt;
 *&lt;br /&gt;
 * @param dataq_id   DATAQ Id&lt;br /&gt;
 * @param d_size     Pointer to size holder&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              DATAQ ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                DATAQ ID &amp;gt;= number of DATAQs&lt;br /&gt;
 *          ERR_DQ_DATA_BAD             DATAQ size holder pointer is null&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_dataq_get_size(&lt;br /&gt;
    dataq_t dataq_id,   // data queue ID&lt;br /&gt;
    U32_t *d_size&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| dataq_id ||  dataq_t with the ID of the data queue (value between 0 and 62)&lt;br /&gt;
|-&lt;br /&gt;
| d_size || U32_t *d_size pointer to the variable to store the size&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || DATAQ ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || DATAQ ID &amp;gt;= number of DATAQs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DQ_DATA_BAD             || DATAQ size holder pointer is null&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, d_size;&lt;br /&gt;
...&lt;br /&gt;
// Get the number of entries on data queue d_0&lt;br /&gt;
status = oceos_dataq_get_size(d_0, &amp;amp;d_size);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_dataq_penq_get_size()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''dataq.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns number of jobs on the specified data queue pending job's queue.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Returns number of jobs on the dataq pending job's queue&lt;br /&gt;
 *&lt;br /&gt;
 * @param dataq_id  DATAQ Id&lt;br /&gt;
 * @param d_size    Pointer to pending queue size holder&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              DATAQ ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                DATAQ ID &amp;gt;= number of DATAQs&lt;br /&gt;
 *          ERR_DQ_DATA_BAD             DATAQ pending size holder pointer is null&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_dataq_penq_get_size(&lt;br /&gt;
    dataq_t dataq_id,&lt;br /&gt;
    U32_t *d_size&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| dataq_id ||  dataq_t with the ID of the data queue (value between 0 and 62)&lt;br /&gt;
|-&lt;br /&gt;
| d_jobs || U32_t *d_jobs pointer to the variable to store the number of jobs on the pending queue&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || DATAQ ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || DATAQ ID &amp;gt;= number of DATAQs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DQ_DATA_BAD             || DATAQ pending size holder pointer is null&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, d_jobs;&lt;br /&gt;
...&lt;br /&gt;
// Get the number of jobs the the pending jubs queue for data queue d_1&lt;br /&gt;
status = oceos_dataq_penq_get_size(d_1, &amp;amp;d_jobs);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_dataq_clear()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''dataq.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function clears the specified data queue including pending jobs for that queue.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Clears data queue and&lt;br /&gt;
 * frees tasks on pending queue&lt;br /&gt;
 *&lt;br /&gt;
 * @param dataq_t dataq_id Data queue ID&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              DATAQ ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                DATAQ ID &amp;gt;= number of DATAQs&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to acquire guard&lt;br /&gt;
 *          ERR_DQ_JOB_ID_WRONG         Job ID of the task on DATAQ pending queue is wrong&lt;br /&gt;
 *          ERR_TA_NOT_FOUND            Timed action index to be removed for job not found&lt;br /&gt;
 *          ERR_TA_START_FAILED         Timed action re-start failed after job remove from timed action queue&lt;br /&gt;
 */&lt;br /&gt;
S32_t  oceos_dataq_clear(&lt;br /&gt;
    dataq_t dataq_id    // data queue ID&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| dataq_id ||  dataq_t with the ID of the data queue to be cleared (value between 0 and 62)&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || DATAQ ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || DATAQ ID &amp;gt;= number of DATAQs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to acquire guard&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DQ_JOB_ID_WRONG         || Job ID of the task on DATAQ pending queue is wrong&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_NOT_FOUND            || Timed action index to be removed for job not found&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_START_FAILED         || Timed action re-start failed after job remove from timed action queue&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Clear data queue d_1&lt;br /&gt;
status = oceos_dataq_penq_get_size(d_1);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Timed Actions ==&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_timed_output_add()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''timed_action.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function adds a timed action to the timed action queue. It writes a value to an address at a specified system time. An optional mask can be applied so that only those bits are changed.&lt;br /&gt;
The action types are WRITE_ACTION, RMW_ACTION. WRITE_ACTION writes the value to the address. RMW_ACTION reads the values at the address and modifies the bits specified by the mask and value.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Add output action to timed actions queue :&lt;br /&gt;
 *  1. Create timed output action&lt;br /&gt;
 *  2. Stop timer&lt;br /&gt;
 *  3. Add action to action_array&lt;br /&gt;
 *  4. Start timer or execute if time is right&lt;br /&gt;
 *&lt;br /&gt;
 * Returns timed action ID that can be used later to remove&lt;br /&gt;
 * if need by oceos_timed_output_remove&lt;br /&gt;
 *&lt;br /&gt;
 * @param enum ACTION_TYPE action_type  Action type&lt;br /&gt;
 * @param U64_t act_time                System time at which action should be done&lt;br /&gt;
 * @param U32_t before_time             Forward tolerance for time&lt;br /&gt;
 * @param U32_t after_time              Backward tolerance for time&lt;br /&gt;
 * @param adrs_t address                Output address&lt;br /&gt;
 * @param U32_t value                   Output value&lt;br /&gt;
 * @param U32_t mask                    Output mask&lt;br /&gt;
 * @param U32_ *ta_index                Pointer to store timed action index&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_TA_NOT_INIT             Timed action inialisation is not done and tried to be used&lt;br /&gt;
 *          ERR_TA_PTR_BAD              Timed action pointer is null&lt;br /&gt;
 *          ERR_TA_TYPE_WRONG           Timed action type is wrong&lt;br /&gt;
 *          ERR_TOO_LATE                Timed action time is too late&lt;br /&gt;
 *          ERR_SYS_BUSY                Timed action guard failed to acquire&lt;br /&gt;
 *          ERR_TA_Q_FULL               Timed action queue is full&lt;br /&gt;
 *          ERR_TA_START_FAILED         Timed action execute failed; See log&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_timed_output_add(&lt;br /&gt;
    const enum ACTION_TYPE action_type,// Action type&lt;br /&gt;
    U64_t act_time,                    // system time at which action should be done&lt;br /&gt;
    U32_t before_time,                 // forward tolerance for time&lt;br /&gt;
    U32_t after_time,                  // backward tolerance for time&lt;br /&gt;
    const adrs_t address,              // output address&lt;br /&gt;
    const U32_t value,                 // output value&lt;br /&gt;
    const U32_t mask,                  // output mask&lt;br /&gt;
    U32_t *ta_index                    // Pointer to store timed action index&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| enum ACTION_TYPE action_type  || Action type&lt;br /&gt;
|-&lt;br /&gt;
| U64_t act_time                || System time at which action should be done&lt;br /&gt;
|-&lt;br /&gt;
| U32_t before_time             || Forward tolerance for time&lt;br /&gt;
|-&lt;br /&gt;
| U32_t after_time              || Backward tolerance for time&lt;br /&gt;
|-&lt;br /&gt;
| adrs_t address                || Output address&lt;br /&gt;
|-&lt;br /&gt;
| U32_t value                   || Output value&lt;br /&gt;
|-&lt;br /&gt;
| U32_t mask                    || Output mask&lt;br /&gt;
|-&lt;br /&gt;
| U32_ *ta_index                || Pointer to store timed action index&lt;br /&gt;
|-&lt;br /&gt;
| param || parameter to function&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_NOT_INIT             || Timed action inialisation is not done and tried to be used&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_PTR_BAD              || Timed action pointer is null&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_TYPE_WRONG           || Timed action type is wrong&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TOO_LATE                || Timed action time is too late&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Timed action guard failed to acquire&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_Q_FULL               || Timed action queue is full&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_START_FAILED         || Timed action execute failed; See log&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
#define OUTPUT_TIMED_VAL    0xDEADBEEF&lt;br /&gt;
#define OUTPUT_TIMED_MASK   0x1000001&lt;br /&gt;
#define OUTPUT_TIME         0xfffff&lt;br /&gt;
#define OUTPUT_TIME_FW      0x1000&lt;br /&gt;
#define OUTPUT_TIME_BW      0x1000&lt;br /&gt;
&lt;br /&gt;
static U32_t test_data[16] = { 0 };&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Write OUTPUT_TIMED_VAL to test_data[0] at 0xfffff time units from now with a tolerance of 0x1000 before and after the specified time   &lt;br /&gt;
status = oceos_timed_output_add(&lt;br /&gt;
                                       WRITE_ACTION,&lt;br /&gt;
                                       OUTPUT_TIME,&lt;br /&gt;
                                       OUTPUT_TIME_FW,&lt;br /&gt;
                                       OUTPUT_TIME_BW,&lt;br /&gt;
                                       (adrs_t) &amp;amp;test_data[0],&lt;br /&gt;
                                       OUTPUT_TIMED_VAL,&lt;br /&gt;
                                       0,&lt;br /&gt;
                                       &amp;amp;timed_action_index));&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_timed_jobs_number()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''timed_action.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the number of jobs on the timed actions queue.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Get number of Jobs (request to start the task) waiting on timed action queue.&lt;br /&gt;
 * These jobs are added by oceos_task_timed_start() or&lt;br /&gt;
 * oceos_dataq_read_restart_timeout when data is not available (NULL) or&lt;br /&gt;
 * oceos_sem_wait_restart_timeout when counting semaphore is 0&lt;br /&gt;
 *&lt;br /&gt;
 * @param total_jobs    Pointer to store total jobs number waiting on timed action Q&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_TA_NOT_INIT             Timed action inialisation is not done and tried to be used&lt;br /&gt;
 *          ERR_TA_PTR_BAD              Timed action pointer is null&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_timed_jobs_number(U32_t *total_jobs);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| total_jobs || s32_t pointer to store total jobs number waiting on timed action Q&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_NOT_INIT             || Timed action inialisation is not done and tried to be used&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_PTR_BAD              || Timed action pointer is null&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, no_of_jobs;&lt;br /&gt;
...&lt;br /&gt;
// Get the number of jobs on the timed actions queue&lt;br /&gt;
status = oceos_timed_jobs_number(&amp;amp;no_of_jobs);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_timed_output_number()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''timed_action.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the number timed output actions waiting on the timed actions queue.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Get number of timed output actions waiting on timed action queue.&lt;br /&gt;
 * These timed output actions are created by oceos_timed_output_add&lt;br /&gt;
 *&lt;br /&gt;
 * @param total_outputs   Pointer to store total outputs number waiting on timed action Q&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_TA_NOT_INIT             Timed action inialisation is not done and tried to be used&lt;br /&gt;
 *          ERR_TA_PTR_BAD              Timed action pointer is null&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_timed_output_number(U32_t *total_outputs);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| total_outputs || s32_t pointer to store total output actions waiting on timed action queue&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_NOT_INIT             || Timed action inialisation is not done and tried to be used&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_PTR_BAD              || Timed action pointer is null&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, no_of_outputs;&lt;br /&gt;
...&lt;br /&gt;
// Get the number of output actions on the timed actions queue&lt;br /&gt;
status = oceos_timed_output_number(&amp;amp;no_of_outputs);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_timed_jobs_remove()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''timed_action.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function removes the specified timed action from the queue.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Remove job from timed action queue&lt;br /&gt;
 * When task started using oceos_task_timed_start(),&lt;br /&gt;
 * this directive requires pointer to store ID&lt;br /&gt;
 * of job that put on the timed action queue.&lt;br /&gt;
 * This job can be removed later using this directive and stored job ID.&lt;br /&gt;
 *&lt;br /&gt;
 * @param U32_t job_id  Job ID&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_TA_NOT_INIT             Timed action intialisation is not done and tried to be used&lt;br /&gt;
 *          ERR_TA_PTR_BAD              Timed action pointer corrupt&lt;br /&gt;
 *          ERR_ID_WRONG                Job ID is wrong&lt;br /&gt;
 *          ERR_TA_NOT_FOUND            Timed action ID not found for action with job_id or removed already&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to acquire timed action guard&lt;br /&gt;
 *          WARN_TA_Q_EMPTY             Timed action queue is empty&lt;br /&gt;
 *          ERR_TA_START_FAILED         Timed action execute failed; See log&lt;br /&gt;
 */&lt;br /&gt;
S32_t   oceos_timed_jobs_remove(&lt;br /&gt;
    U32_t job_id                             // Job ID&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| job_id || U32_t Job ID to be removed from the timed actions queue&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_NOT_INIT             || Timed action intialisation is not done and tried to be used&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_PTR_BAD              || Timed action pointer corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || Job ID is wrong&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_NOT_FOUND            || Timed action ID not found for action with job_id or removed already&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to acquire timed action guard&lt;br /&gt;
|-&lt;br /&gt;
| WARN_TA_Q_EMPTY             || Timed action queue is empty&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_START_FAILED         || Timed action execute failed; See log&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, job_id;&lt;br /&gt;
...&lt;br /&gt;
// Remove job_id from the timed actions queue&lt;br /&gt;
status = oceos_timed_jobs_remove(job_id);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_timed_jobs_reset()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''timed_action.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function removes all jobs from timed actions queue.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Remove all jobs (requests to start a task) from timed actions queue&lt;br /&gt;
 * These jobs were added by oceos_task_timed_start() or&lt;br /&gt;
 * oceos_dataq_read_restart_timeout when data is not available (NULL) or&lt;br /&gt;
 * oceos_sem_wait_restart_timeout when counting semaphore is 0&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_TA_NOT_INIT             Timed action intialisation is not done and tried to be used&lt;br /&gt;
 *          ERR_TA_PTR_BAD              Timed action pointer is null&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to acquire timed action guard&lt;br /&gt;
 *          WARN_TA_Q_EMPTY             Timed action queue is empty&lt;br /&gt;
 *          ERR_TA_NOT_FOUND            Timed action index not found&lt;br /&gt;
 *          ERR_TA_START_FAILED         Timed action execute failed; See log&lt;br /&gt;
 */&lt;br /&gt;
S32_t   oceos_timed_jobs_reset(void);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
There are no input parameters to this function&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_NOT_INIT             || Timed action intialisation is not done and tried to be used&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_PTR_BAD              || Timed action pointer is null&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to acquire timed action guard&lt;br /&gt;
|-&lt;br /&gt;
| WARN_TA_Q_EMPTY             || Timed action queue is empty&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_NOT_FOUND            || Timed action index not found&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_START_FAILED         || Timed action execute failed; See log&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Remove all jobs from the timed actions queue&lt;br /&gt;
status = oceos_timed_jobs_reset(job_id);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_timed_output_remove()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''timed_action.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function removes the specified timed output action from timed actions queue.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Remove timed output action from timed actions queue.&lt;br /&gt;
 * When action is created, action index should be stored&lt;br /&gt;
 * to remove if need&lt;br /&gt;
 *&lt;br /&gt;
 * @param action_index&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_TA_NOT_INIT             Timed action intialisation is not done and tried to be used&lt;br /&gt;
 *          ERR_TA_PTR_BAD              Timed action pointer is null&lt;br /&gt;
 *          ERR_ID_WRONG                Timed action id is wrong&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to acquire timed action guard&lt;br /&gt;
 *          ERR_TA_NOT_FOUND            Timed action index not found&lt;br /&gt;
 *          ERR_TA_START_FAILED         Timed action execute failed&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_timed_output_remove(&lt;br /&gt;
    const U8_t  action_index    // Index in action array, returned when action was created&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| action_index|| S32_t specifying the timed output action index returned when the timed output was added.&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| Error bit  || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_NOT_INIT             || Timed action intialisation is not done and tried to be used&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_PTR_BAD              || Timed action pointer is null&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || Timed action id is wrong&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to acquire timed action guard&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_NOT_FOUND            || Timed action index not found&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_START_FAILED         || Timed action execute failed&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
U8_t action_index;&lt;br /&gt;
...&lt;br /&gt;
// Remove timed output with specified action_index&lt;br /&gt;
status = oceos_timed_output_remove(action_index);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_timed_output_reset()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''timed_action.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function removes all timed output actions from timed actions queue.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Remove all timed output actions from timed actions queue&lt;br /&gt;
 * These timed output actions were created by oceos_timed_output_add&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_TA_NOT_INIT             Timed action intialisation is not done and tried to be used&lt;br /&gt;
 *          ERR_TA_PTR_BAD              Timed action pointer is null&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to acquire timed action guard&lt;br /&gt;
 *          WARN_TA_Q_EMPTY             Timed action queue is empty&lt;br /&gt;
 *          ERR_TA_NOT_FOUND            Timed action index not found&lt;br /&gt;
 *          ERR_TA_START_FAILED         Timed action execute failed; See log&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_timed_output_reset(void);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
There are no input parameters to this function. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| Error bit  || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_NOT_INIT             || Timed action intialisation is not done and tried to be used&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_PTR_BAD              || Timed action pointer is null&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to acquire timed action guard&lt;br /&gt;
|-&lt;br /&gt;
| WARN_TA_Q_EMPTY             || Timed action queue is empty&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_NOT_FOUND            || Timed action index not found&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_START_FAILED         || Timed action execute failed; See log&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Remove all timed outputs from the timed actions queue&lt;br /&gt;
status = oceos_timed_output_reset();&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Logging directives ==&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;Introduction&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Log Area Features  (for details of other areas see oceos_areas.h)&lt;br /&gt;
&lt;br /&gt;
The system log area holds the system log and the records of the present and previous values of the system state variable.&lt;br /&gt;
&lt;br /&gt;
It is set up initially as an array of 32-bit words that starts at a 32-bit aligned address provided by the application developer.&lt;br /&gt;
&lt;br /&gt;
It is recommended that this address be in non-volatile RAM memory if this is available to allow information be preserved across power-up cycles.&lt;br /&gt;
&lt;br /&gt;
OCEOS preserves log area information across resets as far as possible.&lt;br /&gt;
&lt;br /&gt;
The system log itself is a circular buffer of struct log entry. Older entries are overwritten by new entries once all entries are in use.&lt;br /&gt;
&lt;br /&gt;
The application developer can specify a function to be called when 3/4 of log entries are in use. This function is called again only after 3/4 of log entries have been read and the log has again become 3/4 full.&lt;br /&gt;
&lt;br /&gt;
The read and write indices are stored in the log area and if equal indicate that the log is empty.&lt;br /&gt;
&lt;br /&gt;
As with other OCEOS data areas, the log area starts with a header&lt;br /&gt;
*a 32-bit word holding a constant OCEOS_VERSION&lt;br /&gt;
*a 32-bit word holding the log area size in 32-bit words&lt;br /&gt;
*a 32-bit word, the system status variable&lt;br /&gt;
*a 32-bit word, the system status mask&lt;br /&gt;
*a 32-bit word, the accumulated system status&lt;br /&gt;
*a 32-bit word, the previous system status mask&lt;br /&gt;
*a 32-bit word, the log control, that gives whether the log full function was called&lt;br /&gt;
*the read index&lt;br /&gt;
*the write index&lt;br /&gt;
*an array of struct log_entry making up the system log itself&lt;br /&gt;
*ending with a 32-bit constant END_SENTINEL&lt;br /&gt;
&lt;br /&gt;
The system fixed meta structure at sysMetaPtr provides&lt;br /&gt;
&lt;br /&gt;
*system_log_ptr      the start address of the log area&lt;br /&gt;
*logEntries          the number of log entries&lt;br /&gt;
*logCreated          flag indicating log was created successfully&lt;br /&gt;
*logFullFunction     user defined function, called when the log becomes 3/4 full (or NULL if not used)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Log Entry Types and Structure'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/*****************************************************************************&lt;br /&gt;
 * LOG ENTRY TYPES&lt;br /&gt;
 *&lt;br /&gt;
 * A log entry type is an 8-bit number.&lt;br /&gt;
 * Values from 0 to 127 can be defined by the application.&lt;br /&gt;
 * Values from 128 to 255 are used by OCEOS as below.&lt;br /&gt;
 *&lt;br /&gt;
 *&lt;br /&gt;
 * NOTE: Add new log types at the end for backward compatibility&lt;br /&gt;
 */&lt;br /&gt;
enum LOG_ENTRY_TYPE{&lt;br /&gt;
  LOG_SYS_OK = 0x80U,&lt;br /&gt;
  LOG_OCEOS_ABORT,				// when exiting from oceos_start&lt;br /&gt;
  LOG_LOG_NOT_VALID_ENTRY,		// used to initialise log and when log empty&lt;br /&gt;
  LOG_INIT_TASK_START_FAIL,		// initial task passed to oceos_start failed&lt;br /&gt;
  LOG_DEADLINE_MISSED,			// task deadline missed&lt;br /&gt;
  LOG_JOB_NOT_ACTIVE,			// cpu_terminate but job not active, absurd&lt;br /&gt;
  LOG_JOB_NOT_FREE,				// job guarded but not free&lt;br /&gt;
  LOG_JOBS_INC_FAILED, 			// pending jobs increment failed&lt;br /&gt;
  LOG_JOB_NOT_GUARDED,			// paranoia&lt;br /&gt;
  LOG_CS_LOG_SPIN_FAIL,			// oceos_CPU_sleep, trying to update CS log&lt;br /&gt;
  LOG_MUTEX_ALREADY_HELD,		// oceos_mutex_wait, code returned, not needed&lt;br /&gt;
  LOG_MUTEX_INCORRECT_ORDER,	// oceos_mutex_wait&lt;br /&gt;
  LOG_MUTEX_EXIT_HOLDING,		// task exits holding one or more mutexes&lt;br /&gt;
  LOG_MUTEX_EXIT_NONE,			// __oceos_tasks_remove_mutexes called but no mutex held&lt;br /&gt;
  LOG_SEMAPHORE_PENDING_REMOVE_FAIL,	// timed_action.c&lt;br /&gt;
  LOG_SEMAPHORE_PENDING_QUEUE_FULL,		// __oceos_semaphore_add_pend&lt;br /&gt;
  LOG_SEMAPHORE_SPIN_FAILED,			// trying to access semaphore&lt;br /&gt;
  LOG_DATAQ_PENDING_QUEUE_FULL,&lt;br /&gt;
  LOG_DATAQ_PENDING_REMOVE_FAIL,&lt;br /&gt;
  LOG_DATAQ_SPIN_FAILED,&lt;br /&gt;
  LOG_TIMED_ACTION_TIMER_NULL,&lt;br /&gt;
  LOG_TIMED_ACTION_INVALID,&lt;br /&gt;
  LOG_TIMED_ACTION_BAD_INDEX,&lt;br /&gt;
  LOG_TIMED_ACTION_MISSED,&lt;br /&gt;
  LOG_TIMED_ACTION_Q_EMPTY,&lt;br /&gt;
  LOG_TIMED_ACTION_REMOVE_FAIL,&lt;br /&gt;
  LOG_TIMED_ACTION_BAD_JOB_ID,&lt;br /&gt;
  LOG_TIMED_Q_SPIN_FAIL,&lt;br /&gt;
  LOG_SYSTEM_ERROR,&lt;br /&gt;
  LOG_ATOMICINC_FAILED,&lt;br /&gt;
  LOG_PENDING_PRI_UPDATE_FAILED,&lt;br /&gt;
  LOG_KILL_TASK_INVALID_ID,      // Tried to kill task with invalid ID&lt;br /&gt;
  LOG_OCEOS_EXIT_REQUEST,         // oceos_exit command was called&lt;br /&gt;
  LOG_RWMUTEX_NOT_RETURNED,&lt;br /&gt;
  LOG_RWMUTEX_NOT_HIGHEST&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
/*****************************************************************************&lt;br /&gt;
 * Structures&lt;br /&gt;
 */&lt;br /&gt;
/**&lt;br /&gt;
 * Log entry structure&lt;br /&gt;
 */&lt;br /&gt;
struct log_entry{&lt;br /&gt;
  U64_t             time64;&lt;br /&gt;
&lt;br /&gt;
  unsigned int      entry_cpu          :8;&lt;br /&gt;
  unsigned int      entry_type         :8;&lt;br /&gt;
  unsigned int      entry_note         :16;	// not used at present&lt;br /&gt;
&lt;br /&gt;
  U32_t             entry_comment;&lt;br /&gt;
}__attribute__ ((aligned (8)));&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_log_add_entry()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''system_log.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function adds an entry to the log. The entry overwrites the oldest unread entry if the log is full.&lt;br /&gt;
Custom log entries can be added to enum LOG_ENTRY from 0 to 128.&lt;br /&gt;
The indices are incremented in a circular fashion. If the write index reaches the read_index the read index is moved on, as read and write indices equal would indicate an empty log.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Add an entry to the log.&lt;br /&gt;
 * this overwrites the oldest unread entry if the log is full.&lt;br /&gt;
 * Custom log entries can be added to enum LOG_ENTRY from 0 to 128&lt;br /&gt;
 *&lt;br /&gt;
 * N.B. The indices are incremented in a circular fashion.&lt;br /&gt;
 *      If the write index reaches the read_index the read index is moved on,&lt;br /&gt;
 *      as read and write indices equal would indicate an empty log.&lt;br /&gt;
 *&lt;br /&gt;
 * @param type  enum LOG_ENTRY_TYPE&lt;br /&gt;
 * @param info  extra information to be logged&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_LOG_CORRUPT         System Log area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Log directive called in wrong phase; can be used after oceos_init() called&lt;br /&gt;
 *          ERR_ID_INVALID              Log type invalid&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to acquire log guard&lt;br /&gt;
 *          ERR_LOG_INDEX_WRONG         Read/write log index is wrong&lt;br /&gt;
 */&lt;br /&gt;
S32_t   oceos_log_add_entry(&lt;br /&gt;
    enum LOG_ENTRY_TYPE type,   // 8 bits enum LOG_ENTRY_TYPE&lt;br /&gt;
    const U32_t        info     // information&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| enum LOG_ENTRY_TYPE || Log entry type (see previous section for a list)&lt;br /&gt;
|-&lt;br /&gt;
| info | U32_t with the log information&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit  !! Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_LOG_CORRUPT         || System Log area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Log directive called in wrong phase; can be used after oceos_init() called&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || Log type invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to acquire log guard&lt;br /&gt;
|-&lt;br /&gt;
| ERR_LOG_INDEX_WRONG         || Read/write log index is wrong&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, info;&lt;br /&gt;
...&lt;br /&gt;
// Log LOG_APP_COMMS__ERROR (defined in enum LOG_ENTRY_TYPE) and info with more details&lt;br /&gt;
status = oceos_log_add_entry(LOG_APP_COMMS__ERROR, info);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_log_get_indexed_entry()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''system_log.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the entry at the specified position in the log. The entry is not removed and the log and log indices are not changed.&lt;br /&gt;
One use of this function is to allow the log be examined after a reset.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Returns the entry at the specified position in the log.&lt;br /&gt;
 * The entry is not removed and the log and log indices are not changed.&lt;br /&gt;
 * (intended to allow the log be examined for example after reset)&lt;br /&gt;
 *&lt;br /&gt;
 * @param index         position in the log&lt;br /&gt;
 * @param outputPtr     pointer to return log entry&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_LOG_CORRUPT         System Log area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Log directive called in wrong phase; can be used after oceos_init() called&lt;br /&gt;
 *          ERR_LOG_INDEX_WRONG         Read log index is wrong&lt;br /&gt;
 *          ERR_LOG_DATA_PTR_BAD        Data holder pointer is null&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_log_get_indexed_entry(&lt;br /&gt;
    const unsigned int index,&lt;br /&gt;
    struct log_entry * const outputPtr&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| index || U32_t with position in the log&lt;br /&gt;
|-&lt;br /&gt;
| outputPtr || pointer to struct log_entry to hold the returned entry&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit  !! Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_LOG_CORRUPT         || System Log area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Log directive called in wrong phase; can be used after oceos_init() called&lt;br /&gt;
|-&lt;br /&gt;
| ERR_LOG_INDEX_WRONG         || Read log index is wrong&lt;br /&gt;
|-&lt;br /&gt;
| ERR_LOG_DATA_PTR_BAD        || Data holder pointer is null&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, index;&lt;br /&gt;
struct log_entry store_entry;&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
// Read log_entry at specified index into outputPtr&lt;br /&gt;
status = oceos_log_get_indexed_entry(index, &amp;amp;store_entry);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_log_remove_entry()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''system_log.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function reads and removes the oldest unread log entry. &lt;br /&gt;
If the log is not empty use the entry at the read index to update the value at the output pointer, returning OCEOS_SUCCESS.&lt;br /&gt;
If outputPtr is NULL, entry is removed but no returned.&lt;br /&gt;
If the log is empty, set the value at the output pointer to LOG_LOG_NOT_VALID_ENTRY and return ERR_LOG_EMPTY.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Read and remove the oldest unread log entry&lt;br /&gt;
 *&lt;br /&gt;
 * If the log is not empty use the entry at the read index to update the value&lt;br /&gt;
 * at the output pointer, returning OCEOS_SUCCESS.&lt;br /&gt;
 *&lt;br /&gt;
 * If outputPtr is NULL, entry is removed but no returned&lt;br /&gt;
 *&lt;br /&gt;
 * If the log is empty, set the value at the output pointer to LOG_LOG_NOT_VALID_ENTRY&lt;br /&gt;
 * and return ERR_LOG_EMPTY&lt;br /&gt;
 *&lt;br /&gt;
 * @param outputPtr   pointer to struct log_entry&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_LOG_CORRUPT         System Log area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Log directive called in wrong phase; can be used after oceos_init() called&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to acquire log guard&lt;br /&gt;
 *          ERR_LOG_INDEX_WRONG         Read/write log index is wrong&lt;br /&gt;
 *          ERR_LOG_EMPTY               Log is empty&lt;br /&gt;
 */&lt;br /&gt;
S32_t   oceos_log_remove_entry(&lt;br /&gt;
    struct log_entry * const outputPtr&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| outputPtr || pointer to struct log_entry&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit  !! Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_LOG_CORRUPT         || System Log area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Log directive called in wrong phase; can be used after oceos_init() called&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to acquire log guard&lt;br /&gt;
|-&lt;br /&gt;
| ERR_LOG_INDEX_WRONG         || Read/write log index is wrong&lt;br /&gt;
|-&lt;br /&gt;
| ERR_LOG_EMPTY               || Log is empty&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
struct log_entry *outputPtr;&lt;br /&gt;
...&lt;br /&gt;
// Read log_entry into outputPtr and remove the oldest unread log entry&lt;br /&gt;
status = oceos_log_remove_entry(outputPtr);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_log_reset()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''system_log.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function sets all log entries to LOG_LOG_NOT_VALID_ENTRY and the log to empty, with the read and write indices set to 0.&lt;br /&gt;
The log is empty if the index of the next write is the same as the index of the next read. It does not affect the system status variable. It does not affect the context switch log.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * oceos_log_reset()&lt;br /&gt;
 *&lt;br /&gt;
 * Set all log entries to LOG_LOG_NOT_VALID_ENTRY and the log to empty, with the&lt;br /&gt;
 * read and write indices set to 0. and function called flag 0&lt;br /&gt;
 *&lt;br /&gt;
 * The log is empty if the index of the next write&lt;br /&gt;
 * is the same as the index of the next read.&lt;br /&gt;
 *&lt;br /&gt;
 * Does not affect the system status variable&lt;br /&gt;
 * Does not affect the context switch log&lt;br /&gt;
 *&lt;br /&gt;
 * N.B The fixed data area may no longer be writable&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_LOG_CORRUPT         System Log area corrupt; reset failed&lt;br /&gt;
 *          ERR_WRONG_PHASE             Log directive called in wrong phase; can be used after oceos_init() called&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to acquire log guard&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_log_reset(void);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
There are no input parameters to this function.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit  !! Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_LOG_CORRUPT         || System Log area corrupt; reset failed&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Log directive called in wrong phase; can be used after oceos_init() called&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to acquire log guard&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
// Clear down the system log&lt;br /&gt;
status = oceos_log_reset();&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_log_get_size()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''system_log.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the number of entries in the log according to the current values of the read and write indices.&lt;br /&gt;
The value will be zero if the current values of the read and write indices are the same. There may still be useful information in the log, e.g. after system reset, this can be accessed using oceos_log_get_indexed_entry().&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Return the number of entries in the log&lt;br /&gt;
 * according to the current values of the read and write indices.&lt;br /&gt;
 *&lt;br /&gt;
 * The value will be zero if the current values of the read and write indices&lt;br /&gt;
 * are the same.&lt;br /&gt;
 *&lt;br /&gt;
 * There may still be useful information in the log, e.g. after system reset,&lt;br /&gt;
 * this can be accessed using oceos_log_get_indexed_entry()&lt;br /&gt;
 *&lt;br /&gt;
 * @param l_size        pointer to log size holder&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_LOG_CORRUPT         System Log area corrupt;&lt;br /&gt;
 *          ERR_WRONG_PHASE             Log directive called in wrong phase; can be used after oceos_init() called&lt;br /&gt;
 *          ERR_LOG_DATA_PTR_BAD        Pointer to log size holder is NULL&lt;br /&gt;
 *          ERR_LOG_INDEX_WRONG         Read/write log index is wrong&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_log_get_size(&lt;br /&gt;
    U32_t *l_size&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| l_size|| U32_t pointer where size will be written.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit  !! Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_LOG_CORRUPT         || System Log area corrupt;&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Log directive called in wrong phase; can be used after oceos_init() called&lt;br /&gt;
|-&lt;br /&gt;
| ERR_LOG_DATA_PTR_BAD        || Pointer to log size holder is NULL&lt;br /&gt;
|-&lt;br /&gt;
| ERR_LOG_INDEX_WRONG         || Read/write log index is wrong&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, size;&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
// Clear down the system log&lt;br /&gt;
status = oceos_log_get_size(&amp;amp;size);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;System State Variable and System State Mask&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The System State variable provides a record of anomalies or problems detected by OCEOSmp's automatic consistency checks. An application handler for these can be set to be called automatically.&lt;br /&gt;
&lt;br /&gt;
An anomaly or problem results in a flag bit being set in the 32-bit word used to store the system state variable. The flags are identified below.&lt;br /&gt;
&lt;br /&gt;
All flags are reset to zero by oceos_init() when OCEOSmp is initialised, and may also be reset by the application using the directive provided.&lt;br /&gt;
&lt;br /&gt;
To provide a record across OCEOSmp restarts a copy is updated automatically whenever the state variable is updated. This is not cleared by oceos_init() but may be cleared by the application using a directive.&lt;br /&gt;
&lt;br /&gt;
Application software can define a problem handling function to be called automatically when specified system state flags are set. The flags are specified by setting the corresponding bits in the system state mask. The function and the state mask are defined in the system configuration.&lt;br /&gt;
&lt;br /&gt;
Changing a state flag from clear to set results in the function being called (if defined). Subsequent settings of that flag have no effect until after it has been cleared using the directive provided.&lt;br /&gt;
&lt;br /&gt;
N.B. In many cases when OCEOSmp sets a System State flag it also makes an entry in the system log that provides further information.&lt;br /&gt;
&lt;br /&gt;
SYSTEM STATE VARIABLE FLAGS&lt;br /&gt;
&lt;br /&gt;
These flags are updated by OCEOSmp using inclusive 'OR' when a consistency check detects a problem or anomaly. A copy of the system state variable is updated also and accumulates a record of flag settings that is preserved across restarts of OCEOSmp. OCEOSmp restarts reset the system state variable but not the copy.&lt;br /&gt;
&lt;br /&gt;
Resetting the state variables is the responsibility of the application (except for the state variable reset done when OCEOSmp is restarted).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''System Status Bits'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
#define  STATUS_NORMAL                    0u    // No flag set                              YES&lt;br /&gt;
#define  STATUS_INVALID          0xffffffffu    // System status is invalid                 YES BUT NO DETAIL!!!&lt;br /&gt;
&lt;br /&gt;
#define  STATUS_MASK_NORMAL      0xffffffffu    // Always call user def fn                  YES&lt;br /&gt;
&lt;br /&gt;
/* Task related problems */&lt;br /&gt;
#define  STATUS_DISABLED_TASK_START    0x1U    // An attempt to start a disabled task&lt;br /&gt;
#define  STATUS_TASK_JOB_LIMIT_OVER    0x2U    // An attempt to execute a task when its jobs limit is already reached.&lt;br /&gt;
#define  STATUS_JOB_OVER_TIME          0x4U    // Job time from creation to completion exceeds allowed maximum for task. YES&lt;br /&gt;
#define  STATUS_JOB_INTERVAL_SHORT     0x8U    // Minimum time between job creations is less than the allowed minimum for task&lt;br /&gt;
#define  STATUS_READYQ_FULL           0x10U    // Ready queue unable to accept job as result of being full&lt;br /&gt;
#define  STATUS_READYQ_NO_REMOVE      0x20U    // Remove job from ready queue failed&lt;br /&gt;
&lt;br /&gt;
/* Mutex related problems */&lt;br /&gt;
#define  STATUS_MUTEX_ALREADY_HELD    0x40U    // Mutex wait() when mutex already held&lt;br /&gt;
#define  STATUS_MUTEX_NOT_HELD        0x80U    // Mutex signal() when not already held&lt;br /&gt;
#define  STATUS_MUTEX_NOT_RETURNED   0x100U    // Mutex not returned before job terminates&lt;br /&gt;
#define  STATUS_MUTEX_NOT_NESTED     0x200U    // Use of multiple mutexes not nested&lt;br /&gt;
&lt;br /&gt;
/* Counting semaphore and data queue related problems */&lt;br /&gt;
#define  STATUS_SEMAPHORE_JOBS_FULL  0x400U    // Attempt to add job to semaphore pending list when list full&lt;br /&gt;
#define  STATUS_DATAQ_JOBS_FULL      0x800U    // Attempt to add job to data queue pending list when list full&lt;br /&gt;
#define  STATUS_DATAQ_FULL          0x1000U    // Data queue write when queue already full&lt;br /&gt;
&lt;br /&gt;
/* Timed actions related problems */&lt;br /&gt;
#define  STATUS_TIMED_JOBS_FULL     0x2000U    // Timed actions queue already full for timed task start&lt;br /&gt;
#define  STATUS_TIMED_OUTPUT_FULL   0x4000U    // Timed actions queue already full for timed output&lt;br /&gt;
#define  STATUS_TIMED_ACTION_LATE   0x8000U    // Timed action late                          YES&lt;br /&gt;
&lt;br /&gt;
/* Default trap handler should have been replaced&lt;br /&gt;
 * NOT USED AT THE MOMENT*/&lt;br /&gt;
#define  STATUS_SYSTEM_ERROR       0x10000U    // ERROR was handled by default trap handler  YES&lt;br /&gt;
&lt;br /&gt;
/* Flag to indicate problem with Stack Pointer&lt;br /&gt;
 * NOT USED AT THE MOMENT*/&lt;br /&gt;
#define  STATUS_SP_WARNING         0x20000U    // SP not in expected range&lt;br /&gt;
/* Log system error */&lt;br /&gt;
#define  STATUS_BAD_LOG            0x40000U    // System log problem&lt;br /&gt;
#define  STATUS_SPIN_FAILED        0x80000U    // Get SPIN lock failed&lt;br /&gt;
/* Not using next few bits */&lt;br /&gt;
&lt;br /&gt;
/* Will have to exit */&lt;br /&gt;
#define  STATUS_BAD_SENTINEL     0x40000000U    // Area sentinel corrupt&lt;br /&gt;
#define  STATUS_BAD_META_PTR     0x80000000U    // Null meta pointer&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_system_state_get()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''system_log.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns of the system state variable.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Returns the value of the system state variable&lt;br /&gt;
 *&lt;br /&gt;
 * @param state  pointer to state holder&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_LOG_DATA_PTR_BAD        Data holder pointer is null&lt;br /&gt;
 *          ERR_SYS_LOG_CORRUPT         LOG dynamic pointer is null&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_system_state_get(&lt;br /&gt;
    U32_t *state // pointer to state holder&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| state || U32_t pointer to state holder&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit  !! Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_LOG_DATA_PTR_BAD        || Data holder pointer is null&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_LOG_CORRUPT         || LOG dynamic pointer is null&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, state;&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
// Get the system state&lt;br /&gt;
status = oceos_system_state_get(&amp;amp;state);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_system_state_set()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''system_log.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function sets system state variable.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Sets system state variable&lt;br /&gt;
 *&lt;br /&gt;
 * @param new_state&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_LOG_CORRUPT         LOG dynamic pointer is null&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_system_state_set(&lt;br /&gt;
    U32_t new_state   // new value of system state variable&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| new_state || U32_t containing new system state&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit  !! Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_LOG_CORRUPT         || LOG dynamic pointer is null&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, new_state;&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
// Set new system state&lt;br /&gt;
status = oceos_system_state_set(new_state);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_system_state_copy_get()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''system_log.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the value of the system state copy variable.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Returns the value of the copy of system state variable&lt;br /&gt;
 *&lt;br /&gt;
 * @param state  pointer to state holder&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_LOG_DATA_PTR_BAD        Data holder pointer is null&lt;br /&gt;
 *          ERR_SYS_LOG_CORRUPT         LOG dynamic pointer is null&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_system_state_copy_get(&lt;br /&gt;
    U32_t *state // pointer to state copy holder&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| state || U32_t pointer to state copy holder&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit  !! Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_LOG_DATA_PTR_BAD        || Data holder pointer is null&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_LOG_CORRUPT         || LOG dynamic pointer is null&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, copy_state;&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
// Get the system state copy&lt;br /&gt;
status = oceos_system_state_copy_get(&amp;amp;copy_state);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_system_state_copy_set()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''system_log.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function loads a value to tha system state copy variable.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Sets system state copy variable&lt;br /&gt;
 *&lt;br /&gt;
 * @param new_state&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_LOG_CORRUPT         LOG dynamic pointer is null&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_system_state_copy_set(&lt;br /&gt;
    U32_t new_state   // new value of system state variable&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| new_state || U32_t containing new system state copy&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit  !! Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_LOG_CORRUPT         || LOG dynamic pointer is null&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, new_state;&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
// Set new system state copy&lt;br /&gt;
status = oceos_system_state_copy_set(new_state);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Timing directives ==&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;Introduction&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''SPARC'''&lt;br /&gt;
&lt;br /&gt;
In OCEOS system time is based on two chained 32-bit timers.&lt;br /&gt;
&lt;br /&gt;
No interrupts are involved, the current system time is obtained by reading the two timer counter registers (in an atomic way) and then inverting the&lt;br /&gt;
values since the timers count down.&lt;br /&gt;
&lt;br /&gt;
The scaler associated with the timers is configured based on the system clock frequency to decrement the low order timer every microsecond. This&lt;br /&gt;
decrements the high order timer when it rolls over, every 71.6 minutes approximately. The 64-bit time range is very long, over 584,000 years.&lt;br /&gt;
&lt;br /&gt;
'''ARM Cortex-M'''&lt;br /&gt;
&lt;br /&gt;
In OCEOS for ARM Cortex-M, system time is based on SysTick. The processor has a 24-bit system timer, SysTick, that counts down from the reload value to zero, reloads (wraps to) the value in the LOAD register on the next clock edge, then counts down on subsequent clocks.&lt;br /&gt;
&lt;br /&gt;
Note: When the processor is halted for debugging the counter does not decrement.&lt;br /&gt;
&lt;br /&gt;
OCEOS initializes the timer to be driven from MCK and counting down to zero asserts SysTick exception request.&lt;br /&gt;
OCEOS has 64 bit counter which is increased by 0xFFFFFF value every time timer reloads.&lt;br /&gt;
&lt;br /&gt;
'''RISC-V'''&lt;br /&gt;
&lt;br /&gt;
In OCEOS for RISC-V systems time is based internally on clock cycles.&lt;br /&gt;
The RISC-V processor typically has a 64 bit counter (typically mtime) that  updates automatically on each clock cycle. Each hart typically has its own comparison register (typically mtimecmp) that can be used to interrupt that hart when a certain cycle count has been exceeded.&lt;br /&gt;
If a particular RISC-V implementation provides a more restricted clock cycle count this will be used with appropriate modifications as clock cycles give the best timing precision available.&lt;br /&gt;
&lt;br /&gt;
Note: The application configuration provides the constant needed to allow microseconds (as used in OCEOS directives) be converted to clock cycles. Time is reported by OCEOSmp as the number of microseconds since OCEOS was initialized.&lt;br /&gt;
&lt;br /&gt;
A potential difficulty arises if the main system clock rate can change for power saving or other reasons, each system is probably different with regard to this. OCEOSmp can handle this, if needed.&lt;br /&gt;
&lt;br /&gt;
The units of OCEOS system time are microseconds on SPARC and ARM and on RISC-V the period of the clock cycle.&lt;br /&gt;
&lt;br /&gt;
The system time is reset to 0 by oceos_init()&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_time_sys_get64()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''oceos_timer.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the current system time as a 64-bit number.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
**&lt;br /&gt;
 * Get the current system time (64-bit)&lt;br /&gt;
 *&lt;br /&gt;
 * @return U64_t&lt;br /&gt;
 */&lt;br /&gt;
U64_t oceos_time_sys_get64(void);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There are no parameters to this function.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S64_t with the current system time.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S64_t now;&lt;br /&gt;
...&lt;br /&gt;
// Get the time&lt;br /&gt;
now = oceos_time_sys_get64();&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_time_sys_get32()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''oceos_timer.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the low 32 bits of the system time.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Get the current system time (low 32 bits of 64 bit value)&lt;br /&gt;
 *&lt;br /&gt;
 * @return U32_t&lt;br /&gt;
 */&lt;br /&gt;
U32_t oceos_time_sys_get32(void);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
There are no parameters to this function.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with the current system time.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t now;&lt;br /&gt;
...&lt;br /&gt;
// Get the time&lt;br /&gt;
now = oceos_time_sys_get32();&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:backup]]&lt;/div&gt;</summary>
		<author><name>Bkavanagh</name></author>
	</entry>
	<entry>
		<id>https://wiki.ocetechnology.com/mediawiki/index.php?title=OCEOSmp/directive_reference&amp;diff=1717</id>
		<title>OCEOSmp/directive reference</title>
		<link rel="alternate" type="text/html" href="https://wiki.ocetechnology.com/mediawiki/index.php?title=OCEOSmp/directive_reference&amp;diff=1717"/>
		<updated>2024-06-24T16:14:03Z</updated>

		<summary type="html">&lt;p&gt;Bkavanagh: /* oceos_timed_output_number() */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Introduction =&lt;br /&gt;
&lt;br /&gt;
To be added&lt;br /&gt;
&lt;br /&gt;
= Directives =&lt;br /&gt;
&lt;br /&gt;
== Initialisation directives ==&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_init()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''initialisation.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Initialises OCEOS and  must be the first directive used.&lt;br /&gt;
&lt;br /&gt;
Initialises the OCEOS system meta data using the information supplied in the application configuration and prepares for creation of tasks etc.&lt;br /&gt;
&lt;br /&gt;
The values provided in the application configuration are checked as much as possible before being used.&lt;br /&gt;
&lt;br /&gt;
The system log also is created here.&lt;br /&gt;
&lt;br /&gt;
This function sets up sysMetaPtr and init_meta_ptr and must have completed successfully before tasks etc. can be created.&lt;br /&gt;
&lt;br /&gt;
It disables interrupts and leaves them disabled, they will be re-enabled to the previous level after all tasks etc. have been created and [[OCEOSmp/directive_reference#oceos_init_finish()|oceos_init_finish()]] has completed successfully.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Initialises OCEOS and  must be the first directive used.&lt;br /&gt;
 *&lt;br /&gt;
 * Initialises the OCEOS system meta data using the information supplied in&lt;br /&gt;
 * the application configuration and prepares for creation of tasks etc.&lt;br /&gt;
 *&lt;br /&gt;
 * The values provided in the application configuration are checked as much&lt;br /&gt;
 * as possible before being used.&lt;br /&gt;
 *&lt;br /&gt;
 * The system log also is created here.&lt;br /&gt;
 *&lt;br /&gt;
 * This function sets up sysMetaPtr and init_meta_ptr and must have completed&lt;br /&gt;
 * successfully before tasks etc. can be created.&lt;br /&gt;
 *&lt;br /&gt;
 * It disables interrupts and leaves them disabled, they will be re-enabled to&lt;br /&gt;
 * the previous level after all tasks etc. have been created and&lt;br /&gt;
 * oceos_init_finish() has completed successfully.&lt;br /&gt;
 *&lt;br /&gt;
 * @param app_config Pointer to configuration struct&lt;br /&gt;
 * @return SUCCESSFUL                        All OK&lt;br /&gt;
 *         WARN_LOG_SIZE_DEFAULT             Warning, log size is set to default value of 64 entries&lt;br /&gt;
 *         WARN_NO_ERROR_FUNCTION            Warning, user defined function for ERROR handling is not provided&lt;br /&gt;
 *         ERR_CPU_FIRST_CORE_INVALID        Start CPU not in a range of available cores for this target; or greater than end CPU&lt;br /&gt;
 *         ERR_CPU_LAST_CORE_INVALID         Last CPU not in a range of available cores for this target&lt;br /&gt;
 *         ERR_NOT_START_CPU_CORE            Executing oceos_init on wrong CPU&lt;br /&gt;
 *         ERR_STACK_START_MISALIGNED        Stack start address is not set by user misaligned&lt;br /&gt;
 *         ERR_STACK_PER_CORE_INVALID        Stack per CPU size is zero, or not 8byte aligned, or less then min require&lt;br /&gt;
 *         ERR_LOG_ADDR_MISALIGNED           Log start address is not 8 byte aligned&lt;br /&gt;
 *         ERR_FIX_ADDR_MISALIGNED           Fixed area start address is not 8 byte aligned&lt;br /&gt;
 *         ERR_DYN_ADDR_MISALIGNED           Dynamic area start address is not 8 byte aligned&lt;br /&gt;
 *         ERR_CPU_CORE_RANGE_WRONG          CPU cores in use exceed available CPUs on the SoC&lt;br /&gt;
 *         ERR_STACK_SPACE_WRONG             Current CPU SP is not within user provided stack range&lt;br /&gt;
 *         ERR_LOG_SIZE_INVALID              Log size outside expected range&lt;br /&gt;
 *         ERR_CS_LOG_SIZE_INVALID           Context switch log size invalid&lt;br /&gt;
 *         ERR_TASK_NUMBER_INVALID           Number of tasks invalid&lt;br /&gt;
 *         ERR_MUTEX_NUMBER_INVALID          Number of mutexes invalid&lt;br /&gt;
 *         ERR_RWMUTEX_NUMBER_INVALID        Number of rwmutexes invalid&lt;br /&gt;
 *         ERR_SEM_NUMBER_INVALID            Number of semaphores invalid&lt;br /&gt;
 *         ERR_DATAQ_NUMBER_INVALID          Number of datqs invalid&lt;br /&gt;
 *         ERR_TIMED_ACTIONS_NUMBER_INVALID  Number of timed actions invalid&lt;br /&gt;
 *         ERR_OVERLAP_STACK                 Overlap stack end address with (two overlap areas are set)&lt;br /&gt;
 *         ERR_OVERLAP_LOG                   Overlap log with (two overlap areas are set)&lt;br /&gt;
 *         ERR_OVERLAP_FIXED                 Overlap fixed area with (two overlap areas are set)&lt;br /&gt;
 *         ERR_OVERLAP_DYNAMIC               Overlap dynamic area with (two overlap areas are set)&lt;br /&gt;
 *         ERR_FIXED_MEMORY_FAILED           Fixed area memory write fail&lt;br /&gt;
 *         ERR_DYNAMIC_MEMORY_FAILED         Dynamic area memory write fail&lt;br /&gt;
 *         ERR_TIMER_ADDR_INVALID            Timer address not provided by user (null). SPARC only&lt;br /&gt;
 *         ERR_SYS_TIMER_INDEX_INVALID       System timer index of subtimer invalid; SPARC only; Subtimers start from index 1; Need index of subtimer plus one in front&lt;br /&gt;
 *         ERR_PERIPHERAL_CLOCK_INVALID      System peripheral code invalid&lt;br /&gt;
 *&lt;br /&gt;
 */&lt;br /&gt;
S32_t   oceos_init(&lt;br /&gt;
    const struct application_configuration app_config&lt;br /&gt;
);&lt;br /&gt;
 &amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| app_config || Pointer to configuration struct.  struct application_configuration defined in '''''basic_structs.h'''''&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| WARN_LOG_SIZE_DEFAULT             || Warning, log size is set to default value of 64 entries&lt;br /&gt;
|-&lt;br /&gt;
| WARN_NO_ERROR_FUNCTION            || Warning, user defined function for ERROR handling is not provided&lt;br /&gt;
|-&lt;br /&gt;
| ERR_CPU_FIRST_CORE_INVALID        || Start CPU not in a range of available cores for this target; or greater than end CPU&lt;br /&gt;
|-&lt;br /&gt;
| ERR_CPU_LAST_CORE_INVALID         || Last CPU not in a range of available cores for this target&lt;br /&gt;
|-&lt;br /&gt;
| ERR_NOT_START_CPU_CORE            || Executing oceos_init on wrong CPU&lt;br /&gt;
|-&lt;br /&gt;
| ERR_STACK_START_MISALIGNED        || Stack start address is not set by user misaligned&lt;br /&gt;
|-&lt;br /&gt;
| ERR_STACK_PER_CORE_INVALID        || Stack per CPU size is zero, or not 8byte aligned, or less then min require&lt;br /&gt;
|-&lt;br /&gt;
| ERR_LOG_ADDR_MISALIGNED           || Log start address is not 8 byte aligned&lt;br /&gt;
|-&lt;br /&gt;
| ERR_FIX_ADDR_MISALIGNED           || Fixed area start address is not 8 byte aligned&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DYN_ADDR_MISALIGNED           || Dynamic area start address is not 8 byte aligned&lt;br /&gt;
|-&lt;br /&gt;
| ERR_CPU_CORE_RANGE_WRONG          || CPU cores in use exceed available CPUs on the SoC&lt;br /&gt;
|-&lt;br /&gt;
| ERR_STACK_SPACE_WRONG             || Current CPU SP is not within user provided stack range&lt;br /&gt;
|-&lt;br /&gt;
| ERR_LOG_SIZE_INVALID              || Log size outside expected range&lt;br /&gt;
|-&lt;br /&gt;
| ERR_CS_LOG_SIZE_INVALID           || Context switch log size invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TASK_NUMBER_INVALID           || Number of tasks invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_MUTEX_NUMBER_INVALID          || Number of mutexes invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_RWMUTEX_NUMBER_INVALID        || Number of rwmutexes invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SEM_NUMBER_INVALID            || Number of semaphores invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DATAQ_NUMBER_INVALID          || Number of datqs invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TIMED_ACTIONS_NUMBER_INVALID  || Number of timed actions invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_OVERLAP_STACK                 || Overlap stack end address with (two overlap areas are set)&lt;br /&gt;
|-&lt;br /&gt;
| ERR_OVERLAP_LOG                   || Overlap log with (two overlap areas are set)&lt;br /&gt;
|-&lt;br /&gt;
| ERR_OVERLAP_FIXED                 || Overlap fixed area with (two overlap areas are set)&lt;br /&gt;
|-&lt;br /&gt;
| ERR_OVERLAP_DYNAMIC               || Overlap dynamic area with (two overlap areas are set)&lt;br /&gt;
|-&lt;br /&gt;
| ERR_FIXED_MEMORY_FAILED           || Fixed area memory write fail&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DYNAMIC_MEMORY_FAILED         || Dynamic area memory write fail&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TIMER_ADDR_INVALID            || Timer address not provided by user (null). SPARC only&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_TIMER_INDEX_INVALID       || System timer index of subtimer invalid; SPARC only; Subtimers start from index 1; Need index of subtimer plus one in front&lt;br /&gt;
|-&lt;br /&gt;
| ERR_PERIPHERAL_CLOCK_INVALID      || System peripheral code invalid&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
    /*&lt;br /&gt;
     * Create the application configuration structure&lt;br /&gt;
     */&lt;br /&gt;
    struct application_configuration           app_config = {0};&lt;br /&gt;
&lt;br /&gt;
    /*&lt;br /&gt;
     * Fill in the application parameters&lt;br /&gt;
     */&lt;br /&gt;
    app_config.log_address                   = (log_t)log_data;              // required&lt;br /&gt;
    app_config.fixed_data_address            = (adrs_t)fixed_data;            // required&lt;br /&gt;
    app_config.dynamic_data_address          = (adrs_t)dynamic_data;          // required&lt;br /&gt;
&lt;br /&gt;
    app_config.stack_start_address           = start_stack_array[OCEOS_START_CPU_INDEX];// OCEOSMP_STACK_START_ADDRESS;&lt;br /&gt;
    app_config.stack_size_per_cpu            = (U32_t)&amp;amp;__oceos_stack_size_per_cpu;  // OCEOSMP_STACK_LOW_BOUND_ADDRESS;&lt;br /&gt;
&lt;br /&gt;
    app_config.system_error_function         = oceosmp_on_error;               // NULL =&amp;gt; ignore&lt;br /&gt;
    app_config.log_full_function             = oceosmp_on_full_log;            // NULL =&amp;gt; ignore&lt;br /&gt;
&lt;br /&gt;
    // used in setting up system log and fixed data array&lt;br /&gt;
    app_config.log_number_of_entries         = NUMBER_OF_LOG_ENTRIES;          // 0 =&amp;gt; use default&lt;br /&gt;
&lt;br /&gt;
    app_config.number_of_tasks               = NUMBER_OF_TASKS;                // &amp;gt;= 1&lt;br /&gt;
&lt;br /&gt;
    app_config.number_of_mutexes             = NUMBER_OF_MUTEXES;&lt;br /&gt;
	app_config.number_of_rwmutexes			 = NUMBER_OF_RWMUTEXES;&lt;br /&gt;
    app_config.number_of_counting_semaphores = NUMBER_OF_SEMAPHORES;&lt;br /&gt;
    app_config.number_of_data_queues         = NUMBER_OF_DATAQS;&lt;br /&gt;
&lt;br /&gt;
    /**&lt;br /&gt;
     * FOR SPARC TARGET ONLY.&lt;br /&gt;
     */&lt;br /&gt;
    app_config.sys_time_timer_index          = SYS_TIME_TIMER_INDEX;           // 0 =&amp;gt; invalid index&lt;br /&gt;
    /**&lt;br /&gt;
     * FOR SPARC TARGET ONLY.&lt;br /&gt;
     * Not Used for ARM. Always Nested&lt;br /&gt;
     */&lt;br /&gt;
    app_config.interrupt_nesting_enabled     = TRUE;                           // TRUE =&amp;gt; single vector&lt;br /&gt;
    app_config.oceos_cpu_switch_int_number   = OCEOS_CPU_INTER_COM_INT_NUMBER; // User should provide SGI ID (0-15)&lt;br /&gt;
&lt;br /&gt;
    app_config.timed_actions_queue_size      = NUMBER_OF_ACTION_ENTRIES;&lt;br /&gt;
    app_config.CS_log_entries_base2          = CS_LOG_DEF_ENTRIES_BASE2;&lt;br /&gt;
    /**&lt;br /&gt;
     * Set starting index of CPU that will be used by OCEOSMP&lt;br /&gt;
     */&lt;br /&gt;
    app_config.oceos_cpu_start_index         = OCEOS_START_CPU_INDEX;&lt;br /&gt;
    /**&lt;br /&gt;
     * Set last index of CPU that will be used by OCEOSMP&lt;br /&gt;
     */&lt;br /&gt;
    app_config.oceos_cpu_last_index          = OCEOS_LAST_CPU_INDEX;&lt;br /&gt;
    /*&lt;br /&gt;
     * Set system/peripheral clock used to initialise system timer&lt;br /&gt;
     */&lt;br /&gt;
    app_config.soc_peripheral_clck           = BSP_SYSFREQ * 1000 * 1000;&lt;br /&gt;
&lt;br /&gt;
    // initialise OCEOSMP&lt;br /&gt;
    S32_t status;&lt;br /&gt;
    status = oceos_init(app_config);&lt;br /&gt;
    if (OCEOS_SUCCESS &amp;gt; status) {&lt;br /&gt;
      oceosmp_print(&amp;quot;\n oceos_init failure\n\r&amp;quot;);&lt;br /&gt;
      return 0;&lt;br /&gt;
    } else {&lt;br /&gt;
      return 1;&lt;br /&gt;
    }   // else&lt;br /&gt;
 &amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_init_finish()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''initialisation.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Finalizes the fixed data array after all tasks etc. have been created&lt;br /&gt;
&lt;br /&gt;
All information needed to start OCEOS can be found in the fixed data area&lt;br /&gt;
when oceos_init_finish() has completed.&lt;br /&gt;
&lt;br /&gt;
Once all tasks etc. have been created oceos_init_finish() checks the&lt;br /&gt;
accumulated information against the application configuration data&lt;br /&gt;
stored in the fixed meta structure.&lt;br /&gt;
&lt;br /&gt;
oceos_init_finish also calculates the size of the dynamic data area and&lt;br /&gt;
checks it does not overlap with the system stack, the system log, or the&lt;br /&gt;
fixed data, and if all ok sets up pointers to the various dynamic area&lt;br /&gt;
components in the fixed data.&lt;br /&gt;
&lt;br /&gt;
It then adds an XOR checksum to the fixed data area, and checks that this&lt;br /&gt;
is followed by FILLER, which it replaces with the end sentinel.&lt;br /&gt;
&lt;br /&gt;
On successful completion it restores the interrupt level to its value&lt;br /&gt;
before oceos_init() was called, otherwise interrupts remain disabled.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Finalizes the fixed data array after all tasks etc. have been created&lt;br /&gt;
 *&lt;br /&gt;
 * All information needed to start OCEOS can be found in the fixed data area&lt;br /&gt;
 * when oceos_init_finish() has completed.&lt;br /&gt;
 *&lt;br /&gt;
 * Once all tasks etc. have been created oceos_init_finish() checks the&lt;br /&gt;
 * accumulated information against the application configuration data&lt;br /&gt;
 * stored in the fixed meta structure.&lt;br /&gt;
 *&lt;br /&gt;
 * oceos_init_finish also calculates the size of the dynamic data area and&lt;br /&gt;
 * checks it does not overlap with the system stack, the system log, or the&lt;br /&gt;
 * fixed data, and if all ok sets up pointers to the various dynamic area&lt;br /&gt;
 * components in the fixed data.&lt;br /&gt;
 *&lt;br /&gt;
 * It then adds an XOR checksum to the fixed data area, and checks that this&lt;br /&gt;
 * is followed by FILLER, which it replaces with the end sentinel.&lt;br /&gt;
 *&lt;br /&gt;
 * On successful completion it restores the interrupt level to its value&lt;br /&gt;
 * before oceos_init() was called, otherwise interrupts remain disabled.&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS                             All OK&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT               System Meta data is NULL or corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT                 System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_CPU_CORE                  Executing directive on wrong CPU&lt;br /&gt;
 *          ERR_WRONG_PHASE                     Called before oceos_init()&lt;br /&gt;
 *          ERR_TASKS_INCOMPLETE                Created wrong number of tasks&lt;br /&gt;
 *          ERR_MUTEX_INCOMPLETE                Created wrong number of mutexes&lt;br /&gt;
 *          ERR_RWMUTEX_INCOMPLETE              Created wrong number of rwmutexes&lt;br /&gt;
 *          ERR_SEM_INCOMPLETE                  Created wrong number of semaphores&lt;br /&gt;
 *          ERR_DATAQ_INCOMPLETE                Created wrong number of dataqs&lt;br /&gt;
 *          ERR_TASK_MAX_ID_INVALID             Task's max id invalid&lt;br /&gt;
 *          ERR_MUTEX_MAX_ID_INVALID            Mutexe's max id invalid&lt;br /&gt;
 *          ERR_RWMUTEX_MAX_ID_INVALID          Rwmutexe's max id invalid&lt;br /&gt;
 *          ERR_SEM_MAX_ID_INVALID              Semaphore's max id invalid&lt;br /&gt;
 *          ERR_DATAQ_MAX_ID_INVALID            Dataq's max id invalid&lt;br /&gt;
 *          ERR_TOTAL_JOBS_NUMBER_WRONG         Wrong number of total jobs created&lt;br /&gt;
 *          ERR_ORDER_ARRAY_PTR_INVALID         Order array pointer is NULL or mis-aligned&lt;br /&gt;
 *          ERR_FIXED_AREA_TOO_SMALL            Not enough space for fixed data area&lt;br /&gt;
 */&lt;br /&gt;
S32_t   oceos_init_finish(void);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
There are no input parameters to this function.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit  || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT               || System Meta data is NULL or corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT                 || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_CPU_CORE                  || Executing directive on wrong CPU&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE                     || Called before oceos_init()&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TASKS_INCOMPLETE                || Created wrong number of tasks&lt;br /&gt;
|-&lt;br /&gt;
| ERR_MUTEX_INCOMPLETE                || Created wrong number of mutexes&lt;br /&gt;
|-&lt;br /&gt;
| ERR_RWMUTEX_INCOMPLETE              || Created wrong number of rwmutexes&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SEM_INCOMPLETE                  || Created wrong number of semaphores&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DATAQ_INCOMPLETE                || Created wrong number of dataqs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TASK_MAX_ID_INVALID             || Task's max id invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_MUTEX_MAX_ID_INVALID            || Mutexe's max id invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_RWMUTEX_MAX_ID_INVALID          || Rwmutexe's max id invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SEM_MAX_ID_INVALID              || Semaphore's max id invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DATAQ_MAX_ID_INVALID            || Dataq's max id invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TOTAL_JOBS_NUMBER_WRONG         || Wrong number of total jobs created&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ORDER_ARRAY_PTR_INVALID         || Order array pointer is NULL or mis-aligned&lt;br /&gt;
|-&lt;br /&gt;
| ERR_FIXED_AREA_TOO_SMALL            || Not enough space for fixed data area&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
    /*&lt;br /&gt;
     * Finish initialising OCEOS and setting up the fixed data&lt;br /&gt;
     */&lt;br /&gt;
    status = oceos_init_finish();&lt;br /&gt;
    if(OCEOS_SUCCESS &amp;gt; status){&lt;br /&gt;
        // LOG&lt;br /&gt;
      oceosmp_print(&amp;quot;\nAbandoning, problem ending OCEOS initialisation\n\r&amp;quot;);&lt;br /&gt;
        return -1;&lt;br /&gt;
    }   // if&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_start()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''initialisation.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Starts OCEOS scheduling.&amp;lt;br&amp;gt;&lt;br /&gt;
Create dynamic OCEOS structures and start scheduling.&amp;lt;br&amp;gt;&lt;br /&gt;
This function should only be called once and only after [[OCEOSmp/directive_reference#oceos_init()|oceos_init()]] and [[OCEOSmp/directive_reference#oceos_init_finish()|oceos_init_finish()]] have been called successfully.&amp;lt;br&amp;gt;&lt;br /&gt;
Normally this function does not return. &amp;lt;br&amp;gt;&lt;br /&gt;
If a problem is detected the function terminates and returns an appropriate DIRECTIVE_STATUS code, with interrupts disabled.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Starts OCEOS scheduling&lt;br /&gt;
 *&lt;br /&gt;
 * Create dynamic OCEOS structures and start scheduling&lt;br /&gt;
 *&lt;br /&gt;
 * This function should only be called once&lt;br /&gt;
 * and only after oceos_init()&lt;br /&gt;
 * and oceos_init_finish() have&lt;br /&gt;
 *  been called successfully.&lt;br /&gt;
 * Normally this function does not return.&lt;br /&gt;
 * If a problem is detected the function&lt;br /&gt;
 * terminates and returns an appropriate&lt;br /&gt;
 * DIRECTIVE_STATUS code, with interrupts disabled.&lt;br /&gt;
 *&lt;br /&gt;
 * @param fixed_array_ptr   Pointer to fixed data array&lt;br /&gt;
 * @param start_task        Task ID&lt;br /&gt;
 * @param data_ptr          Pointer to data to be passed to the task&lt;br /&gt;
 * @return  OCEOSMP_EXIT                        OCEOSMP return from scheduling and exit&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT               Fixed area pointer is null or bad sentinel&lt;br /&gt;
 *          ERR_FIXED_AREA_SIZE_WRONG           Fixed area size is zero&lt;br /&gt;
 *          ERR_FIXED_AREA_END_SENTINEL_BAD     Fixed data end sentinel corrupt&lt;br /&gt;
 *          ERR_FIXED_AREA_BAD_XOR              Fixed area bad checksum or checksum mis-match&lt;br /&gt;
 *          ERR_INIT_NOT_DONE                   oceos_start() called without initialisation&lt;br /&gt;
 *          ERR_DYN_AREA_PTR_BAD                Dynamic area pointer invalid in sysMetaPtr&lt;br /&gt;
 *          ERR_INT_HANDLER_BAD                 IRQ controller pointer provided by BCC is NULL;or OCEOS handler is not set&lt;br /&gt;
 *          ERR_DYN_JOB_PTR_BAD                 Job array pointer is NULL&lt;br /&gt;
 *          ERR_FIXED_TASK_PTR_BAD              Tasks array pointer is NULL&lt;br /&gt;
 *          ERR_JOB_COUNT_WRONG                 Total job count inconsistent&lt;br /&gt;
 *          ERR_DYN_MUTEX_PTR_BAD               Mutex dynamic pointer is NULL&lt;br /&gt;
 *          ERR_DYN_LOCK_PTR_BAD                Mutex lock array pointer is NULL&lt;br /&gt;
 *          ERR_DYN_RWMUTEX_PTR_BAD             Rwmutex dynamic pointer is NULL&lt;br /&gt;
 *          ERR_DYN_RWLOCK_PTR_BAD              Rwmutex lock array pointer is NULL&lt;br /&gt;
 *          ERR_FIXED_SEM_PTR_BAD               Semaphore fixed pointer is NULL&lt;br /&gt;
 *          ERR_DYN_SEM_PTR_BAD                 Semaphore dynamic pointer is NULL&lt;br /&gt;
 *          ERR_SEM_PEND_PTR_BAD                Semaphore pending queue pointer is NULL&lt;br /&gt;
 *          ERR_FIXED_DATAQ_PTR_BAD             Dataq fixed pointer is NULL&lt;br /&gt;
 *          ERR_DYN_DATAQ_PTR_BAD               Dataq dynamic pointer is NULL&lt;br /&gt;
 *          ERR_DATAQ_PEND_PTR_BAD              Dataq pending queue pointer is NULL&lt;br /&gt;
 *          ERR_DATAQ_DATA_PTR_BAD              Dataq data pointer is NULL&lt;br /&gt;
 *          ERR_CPU_INT_NUMBER_INVALID          SPARC only.IRQ number for CPU inter-comunication invalid(zero or used by timer)&lt;br /&gt;
 *          ERR_REGISTER_CPU_IRQ_FAILED         SPARC only. Failed to set CPU IRQ handler in BCC&lt;br /&gt;
 *          ERR_CPU_STACK_INVALID               Current CPU stack not within specified range&lt;br /&gt;
 *          ERR_CPU_PRIORITY_STACK_INVALID      Per CPU priority stack invalid&lt;br /&gt;
 *          ERR_LOG_AREA_END_SENTINEL_BAD       Log area end sentinel override&lt;br /&gt;
 *          ERR_TA_CONFIG_PTR_BAD               SPARC only; Timed action configuration data pointer is NULL&lt;br /&gt;
 *          ERR_TA_TIMER_INDEX_INVALID          SPARC only; Timed action sub-timer index in timer unit is invalid&lt;br /&gt;
 *          ERR_TA_IRQ_NUMBER_INVALID           SPARC only; Timer action timer IRQ number is invalid&lt;br /&gt;
 *          ERR_TA_BCC_IRQ_REGISTER_FAILED      SPARC only; Timed action timer IRQ handler failed to register&lt;br /&gt;
 */&lt;br /&gt;
S32_t   oceos_start(&lt;br /&gt;
    const U32_t * const fixed_array_ptr,// pointer to fixed data array&lt;br /&gt;
    const U32_t start_task,             // taskID&lt;br /&gt;
    void * const data_ptr               // pointer to data to be passed to task&lt;br /&gt;
);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| fixed_array_ptr || Pointer to fixed data array&lt;br /&gt;
|-&lt;br /&gt;
| start_task      || Task ID&lt;br /&gt;
|-&lt;br /&gt;
| data_ptr        || Pointer to data to be passed to the task&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit  || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT               || Fixed area pointer is null or bad sentinel&lt;br /&gt;
|-&lt;br /&gt;
| ERR_FIXED_AREA_SIZE_WRONG           || Fixed area size is zero&lt;br /&gt;
|-&lt;br /&gt;
| ERR_FIXED_AREA_END_SENTINEL_BAD     || Fixed data end sentinel corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_FIXED_AREA_BAD_XOR              || Fixed area bad checksum or checksum mis-match&lt;br /&gt;
|-&lt;br /&gt;
| ERR_INIT_NOT_DONE                   || oceos_start() called without initialisation&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DYN_AREA_PTR_BAD                || Dynamic area pointer invalid in sysMetaPtr&lt;br /&gt;
|-&lt;br /&gt;
| ERR_INT_HANDLER_BAD                 || IRQ controller pointer provided by BCC is NULL;or OCEOS handler is not set&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DYN_JOB_PTR_BAD                 || Job array pointer is NULL&lt;br /&gt;
|-&lt;br /&gt;
| ERR_FIXED_TASK_PTR_BAD              || Tasks array pointer is NULL&lt;br /&gt;
|-&lt;br /&gt;
| ERR_JOB_COUNT_WRONG                 || Total job count inconsistent&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DYN_MUTEX_PTR_BAD               || Mutex dynamic pointer is NULL&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DYN_LOCK_PTR_BAD                || Mutex lock array pointer is NULL&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DYN_RWMUTEX_PTR_BAD             || Rwmutex dynamic pointer is NULL&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DYN_RWLOCK_PTR_BAD              || Rwmutex lock array pointer is NULL&lt;br /&gt;
|-&lt;br /&gt;
| ERR_FIXED_SEM_PTR_BAD               || Semaphore fixed pointer is NULL&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DYN_SEM_PTR_BAD                 || Semaphore dynamic pointer is NULL&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SEM_PEND_PTR_BAD                || Semaphore pending queue pointer is NULL&lt;br /&gt;
|-&lt;br /&gt;
| ERR_FIXED_DATAQ_PTR_BAD             || Dataq fixed pointer is NULL&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DYN_DATAQ_PTR_BAD               || Dataq dynamic pointer is NULL&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DATAQ_PEND_PTR_BAD              || Dataq pending queue pointer is NULL&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DATAQ_DATA_PTR_BAD              || Dataq data pointer is NULL&lt;br /&gt;
|-&lt;br /&gt;
| ERR_CPU_INT_NUMBER_INVALID          || SPARC only.IRQ number for CPU inter-comunication invalid(zero or used by timer)&lt;br /&gt;
|-&lt;br /&gt;
| ERR_REGISTER_CPU_IRQ_FAILED         || SPARC only. Failed to set CPU IRQ handler in BCC&lt;br /&gt;
|-&lt;br /&gt;
| ERR_CPU_STACK_INVALID               || Current CPU stack not within specified range&lt;br /&gt;
|-&lt;br /&gt;
| ERR_CPU_PRIORITY_STACK_INVALID      || Per CPU priority stack invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_LOG_AREA_END_SENTINEL_BAD       || Log area end sentinel override&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_CONFIG_PTR_BAD               || SPARC only; Timed action configuration data pointer is NULL&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_TIMER_INDEX_INVALID          || SPARC only; Timed action sub-timer index in timer unit is invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_IRQ_NUMBER_INVALID           || SPARC only; Timer action timer IRQ number is invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_BCC_IRQ_REGISTER_FAILED      || SPARC only; Timed action timer IRQ handler failed to register&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/* Sample Task names - all here start with t_ to help avoid name confusion */&lt;br /&gt;
enum TASK_NAME{&lt;br /&gt;
    t_tom,                      // will have task ID 0&lt;br /&gt;
    t_dick,                     // will have task ID 1&lt;br /&gt;
};&lt;br /&gt;
extern U32_t fixed_data[];&lt;br /&gt;
...&lt;br /&gt;
S32_t status;&lt;br /&gt;
&lt;br /&gt;
status = oceos_start(fixed_data, t_tom, NULL);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_exit()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''initialisation.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Ends scheduling and exit from [[OCEOSmp/directive_reference#oceos_start()|oceos_start()]].&lt;br /&gt;
No task can be started after this.&amp;lt;br&amp;gt;&lt;br /&gt;
OCEOS will exit when the current job ends.&amp;lt;br&amp;gt;&lt;br /&gt;
An idle task in an endless loop should check that scheduling is enabled.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Ends scheduling and exit from oceos_start.&lt;br /&gt;
 * No task can be started after this.&lt;br /&gt;
 * OCEOS will exit when the current job ends.&lt;br /&gt;
 * An idle task in an endless loop should check that scheduling is enabled.&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Called before scheduling started&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_exit(void);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
There are no input parameters to this function.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit  || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Called before scheduling started&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
// Exit OCEOS&lt;br /&gt;
oceos_exit();&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_CPU_sleep()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''initialisation.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
 Puts CPU in sleep mode.&amp;lt;br&amp;gt;&lt;br /&gt;
 User must to be sure that interrupts are enabled.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Puts CPU in sleep mode.&lt;br /&gt;
 * User must to be sure that interrupts are enabled.&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_CPU_sleep(void);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
There are no input parameters to this function.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
// Put CPU to sleep&lt;br /&gt;
oceos_CPU_sleep();&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceosmp_cpu_disable()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''initialisation.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function ends execution of all tasks running on particular CPU and removes the CPU from scheduling.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Ends execution of all tasks running on particular CPU and removes this CPU from scheduling.&lt;br /&gt;
 * @param cpu_id&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              CPU ID outside allowed range 0 to 254&lt;br /&gt;
 *          ERR_ID_WRONG                CPU ID &amp;gt;= number of available CPUs&lt;br /&gt;
 *          ERR_CPU_ALREADY_DISABLED    CPU already disabled&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceosmp_cpu_disable(&lt;br /&gt;
    U32_t cpu_id&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| cpu_id || ID of CPU core to be disabled.&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit  || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || CPU ID outside allowed range 0 to 254&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || CPU ID &amp;gt;= number of available CPUs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_CPU_ALREADY_DISABLED    || CPU already disabled&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, faulty_cpu;&lt;br /&gt;
...&lt;br /&gt;
// Disable faulty CPU core&lt;br /&gt;
status = oceosmp_cpu_disable(faulty_cpu));&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceosmp_cpu_enable()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''initialisation.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function adds a disabled CPU core to the OCEOSmp scheduler. It should only be called after scheduling has started&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 *  Adds disabled CPU to OCEOSmp scheduler&lt;br /&gt;
 *&lt;br /&gt;
 *  N.B. This function should only be called after scheduling has started&lt;br /&gt;
 *&lt;br /&gt;
 * @param cpu_id&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              CPU ID outside allowed range 0 to 254&lt;br /&gt;
 *          ERR_ID_WRONG                CPU ID &amp;gt;= number of available CPUs; or the same as currently running&lt;br /&gt;
 *          ERR_CPU_ALREADY_ENABLED     CPU already enabled&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceosmp_cpu_enable(&lt;br /&gt;
    U32_t cpu_id&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| cpu_id || ID of CPU core to be enabled.&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit  || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || CPU ID outside allowed range 0 to 254&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || CPU ID &amp;gt;= number of available CPUs; or the same as currently running&lt;br /&gt;
|-&lt;br /&gt;
| ERR_CPU_ALREADY_ENABLED     || CPU already enabled&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, good_cpu;&lt;br /&gt;
...&lt;br /&gt;
// Enable CPU core&lt;br /&gt;
status = oceosmp_cpu_enable(good_cpu));&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceosmp_cpu_terminate()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''initialisation.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function removes a CPU core from the OCEOSmp scheduler and marks it so it cannot be restarted. It puts CPU to sleep with interrupts disabled. It should only be called after scheduling has started.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 *  Removes CPU from OCEOSMP scheduler and terminates, cannot be restarted.&lt;br /&gt;
 *  Puts CPU to sleep with interrupts disabled&lt;br /&gt;
 *&lt;br /&gt;
 *  N.B. This function should only be called after scheduling has started&lt;br /&gt;
 *  Steps:&lt;br /&gt;
 *     1. Set terminate flag on this CPU;&lt;br /&gt;
 *     2. Trigger software interrupt to transfer execution to IRQ handler;&lt;br /&gt;
 *     3. Check flag and if set =&amp;gt; put CPU to sleep in while loop with interrupts disabled;&lt;br /&gt;
 *     4. Set MAX priority on this CPU priority stack;&lt;br /&gt;
 *     5. Remove CPU from scheduling;&lt;br /&gt;
 *     6. Clean up all the tasks by calling task terminate function and free up all the&lt;br /&gt;
 *        preempted jobs by this CPU;&lt;br /&gt;
 *&lt;br /&gt;
 * @param cpu_id&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              CPU ID outside allowed range 0 to 254&lt;br /&gt;
 *          ERR_ID_WRONG                CPU ID &amp;gt;= number of available CPUs; or the same as currently running&lt;br /&gt;
 *          ERR_CPU_ALREADY_TERMINATED  CPU already terminated&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceosmp_cpu_terminate(&lt;br /&gt;
    U32_t cpu_id&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| cpu_id || ID of CPU core to be terminated.&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit  || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || CPU ID outside allowed range 0 to 254&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || CPU ID &amp;gt;= number of available CPUs; or the same as currently running&lt;br /&gt;
|-&lt;br /&gt;
| ERR_CPU_ALREADY_TERMINATED  || CPU already terminated&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, faulty_cpu;&lt;br /&gt;
...&lt;br /&gt;
// Terminate CPU core&lt;br /&gt;
status = oceosmp_cpu_terminate(faulty_cpu));&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;Task directives&amp;lt;/span&amp;gt;==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ API Functions&lt;br /&gt;
|-&lt;br /&gt;
| Directive                                                                     || Description                          || main || task || IRQ handler&lt;br /&gt;
|-&lt;br /&gt;
| [[OCEOSmp/directive reference#oceos_task_create()| oceos_task_create()]]             || Create Task                        || *    ||      || &lt;br /&gt;
|-&lt;br /&gt;
| [[OCEOSmp/directive reference#oceos_task_start()| oceos_task_start()]]               || Start Task                         ||      ||  *   || *&lt;br /&gt;
|-&lt;br /&gt;
| [[OCEOSmp/directive reference#oceos_task_timed_start()| oceos_task_timed_start()]]   || Schedule a task to start execution at a given system time||      ||  *   || *&lt;br /&gt;
|-&lt;br /&gt;
| [[OCEOSmp/directive reference#oceos_task_disable()| oceos_task_disable()]]           || Disable Task                       ||      ||  *   || *&lt;br /&gt;
|-&lt;br /&gt;
| [[OCEOSmp/directive reference#oceos_task_enable()| oceos_task_enable()]]             || Enable Task                        ||      ||  *   || *&lt;br /&gt;
|-&lt;br /&gt;
| [[OCEOSmp/directive reference#oceos_task_self()| oceos_task_self()]]                 || Returns the task ID of the currently executing task ||    ||  *   || *&lt;br /&gt;
|-&lt;br /&gt;
| [[OCEOSmp/directive reference#oceos_task_get_priority()| oceos_task_get_priority()]] || Get priority of a task             ||      ||  *   || *&lt;br /&gt;
|-&lt;br /&gt;
| [[OCEOSmp/directive reference#oceos_task_get_status()| oceos_task_get_status()]]     || Get status of a task               ||      ||  *   || *&lt;br /&gt;
|-&lt;br /&gt;
| [[OCEOSmp/directive reference#oceos_task_kill()| oceos_task_kill()]]                 || Directive to terminate current task||      ||  *   || *&lt;br /&gt;
|-&lt;br /&gt;
| [[OCEOSmp/directive reference#oceos_task_get_info()| oceos_task_get_info()]]         || Get task information               ||      ||  *   || *&lt;br /&gt;
|-&lt;br /&gt;
| [[OCEOSmp/directive reference#oceosmp_task_kill()| oceosmp_task_kill()]]                 || Directive to terminate current task||      ||  *   || *&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;Task data structures&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''tasks.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The following data structures are used by some of the task directives.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Data structures'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * A pointer to this structure is passed to oceos_task_create().&lt;br /&gt;
 * The structure is first initialised according to a tasks's parameters,&lt;br /&gt;
 * and is not used again after the task is created and may then be discarded.&lt;br /&gt;
 */&lt;br /&gt;
struct task_descriptor {&lt;br /&gt;
&lt;br /&gt;
	void (*function_start)(void*);	// name of task start function&lt;br /&gt;
	void (*function_end)(void*);	// optional, NULL or task end function&lt;br /&gt;
&lt;br /&gt;
	U32_t task_id;					// 0 to 254, usually an enum&lt;br /&gt;
	U32_t task_jobs_max;			// 1 to 15, max concurrent 'jobs'&lt;br /&gt;
	U32_t task_priority;			// 1 (highest) to 254 (lowest)&lt;br /&gt;
	U32_t task_threshold;			// &amp;gt;=1, &amp;lt;= task_priority (higher or same priority)&lt;br /&gt;
	U32_t task_turned_on_initially;	// 0: disabled initially, else enabled&lt;br /&gt;
&lt;br /&gt;
	U32_t time_deadline_microsecs;	// start request to finish, 0 to ignore&lt;br /&gt;
	U32_t time_min_interval_microsecs;	// between start requests, 0 to ignore&lt;br /&gt;
&lt;br /&gt;
	U32_t uses_cpu_affinity;		// 0: not restricted, else core restricted&lt;br /&gt;
	U32_t uses_cpu_affinity_core_id;// core ID to which restricted if affinity used&lt;br /&gt;
}__attribute__ ((aligned (8)));&lt;br /&gt;
&lt;br /&gt;
/**&lt;br /&gt;
 * Task info used with oceos_task_get_info&lt;br /&gt;
 */&lt;br /&gt;
struct task_info {&lt;br /&gt;
  U64_t           time_max_delay;               // maximum time job is waiting on ready queue before becoming active&lt;br /&gt;
  U64_t           time_max_finish;              // maximum time to finish job execution after starting&lt;br /&gt;
  U64_t           time_max_exec;                // maximum time spent executing&lt;br /&gt;
  U64_t           time_total_exec;              // total CPU time used by this task&lt;br /&gt;
  U64_t           time_min_gap_starts;          // minimum time between job creations, can be reset&lt;br /&gt;
  U64_t           time_min_gap_finish_start;    // minimum time between job ending and new job creation, can be reset&lt;br /&gt;
&lt;br /&gt;
  U64_t           time_last_start;              // time of most recent job creation&lt;br /&gt;
  U64_t           time_last_finish;             // time of most recent job finish&lt;br /&gt;
&lt;br /&gt;
  unsigned int    jobs_current_max  :16;        // maximum number of current jobs for this task, no roll over, can be reset&lt;br /&gt;
  unsigned int    jobs_total        :16;        // number of times this task was started, no roll-over, can be reset&lt;br /&gt;
  U32_t           jobs_current;                 // Number of task instances currently in use by oceos&lt;br /&gt;
&lt;br /&gt;
  U32_t           preempt_max;                  // maximum times any job was pre-empted, no roll-over, can be reset&lt;br /&gt;
}__attribute__ ((aligned (8)));&lt;br /&gt;
&lt;br /&gt;
/* A task's status is returned as below if queried */&lt;br /&gt;
enum TASK_STATUS {&lt;br /&gt;
    TASK_DISABLED,      // cannot be scheduled, and no current jobs&lt;br /&gt;
    TASK_ENABLED,       // can be scheduled, but no current jobs&lt;br /&gt;
    TASK_INVALID,       // task does not exist&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_task_create()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''tasks.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Create a task.&lt;br /&gt;
Can only be use before OCEOS starts. Stores the task information in the OCEOS fixed data area.&lt;br /&gt;
This directive populates the data structures for a task. It should be called after [[OCEOSmp/directive_reference#oceos_init()|oceos_init()]] and before [[OCEOSmp/directive_reference#oceos_init_finish()|oceos_init_finish()]].&amp;lt;br&amp;gt;&lt;br /&gt;
It must be called for each task otherwise [[OCEOSmp/directive_reference#oceos_start()|oceos_start()]] will return an error.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Create a task using a task descriptor structure&lt;br /&gt;
 *&lt;br /&gt;
 * Can only be used in Initialisation Phase.&lt;br /&gt;
 *&lt;br /&gt;
 * A task has twelve constant parameters set when the task is created.&lt;br /&gt;
 * Rather than setting a list of these parameters the named fields of a&lt;br /&gt;
 * task_descriptor structure are set and a pointer to it passed here.&lt;br /&gt;
 *&lt;br /&gt;
 * The task_descriptor structure fields are described above.&lt;br /&gt;
 * Once the task has been created the structure can be discarded.&lt;br /&gt;
 *&lt;br /&gt;
 * To create a task:&lt;br /&gt;
 *		set up a task_descriptor structure,&lt;br /&gt;
 *		set its fields to the parameter values for the task,&lt;br /&gt;
 *		pass a pointer to the structure to this directive.&lt;br /&gt;
 *&lt;br /&gt;
 * The structure is checked for validity by oceos_task_create and its&lt;br /&gt;
 * information used to set the task details in the OCEOS fixed data area.&lt;br /&gt;
 *&lt;br /&gt;
 * @param  struct task_descriptor *	fields give task characteristics&lt;br /&gt;
 *&lt;br /&gt;
 * @return OCEOS_SUCCESS            No errors or warnings&lt;br /&gt;
 *         WARN_NO_END_FUNCTION     Warning, no end task function specified&lt;br /&gt;
 *&lt;br /&gt;
 *         ERR_SYS_FIXED_CORRUPT    System Fixed area corrupt&lt;br /&gt;
 *         ERR_WRONG_CPU_CORE       Executing directive on wrong CPU&lt;br /&gt;
 *         ERR_WRONG_PHASE          Called before oceos_init() is done&lt;br /&gt;
 *         ERR_TOO_MANY             MAX number of tasks already created&lt;br /&gt;
 *         ERR_ID_INVALID           Task ID outside allowed range 0 to 254&lt;br /&gt;
 *         ERR_ID_WRONG             Task ID outside &amp;gt;= number of tasks&lt;br /&gt;
 *         ERR_T_ALREADY_ALLOCATED  Task ID already in use&lt;br /&gt;
 *         ERR_T_PRIORITY_INVALID   Task priority outside allowed range 1 to 254&lt;br /&gt;
 *         ERR_THRESHOLD_INVALID    Task threshold outside range 1 to 254&lt;br /&gt;
 *         ERR_THRESHOLD_WRONG      Task threshold  higher priority than task priority&lt;br /&gt;
 *         ERR_JOBS_MAX_INVALID     Job number outside range 1 to 15&lt;br /&gt;
 *         ERR_JOBS_TOO_MANY        System capacity exceeded&lt;br /&gt;
 *         ERR_AFFINITY_WRONG       CPU core specified is outside chosen range&lt;br /&gt;
 *         ERR_START_FUNCTION_BAD   Task start function address either NULL or misaligned&lt;br /&gt;
 */&lt;br /&gt;
S32_t   oceos_task_create(&lt;br /&gt;
    const struct task_descriptor * const task_description_ptr&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter           || Description&lt;br /&gt;
|-&lt;br /&gt;
|struct task_descriptor * || Pointer to task descriptor which contains task attributes&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit     || Description&lt;br /&gt;
|-&lt;br /&gt;
|WARN_NO_END_FUNCTION     || Warning, no end task function specified&lt;br /&gt;
|-&lt;br /&gt;
|ERR_SYS_FIXED_CORRUPT    || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
|ERR_WRONG_CPU_CORE       || Executing directive on wrong CPU&lt;br /&gt;
|-&lt;br /&gt;
|ERR_WRONG_PHASE          || Called before oceos_init() is done&lt;br /&gt;
|-&lt;br /&gt;
|ERR_TOO_MANY             || MAX number of tasks already created&lt;br /&gt;
|-&lt;br /&gt;
|ERR_ID_INVALID           || Task ID outside allowed range 0 to 254&lt;br /&gt;
|-&lt;br /&gt;
|ERR_ID_WRONG             || Task ID outside &amp;gt;= number of tasks&lt;br /&gt;
|-&lt;br /&gt;
|ERR_T_ALREADY_ALLOCATED  || Task ID already in use&lt;br /&gt;
|-&lt;br /&gt;
|ERR_T_PRIORITY_INVALID   || Task priority outside allowed range 1 to 254&lt;br /&gt;
|-&lt;br /&gt;
|ERR_THRESHOLD_INVALID    || Task threshold outside range 1 to 254&lt;br /&gt;
|-&lt;br /&gt;
|ERR_THRESHOLD_WRONG      || Task threshold  higher priority than task priority&lt;br /&gt;
|-&lt;br /&gt;
|ERR_JOBS_MAX_INVALID     || Job number outside range 1 to 15&lt;br /&gt;
|-&lt;br /&gt;
|ERR_JOBS_TOO_MANY        || System capacity exceeded&lt;br /&gt;
|-&lt;br /&gt;
|ERR_AFFINITY_WRONG       || CPU core specified is outside chosen range&lt;br /&gt;
|-&lt;br /&gt;
|ERR_START_FUNCTION_BAD   || Task start function address either NULL or misaligned&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
/* Sample Task names - all here start with t_ to help avoid name confusion */&lt;br /&gt;
enum TASK_NAME{&lt;br /&gt;
      t_0,&lt;br /&gt;
      t_1,&lt;br /&gt;
      t_2&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
/*&lt;br /&gt;
 * APPLICATION FUNCTION DECLARATIONS&lt;br /&gt;
 */&lt;br /&gt;
void fun0(void *);&lt;br /&gt;
void fun1(void *);&lt;br /&gt;
void fun2(void *);&lt;br /&gt;
void end_function(void *);&lt;br /&gt;
&lt;br /&gt;
const struct task_descriptor tasks_data[NUMBER_OF_TASKS] = {&lt;br /&gt;
    {fun0, end_function, t_0, 2, 10, 8, TASK_ENABLED, 0, 0, 0, 0},&lt;br /&gt;
    {fun1, end_function, t_1, 2, 10, 8, TASK_ENABLED, 0, 0, 0, 0},&lt;br /&gt;
    {fun2, end_function, t_2, 2, 10, 8, TASK_ENABLED, 0, 0, 0, 0}&lt;br /&gt;
}; &lt;br /&gt;
&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
    // create tasks (names are defined in the application header)&lt;br /&gt;
    for (i=0; i&amp;lt;NUMBER_OF_TASKS; i++){&lt;br /&gt;
        if ( oceos_task_create(&amp;amp;tasks_data[i]) != OCEOS_SUCCESS ){&lt;br /&gt;
        	oceosmp_print(&amp;quot;\nFailed to create task\n\r&amp;quot;);&lt;br /&gt;
        	return -i;&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_task_start()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''tasks.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function starts an instance of a task. An instance of a task is called a job in OCEOS terminology.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 *  Starting a task involves three main stages&lt;br /&gt;
 *      1 setting up a job&lt;br /&gt;
 *          finding a free job entry if available&lt;br /&gt;
 *          setting up this entry including passing it the data void *&lt;br /&gt;
 *&lt;br /&gt;
 *      2 placing the job on readyQ&lt;br /&gt;
 *&lt;br /&gt;
 *      3 doing a context switch&lt;br /&gt;
 * This function should only be called after OCEOS is initialised&lt;br /&gt;
 *       and the dynamic task and job structures set up&lt;br /&gt;
 *&lt;br /&gt;
 *  When used from an interrupt handler,&lt;br /&gt;
 *  the context switch is only done&lt;br /&gt;
 *  after all nested interrupts have unwound&lt;br /&gt;
 *&lt;br /&gt;
 * @param task_id Task ID must be in range 0 to 254&lt;br /&gt;
 * @param ptr     Pointer to task data&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT    System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT      System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE          Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID           Task ID is invalid&lt;br /&gt;
 *          ERR_ID_WRONG             Task ID is wrong&lt;br /&gt;
 *          ERR_START_TASK_DISABLED  Starting task is disabled&lt;br /&gt;
 *          ERR_TOO_MANY             There is no free job&lt;br /&gt;
 *          ERR_SYS_BUSY             Failed to grab the lock&lt;br /&gt;
 */&lt;br /&gt;
S32_t   oceos_task_start(&lt;br /&gt;
    const U32_t task_id, // task ID, must be in range 0 to 254&lt;br /&gt;
    void * const ptr    // pointer to data&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| task_id || U32_t with Task ID in range 0 to 254.&lt;br /&gt;
|-&lt;br /&gt;
| ptr    || void * pointer to task data&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit  || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT    || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT      || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE          || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID           || Task ID is invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG             || Task ID is wrong&lt;br /&gt;
|-&lt;br /&gt;
| ERR_START_TASK_DISABLED  || Starting task is disabled&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TOO_MANY             || There is no free job&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY             || Failed to grab the lock&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
void *ptr;&lt;br /&gt;
...&lt;br /&gt;
// Start instance of task T_1 passing pointer ptr&lt;br /&gt;
status = oceos_task_start(t_1,ptr);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_task_timed_start()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''tasks.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function schedules a task to start execution at a given system time.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 *  Schedule a task to start execution at a given system time&lt;br /&gt;
 *&lt;br /&gt;
 *  The before and after offsets define a window around the selected time&lt;br /&gt;
 *  in which the task may be started.&lt;br /&gt;
 *&lt;br /&gt;
 *  If the current system time is before the start window a job is created&lt;br /&gt;
 *  and a corresponding action put on the timed action queue.&lt;br /&gt;
 *&lt;br /&gt;
 *  If the current system time is within the time window for starting the task,&lt;br /&gt;
 *  it is started immediately.&lt;br /&gt;
 *&lt;br /&gt;
 *  If the current system time is after the window, an error is reported.&lt;br /&gt;
 *&lt;br /&gt;
 *  Times are in microseconds.&lt;br /&gt;
 *&lt;br /&gt;
 *  This function should only be called after OCEOS is initialised&lt;br /&gt;
 *  and the dynamic task and job structures set up&lt;br /&gt;
 *&lt;br /&gt;
 * @param taskID        Task ID must be in range 0 to 254&lt;br /&gt;
 * @param ptr           Pointer to data&lt;br /&gt;
 * @param start_time    System time at which job should start&lt;br /&gt;
 * @param before        Forward tolerance for time&lt;br /&gt;
 * @param after         Backward tolerance for time&lt;br /&gt;
 * @param return_job_id Return job_id to the user, to remove this job from timed action if needed&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              Task ID invalid&lt;br /&gt;
 *          ERR_ID_WRONG                Task ID is wrong&lt;br /&gt;
 *          ERR_TA_NOT_INIT             Timed action inialisation is not done and tried to be used&lt;br /&gt;
 *          ERR_START_TASK_DISABLED     Starting task is disabled&lt;br /&gt;
 *          ERR_TOO_MANY                There is no free job&lt;br /&gt;
 *          ERR_TOO_LATE                Starting task is too late(out of time frame)&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to grab the lock&lt;br /&gt;
 *          ERR_TA_Q_FULL               Timed action queue is full&lt;br /&gt;
 *          ERR_TA_START_FAILED         Timed action execute failed; See log&lt;br /&gt;
 */&lt;br /&gt;
S32_t   oceos_task_timed_start(&lt;br /&gt;
    const U32_t task_id,     // task ID, must be in range 0 to 254&lt;br /&gt;
    void * const ptr,        // pointer to data&lt;br /&gt;
    const U64_t start_time,  // system time at which job should start&lt;br /&gt;
    const U32_t before,      // forward tolerance for time&lt;br /&gt;
    const U32_t after,       // backward tolerance for time&lt;br /&gt;
    U32_t * return_job_id    // return job_id to the user, to remove this job from timed action if needed&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| taskID        || U32_t task ID must be in range 0 to 254&lt;br /&gt;
|-&lt;br /&gt;
| ptr           || void * pointer to data&lt;br /&gt;
|-&lt;br /&gt;
| start_time    || U64_t system time at which job should start&lt;br /&gt;
|-&lt;br /&gt;
| before        || U32_t forward tolerance for time&lt;br /&gt;
|-&lt;br /&gt;
| after         || U32_t backward tolerance for time&lt;br /&gt;
|-&lt;br /&gt;
| return_job_id || U32_t return job_id to the user, to remove this job from timed action if needed&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit  || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || Task ID invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || Task ID is wrong&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_NOT_INIT             || Timed action inialisation is not done and tried to be used&lt;br /&gt;
|-&lt;br /&gt;
| ERR_START_TASK_DISABLED     || Starting task is disabled&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TOO_MANY                || There is no free job&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TOO_LATE                || Starting task is too late(out of time frame)&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to grab the lock&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_Q_FULL               || Timed action queue is full&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_START_FAILED         || Timed action execute failed; See log&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
U32_t job_id;&lt;br /&gt;
U64_t cur_sys_time;&lt;br /&gt;
...&lt;br /&gt;
  cur_sys_time = oceos_time_sys_get64();&lt;br /&gt;
&lt;br /&gt;
  // Start task 10,000 microseconds (us) from now and advise if started more than 1,000 us before or 2,000 us after.&lt;br /&gt;
  status = oceos_task_timed_start(t_2, ptr, cur_sys_time + 10000, 1000, 2000, &amp;amp;job_id);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_task_disable()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''initialisation.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function disables a task and removes any current pending jobs from the readyQ.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 *  Disable a task and remove any current pending jobs on readyQ.&lt;br /&gt;
 *&lt;br /&gt;
 *  A disabled task's jobs  will not be put into execution nor put on readyQ.&lt;br /&gt;
 *&lt;br /&gt;
 *  Note that where execution of a task has already commenced,&lt;br /&gt;
 *  disabling the task will not prevent it from completing.&lt;br /&gt;
 *&lt;br /&gt;
 *  This function should only be called after OCEOS is initialised&lt;br /&gt;
 *  and the dynamic task and job structures set up&lt;br /&gt;
 *&lt;br /&gt;
 * @param taskID  Task ID must be in range 0 to 254&lt;br /&gt;
 * @return: OCEOS_SUCCESS&lt;br /&gt;
 *          WARN_ALREADY_DISABLED        Task already disabled&lt;br /&gt;
 *          WARN_SEM_PEND_REMOVE_FAILED  Failed to remove job from semaphore pending queue&lt;br /&gt;
 *          WARN_DQ_PEND_REMOVE_FAILED   Failed to remove job from dataq pending queue&lt;br /&gt;
 *&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT        System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT          System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE              Directive was called before OCEOS init is finished&lt;br /&gt;
 *          ERR_ID_INVALID               Task ID is invalid&lt;br /&gt;
 *          ERR_ID_WRONG                 Task ID is wrong&lt;br /&gt;
 *          ERR_SYS_BUSY                 Failed to grab the lock&lt;br /&gt;
 */&lt;br /&gt;
S32_t   oceos_task_disable(&lt;br /&gt;
    const U32_t task_id // task ID, must be in range 0 to 254&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| taskID || U32_t task ID must be in range 0 to 254&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit  || Description&lt;br /&gt;
|-&lt;br /&gt;
| WARN_ALREADY_DISABLED        || Task already disabled&lt;br /&gt;
|-&lt;br /&gt;
| WARN_SEM_PEND_REMOVE_FAILED  || Failed to remove job from semaphore pending queue&lt;br /&gt;
|-&lt;br /&gt;
| WARN_DQ_PEND_REMOVE_FAILED   || Failed to remove job from dataq pending queue&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT        || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT          || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE              || Directive was called before OCEOS init is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID               || Task ID is invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                 || Task ID is wrong&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                 || Failed to grab the lock&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Disable task t_1&lt;br /&gt;
status = oceos_task_disable(t_1);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_task_enable()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''tasks.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function enables a task. Only enabled tasks may be started.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 *  Enable a task - only enabled tasks are placed on readyQ or started.&lt;br /&gt;
 *&lt;br /&gt;
 *  This function should only be called after OCEOS is initialised&lt;br /&gt;
 *  and the dynamic task and job structures set up&lt;br /&gt;
 *&lt;br /&gt;
 * @param taskID   Task ID must be in range 0 to 254&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          WARN_ALREADY_ENABLED     Task already enabled&lt;br /&gt;
 *&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT    System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT      System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE          Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID           Task ID is invalid&lt;br /&gt;
 *          ERR_ID_WRONG             Task ID is wrong&lt;br /&gt;
 *          ERR_SYS_BUSY             Failed to grab the lock&lt;br /&gt;
 */&lt;br /&gt;
S32_t   oceos_task_enable(&lt;br /&gt;
    const U32_t task_id // task ID, must be in range 0 to 254&lt;br /&gt;
);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| taskID  || U32_t task ID must be in range 0 to 254&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit  || Description&lt;br /&gt;
|-&lt;br /&gt;
| WARN_ALREADY_ENABLED     || Task already enabled&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT    || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT      || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE          || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID           || Task ID is invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG             || Task ID is wrong&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY             || Failed to grab the lock&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Enable task t_2&lt;br /&gt;
status = oceos_task_enable(t_2);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_task_self()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''tasks.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the task number of the currently running task on the calling CPU.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Get currently running task on calling CPU&lt;br /&gt;
 *&lt;br /&gt;
 * @param t_id  Task ID holder&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT        System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT          System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE              Directive was called before OCEOS init is finished&lt;br /&gt;
 *          ERR_CPU_DYN_PTR_BAD          CPU dynamic area pointer corrupt&lt;br /&gt;
 */&lt;br /&gt;
S32_t  oceos_task_self(&lt;br /&gt;
    U32_t *t_id&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| t_id || S32_t * pointer to variable where task ID will be written.&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit  || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT        || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT          || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE              || Directive was called before OCEOS init is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_CPU_DYN_PTR_BAD          || CPU dynamic area pointer corrupt&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, task_running;&lt;br /&gt;
...&lt;br /&gt;
// Return task ID that's running on this core&lt;br /&gt;
status = oceos_task_self(&amp;amp;task_running);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_task_get_priority()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''tasks.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the priority of the task ID passed to it.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Get priority of the task&lt;br /&gt;
 *&lt;br /&gt;
 * @param taskID        ID of task, must be in range 0 to 254&lt;br /&gt;
 * @param t_priority    Pointer to task priority holder&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT        System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT          System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE              Directive was called before OCEOS init is finished&lt;br /&gt;
 *          ERR_ID_INVALID               Task ID is invalid&lt;br /&gt;
 *          ERR_ID_WRONG                 Task ID is wrong&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_task_get_priority(&lt;br /&gt;
    const U32_t task_id, // task ID, must be in range 0 to 254&lt;br /&gt;
    U32_t *t_priority   // Pointer to task priority holder&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| task_id || S32_t task ID of task whose priority is required&lt;br /&gt;
|-&lt;br /&gt;
| t_priority || S32_t * pointer to variable where priority will be written&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit  || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT        || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT          || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE              || Directive was called before OCEOS init is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID               || Task ID is invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                 || Task ID is wrong&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
U32_t t_priority;&lt;br /&gt;
...&lt;br /&gt;
// Return the priority of task ID t_4 &lt;br /&gt;
status = oceos_task_get_priority(t_4, &amp;amp;t_priority);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_task_get_status()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''tasks.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the status of the task ID passed to it.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Get status of the task;&lt;br /&gt;
 * if OK t_status holds enum TASK_STATUS&lt;br /&gt;
 *&lt;br /&gt;
 * @param taskID    ID of task, must be in range 0 to 254&lt;br /&gt;
 * @param t_status  enum TASK_STATUS holder&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT        System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT          System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE              Directive was called before OCEOS init is finished&lt;br /&gt;
 *          ERR_ID_INVALID               Task ID is invalid&lt;br /&gt;
 *          ERR_ID_WRONG                 Task ID is wrong&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_task_get_status(&lt;br /&gt;
    const U32_t task_id,&lt;br /&gt;
    U32_t *t_status&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| task_id || S32_t task ID of task whose priority is required&lt;br /&gt;
|-&lt;br /&gt;
| t_status || S32_t * pointer to variable where status will be written&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit  || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT        || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT          || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE              || Directive was called before OCEOS init is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID               || Task ID is invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                 || Task ID is wrong&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
U32_t t_status;&lt;br /&gt;
...&lt;br /&gt;
// Return the status of task ID t_4 &lt;br /&gt;
status = oceos_task_get_status(t_4, &amp;amp;t_status);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_task_get_info()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''tasks.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the task information for the specified task.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Get task information for task with ID.&lt;br /&gt;
 *&lt;br /&gt;
 * User must pass pointer to struct task_info in order to retrieve data.&lt;br /&gt;
 *&lt;br /&gt;
 * @param task_id  Task ID&lt;br /&gt;
 * @param info     Pointer to struct task_info&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT    System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT      System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE          Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID           Task ID invalid&lt;br /&gt;
 *          ERR_ID_WRONG             Task ID wrong&lt;br /&gt;
 *          ERR_TASK_INFO_PTR_BAD    Task info pointer provided by user is NULL&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_task_get_info (&lt;br /&gt;
    const U32_t task_id,   // Task ID&lt;br /&gt;
    struct task_info *info // Pointer to struct task_info&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| task_id || ID of task for which information is required&lt;br /&gt;
|-&lt;br /&gt;
| task_info || struct task_info * pointer to the structure where task information is to be written&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit  || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT    || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT      || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE          || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID           || Task ID invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG             || Task ID wrong&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TASK_INFO_PTR_BAD    || Task info pointer provided by user is NULL&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
struct task_info info;&lt;br /&gt;
...&lt;br /&gt;
// Get information for task T3&lt;br /&gt;
status = oceos_task_get_info(t_3, &amp;amp;info);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceosmp_task_kill()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''tasks.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function kills the specified task running on the specified CPU.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 *  Function to kill currently running task on CPU;&lt;br /&gt;
 *  Can be used:&lt;br /&gt;
 *      From Mode_SVC  =&amp;gt; normal running mode for application&lt;br /&gt;
 *          If nesting level is zero and Mode_SVC&lt;br /&gt;
 *      From Mode_IRQ  =&amp;gt; from IRQ handler&lt;br /&gt;
 *          If nesting level is not zero, set flag to call this function within IRQ handler&lt;br /&gt;
 *      From Exception =&amp;gt; Mode_ABT and Mode_UND&lt;br /&gt;
 *          If nesting level is zero and NOT Mode_SVC, it is exception;&lt;br /&gt;
 *              Disable IRQs on current CPU;&lt;br /&gt;
 *              Set kill current task flag to TRUE;&lt;br /&gt;
 *              Issue SGI on current CPU, will be interrupted on return from Exception and&lt;br /&gt;
 *              this function will be called within IRQ handler&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT    System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT      System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE          Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_CPU_DYN_PTR_BAD      CPU dynamic area pointer corrupt&lt;br /&gt;
 *          ERR_ID_INVALID           Task ID invalid&lt;br /&gt;
 *          ERR_ID_WRONG             Task ID wrong&lt;br /&gt;
 *          ERR_CPU_ID_WRONG         CPU ID wrong&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceosmp_task_kill(&lt;br /&gt;
    U32_t task_id,&lt;br /&gt;
    U32_t cpu_id&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| task_id  || U32_t task ID to be killed (must be in range 0 to 254)&lt;br /&gt;
|-&lt;br /&gt;
| cpu_id  || U32_t CPU ID where task_id is to be killed&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT    || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT      || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE          || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_CPU_DYN_PTR_BAD      || CPU dynamic area pointer corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID           || Task ID invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG             || Task ID wrong&lt;br /&gt;
|-&lt;br /&gt;
| ERR_CPU_ID_WRONG         || CPU ID wrong&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Kill task t_2 on CPU cpu_1&lt;br /&gt;
status = oceosmp_task_kill(t_2, cpu_1);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;Mutex directives&amp;lt;/span&amp;gt;==&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_mutex_create()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''mutex.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function creates a mutex of specified ID with a specified priority ceiling.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Creates a mutex with priority ceiling&lt;br /&gt;
 *&lt;br /&gt;
 * NOTE: This function should only be called after OCEOSmp is initialised with&lt;br /&gt;
 *  oceos_init() and before initialisation ends with oceos_init_finish()&lt;br /&gt;
 *  and scheduling starts with oceos_start()&lt;br /&gt;
 *&lt;br /&gt;
 * @param mutex_id  mutex ID value 0 to 62&lt;br /&gt;
 * @param priority  mutex priority ceiling 1 to 254 (high to low task priority)&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_WRONG_CPU_CORE          Executing directive on wrong CPU&lt;br /&gt;
 *          ERR_WRONG_PHASE             Called before oceos_init() is done&lt;br /&gt;
 *          ERR_TOO_MANY                MAX number of MUTEXs already created&lt;br /&gt;
 *          ERR_ID_INVALID              MUTEX ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                MUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
 *          ERR_MX_ALREADY_ALLOCATED    MUTEX ID already used&lt;br /&gt;
 *          ERR_MX_PRIORITY_WRONG       MUTEX priority ceiling outside allowed range 1 to 254&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_mutex_create(&lt;br /&gt;
    const U32_t mutex_id,  // mutex ID, must be in range 0 to 62&lt;br /&gt;
    const U8_t  priority  // mutex priority ceiling&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| mutex_id  || u32_t mutex ID to be created (value 0 to 62).&lt;br /&gt;
|-&lt;br /&gt;
| priority_ceiling ||  U32_t mutex priority ceiling 1 to 254 (high to low task priority)&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_CPU_CORE          || Executing directive on wrong CPU&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Called before oceos_init() is done&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TOO_MANY                || MAX number of MUTEXs already created&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || MUTEX ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || MUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_MX_ALREADY_ALLOCATED    || MUTEX ID already used&lt;br /&gt;
|-&lt;br /&gt;
| ERR_MX_PRIORITY_WRONG       || MUTEX priority ceiling outside allowed range 1 to 254&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Create mutex with ID print_mutex and priority ceiling of 5&lt;br /&gt;
status = oceos_mutex_create(print_mutex, 5);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_mutex_wait()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''mutex.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function makes the task wait until the specified mutex is available.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
 /*&lt;br /&gt;
  * Wait on mutex with ID.&lt;br /&gt;
  * If task succeeds in grabbing mutex, system level priority rises to&lt;br /&gt;
  * priority of this mutex, so tasks with lower or equal priority will&lt;br /&gt;
  * not be able to start till mutex is released.&lt;br /&gt;
  *&lt;br /&gt;
  * This should only be called after OCEOSmp scheduling has started.&lt;br /&gt;
  *&lt;br /&gt;
  * @param mutex_id     const U32_t  : value 0 to 62&lt;br /&gt;
  *&lt;br /&gt;
  * @return  OCEOS_SUCCESS&lt;br /&gt;
  *          WARN_MX_INCORRECT_ORDER     MUTEX acquired in incorrect order&lt;br /&gt;
  *&lt;br /&gt;
  *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
  *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
  *          ERR_WRONG_PHASE             Directive was called before OCEOSmp initialisation is finished&lt;br /&gt;
  *          ERR_ID_INVALID              MUTEX ID outside allowed range 0 to 62&lt;br /&gt;
  *           ERR_ID_WRONG                MUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
  *          ERR_MX_CEILING_BAD          MUTEX ceiling not lower priority than job priority&lt;br /&gt;
  *          ERR_MX_ALREADY_HELD         MUTEX already held by this job&lt;br /&gt;
  *          ERR_SYS_BUSY                Failed to grab context switch guard&lt;br /&gt;
  */&lt;br /&gt;
S32_t oceos_mutex_wait(&lt;br /&gt;
    const U32_t  mutex_id      // mutex ID, must be in range 0 to 62&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| mutex_id  || u32_t mutex ID to be waited on (value 0 to 62).&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| WARN_MX_INCORRECT_ORDER     || MUTEX acquired in incorrect order&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOSmp initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || MUTEX ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || MUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_MX_CEILING_BAD          || MUTEX ceiling not lower priority than job priority&lt;br /&gt;
|-&lt;br /&gt;
| ERR_MX_ALREADY_HELD         || MUTEX already held by this job&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to grab context switch guard&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Wait on mutex m_2&lt;br /&gt;
status = oceos_mutex_wait(m_2);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_mutex_signal()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''mutex.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function signals the specified mutex.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Signal a mutex with ID&lt;br /&gt;
 *&lt;br /&gt;
 * N.B. :&lt;br /&gt;
 *      This function should not be called from an interrupt handler&lt;br /&gt;
 *      This should only be called after OCEOSmp scheduling has started.&lt;br /&gt;
 *&lt;br /&gt;
 * @param mutex_id     const U32_t  : value 0 to 62&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          WARN_MX_ALREADY_FREE        MUTEX is free already&lt;br /&gt;
 *          WARN_MX_NESTING_BAD         MUTEX nesting incorrect&lt;br /&gt;
 *&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOSmp initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              MUTEX ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                MUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
 *          ERR_MX_WRONG_JOB            MUTEX not held by this job&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to grab context switch guard&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_mutex_signal(&lt;br /&gt;
    const U32_t  mutex_id     // mutex ID, must be in range 0 to 62&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| mutex_id  || u32_t mutex ID to be signalled (value 0 to 62).&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| WARN_MX_ALREADY_FREE        || MUTEX is free already&lt;br /&gt;
|-&lt;br /&gt;
| WARN_MX_NESTING_BAD         || MUTEX nesting incorrect&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOSmp initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || MUTEX ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || MUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_MX_WRONG_JOB            || MUTEX not held by this job&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to grab context switch guard&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Signal mutex m_2&lt;br /&gt;
status = oceos_mutex_signal(m_2);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_mutex_get_value()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''mutex.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the value of the specified mutex.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Get current value of mutex with ID&lt;br /&gt;
 *&lt;br /&gt;
 * @param mutex_id      const U32_t  : value 0 to 62&lt;br /&gt;
 * @param m_value       pointer to MUTEX value holder&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOSmp initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              MUTEX ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                MUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
 *          ERR_MX_DATA_PTR_BAD         Pointer to MUTEX value return holder is null&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_mutex_get_value(&lt;br /&gt;
    const U32_t  mutex_id,      // mutex ID, must be in range 0 to 62&lt;br /&gt;
    U32_t *m_value              // Pointer to MUTEX value holder&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| mutex_id  || u32_t mutex ID to be signalled (value 0 to 62)&lt;br /&gt;
|-&lt;br /&gt;
| m_value  || u32_t * pointer where mutex value is to be written&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOSmp initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || MUTEX ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || MUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_MX_DATA_PTR_BAD         || Pointer to MUTEX value return holder is null&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
U32_t value;&lt;br /&gt;
...&lt;br /&gt;
// Get value of mutex m_2&lt;br /&gt;
status = oceos_mutex_get_value(m_2, &amp;amp;value);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;Read/write mutex directives&amp;lt;/span&amp;gt;==&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;Read/write mutex overview&amp;lt;/span&amp;gt;===&lt;br /&gt;
&lt;br /&gt;
Contents:&lt;br /&gt;
&lt;br /&gt;
 1.  Read/Write Mutex features&lt;br /&gt;
 2.  Read/Write Mutex data structures&lt;br /&gt;
 3.  Read/Write Mutex constants&lt;br /&gt;
 4.  Read/Write Mutex manager Directives&lt;br /&gt;
&lt;br /&gt;
==== Read/Write Mutex Features ====&lt;br /&gt;
&lt;br /&gt;
Read/Write Mutexes (rwmutexes) can be held for 'read' at the same time&lt;br /&gt;
by multiple jobs on different CPUs, but once held for 'write' by any job&lt;br /&gt;
cannot be obtained for 'read' or for 'write' by another job until released.&lt;br /&gt;
&lt;br /&gt;
They can be used to allow data be read simultaneously by multiple jobs when&lt;br /&gt;
the data is not being updated while ensuring that no updating can take&lt;br /&gt;
place while any job is reading the data.&lt;br /&gt;
&lt;br /&gt;
Pending write requests take precedence over pending read requests and are&lt;br /&gt;
done on a first come, first served basis. Once any job on a CPU has a&lt;br /&gt;
rwmutex for 'read' no other job on that CPU can acquire it so as to avoid&lt;br /&gt;
potential problems and minimise delays in servicing write requests by other&lt;br /&gt;
CPUs.&lt;br /&gt;
&lt;br /&gt;
While any job holds a rwmutex for reading any job on another CPU can also&lt;br /&gt;
acquire it for reading. Other jobs on the same CPU that may attempt to&lt;br /&gt;
acquire the rwmutex are delayed in starting until return of the rwmutex.&lt;br /&gt;
No job can acquire the rwmutex for writing until all read acquisitions&lt;br /&gt;
have been returned.&lt;br /&gt;
&lt;br /&gt;
No job will acquire a rwmutex for reading if any job is trying to acquire&lt;br /&gt;
it for writing, giving write precedence over read. Multiple write requests&lt;br /&gt;
waiting for existing read acquisitions to complete are serviced in the&lt;br /&gt;
order in which they were made when the current read acquisitions complete.&lt;br /&gt;
&lt;br /&gt;
If a task waits on a rwmutex that it already holds a system log entry is&lt;br /&gt;
made (LOG_RWMUTEX_ALREADY_HELD) and an INTERNAL_ERROR status code returned.&lt;br /&gt;
&lt;br /&gt;
If a task attempts to release a rwmutex it does not hold a system log entry&lt;br /&gt;
is made (LOG_RWMUTEX_ALREADY_FREE) and an INTERNAL_ERROR status code returned.&lt;br /&gt;
&lt;br /&gt;
If a job holds more than one rwmutex at the same time these must be&lt;br /&gt;
acquired and released in a nested manner&lt;br /&gt;
(e.g. wait 1, wait 2, wait 3, signal 3, signal 2, signal 1).&lt;br /&gt;
&lt;br /&gt;
If a task exits while holding one or more rwmutexes these are returned and&lt;br /&gt;
a system log entry made (LOG_RWMUTEX_NOT_RETURNED).&lt;br /&gt;
&lt;br /&gt;
==== Read/Write Mutex data structures ====&lt;br /&gt;
&lt;br /&gt;
In OCEOSmp each rwmutex has a priority ceiling, the priority of the highest&lt;br /&gt;
priority task that acquires the rwmutex for read or for write.&lt;br /&gt;
OCEOSmp uses this to ensure that once a job on a particular CPU has the&lt;br /&gt;
rwmutex for reading or for writing no other job on that CPU can be started&lt;br /&gt;
that might try to obtain that rwmutex.&lt;br /&gt;
&lt;br /&gt;
The priority ceiling of a rwmutex is specified when the rwmutex is created&lt;br /&gt;
and does not change subsequently. Priority ceilings are stored in the&lt;br /&gt;
fixed data area as an array U8_t rwmutexCeilings[] indexed by mutex ID.&lt;br /&gt;
This array is extended to be a whole number of 32-bit words.&lt;br /&gt;
&lt;br /&gt;
A rwmutex has a unique rwmutex ID, an unsigned integer usually defined in&lt;br /&gt;
the application header file as an enum RWMUTEX_NAME{} thus allowing a&lt;br /&gt;
user-friendly name be associated with each rwmutex ID.&lt;br /&gt;
&lt;br /&gt;
Using an enum is strongly recommended as it allows a user-friendly name be&lt;br /&gt;
associated with each ID, and helps ensure IDs are contiguous from 0.&lt;br /&gt;
&lt;br /&gt;
These rwmutex IDs are used as indices into both fixed and dynamic data&lt;br /&gt;
arrays and must cover the range 0 to ((number of rwmutexes) -1). Using&lt;br /&gt;
enum RWMUTEX_NAME{} automatically assigns names to IDs 0, 1, 2...&lt;br /&gt;
&lt;br /&gt;
Read write mutex dynamic data such as the current write requests and&lt;br /&gt;
current read count are stored in the dynamic data area in an array of&lt;br /&gt;
struct rwmutex_dyn_block also indexed by the rwmutex ID.&lt;br /&gt;
&lt;br /&gt;
A further dynamic area array of guard_t is used in providing mutual&lt;br /&gt;
exclusion when updating the rwmutex dynamic data.&lt;br /&gt;
&lt;br /&gt;
==== Read/Write Mutex constants ====&lt;br /&gt;
&lt;br /&gt;
In OCEOSmp there can be a maximum of 63 rwmutexes,&lt;br /&gt;
with IDs from 0 to 62 (the value 63 is used as an invalid ID).&lt;br /&gt;
&lt;br /&gt;
The rwmutexes can be created in any order, but OCEOSmp will return an error&lt;br /&gt;
and fail to start if the resulting IDs fail to be contiguous from 0 as IDs&lt;br /&gt;
are used by OCEOS as indices into arrays.&lt;br /&gt;
&lt;br /&gt;
Each rwmutex has a priority ceiling, the priority of the highest priority&lt;br /&gt;
task that uses the rwmutex for reading or for writing. This is specified&lt;br /&gt;
when the rwmutex is created, does not change subsequently, and must be in&lt;br /&gt;
the range 1 (TASK_MAX_PRIORITY) to 254 (TASK_MIN_PRIORITY).&lt;br /&gt;
The application developer must ensure that the correct rwmutex ceiling&lt;br /&gt;
is used. OCEOSmp will detect an attempt to acquire a rwmutex by a task&lt;br /&gt;
with higher priority than that rwmutex's priority ceiling, make a&lt;br /&gt;
system log entry (LOG_RWMUTEX_BAD_CEILING) and return an INTERNAL_ERROR&lt;br /&gt;
status code.&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_rwmutex_create()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''rwmutex.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function ees a read/write mutex.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Creates a Read/Write Mutex (RWMUTEX)&lt;br /&gt;
 *&lt;br /&gt;
 * This function should only be called after OCEOSmp is initialised with&lt;br /&gt;
 * oceos_init() and before initialisation ends with oceos_init_finish()&lt;br /&gt;
 * and scheduling starts with oceos_start()&lt;br /&gt;
 *&lt;br /&gt;
 * @param rwm_id    Read/Write RWMUTEX ID, must be in range 0 to 62&lt;br /&gt;
 * @param priority  Priority ceiling of highest priority task that uses the RWMUTEX&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_WRONG_CPU_CORE          Executing directive on wrong CPU&lt;br /&gt;
 *          ERR_WRONG_PHASE             Called before oceos_init() is done&lt;br /&gt;
 *          ERR_TOO_MANY                MAX number of RWMUTEXs already created&lt;br /&gt;
 *          ERR_ID_INVALID              RWMUTEX ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                RWMUTEX ID &amp;gt;= number of RWMUTEXs&lt;br /&gt;
 *          ERR_RWMX_ALREADY_ALLOCATED  RWMUTEX ID already used&lt;br /&gt;
 *          ERR_RWMX_PRIORITY_WRONG     RWMUTEX priority ceiling outside allowed range 1 to 254&lt;br /&gt;
 */&lt;br /&gt;
S32_t   oceos_rwmutex_create(&lt;br /&gt;
    const U32_t rwm_id,   // RWMUTEX ID, must be in range 0 to max rwm&lt;br /&gt;
    const U8_t priority   // RWMUTEX priority ceiling&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| rwm_id || Read/Write RWMUTEX ID, must be in range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| priority || Priority ceiling of highest priority task that uses the RWMUTEX&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_CPU_CORE          || Executing directive on wrong CPU&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Called before oceos_init() is done&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TOO_MANY                || MAX number of RWMUTEXs already created&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || RWMUTEX ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || RWMUTEX ID &amp;gt;= number of RWMUTEXs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_RWMX_ALREADY_ALLOCATED  || RWMUTEX ID already used&lt;br /&gt;
|-&lt;br /&gt;
| ERR_RWMX_PRIORITY_WRONG     || RWMUTEX priority ceiling outside allowed range 1 to 254&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Create read/write mutex with ID rwm_2 and priority ceiling of 100 &lt;br /&gt;
status = oceos_rwmutex_create(rwm_1, 100);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_rwmutex_read_wait()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''rwmutex.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function acquires a read/write mutex for read. If successful, jobs on other CPUs can also acquire it for read, but no job will be able to acquire it for write while any read is under way. If job already holds RWMUTEX for read or for write the appropriate status code is returned, a system log entry made, and the job continues. It will not succeed while any job is waiting to obtain RWMUTEX for write, and will loop waiting for all pending writes on this RWMUTEX to complete.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Read wait on RWMUTEX.&lt;br /&gt;
 *&lt;br /&gt;
 * If successful jobs on other CPUs can also acquire it for read, but no job&lt;br /&gt;
 * will be able to acquire it for write while any read is under way.&lt;br /&gt;
 * If job already holds RWMUTEX for read or for write appropriate status code&lt;br /&gt;
 * is returned, a system log entry made, and the job continues.&lt;br /&gt;
 * Will not succeed while any job is waiting to obtain RWMUTEX for write,&lt;br /&gt;
 * will loop waiting for all pending writes on this RWMUTEX to complete.&lt;br /&gt;
 *&lt;br /&gt;
 * This should only be called after OCEOS scheduling has started.&lt;br /&gt;
 *&lt;br /&gt;
 * N.B.	The returned status code must be checked and appropriate action&lt;br /&gt;
 * 		taken.&lt;br /&gt;
 *&lt;br /&gt;
 * @param rwm_id    const U32_t  : value 0 to 62&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          WARN_RWMX_NOT_HIGHEST       Already holds a RWMUTEX higher in the RWMUTEX order&lt;br /&gt;
 *                                      (there then may be a risk of deadlock)&lt;br /&gt;
 *&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              RWMUTEX ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                RWMUTEX ID &amp;gt;= number of RWMUTEXs&lt;br /&gt;
 *          ERR_RWMX_CEILING_BAD        RWMUTEX ceiling not lower priority than job priority&lt;br /&gt;
 *          ERR_RWMX_ALREADY_HELD       RWMUTEX already held by this job&lt;br /&gt;
 *          ERR_RWMX_CPU_STACK_FULL     CPU priority ceiling stack full&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_rwmutex_read_wait(&lt;br /&gt;
    const U32_t rwm_id  // RWMUTEX ID, must be in range 0 to 62&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| rwm_id || U32_t rwmutex to be acquired for read (value 0 to 62)&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| WARN_RWMX_NOT_HIGHEST       || Already holds a RWMUTEX higher in the RWMUTEX order (deadlock risk)&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || RWMUTEX ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || RWMUTEX ID &amp;gt;= number of RWMUTEXs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_RWMX_CEILING_BAD        || RWMUTEX ceiling not lower priority than job priority&lt;br /&gt;
|-&lt;br /&gt;
| ERR_RWMX_ALREADY_HELD       || RWMUTEX already held by this job&lt;br /&gt;
|-&lt;br /&gt;
| ERR_RWMX_CPU_STACK_FULL     || CPU priority ceiling stack full&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Acquire read/write mutex rwm_1 for read&lt;br /&gt;
status = oceos_rwmutex_read_wait(rwm_1);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_rwmutex_write_wait()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''rwmutex.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function acquires the specified read/write mutex for write.&lt;br /&gt;
If successful, no other job can also obtain it for reading or for writing. Will not succeed while any other job has acquired RWMUTEX for write,&lt;br /&gt;
or any jobs have obtained RWMUTEX for read. Will then loop until the RWMUTEX is released and for its turn in the sequence of jobs that have tried to acquire the RWMUTEX for writing. If already holds the RWMUTEX for writing or reading an appropriate status code is returned, a system log entry made, and the job continues. While there are any outstanding attempts to obtain the RWMUTEX for write no job will be able to acquire it for reading.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Write wait on RWMUTEX.&lt;br /&gt;
 *&lt;br /&gt;
 * If successful no other job can also obtain it for reading or for writing.&lt;br /&gt;
 * Will not succeed while any other job has acquired RWMUTEX for write,&lt;br /&gt;
 * or any jobs have obtained RWMUTEX for read. Will then loop until the&lt;br /&gt;
 * RWMUTEX is released and for its turn in the sequence of jobs that have&lt;br /&gt;
 * tried to acquire the RWMUTEX for writing.&lt;br /&gt;
 * If already holds the RWMUTEX for writing or reading an appropriate status&lt;br /&gt;
 * code is returned, a system log entry made, and the job continues.&lt;br /&gt;
 * While there are any outstanding attempts to obtain the RWMUTEX for write&lt;br /&gt;
 * no job will be able to acquire it for reading.&lt;br /&gt;
 *&lt;br /&gt;
 * This should only be called after OCEOS scheduling has started.&lt;br /&gt;
 *&lt;br /&gt;
 * N.B.	The returned status code must be checked and appropriate action&lt;br /&gt;
 * 		taken.&lt;br /&gt;
 *&lt;br /&gt;
 * @param rwm_id     const U32_t  : value 0 to 62&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          WARN_RWMX_NOT_HIGHEST       Already holds a RWMUTEX higher in the RWMUTEX order&lt;br /&gt;
 *                                      (there then may be a risk of deadlock)&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              RWMUTEX ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                RWMUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
 *          ERR_RWMX_CEILING_BAD        RWMUTEX ceiling not lower priority than job priority&lt;br /&gt;
 *          ERR_RWMX_ALREADY_HELD       RWMUTEX already held by this job&lt;br /&gt;
 *          ERR_RWMX_CPU_STACK_FULL     CPU priority ceiling stack full&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_rwmutex_write_wait(&lt;br /&gt;
    const U32_t rwm_id  // RWMUTEX ID, must be in range 0 to 62&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| rwm_id || U32_t rwmutex to be acquired for write(value 0 to 62)&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| WARN_RWMX_NOT_HIGHEST       || Already holds a RWMUTEX higher in the RWMUTEX order (deadlock risk)&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || RWMUTEX ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || RWMUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_RWMX_CEILING_BAD        || RWMUTEX ceiling not lower priority than job priority&lt;br /&gt;
|-&lt;br /&gt;
| ERR_RWMX_ALREADY_HELD       || RWMUTEX already held by this job&lt;br /&gt;
|-&lt;br /&gt;
| ERR_RWMX_CPU_STACK_FULL     || CPU priority ceiling stack full&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Acquire read/write mutex rwm_1 for write&lt;br /&gt;
status = oceos_rwmutex_read_wait(rwm_1);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_rwmutex_signal()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''rwmutex.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function signals the specified read/write mutex.&lt;br /&gt;
It frees the RWMUTEX for use by other jobs, irrespective of whether the RWMUTEX is held for reading or for writing. If the RWMUTEX is not held by the job then it returns an appropriate status code. It does not take into account how many times a job has obtained the RWMUTEX for read or for write.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Signal a RWMUTEX&lt;br /&gt;
 *&lt;br /&gt;
 * Frees the RWMUTEX for use by other jobs, irrespective of whether&lt;br /&gt;
 * RWMUTEX is held for reading or for writing.&lt;br /&gt;
 * if the RWMUTEX is not held by the job returns an appropriate status code.&lt;br /&gt;
 * Does not take into account how many times a job has obtained the RWMUTEX&lt;br /&gt;
 * for read or for write.&lt;br /&gt;
 *&lt;br /&gt;
 * This should only be called after OCEOS scheduling has started.&lt;br /&gt;
 *&lt;br /&gt;
 * N.B. The returned status code must be checked and appropriate action taken.&lt;br /&gt;
 *&lt;br /&gt;
 * @param rwm_id    const U32_t  : value 0 to 62&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          WARN_RWMX_ALREADY_FREE      RWMUTEX is free already&lt;br /&gt;
 *&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              RWMUTEX ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                RWMUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
 *          ERR_RWMX_CEILING_BAD        RWMUTEX ceiling not lower priority than job priority&lt;br /&gt;
 *          ERR_RWMX_CPU_STACK_EMPTY    CPU priority ceiling stack empty&lt;br /&gt;
 *          ERR_RWMX_CEILING_INVALID    CPU current priority ceiling on the priority stack is invalid&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_rwmutex_signal(&lt;br /&gt;
    const U32_t rwm_id // RWMUTEX ID, must be in range 0 to 62&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| rwm_id || U32_t rwmutex to be signaled(value 0 to 62)&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| WARN_RWMX_ALREADY_FREE      || RWMUTEX is free already&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || RWMUTEX ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || RWMUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_RWMX_CEILING_BAD        || RWMUTEX ceiling not lower priority than job priority&lt;br /&gt;
|-&lt;br /&gt;
| ERR_RWMX_CPU_STACK_EMPTY    || CPU priority ceiling stack empty&lt;br /&gt;
|-&lt;br /&gt;
| ERR_RWMX_CEILING_INVALID    || CPU current priority ceiling on the priority stack is invalid&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Signal read/write mutex number rwm_4&lt;br /&gt;
status = oceos_rwmutex_signal(rwm_4);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_rwmutex_check_status()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''rwmutex.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function checks the status of a read/write mutex. The possible states are free, in-use for read, and in-use for write.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Check whether RWMUTEX is free&lt;br /&gt;
 *&lt;br /&gt;
 * @param rwm_id        must be in range 0 to 62&lt;br /&gt;
 * @param m_status      pointer to RWMUTEX status holder;&lt;br /&gt;
 *                      if return code OCEOS_SUCCESS RWMUTEX status:&lt;br /&gt;
 *                          0 =&amp;gt; Free for use&lt;br /&gt;
 *                          1 =&amp;gt; In use for read&lt;br /&gt;
 *                          2 =&amp;gt; In use for write&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              RWMUTEX ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                RWMUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
 *          ERR_RWMX_DATA_PTR_BAD       Pointer to RWMUTEX status return holder is null&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_rwmutex_check_status(&lt;br /&gt;
    const U32_t rwm_id, // RWMUTEX ID, must be in range 0 to 62&lt;br /&gt;
    U32_t *m_status&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| rwm_id || read/write mutex number in range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| m_status || U32_t pointer to RWMUTEX status holder (0 = free, 1 = in-use for read, 2 = in-use for write &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || RWMUTEX ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || RWMUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_RWMX_DATA_PTR_BAD       || Pointer to RWMUTEX status return holder is null&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, rwm_status;&lt;br /&gt;
...&lt;br /&gt;
// Check the status of read/write mutex rwm_2&lt;br /&gt;
status = oceos_rwmutex_check_status(rwm_2, &amp;amp;rwm_status);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_rwmutex_reading_count()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''rwmutex.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the current number of jobs holding a specified read/write mutex for read.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 *&lt;br /&gt;
 * Get current number of jobs holding RWMUTEX for read&lt;br /&gt;
 *&lt;br /&gt;
 * @param rwm_id    must be in range 0 to 62&lt;br /&gt;
 * @param m_count   pointer to RWMUTEX count holder&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              RWMUTEX ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                RWMUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
 *          ERR_RWMX_DATA_PTR_BAD       Pointer to RWMUTEX count return holder is null&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_rwmutex_reading_count(&lt;br /&gt;
    const U32_t rwm_id, // RWMUTEX ID, must be in range 0 to 62&lt;br /&gt;
    U32_t *m_count&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| rwm_id || U32 value of read/write mutex (in range 0 to 62)&lt;br /&gt;
|-&lt;br /&gt;
| m_count || U32_t pointer to read/write mutex count holder&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || RWMUTEX ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || RWMUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_RWMX_DATA_PTR_BAD       || Pointer to RWMUTEX count return holder is null&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, rwm_count;&lt;br /&gt;
...&lt;br /&gt;
// Get the number of jobs holding the read/write mutex rwm_2 for read&lt;br /&gt;
status = oceos_rwmutex_reading_count(rwm_2, &amp;amp;rwm_count);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_rwmutex_write_reqs_count()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''header.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the current number of write requests for the specified read/write mutex .&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Get current RWMUTEX write requests count&lt;br /&gt;
 *&lt;br /&gt;
 * @param rwm_id    must be in range 0 to 62&lt;br /&gt;
 * @param m_count   pointer to RWMUTEX count holder&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              RWMUTEX ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                RWMUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
 *          ERR_RWMX_DATA_PTR_BAD       Pointer to RWMUTEX count return holder is null&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_rwmutex_write_reqs_count(&lt;br /&gt;
    const U32_t rwm_id, // RWMUTEX ID, must be in range 0 to 62&lt;br /&gt;
    U32_t *m_count&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| rwm_id || U32_t value of read/write mutex (must be in range 0 to 62)&lt;br /&gt;
|-&lt;br /&gt;
| m_count || U32_t pointer to read/write mutex count holder&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || RWMUTEX ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || RWMUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_RWMX_DATA_PTR_BAD       || Pointer to RWMUTEX count return holder is null&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, rwm_count;&lt;br /&gt;
...&lt;br /&gt;
// Get the count of cuurent write requests for read/write mutex rwm_1&lt;br /&gt;
status = oceos_rwmutex_write_reqs_count(rwm_1, &amp;amp;rwm_count);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_rwmutex_writes_pending_count()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''rwmutex.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the current number of pending writes for the specified read/write mutex.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Get current RWMUTEX writes pending count&lt;br /&gt;
 *&lt;br /&gt;
 * @param rwm_id    must be in range 0 to 62&lt;br /&gt;
 * @param m_count   pointer to RWMUTEX count holder&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              RWMUTEX ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                RWMUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
 *          ERR_RWMX_DATA_PTR_BAD       Pointer to RWMUTEX pending count return holder is null&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_rwmutex_writes_pending_count(&lt;br /&gt;
    const U32_t rwm_id, // RWMUTEX ID, must be in range 0 to 62&lt;br /&gt;
    U32_t *m_count&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| rwm_id || U32_t value of read/write mutex (must be in range 0 to 62)&lt;br /&gt;
|-&lt;br /&gt;
| m_count || U32_t pointer to read/write mutex count holder&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || RWMUTEX ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || RWMUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_RWMX_DATA_PTR_BAD       || Pointer to RWMUTEX count return holder is null&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, rwm_count;&lt;br /&gt;
...&lt;br /&gt;
// Get the count of cuurent write requests for read/write mutex rwm_1&lt;br /&gt;
status = oceos_rwmutex_writes_pending_count(rwm_1, &amp;amp;rwm_count);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_rwmutex_holding()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''header.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the read/write mutexes currently held by this instance of this task (job).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Get RWMUTEXs currently held by this instance of the task (job)&lt;br /&gt;
 *&lt;br /&gt;
 * @param m_data    U64_t pointer, each bit indicating RWMUTEX held by current task&lt;br /&gt;
 *                          0 =&amp;gt; Not held by job&lt;br /&gt;
 *                          1 =&amp;gt; Held by job&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_RWMX_DATA_PTR_BAD       Pointer to RWMUTEX status return holder is null&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_rwmutex_holding(&lt;br /&gt;
    U64_t *m_data&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| m_data || U64_t pointer, each bit indicating RWMUTEX held by current task, 0 =&amp;gt; not held, 1 =&amp;gt; held &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_RWMX_DATA_PTR_BAD       || Pointer to RWMUTEX status return holder is null&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
U64_t rwm_held;&lt;br /&gt;
...&lt;br /&gt;
// Which read/write mutexes does this job hold&lt;br /&gt;
status = oceos_rwmutex_holding(&amp;amp;rwm_held);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Semaphores directives ==&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_sem_create()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''semaphore.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function creates a semaphore.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Create a counting semaphore&lt;br /&gt;
 *&lt;br /&gt;
 * @param sem_id            SEMAPHORE ID (from 0 to 62)&lt;br /&gt;
 * @param max_permits       number of max permits allowed for this SEMAPHORE, 1 to 4095&lt;br /&gt;
 * @param count_permits     starting number of permits available 0 to 4095&lt;br /&gt;
 * @param pending_q_size    MAX Number of tasks on SEMAPHORE pending queue 1 to 253&lt;br /&gt;
 * @param use_timeout       if TRUE, directive oceos_sem_wait_restart_timeout can be used&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_WRONG_CPU_CORE          Executing directive on wrong CPU&lt;br /&gt;
 *          ERR_WRONG_PHASE             Called before oceos_init() is done&lt;br /&gt;
 *          ERR_TOO_MANY                MAX number of SEMAPHOREs already created&lt;br /&gt;
 *          ERR_ID_INVALID              SEMAPHORE ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                SEMAPHORE ID &amp;gt;= number of SEMAPHOREs&lt;br /&gt;
 *          ERR_SM_ALREADY_ALLOCATED    SEMAPHORE ID already used&lt;br /&gt;
 *          ERR_SM_MAX_PERMIT_WRONG     MAX permits outside allowed range 1 to 4095&lt;br /&gt;
 *          ERR_SM_COUNT_PERMIT_WRONG   Count permits outside allowed range 0 to 4095&lt;br /&gt;
 *          ERR_SM_COUNT_PERMIT_INVALID Count permits is greater than MAX permits for this SEMAPHORE&lt;br /&gt;
 *          ERR_SM_PENQ_SIZE_WRONG      SEMAPHORE pending queue size outside allowed range 1 to 253&lt;br /&gt;
 *          ERR_SM_TA_MAX_NUM_REACHED   Number of timed actions exceeds MAX allowed 255,&lt;br /&gt;
 *                                      each task on SEMAPHORE pending queue is timed action&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_sem_create(&lt;br /&gt;
    sem_t sem_id,         // counting semaphore ID (MAX 63)&lt;br /&gt;
    U16_t max_permits,    // max number of permits (MAX 4095)&lt;br /&gt;
    U16_t count_permits,  // initial number of permits (MAX 4095)&lt;br /&gt;
    U8_t  pending_q_size, // max number of pending queue jobs (MAX 253)&lt;br /&gt;
    BOOLE_t use_timeout   // whether timeout is used in oceos_sem_wait_restart_timeout&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| sem_id || Semaphore ID to be created (from 0 to 62)&lt;br /&gt;
|-&lt;br /&gt;
| max_permits || number of max permits allowed for this semaphore, 1 to 4095&lt;br /&gt;
|-&lt;br /&gt;
| count_permits || starting number of permits available 0 to 4095&lt;br /&gt;
|-&lt;br /&gt;
| pending_q_size || Maximum Number of tasks on SEMAPHORE pending queue 1 to 253&lt;br /&gt;
|-&lt;br /&gt;
| use_timeout || if TRUE, directive oceos_sem_wait_restart_timeout can be used&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_CPU_CORE          || Executing directive on wrong CPU&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Called before oceos_init() is done&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TOO_MANY                || MAX number of SEMAPHOREs already created&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || SEMAPHORE ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || SEMAPHORE ID &amp;gt;= number of SEMAPHOREs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SM_ALREADY_ALLOCATED    || SEMAPHORE ID already used&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SM_MAX_PERMIT_WRONG     || MAX permits outside allowed range 1 to 4095&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SM_COUNT_PERMIT_WRONG   || Count permits outside allowed range 0 to 4095&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SM_COUNT_PERMIT_INVALID || Count permits is greater than MAX permits for this SEMAPHORE&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SM_PENQ_SIZE_WRONG      || SEMAPHORE pending queue size outside allowed range 1 to 253&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SM_TA_MAX_NUM_REACHED   || Number of timed actions exceeds MAX allowed 255&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, param;&lt;br /&gt;
...&lt;br /&gt;
// Create semaphore called s_audi with max permits of 1000, starting permits of zero, max of 10 tasks on pending queue, and no timeouts &lt;br /&gt;
status = oceos_sem_create(s_audi, 1000, 0, 10, FALSE);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_sem_signal()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''semaphore.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function signals a semaphore, increments its count and transfers pending jobs to the ready queue.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Signals a semaphore, increments and transfers pending jobs to ready queue&lt;br /&gt;
 *&lt;br /&gt;
 * @param sem_id counting SEM ID&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          WARN_JOB_NOT_GUARDED&lt;br /&gt;
 *&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              SEM ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                SEM ID &amp;gt;= number of SEMs&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to grab SEM guard&lt;br /&gt;
 *          ERR_TOO_MANY                SEM max permits count already reached&lt;br /&gt;
 *          ERR_SM_JOB_ID_WRONG         Job ID of the task on SEM pending queue is wrong&lt;br /&gt;
 *          ERR_TA_NOT_FOUND            Timed action index to be removed for job not found&lt;br /&gt;
 *          ERR_TA_START_FAILED         Timed action re-start failed after job remove from timed action queue&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_sem_signal(&lt;br /&gt;
    sem_t sem_id // counting SEM ID&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| sem_id || U32_t value of semaphore to be signalled (incremented)&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| WARN_JOB_NOT_GUARDED        || job not guarded, application should check system log&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || SEM ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || SEM ID &amp;gt;= number of SEMs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to grab SEM guard&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TOO_MANY                || SEM max permits count already reached&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SM_JOB_ID_WRONG         || Job ID of the task on SEM pending queue is wrong&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_NOT_FOUND            || Timed action index to be removed for job not found&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_START_FAILED         || Timed action re-start failed after job remove from timed action queue&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Signal s_audi semaphore (increment its count)&lt;br /&gt;
status = oceos_sem_signal(s_audi);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_sem_wait_continue()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''semaphore.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function decrements the available permits of a sempahore otherwise returns an unsuccessful status code.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Wait on semaphore,&lt;br /&gt;
 * decrement the number of available permits for semaphore,&lt;br /&gt;
 * if no permits continue and task should handle unsuccessful result&lt;br /&gt;
 *&lt;br /&gt;
 * @param sem_id SEM ID&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              SEM ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                SEM ID &amp;gt;= number of SEMs&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to grab SEM guard&lt;br /&gt;
 *          ERR_SM_NOT_AVAILABLE        No more permits available for this SEM&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_sem_wait_continue(&lt;br /&gt;
    sem_t sem_id // counting SEM ID&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| sem_id || U32_t value of semaphore to be decremented&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || SEM ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || SEM ID &amp;gt;= number of SEMs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to grab SEM guard&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SM_NOT_AVAILABLE        || No more permits available for this SEM&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Decrement available permits on semaphore s_1&lt;br /&gt;
status = oceos_sem_wait_continue(s_1);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_sem_wait_restart()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''semaphore.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function decrements the available permits of a sempahore and if none available, the job is put on the pending queue.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Waits on semaphore,&lt;br /&gt;
 * if fail, put job on pending queue and exit task&lt;br /&gt;
 *&lt;br /&gt;
 * @param sem_id SEM ID&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              SEM ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                SEM ID &amp;gt;= number of SEMs&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to grab SEM guard&lt;br /&gt;
 *          ERR_SM_J_START_FROM_TIMOUT  Task started from timeout already, SEM no permits available second time&lt;br /&gt;
 *          ERR_FAILED                  Should never return this&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_sem_wait_restart(&lt;br /&gt;
    sem_t sem_id  // counting SEM ID&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| sem_id || U32_t value of semaphore to be decremented&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || SEM ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || SEM ID &amp;gt;= number of SEMs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to grab SEM guard&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SM_J_START_FROM_TIMOUT  || Task started from timeout already, SEM no permits available second time&lt;br /&gt;
|-&lt;br /&gt;
| ERR_FAILED                  || Should never return this&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Decrement available permits on semaphore s_1 otherwise job is put on pending queue&lt;br /&gt;
status = oceos_sem_wait_restart(s_1);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_sem_wait_restart_timeout()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''semaphore.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function decrements the available permits of a sempahore and if none available, the job is put on the pending queue with a timeout enabled. The job is restarted either when a permit is available to be decremented or when the timeout has expired. In order to use this directive, semaphore must be created with flag use_timeout is set to TRUE.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Waits on semaphore,&lt;br /&gt;
 * if fail, put job on pending queue with optional timeout.&lt;br /&gt;
 * In order to use this directive, semaphore must be created with&lt;br /&gt;
 * flag use_timeout is set to TRUE&lt;br /&gt;
 *&lt;br /&gt;
 * @param sem_id         SEM ID&lt;br /&gt;
 * @param U64_t timeout  Restart time if no permits, 0 =&amp;gt; ignore&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_TA_NOT_INIT             Timed action intialisation is not done and tried to be used; or SEM created without timeouts&lt;br /&gt;
 *          ERR_ID_INVALID              SEM ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                SEM ID &amp;gt;= number of SEMs&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to grab SEM guard&lt;br /&gt;
 *          ERR_SM_J_START_FROM_TIMOUT  Task started from timeout already, SEM no permits available second time&lt;br /&gt;
 *          ERR_TOO_MANY                SEM pending queue is full&lt;br /&gt;
 *          ERR_FAILED                  Should never return this&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_sem_wait_restart_timeout(&lt;br /&gt;
    sem_t sem_id, // counting SEM ID&lt;br /&gt;
    U64_t timeout // timeout, restart time if no permits, 0 =&amp;gt; ignore&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| sem_id || U32_t value of semaphore to be decremented&lt;br /&gt;
|-&lt;br /&gt;
| timeout | U64_t timeout in time units. A value of 0 causes timeout to be ignored.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_NOT_INIT             || Timed action intialisation is not done and tried to be used; or SEM created without&lt;br /&gt;
timeouts&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || SEM ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || SEM ID &amp;gt;= number of SEMs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to grab SEM guard&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SM_J_START_FROM_TIMOUT  || Task started from timeout already, SEM no permits available second time&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TOO_MANY                || SEM pending queue is full&lt;br /&gt;
|-&lt;br /&gt;
| ERR_FAILED                  || Should never return this&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Decrement available permits on semaphore s_1 otherwise job is put on pending queue with timeout of 10,000 time units (usually usecs)&lt;br /&gt;
status = oceos_sem_wait_restart_timeout(s_1);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_sem_get_value()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''semaphore.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the number of available permits for the specified semaphore.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Returns number of available permits&lt;br /&gt;
 * for SEM ID&lt;br /&gt;
 *&lt;br /&gt;
 * @param sem_id        SEM id&lt;br /&gt;
 * @param s_permits     pointer to permits count holder&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              SEM ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                SEM ID &amp;gt;= number of SEMs&lt;br /&gt;
 *          ERR_SM_DATA_BAD             Data holder pointer is null&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_sem_get_value(&lt;br /&gt;
    sem_t sem_id,    // counting SEM ID&lt;br /&gt;
    U32_t *s_permits // pointer to permits count holder&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| sem_id || U32_t value of semaphore whose permit count is required&lt;br /&gt;
|-&lt;br /&gt;
| s_permits || U32_t pointer to permits count holder&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || SEM ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || SEM ID &amp;gt;= number of SEMs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SM_DATA_BAD             || Data holder pointer is null&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, permit_count;&lt;br /&gt;
...&lt;br /&gt;
// Get the available permits for semaphore s_1&lt;br /&gt;
status = oceos_sem_get_value(s_1, &amp;amp;permit_count);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_sem_penq_get_size()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''semaphore.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the number of jobs on the specified semaphore pending queue.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Returns number of jobs on semaphore pending queue&lt;br /&gt;
 * for semaphore ID&lt;br /&gt;
 *&lt;br /&gt;
 * @param sem_id    SEM id&lt;br /&gt;
 * @param s_size    pointer to pending queue size holder&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              SEM ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                SEM ID &amp;gt;= number of SEMs&lt;br /&gt;
 *          ERR_SM_DATA_BAD             Data holder pointer is null&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_sem_penq_get_size(&lt;br /&gt;
    sem_t sem_id,   // counting SEM ID&lt;br /&gt;
    U32_t *s_size   // pointer to pending queue size holder&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| sem_id || U32_t value of semaphore whose permit count is required&lt;br /&gt;
|-&lt;br /&gt;
| s_size || U32_t pointer to pending queue jobs count holder&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || SEM ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || SEM ID &amp;gt;= number of SEMs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SM_DATA_BAD             || Data holder pointer is null&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, job_count;&lt;br /&gt;
...&lt;br /&gt;
// Get the available permits for semaphore s_1&lt;br /&gt;
status = oceos_sem_penq_get_size(s_1, &amp;amp;job_count);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_sem_reset()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''semaphore.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function restores the permits to the original semaphore initial value and removes any jobs from the pending queue.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Restore permits to original value and&lt;br /&gt;
 * remove jobs from pending queue&lt;br /&gt;
 *&lt;br /&gt;
 * @param sem_id    SEM ID&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              SEM ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                SEM ID &amp;gt;= number of SEMs&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to grab SEM guard&lt;br /&gt;
 *          ERR_SM_JOB_ID_WRONG         Job ID of the task on SEM pending queue is wrong&lt;br /&gt;
 *          ERR_TA_NOT_FOUND            Timed action index to be removed for job not found&lt;br /&gt;
 *          ERR_TA_START_FAILED         Timed action re-start failed after job remove from timed action queue&lt;br /&gt;
 */&lt;br /&gt;
S32_t   oceos_sem_reset(&lt;br /&gt;
    sem_t sem_id   // counting SEM ID&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| sem_id || U32_t value of semaphore to be reset&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || SEM ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || SEM ID &amp;gt;= number of SEMs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to grab SEM guard&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SM_JOB_ID_WRONG         || Job ID of the task on SEM pending queue is wrong&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_NOT_FOUND            || Timed action index to be removed for job not found&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_START_FAILED         || Timed action re-start failed after job remove from timed action queue&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Reset semaphore s_1&lt;br /&gt;
status = oceos_sem_reset(s_1);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Data Queues ==&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_dataq_create()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''dataq.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function creates a data queue with the specified characteristics.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Create data queue&lt;br /&gt;
 * If use_timeout = TRUE, timed actions must be initialised&lt;br /&gt;
 *&lt;br /&gt;
 * @param dataq_id      data queue ID&lt;br /&gt;
 * @param dataq_size    data queue size&lt;br /&gt;
 * @param pen_q_size    pending jobs queue size&lt;br /&gt;
 * @param roll_over     whether to roll over when full&lt;br /&gt;
 * @param use_timeout   if TRUE, directive oceos_dataq_read_restart_timeout can be used&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_WRONG_CPU_CORE          Executing directive on wrong CPU&lt;br /&gt;
 *          ERR_WRONG_PHASE             Called before oceos_init() is done&lt;br /&gt;
 *          ERR_TOO_MANY                MAX number of DATAQs already created&lt;br /&gt;
 *          ERR_ID_INVALID              DATAQ ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                DATAQ ID &amp;gt;= number of DATAQs&lt;br /&gt;
 *          ERR_DQ_ALREADY_ALLOCATED    DATAQ ID already used&lt;br /&gt;
 *          ERR_DQ_SIZE_WRONG           DATAQ size outside allowed range 1 to 255&lt;br /&gt;
 *          ERR_DQ_PENQ_SIZE_WRONG      DATAQ pending queue size outside allowed range 1 to 253&lt;br /&gt;
 *          ERR_DQ_TA_MAX_NUM_REACHED   Number of timed actions exceeds MAX allowed 255,&lt;br /&gt;
 *                                      each task on DATAQ pending queue is timed action&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_dataq_create(&lt;br /&gt;
                         dataq_t dataq_id,    // data queue ID&lt;br /&gt;
                         U16_t dataq_size,    // data queue size&lt;br /&gt;
                         U16_t pen_q_size,    // pending jobs queue size&lt;br /&gt;
                         BOOLE_t roll_over,   // whether to roll over when full&lt;br /&gt;
                         BOOLE_t use_timeout  // whether timeout is used oceos_dataq_read_restart_timeout&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| dataq_id ||   dataq_t data queue ID (number between 0 and 62)&lt;br /&gt;
|-&lt;br /&gt;
| dataq_size ||   data queue size (max number of pointers than can be added to the queue)&lt;br /&gt;
|-&lt;br /&gt;
| pen_q_size ||   pending jobs queue size&lt;br /&gt;
|-&lt;br /&gt;
| roll_over ||    whether to roll over when full (0 =&amp;gt; disabled, 1 =&amp;gt; enabled)&lt;br /&gt;
|-&lt;br /&gt;
| use_timeout ||  if TRUE, directive oceos_dataq_read_restart_timeout can be used&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_CPU_CORE          || Executing directive on wrong CPU&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Called before oceos_init() is done&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TOO_MANY                || MAX number of DATAQs already created&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || DATAQ ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || DATAQ ID &amp;gt;= number of DATAQs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DQ_ALREADY_ALLOCATED    || DATAQ ID already used&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DQ_SIZE_WRONG           || DATAQ size outside allowed range 1 to 255&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DQ_PENQ_SIZE_WRONG      || DATAQ pending queue size outside allowed range 1 to 253&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DQ_TA_MAX_NUM_REACHED   || Number of timed actions exceeds MAX allowed 255, each task on DATAQ pending queue is timed action&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Create data queue d_3 with size 20, max pending jobs of 10, rollover enabled, timeouts disabled &lt;br /&gt;
status = oceos_dataq_create(d_3, 20, 10, 1, 0));&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_dataq_write()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''dataq.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function puts a non-null pointer on the specified data queue.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Puts pointer to the data on data queue.&lt;br /&gt;
 * Pointer to the data must not be NULL&lt;br /&gt;
 *&lt;br /&gt;
 * @param dataq_t dataq_id Data queue ID&lt;br /&gt;
 * @param void* data       Non-null pointer to data&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          WARN_DQ_NOW_FULL            Warning, DATAQ is full now&lt;br /&gt;
 *          WARN_JOB_NOT_GUARDED&lt;br /&gt;
 *&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              DATAQ ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                DATAQ ID &amp;gt;= number of DATAQs&lt;br /&gt;
 *          ERR_DQ_DATA_BAD             Data pointer is null&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to acquire guard&lt;br /&gt;
 *          ERR_TOO_MANY                DATAQ is full&lt;br /&gt;
 *          ERR_DQ_JOB_ID_WRONG         Job ID of the task on pending queue is wrong&lt;br /&gt;
 *          ERR_TA_NOT_FOUND            Timed action index to be removed for job not found&lt;br /&gt;
 *          ERR_TA_START_FAILED         Timed action re-start failed after job remove from timed action queue&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_dataq_write(&lt;br /&gt;
    dataq_t dataq_id, // data queue ID&lt;br /&gt;
    void *data        // non-null pointer to data&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| dataq_id || dataq_t with value of Data queue ID&lt;br /&gt;
|-&lt;br /&gt;
| ptr || void* pointer to application data (non-null pointer)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| WARN_DQ_NOW_FULL            || Warning, DATAQ is full now&lt;br /&gt;
|-&lt;br /&gt;
| WARN_JOB_NOT_GUARDED        || &lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || DATAQ ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || DATAQ ID &amp;gt;= number of DATAQs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DQ_DATA_BAD             || Data pointer is null&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to acquire guard&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TOO_MANY                || DATAQ is full&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DQ_JOB_ID_WRONG         || Job ID of the task on pending queue is wrong&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_NOT_FOUND            || Timed action index to be removed for job not found&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_START_FAILED         || Timed action re-start failed after job remove from timed action queue&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
char[100] message_in;&lt;br /&gt;
...&lt;br /&gt;
// Put pointer to message_in on data queue s_2 &lt;br /&gt;
status = oceos_dataq_write(s_2, (void *)message_in);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_dataq_read_continue()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''dataq.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns a pointer from the specified data queue.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Read data queue&lt;br /&gt;
 *&lt;br /&gt;
 * @param dataq_t dataq_id  Data queue ID&lt;br /&gt;
 * @param void*   data      Pointer to data&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              DATAQ ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                DATAQ ID &amp;gt;= number of DATAQs&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to acquire guard&lt;br /&gt;
 *          ERR_DQ_EMPTY                DATAQ empty(count zero)&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_dataq_read_continue(&lt;br /&gt;
    dataq_t dataq_id, // data queue ID&lt;br /&gt;
    void* *data        // return data&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Descriptionn&lt;br /&gt;
|-&lt;br /&gt;
| dataq_id || dataq_t with value of Data queue ID&lt;br /&gt;
|-&lt;br /&gt;
| ptr || void* pointer to store returned data queue pointer removed from the queue&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || DATAQ ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || DATAQ ID &amp;gt;= number of DATAQs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to acquire guard&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DQ_EMPTY                || DATAQ empty(count zero)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
char *data_ptr;&lt;br /&gt;
...&lt;br /&gt;
// Read pointer from data queue s_2 &lt;br /&gt;
status = oceos_dataq_read_continue(s_2, (void *)data_ptr);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_dataq_read_restart()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''dataq.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns a pointer from the specified data queue. If the queue is empty, the job is added top the dataq pending queue. The job will be restarted when data is available. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Read data queue next item.&lt;br /&gt;
 * If dataq is empty, task is put on pending Q for dataq and&lt;br /&gt;
 * restarted by oceos_dataq_write&lt;br /&gt;
 *&lt;br /&gt;
 * @param dataq_id Data queue ID&lt;br /&gt;
 * @param data     Pointer to return data&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              DATAQ ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                DATAQ ID &amp;gt;= number of DATAQs&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to acquire guard&lt;br /&gt;
 *          ERR_DQ_J_START_FROM_TIMOUT  Job started from timeout already, DATAQ empty second time&lt;br /&gt;
 *          ERR_FAILED                  Should never return this&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_dataq_read_restart(&lt;br /&gt;
    dataq_t dataq_id,    // data queue ID&lt;br /&gt;
    void* *data           // pointer to return data&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| dataq_id || dataq_t with value of Data queue ID&lt;br /&gt;
|-&lt;br /&gt;
| ptr || void* pointer to store returned data queue pointer removed from the queue&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || DATAQ ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || DATAQ ID &amp;gt;= number of DATAQs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to acquire guard&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DQ_J_START_FROM_TIMOUT  || Job started from timeout already, DATAQ empty second time&lt;br /&gt;
|-&lt;br /&gt;
| ERR_FAILED                  || Should never return this&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
char *data_ptr;&lt;br /&gt;
...&lt;br /&gt;
// Read pointer from data queue s_2 with restart when data is available&lt;br /&gt;
status = oceos_dataq_read_restart(s_2, (void *)data_ptr);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_dataq_read_restart_timeout()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''dataq.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns a pointer from the specified data queue. If the queue is empty, the job is added top the dataq pending queue. The job will be restarted either when data is available or the timeout has expired. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Read data queue next item.&lt;br /&gt;
 * If dataq is empty, task is put on pending Q for dataq and&lt;br /&gt;
 * restarted by oceos_dataq_write or by timeout if timeout != 0&lt;br /&gt;
 * In order to use this feature timed actions must be configured and&lt;br /&gt;
 * dataq created with use timeout set to true&lt;br /&gt;
 *&lt;br /&gt;
 * @param dataq_id          Data queue ID&lt;br /&gt;
 * @param data              Pointer to return data&lt;br /&gt;
 * @param timeout           Timeout, restart time if no entry, 0 =&amp;gt; ignore&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_TA_NOT_INIT             Timed action intialisation is not done and tried to be used; or DATAQ created without timeouts&lt;br /&gt;
 *          ERR_ID_INVALID              DATAQ ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                DATAQ ID &amp;gt;= number of DATAQs&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to acquire guard&lt;br /&gt;
 *          ERR_DQ_EMPTY                DATAQ empty(count zero)&lt;br /&gt;
 *          ERR_DQ_J_START_FROM_TIMOUT  Job started from timeout already, DATAQ empty second time&lt;br /&gt;
 *          ERR_TOO_MANY                DATAQ pending queue is full&lt;br /&gt;
 *          ERR_FAILED                  Should never return this&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_dataq_read_restart_timeout(&lt;br /&gt;
    dataq_t dataq_id,   // data queue ID&lt;br /&gt;
    void* *data,         // Pointer to return data&lt;br /&gt;
    U64_t timeout       // timeout, restart time if no entry, 0 =&amp;gt; ignore&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| dataq_id || dataq_t with value of Data queue ID&lt;br /&gt;
|-&lt;br /&gt;
| ptr || void* pointer to store returned data queue pointer removed from the queue&lt;br /&gt;
|-&lt;br /&gt;
| timeout || U64_t containing timeout value, restart time if no entry, 0 =&amp;gt; ignore&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_NOT_INIT             || Timed action intialisation is not done and tried to be used; or DATAQ created without timeouts&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || DATAQ ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || DATAQ ID &amp;gt;= number of DATAQs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to acquire guard&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DQ_EMPTY                || DATAQ empty(count zero)&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DQ_J_START_FROM_TIMOUT  || Job started from timeout already, DATAQ empty second time&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TOO_MANY                || DATAQ pending queue is full&lt;br /&gt;
|-&lt;br /&gt;
| ERR_FAILED                  || Should never return this&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
char *data_ptr;&lt;br /&gt;
...&lt;br /&gt;
// Read pointer from data queue s_2 with timeout after 10,000 time units if no data is available&lt;br /&gt;
status = oceos_dataq_read_restart_timeout(s_2, (void *)data_ptr, 10000ull);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_dataq_get_size()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''dataq.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the number of items on the specified data queue.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Returns number of items on the data queue with ID&lt;br /&gt;
 *&lt;br /&gt;
 * @param dataq_id   DATAQ Id&lt;br /&gt;
 * @param d_size     Pointer to size holder&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              DATAQ ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                DATAQ ID &amp;gt;= number of DATAQs&lt;br /&gt;
 *          ERR_DQ_DATA_BAD             DATAQ size holder pointer is null&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_dataq_get_size(&lt;br /&gt;
    dataq_t dataq_id,   // data queue ID&lt;br /&gt;
    U32_t *d_size&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| dataq_id ||  dataq_t with the ID of the data queue (value between 0 and 62)&lt;br /&gt;
|-&lt;br /&gt;
| d_size || U32_t *d_size pointer to the variable to store the size&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || DATAQ ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || DATAQ ID &amp;gt;= number of DATAQs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DQ_DATA_BAD             || DATAQ size holder pointer is null&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, d_size;&lt;br /&gt;
...&lt;br /&gt;
// Get the number of entries on data queue d_0&lt;br /&gt;
status = oceos_dataq_get_size(d_0, &amp;amp;d_size);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_dataq_penq_get_size()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''dataq.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns number of jobs on the specified data queue pending job's queue.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Returns number of jobs on the dataq pending job's queue&lt;br /&gt;
 *&lt;br /&gt;
 * @param dataq_id  DATAQ Id&lt;br /&gt;
 * @param d_size    Pointer to pending queue size holder&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              DATAQ ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                DATAQ ID &amp;gt;= number of DATAQs&lt;br /&gt;
 *          ERR_DQ_DATA_BAD             DATAQ pending size holder pointer is null&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_dataq_penq_get_size(&lt;br /&gt;
    dataq_t dataq_id,&lt;br /&gt;
    U32_t *d_size&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| dataq_id ||  dataq_t with the ID of the data queue (value between 0 and 62)&lt;br /&gt;
|-&lt;br /&gt;
| d_jobs || U32_t *d_jobs pointer to the variable to store the number of jobs on the pending queue&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || DATAQ ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || DATAQ ID &amp;gt;= number of DATAQs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DQ_DATA_BAD             || DATAQ pending size holder pointer is null&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, d_jobs;&lt;br /&gt;
...&lt;br /&gt;
// Get the number of jobs the the pending jubs queue for data queue d_1&lt;br /&gt;
status = oceos_dataq_penq_get_size(d_1, &amp;amp;d_jobs);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_dataq_clear()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''dataq.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function clears the specified data queue including pending jobs for that queue.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Clears data queue and&lt;br /&gt;
 * frees tasks on pending queue&lt;br /&gt;
 *&lt;br /&gt;
 * @param dataq_t dataq_id Data queue ID&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              DATAQ ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                DATAQ ID &amp;gt;= number of DATAQs&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to acquire guard&lt;br /&gt;
 *          ERR_DQ_JOB_ID_WRONG         Job ID of the task on DATAQ pending queue is wrong&lt;br /&gt;
 *          ERR_TA_NOT_FOUND            Timed action index to be removed for job not found&lt;br /&gt;
 *          ERR_TA_START_FAILED         Timed action re-start failed after job remove from timed action queue&lt;br /&gt;
 */&lt;br /&gt;
S32_t  oceos_dataq_clear(&lt;br /&gt;
    dataq_t dataq_id    // data queue ID&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| dataq_id ||  dataq_t with the ID of the data queue to be cleared (value between 0 and 62)&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || DATAQ ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || DATAQ ID &amp;gt;= number of DATAQs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to acquire guard&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DQ_JOB_ID_WRONG         || Job ID of the task on DATAQ pending queue is wrong&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_NOT_FOUND            || Timed action index to be removed for job not found&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_START_FAILED         || Timed action re-start failed after job remove from timed action queue&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Clear data queue d_1&lt;br /&gt;
status = oceos_dataq_penq_get_size(d_1);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Timed Actions ==&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_timed_output_add()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''timed_action.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function adds a timed action to the timed action queue. It writes a value to an address at a specified system time. An optional mask can be applied so that only those bits are changed.&lt;br /&gt;
The action types are WRITE_ACTION, RMW_ACTION. WRITE_ACTION writes the value to the address. RMW_ACTION reads the values at the address and modifies the bits specified by the mask and value.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Add output action to timed actions queue :&lt;br /&gt;
 *  1. Create timed output action&lt;br /&gt;
 *  2. Stop timer&lt;br /&gt;
 *  3. Add action to action_array&lt;br /&gt;
 *  4. Start timer or execute if time is right&lt;br /&gt;
 *&lt;br /&gt;
 * Returns timed action ID that can be used later to remove&lt;br /&gt;
 * if need by oceos_timed_output_remove&lt;br /&gt;
 *&lt;br /&gt;
 * @param enum ACTION_TYPE action_type  Action type&lt;br /&gt;
 * @param U64_t act_time                System time at which action should be done&lt;br /&gt;
 * @param U32_t before_time             Forward tolerance for time&lt;br /&gt;
 * @param U32_t after_time              Backward tolerance for time&lt;br /&gt;
 * @param adrs_t address                Output address&lt;br /&gt;
 * @param U32_t value                   Output value&lt;br /&gt;
 * @param U32_t mask                    Output mask&lt;br /&gt;
 * @param U32_ *ta_index                Pointer to store timed action index&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_TA_NOT_INIT             Timed action inialisation is not done and tried to be used&lt;br /&gt;
 *          ERR_TA_PTR_BAD              Timed action pointer is null&lt;br /&gt;
 *          ERR_TA_TYPE_WRONG           Timed action type is wrong&lt;br /&gt;
 *          ERR_TOO_LATE                Timed action time is too late&lt;br /&gt;
 *          ERR_SYS_BUSY                Timed action guard failed to acquire&lt;br /&gt;
 *          ERR_TA_Q_FULL               Timed action queue is full&lt;br /&gt;
 *          ERR_TA_START_FAILED         Timed action execute failed; See log&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_timed_output_add(&lt;br /&gt;
    const enum ACTION_TYPE action_type,// Action type&lt;br /&gt;
    U64_t act_time,                    // system time at which action should be done&lt;br /&gt;
    U32_t before_time,                 // forward tolerance for time&lt;br /&gt;
    U32_t after_time,                  // backward tolerance for time&lt;br /&gt;
    const adrs_t address,              // output address&lt;br /&gt;
    const U32_t value,                 // output value&lt;br /&gt;
    const U32_t mask,                  // output mask&lt;br /&gt;
    U32_t *ta_index                    // Pointer to store timed action index&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| enum ACTION_TYPE action_type  || Action type&lt;br /&gt;
|-&lt;br /&gt;
| U64_t act_time                || System time at which action should be done&lt;br /&gt;
|-&lt;br /&gt;
| U32_t before_time             || Forward tolerance for time&lt;br /&gt;
|-&lt;br /&gt;
| U32_t after_time              || Backward tolerance for time&lt;br /&gt;
|-&lt;br /&gt;
| adrs_t address                || Output address&lt;br /&gt;
|-&lt;br /&gt;
| U32_t value                   || Output value&lt;br /&gt;
|-&lt;br /&gt;
| U32_t mask                    || Output mask&lt;br /&gt;
|-&lt;br /&gt;
| U32_ *ta_index                || Pointer to store timed action index&lt;br /&gt;
|-&lt;br /&gt;
| param || parameter to function&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_NOT_INIT             || Timed action inialisation is not done and tried to be used&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_PTR_BAD              || Timed action pointer is null&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_TYPE_WRONG           || Timed action type is wrong&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TOO_LATE                || Timed action time is too late&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Timed action guard failed to acquire&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_Q_FULL               || Timed action queue is full&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_START_FAILED         || Timed action execute failed; See log&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
#define OUTPUT_TIMED_VAL    0xDEADBEEF&lt;br /&gt;
#define OUTPUT_TIMED_MASK   0x1000001&lt;br /&gt;
#define OUTPUT_TIME         0xfffff&lt;br /&gt;
#define OUTPUT_TIME_FW      0x1000&lt;br /&gt;
#define OUTPUT_TIME_BW      0x1000&lt;br /&gt;
&lt;br /&gt;
static U32_t test_data[16] = { 0 };&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Write OUTPUT_TIMED_VAL to test_data[0] at 0xfffff time units from now with a tolerance of 0x1000 before and after the specified time   &lt;br /&gt;
status = oceos_timed_output_add(&lt;br /&gt;
                                       WRITE_ACTION,&lt;br /&gt;
                                       OUTPUT_TIME,&lt;br /&gt;
                                       OUTPUT_TIME_FW,&lt;br /&gt;
                                       OUTPUT_TIME_BW,&lt;br /&gt;
                                       (adrs_t) &amp;amp;test_data[0],&lt;br /&gt;
                                       OUTPUT_TIMED_VAL,&lt;br /&gt;
                                       0,&lt;br /&gt;
                                       &amp;amp;timed_action_index));&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_timed_jobs_number()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''timed_action.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the number of jobs on the timed actions queue.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Get number of Jobs (request to start the task) waiting on timed action queue.&lt;br /&gt;
 * These jobs are added by oceos_task_timed_start() or&lt;br /&gt;
 * oceos_dataq_read_restart_timeout when data is not available (NULL) or&lt;br /&gt;
 * oceos_sem_wait_restart_timeout when counting semaphore is 0&lt;br /&gt;
 *&lt;br /&gt;
 * @param total_jobs    Pointer to store total jobs number waiting on timed action Q&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_TA_NOT_INIT             Timed action inialisation is not done and tried to be used&lt;br /&gt;
 *          ERR_TA_PTR_BAD              Timed action pointer is null&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_timed_jobs_number(U32_t *total_jobs);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| total_jobs || s32_t pointer to store total jobs number waiting on timed action Q&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_NOT_INIT             || Timed action inialisation is not done and tried to be used&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_PTR_BAD              || Timed action pointer is null&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, no_of_jobs;&lt;br /&gt;
...&lt;br /&gt;
// Get the number of jobs on the timed actions queue&lt;br /&gt;
status = oceos_timed_jobs_number(&amp;amp;no_of_jobs);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_timed_output_number()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''timed_action.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the number timed output actions waiting on the timed actions queue.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Get number of timed output actions waiting on timed action queue.&lt;br /&gt;
 * These timed output actions are created by oceos_timed_output_add&lt;br /&gt;
 *&lt;br /&gt;
 * @param total_outputs   Pointer to store total outputs number waiting on timed action Q&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_TA_NOT_INIT             Timed action inialisation is not done and tried to be used&lt;br /&gt;
 *          ERR_TA_PTR_BAD              Timed action pointer is null&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_timed_output_number(U32_t *total_outputs);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| total_outputs || s32_t pointer to store total output actions waiting on timed action queue&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_NOT_INIT             || Timed action inialisation is not done and tried to be used&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_PTR_BAD              || Timed action pointer is null&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, no_of_outputs;&lt;br /&gt;
...&lt;br /&gt;
// Get the number of jobs on the timed actions queue&lt;br /&gt;
status = oceos_timed_output_number(&amp;amp;no_of_outputs);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_timed_jobs_remove()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''timed_action.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function removes the specified timed action from the queue.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Remove job from timed action queue&lt;br /&gt;
 * When task started using oceos_task_timed_start(),&lt;br /&gt;
 * this directive requires pointer to store ID&lt;br /&gt;
 * of job that put on the timed action queue.&lt;br /&gt;
 * This job can be removed later using this directive and stored job ID.&lt;br /&gt;
 *&lt;br /&gt;
 * @param U32_t job_id  Job ID&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_TA_NOT_INIT             Timed action intialisation is not done and tried to be used&lt;br /&gt;
 *          ERR_TA_PTR_BAD              Timed action pointer corrupt&lt;br /&gt;
 *          ERR_ID_WRONG                Job ID is wrong&lt;br /&gt;
 *          ERR_TA_NOT_FOUND            Timed action ID not found for action with job_id or removed already&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to acquire timed action guard&lt;br /&gt;
 *          WARN_TA_Q_EMPTY             Timed action queue is empty&lt;br /&gt;
 *          ERR_TA_START_FAILED         Timed action execute failed; See log&lt;br /&gt;
 */&lt;br /&gt;
S32_t   oceos_timed_jobs_remove(&lt;br /&gt;
    U32_t job_id                             // Job ID&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| job_id || U32_t Job ID to be removed from the timed actions queue&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_NOT_INIT             || Timed action intialisation is not done and tried to be used&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_PTR_BAD              || Timed action pointer corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || Job ID is wrong&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_NOT_FOUND            || Timed action ID not found for action with job_id or removed already&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to acquire timed action guard&lt;br /&gt;
|-&lt;br /&gt;
| WARN_TA_Q_EMPTY             || Timed action queue is empty&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_START_FAILED         || Timed action execute failed; See log&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, job_id;&lt;br /&gt;
...&lt;br /&gt;
// Remove job_id from the timed actions queue&lt;br /&gt;
status = oceos_timed_jobs_remove(job_id);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_timed_jobs_reset()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''timed_action.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function removes all jobs from timed actions queue.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Remove all jobs (requests to start a task) from timed actions queue&lt;br /&gt;
 * These jobs were added by oceos_task_timed_start() or&lt;br /&gt;
 * oceos_dataq_read_restart_timeout when data is not available (NULL) or&lt;br /&gt;
 * oceos_sem_wait_restart_timeout when counting semaphore is 0&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_TA_NOT_INIT             Timed action intialisation is not done and tried to be used&lt;br /&gt;
 *          ERR_TA_PTR_BAD              Timed action pointer is null&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to acquire timed action guard&lt;br /&gt;
 *          WARN_TA_Q_EMPTY             Timed action queue is empty&lt;br /&gt;
 *          ERR_TA_NOT_FOUND            Timed action index not found&lt;br /&gt;
 *          ERR_TA_START_FAILED         Timed action execute failed; See log&lt;br /&gt;
 */&lt;br /&gt;
S32_t   oceos_timed_jobs_reset(void);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
There are no input parameters to this function&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_NOT_INIT             || Timed action intialisation is not done and tried to be used&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_PTR_BAD              || Timed action pointer is null&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to acquire timed action guard&lt;br /&gt;
|-&lt;br /&gt;
| WARN_TA_Q_EMPTY             || Timed action queue is empty&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_NOT_FOUND            || Timed action index not found&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_START_FAILED         || Timed action execute failed; See log&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Remove all jobs from the timed actions queue&lt;br /&gt;
status = oceos_timed_jobs_reset(job_id);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_timed_output_remove()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''timed_action.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function removes the specified timed output action from timed actions queue.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Remove timed output action from timed actions queue.&lt;br /&gt;
 * When action is created, action index should be stored&lt;br /&gt;
 * to remove if need&lt;br /&gt;
 *&lt;br /&gt;
 * @param action_index&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_TA_NOT_INIT             Timed action intialisation is not done and tried to be used&lt;br /&gt;
 *          ERR_TA_PTR_BAD              Timed action pointer is null&lt;br /&gt;
 *          ERR_ID_WRONG                Timed action id is wrong&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to acquire timed action guard&lt;br /&gt;
 *          ERR_TA_NOT_FOUND            Timed action index not found&lt;br /&gt;
 *          ERR_TA_START_FAILED         Timed action execute failed&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_timed_output_remove(&lt;br /&gt;
    const U8_t  action_index    // Index in action array, returned when action was created&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| action_index|| S32_t specifying the timed output action index returned when the timed output was added.&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| Error bit  || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_NOT_INIT             || Timed action intialisation is not done and tried to be used&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_PTR_BAD              || Timed action pointer is null&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || Timed action id is wrong&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to acquire timed action guard&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_NOT_FOUND            || Timed action index not found&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_START_FAILED         || Timed action execute failed&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
U8_t action_index;&lt;br /&gt;
...&lt;br /&gt;
// Remove timed output with specified action_index&lt;br /&gt;
status = oceos_timed_output_remove(action_index);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_timed_output_reset()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''timed_action.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function removes all timed output actions from timed actions queue.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Remove all timed output actions from timed actions queue&lt;br /&gt;
 * These timed output actions were created by oceos_timed_output_add&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_TA_NOT_INIT             Timed action intialisation is not done and tried to be used&lt;br /&gt;
 *          ERR_TA_PTR_BAD              Timed action pointer is null&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to acquire timed action guard&lt;br /&gt;
 *          WARN_TA_Q_EMPTY             Timed action queue is empty&lt;br /&gt;
 *          ERR_TA_NOT_FOUND            Timed action index not found&lt;br /&gt;
 *          ERR_TA_START_FAILED         Timed action execute failed; See log&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_timed_output_reset(void);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
There are no input parameters to this function. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| Error bit  || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_NOT_INIT             || Timed action intialisation is not done and tried to be used&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_PTR_BAD              || Timed action pointer is null&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to acquire timed action guard&lt;br /&gt;
|-&lt;br /&gt;
| WARN_TA_Q_EMPTY             || Timed action queue is empty&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_NOT_FOUND            || Timed action index not found&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_START_FAILED         || Timed action execute failed; See log&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Remove all timed outputs from the timed actions queue&lt;br /&gt;
status = oceos_timed_output_reset();&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Logging directives ==&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;Introduction&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Log Area Features  (for details of other areas see oceos_areas.h)&lt;br /&gt;
&lt;br /&gt;
The system log area holds the system log and the records of the present and previous values of the system state variable.&lt;br /&gt;
&lt;br /&gt;
It is set up initially as an array of 32-bit words that starts at a 32-bit aligned address provided by the application developer.&lt;br /&gt;
&lt;br /&gt;
It is recommended that this address be in non-volatile RAM memory if this is available to allow information be preserved across power-up cycles.&lt;br /&gt;
&lt;br /&gt;
OCEOS preserves log area information across resets as far as possible.&lt;br /&gt;
&lt;br /&gt;
The system log itself is a circular buffer of struct log entry. Older entries are overwritten by new entries once all entries are in use.&lt;br /&gt;
&lt;br /&gt;
The application developer can specify a function to be called when 3/4 of log entries are in use. This function is called again only after 3/4 of log entries have been read and the log has again become 3/4 full.&lt;br /&gt;
&lt;br /&gt;
The read and write indices are stored in the log area and if equal indicate that the log is empty.&lt;br /&gt;
&lt;br /&gt;
As with other OCEOS data areas, the log area starts with a header&lt;br /&gt;
*a 32-bit word holding a constant OCEOS_VERSION&lt;br /&gt;
*a 32-bit word holding the log area size in 32-bit words&lt;br /&gt;
*a 32-bit word, the system status variable&lt;br /&gt;
*a 32-bit word, the system status mask&lt;br /&gt;
*a 32-bit word, the accumulated system status&lt;br /&gt;
*a 32-bit word, the previous system status mask&lt;br /&gt;
*a 32-bit word, the log control, that gives whether the log full function was called&lt;br /&gt;
*the read index&lt;br /&gt;
*the write index&lt;br /&gt;
*an array of struct log_entry making up the system log itself&lt;br /&gt;
*ending with a 32-bit constant END_SENTINEL&lt;br /&gt;
&lt;br /&gt;
The system fixed meta structure at sysMetaPtr provides&lt;br /&gt;
&lt;br /&gt;
*system_log_ptr      the start address of the log area&lt;br /&gt;
*logEntries          the number of log entries&lt;br /&gt;
*logCreated          flag indicating log was created successfully&lt;br /&gt;
*logFullFunction     user defined function, called when the log becomes 3/4 full (or NULL if not used)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Log Entry Types and Structure'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/*****************************************************************************&lt;br /&gt;
 * LOG ENTRY TYPES&lt;br /&gt;
 *&lt;br /&gt;
 * A log entry type is an 8-bit number.&lt;br /&gt;
 * Values from 0 to 127 can be defined by the application.&lt;br /&gt;
 * Values from 128 to 255 are used by OCEOS as below.&lt;br /&gt;
 *&lt;br /&gt;
 *&lt;br /&gt;
 * NOTE: Add new log types at the end for backward compatibility&lt;br /&gt;
 */&lt;br /&gt;
enum LOG_ENTRY_TYPE{&lt;br /&gt;
  LOG_SYS_OK = 0x80U,&lt;br /&gt;
  LOG_OCEOS_ABORT,				// when exiting from oceos_start&lt;br /&gt;
  LOG_LOG_NOT_VALID_ENTRY,		// used to initialise log and when log empty&lt;br /&gt;
  LOG_INIT_TASK_START_FAIL,		// initial task passed to oceos_start failed&lt;br /&gt;
  LOG_DEADLINE_MISSED,			// task deadline missed&lt;br /&gt;
  LOG_JOB_NOT_ACTIVE,			// cpu_terminate but job not active, absurd&lt;br /&gt;
  LOG_JOB_NOT_FREE,				// job guarded but not free&lt;br /&gt;
  LOG_JOBS_INC_FAILED, 			// pending jobs increment failed&lt;br /&gt;
  LOG_JOB_NOT_GUARDED,			// paranoia&lt;br /&gt;
  LOG_CS_LOG_SPIN_FAIL,			// oceos_CPU_sleep, trying to update CS log&lt;br /&gt;
  LOG_MUTEX_ALREADY_HELD,		// oceos_mutex_wait, code returned, not needed&lt;br /&gt;
  LOG_MUTEX_INCORRECT_ORDER,	// oceos_mutex_wait&lt;br /&gt;
  LOG_MUTEX_EXIT_HOLDING,		// task exits holding one or more mutexes&lt;br /&gt;
  LOG_MUTEX_EXIT_NONE,			// __oceos_tasks_remove_mutexes called but no mutex held&lt;br /&gt;
  LOG_SEMAPHORE_PENDING_REMOVE_FAIL,	// timed_action.c&lt;br /&gt;
  LOG_SEMAPHORE_PENDING_QUEUE_FULL,		// __oceos_semaphore_add_pend&lt;br /&gt;
  LOG_SEMAPHORE_SPIN_FAILED,			// trying to access semaphore&lt;br /&gt;
  LOG_DATAQ_PENDING_QUEUE_FULL,&lt;br /&gt;
  LOG_DATAQ_PENDING_REMOVE_FAIL,&lt;br /&gt;
  LOG_DATAQ_SPIN_FAILED,&lt;br /&gt;
  LOG_TIMED_ACTION_TIMER_NULL,&lt;br /&gt;
  LOG_TIMED_ACTION_INVALID,&lt;br /&gt;
  LOG_TIMED_ACTION_BAD_INDEX,&lt;br /&gt;
  LOG_TIMED_ACTION_MISSED,&lt;br /&gt;
  LOG_TIMED_ACTION_Q_EMPTY,&lt;br /&gt;
  LOG_TIMED_ACTION_REMOVE_FAIL,&lt;br /&gt;
  LOG_TIMED_ACTION_BAD_JOB_ID,&lt;br /&gt;
  LOG_TIMED_Q_SPIN_FAIL,&lt;br /&gt;
  LOG_SYSTEM_ERROR,&lt;br /&gt;
  LOG_ATOMICINC_FAILED,&lt;br /&gt;
  LOG_PENDING_PRI_UPDATE_FAILED,&lt;br /&gt;
  LOG_KILL_TASK_INVALID_ID,      // Tried to kill task with invalid ID&lt;br /&gt;
  LOG_OCEOS_EXIT_REQUEST,         // oceos_exit command was called&lt;br /&gt;
  LOG_RWMUTEX_NOT_RETURNED,&lt;br /&gt;
  LOG_RWMUTEX_NOT_HIGHEST&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
/*****************************************************************************&lt;br /&gt;
 * Structures&lt;br /&gt;
 */&lt;br /&gt;
/**&lt;br /&gt;
 * Log entry structure&lt;br /&gt;
 */&lt;br /&gt;
struct log_entry{&lt;br /&gt;
  U64_t             time64;&lt;br /&gt;
&lt;br /&gt;
  unsigned int      entry_cpu          :8;&lt;br /&gt;
  unsigned int      entry_type         :8;&lt;br /&gt;
  unsigned int      entry_note         :16;	// not used at present&lt;br /&gt;
&lt;br /&gt;
  U32_t             entry_comment;&lt;br /&gt;
}__attribute__ ((aligned (8)));&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_log_add_entry()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''system_log.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function adds an entry to the log. The entry overwrites the oldest unread entry if the log is full.&lt;br /&gt;
Custom log entries can be added to enum LOG_ENTRY from 0 to 128.&lt;br /&gt;
The indices are incremented in a circular fashion. If the write index reaches the read_index the read index is moved on, as read and write indices equal would indicate an empty log.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Add an entry to the log.&lt;br /&gt;
 * this overwrites the oldest unread entry if the log is full.&lt;br /&gt;
 * Custom log entries can be added to enum LOG_ENTRY from 0 to 128&lt;br /&gt;
 *&lt;br /&gt;
 * N.B. The indices are incremented in a circular fashion.&lt;br /&gt;
 *      If the write index reaches the read_index the read index is moved on,&lt;br /&gt;
 *      as read and write indices equal would indicate an empty log.&lt;br /&gt;
 *&lt;br /&gt;
 * @param type  enum LOG_ENTRY_TYPE&lt;br /&gt;
 * @param info  extra information to be logged&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_LOG_CORRUPT         System Log area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Log directive called in wrong phase; can be used after oceos_init() called&lt;br /&gt;
 *          ERR_ID_INVALID              Log type invalid&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to acquire log guard&lt;br /&gt;
 *          ERR_LOG_INDEX_WRONG         Read/write log index is wrong&lt;br /&gt;
 */&lt;br /&gt;
S32_t   oceos_log_add_entry(&lt;br /&gt;
    enum LOG_ENTRY_TYPE type,   // 8 bits enum LOG_ENTRY_TYPE&lt;br /&gt;
    const U32_t        info     // information&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| enum LOG_ENTRY_TYPE || Log entry type (see previous section for a list)&lt;br /&gt;
|-&lt;br /&gt;
| info | U32_t with the log information&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit  !! Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_LOG_CORRUPT         || System Log area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Log directive called in wrong phase; can be used after oceos_init() called&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || Log type invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to acquire log guard&lt;br /&gt;
|-&lt;br /&gt;
| ERR_LOG_INDEX_WRONG         || Read/write log index is wrong&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, info;&lt;br /&gt;
...&lt;br /&gt;
// Log LOG_APP_COMMS__ERROR (defined in enum LOG_ENTRY_TYPE) and info with more details&lt;br /&gt;
status = oceos_log_add_entry(LOG_APP_COMMS__ERROR, info);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_log_get_indexed_entry()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''system_log.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the entry at the specified position in the log. The entry is not removed and the log and log indices are not changed.&lt;br /&gt;
One use of this function is to allow the log be examined after a reset.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Returns the entry at the specified position in the log.&lt;br /&gt;
 * The entry is not removed and the log and log indices are not changed.&lt;br /&gt;
 * (intended to allow the log be examined for example after reset)&lt;br /&gt;
 *&lt;br /&gt;
 * @param index         position in the log&lt;br /&gt;
 * @param outputPtr     pointer to return log entry&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_LOG_CORRUPT         System Log area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Log directive called in wrong phase; can be used after oceos_init() called&lt;br /&gt;
 *          ERR_LOG_INDEX_WRONG         Read log index is wrong&lt;br /&gt;
 *          ERR_LOG_DATA_PTR_BAD        Data holder pointer is null&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_log_get_indexed_entry(&lt;br /&gt;
    const unsigned int index,&lt;br /&gt;
    struct log_entry * const outputPtr&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| index || U32_t with position in the log&lt;br /&gt;
|-&lt;br /&gt;
| outputPtr || pointer to struct log_entry to hold the returned entry&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit  !! Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_LOG_CORRUPT         || System Log area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Log directive called in wrong phase; can be used after oceos_init() called&lt;br /&gt;
|-&lt;br /&gt;
| ERR_LOG_INDEX_WRONG         || Read log index is wrong&lt;br /&gt;
|-&lt;br /&gt;
| ERR_LOG_DATA_PTR_BAD        || Data holder pointer is null&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, index;&lt;br /&gt;
struct log_entry store_entry;&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
// Read log_entry at specified index into outputPtr&lt;br /&gt;
status = oceos_log_get_indexed_entry(index, &amp;amp;store_entry);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_log_remove_entry()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''system_log.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function reads and removes the oldest unread log entry. &lt;br /&gt;
If the log is not empty use the entry at the read index to update the value at the output pointer, returning OCEOS_SUCCESS.&lt;br /&gt;
If outputPtr is NULL, entry is removed but no returned.&lt;br /&gt;
If the log is empty, set the value at the output pointer to LOG_LOG_NOT_VALID_ENTRY and return ERR_LOG_EMPTY.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Read and remove the oldest unread log entry&lt;br /&gt;
 *&lt;br /&gt;
 * If the log is not empty use the entry at the read index to update the value&lt;br /&gt;
 * at the output pointer, returning OCEOS_SUCCESS.&lt;br /&gt;
 *&lt;br /&gt;
 * If outputPtr is NULL, entry is removed but no returned&lt;br /&gt;
 *&lt;br /&gt;
 * If the log is empty, set the value at the output pointer to LOG_LOG_NOT_VALID_ENTRY&lt;br /&gt;
 * and return ERR_LOG_EMPTY&lt;br /&gt;
 *&lt;br /&gt;
 * @param outputPtr   pointer to struct log_entry&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_LOG_CORRUPT         System Log area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Log directive called in wrong phase; can be used after oceos_init() called&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to acquire log guard&lt;br /&gt;
 *          ERR_LOG_INDEX_WRONG         Read/write log index is wrong&lt;br /&gt;
 *          ERR_LOG_EMPTY               Log is empty&lt;br /&gt;
 */&lt;br /&gt;
S32_t   oceos_log_remove_entry(&lt;br /&gt;
    struct log_entry * const outputPtr&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| outputPtr || pointer to struct log_entry&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit  !! Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_LOG_CORRUPT         || System Log area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Log directive called in wrong phase; can be used after oceos_init() called&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to acquire log guard&lt;br /&gt;
|-&lt;br /&gt;
| ERR_LOG_INDEX_WRONG         || Read/write log index is wrong&lt;br /&gt;
|-&lt;br /&gt;
| ERR_LOG_EMPTY               || Log is empty&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
struct log_entry *outputPtr;&lt;br /&gt;
...&lt;br /&gt;
// Read log_entry into outputPtr and remove the oldest unread log entry&lt;br /&gt;
status = oceos_log_remove_entry(outputPtr);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_log_reset()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''system_log.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function sets all log entries to LOG_LOG_NOT_VALID_ENTRY and the log to empty, with the read and write indices set to 0.&lt;br /&gt;
The log is empty if the index of the next write is the same as the index of the next read. It does not affect the system status variable. It does not affect the context switch log.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * oceos_log_reset()&lt;br /&gt;
 *&lt;br /&gt;
 * Set all log entries to LOG_LOG_NOT_VALID_ENTRY and the log to empty, with the&lt;br /&gt;
 * read and write indices set to 0. and function called flag 0&lt;br /&gt;
 *&lt;br /&gt;
 * The log is empty if the index of the next write&lt;br /&gt;
 * is the same as the index of the next read.&lt;br /&gt;
 *&lt;br /&gt;
 * Does not affect the system status variable&lt;br /&gt;
 * Does not affect the context switch log&lt;br /&gt;
 *&lt;br /&gt;
 * N.B The fixed data area may no longer be writable&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_LOG_CORRUPT         System Log area corrupt; reset failed&lt;br /&gt;
 *          ERR_WRONG_PHASE             Log directive called in wrong phase; can be used after oceos_init() called&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to acquire log guard&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_log_reset(void);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
There are no input parameters to this function.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit  !! Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_LOG_CORRUPT         || System Log area corrupt; reset failed&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Log directive called in wrong phase; can be used after oceos_init() called&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to acquire log guard&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
// Clear down the system log&lt;br /&gt;
status = oceos_log_reset();&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_log_get_size()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''system_log.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the number of entries in the log according to the current values of the read and write indices.&lt;br /&gt;
The value will be zero if the current values of the read and write indices are the same. There may still be useful information in the log, e.g. after system reset, this can be accessed using oceos_log_get_indexed_entry().&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Return the number of entries in the log&lt;br /&gt;
 * according to the current values of the read and write indices.&lt;br /&gt;
 *&lt;br /&gt;
 * The value will be zero if the current values of the read and write indices&lt;br /&gt;
 * are the same.&lt;br /&gt;
 *&lt;br /&gt;
 * There may still be useful information in the log, e.g. after system reset,&lt;br /&gt;
 * this can be accessed using oceos_log_get_indexed_entry()&lt;br /&gt;
 *&lt;br /&gt;
 * @param l_size        pointer to log size holder&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_LOG_CORRUPT         System Log area corrupt;&lt;br /&gt;
 *          ERR_WRONG_PHASE             Log directive called in wrong phase; can be used after oceos_init() called&lt;br /&gt;
 *          ERR_LOG_DATA_PTR_BAD        Pointer to log size holder is NULL&lt;br /&gt;
 *          ERR_LOG_INDEX_WRONG         Read/write log index is wrong&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_log_get_size(&lt;br /&gt;
    U32_t *l_size&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| l_size|| U32_t pointer where size will be written.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit  !! Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_LOG_CORRUPT         || System Log area corrupt;&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Log directive called in wrong phase; can be used after oceos_init() called&lt;br /&gt;
|-&lt;br /&gt;
| ERR_LOG_DATA_PTR_BAD        || Pointer to log size holder is NULL&lt;br /&gt;
|-&lt;br /&gt;
| ERR_LOG_INDEX_WRONG         || Read/write log index is wrong&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, size;&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
// Clear down the system log&lt;br /&gt;
status = oceos_log_get_size(&amp;amp;size);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;System State Variable and System State Mask&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The System State variable provides a record of anomalies or problems detected by OCEOSmp's automatic consistency checks. An application handler for these can be set to be called automatically.&lt;br /&gt;
&lt;br /&gt;
An anomaly or problem results in a flag bit being set in the 32-bit word used to store the system state variable. The flags are identified below.&lt;br /&gt;
&lt;br /&gt;
All flags are reset to zero by oceos_init() when OCEOSmp is initialised, and may also be reset by the application using the directive provided.&lt;br /&gt;
&lt;br /&gt;
To provide a record across OCEOSmp restarts a copy is updated automatically whenever the state variable is updated. This is not cleared by oceos_init() but may be cleared by the application using a directive.&lt;br /&gt;
&lt;br /&gt;
Application software can define a problem handling function to be called automatically when specified system state flags are set. The flags are specified by setting the corresponding bits in the system state mask. The function and the state mask are defined in the system configuration.&lt;br /&gt;
&lt;br /&gt;
Changing a state flag from clear to set results in the function being called (if defined). Subsequent settings of that flag have no effect until after it has been cleared using the directive provided.&lt;br /&gt;
&lt;br /&gt;
N.B. In many cases when OCEOSmp sets a System State flag it also makes an entry in the system log that provides further information.&lt;br /&gt;
&lt;br /&gt;
SYSTEM STATE VARIABLE FLAGS&lt;br /&gt;
&lt;br /&gt;
These flags are updated by OCEOSmp using inclusive 'OR' when a consistency check detects a problem or anomaly. A copy of the system state variable is updated also and accumulates a record of flag settings that is preserved across restarts of OCEOSmp. OCEOSmp restarts reset the system state variable but not the copy.&lt;br /&gt;
&lt;br /&gt;
Resetting the state variables is the responsibility of the application (except for the state variable reset done when OCEOSmp is restarted).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''System Status Bits'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
#define  STATUS_NORMAL                    0u    // No flag set                              YES&lt;br /&gt;
#define  STATUS_INVALID          0xffffffffu    // System status is invalid                 YES BUT NO DETAIL!!!&lt;br /&gt;
&lt;br /&gt;
#define  STATUS_MASK_NORMAL      0xffffffffu    // Always call user def fn                  YES&lt;br /&gt;
&lt;br /&gt;
/* Task related problems */&lt;br /&gt;
#define  STATUS_DISABLED_TASK_START    0x1U    // An attempt to start a disabled task&lt;br /&gt;
#define  STATUS_TASK_JOB_LIMIT_OVER    0x2U    // An attempt to execute a task when its jobs limit is already reached.&lt;br /&gt;
#define  STATUS_JOB_OVER_TIME          0x4U    // Job time from creation to completion exceeds allowed maximum for task. YES&lt;br /&gt;
#define  STATUS_JOB_INTERVAL_SHORT     0x8U    // Minimum time between job creations is less than the allowed minimum for task&lt;br /&gt;
#define  STATUS_READYQ_FULL           0x10U    // Ready queue unable to accept job as result of being full&lt;br /&gt;
#define  STATUS_READYQ_NO_REMOVE      0x20U    // Remove job from ready queue failed&lt;br /&gt;
&lt;br /&gt;
/* Mutex related problems */&lt;br /&gt;
#define  STATUS_MUTEX_ALREADY_HELD    0x40U    // Mutex wait() when mutex already held&lt;br /&gt;
#define  STATUS_MUTEX_NOT_HELD        0x80U    // Mutex signal() when not already held&lt;br /&gt;
#define  STATUS_MUTEX_NOT_RETURNED   0x100U    // Mutex not returned before job terminates&lt;br /&gt;
#define  STATUS_MUTEX_NOT_NESTED     0x200U    // Use of multiple mutexes not nested&lt;br /&gt;
&lt;br /&gt;
/* Counting semaphore and data queue related problems */&lt;br /&gt;
#define  STATUS_SEMAPHORE_JOBS_FULL  0x400U    // Attempt to add job to semaphore pending list when list full&lt;br /&gt;
#define  STATUS_DATAQ_JOBS_FULL      0x800U    // Attempt to add job to data queue pending list when list full&lt;br /&gt;
#define  STATUS_DATAQ_FULL          0x1000U    // Data queue write when queue already full&lt;br /&gt;
&lt;br /&gt;
/* Timed actions related problems */&lt;br /&gt;
#define  STATUS_TIMED_JOBS_FULL     0x2000U    // Timed actions queue already full for timed task start&lt;br /&gt;
#define  STATUS_TIMED_OUTPUT_FULL   0x4000U    // Timed actions queue already full for timed output&lt;br /&gt;
#define  STATUS_TIMED_ACTION_LATE   0x8000U    // Timed action late                          YES&lt;br /&gt;
&lt;br /&gt;
/* Default trap handler should have been replaced&lt;br /&gt;
 * NOT USED AT THE MOMENT*/&lt;br /&gt;
#define  STATUS_SYSTEM_ERROR       0x10000U    // ERROR was handled by default trap handler  YES&lt;br /&gt;
&lt;br /&gt;
/* Flag to indicate problem with Stack Pointer&lt;br /&gt;
 * NOT USED AT THE MOMENT*/&lt;br /&gt;
#define  STATUS_SP_WARNING         0x20000U    // SP not in expected range&lt;br /&gt;
/* Log system error */&lt;br /&gt;
#define  STATUS_BAD_LOG            0x40000U    // System log problem&lt;br /&gt;
#define  STATUS_SPIN_FAILED        0x80000U    // Get SPIN lock failed&lt;br /&gt;
/* Not using next few bits */&lt;br /&gt;
&lt;br /&gt;
/* Will have to exit */&lt;br /&gt;
#define  STATUS_BAD_SENTINEL     0x40000000U    // Area sentinel corrupt&lt;br /&gt;
#define  STATUS_BAD_META_PTR     0x80000000U    // Null meta pointer&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_system_state_get()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''system_log.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns of the system state variable.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Returns the value of the system state variable&lt;br /&gt;
 *&lt;br /&gt;
 * @param state  pointer to state holder&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_LOG_DATA_PTR_BAD        Data holder pointer is null&lt;br /&gt;
 *          ERR_SYS_LOG_CORRUPT         LOG dynamic pointer is null&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_system_state_get(&lt;br /&gt;
    U32_t *state // pointer to state holder&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| state || U32_t pointer to state holder&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit  !! Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_LOG_DATA_PTR_BAD        || Data holder pointer is null&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_LOG_CORRUPT         || LOG dynamic pointer is null&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, state;&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
// Get the system state&lt;br /&gt;
status = oceos_system_state_get(&amp;amp;state);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_system_state_set()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''system_log.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function sets system state variable.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Sets system state variable&lt;br /&gt;
 *&lt;br /&gt;
 * @param new_state&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_LOG_CORRUPT         LOG dynamic pointer is null&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_system_state_set(&lt;br /&gt;
    U32_t new_state   // new value of system state variable&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| new_state || U32_t containing new system state&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit  !! Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_LOG_CORRUPT         || LOG dynamic pointer is null&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, new_state;&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
// Set new system state&lt;br /&gt;
status = oceos_system_state_set(new_state);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_system_state_copy_get()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''system_log.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the value of the system state copy variable.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Returns the value of the copy of system state variable&lt;br /&gt;
 *&lt;br /&gt;
 * @param state  pointer to state holder&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_LOG_DATA_PTR_BAD        Data holder pointer is null&lt;br /&gt;
 *          ERR_SYS_LOG_CORRUPT         LOG dynamic pointer is null&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_system_state_copy_get(&lt;br /&gt;
    U32_t *state // pointer to state copy holder&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| state || U32_t pointer to state copy holder&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit  !! Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_LOG_DATA_PTR_BAD        || Data holder pointer is null&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_LOG_CORRUPT         || LOG dynamic pointer is null&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, copy_state;&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
// Get the system state copy&lt;br /&gt;
status = oceos_system_state_copy_get(&amp;amp;copy_state);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_system_state_copy_set()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''system_log.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function loads a value to tha system state copy variable.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Sets system state copy variable&lt;br /&gt;
 *&lt;br /&gt;
 * @param new_state&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_LOG_CORRUPT         LOG dynamic pointer is null&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_system_state_copy_set(&lt;br /&gt;
    U32_t new_state   // new value of system state variable&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| new_state || U32_t containing new system state copy&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit  !! Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_LOG_CORRUPT         || LOG dynamic pointer is null&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, new_state;&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
// Set new system state copy&lt;br /&gt;
status = oceos_system_state_copy_set(new_state);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Timing directives ==&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;Introduction&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''SPARC'''&lt;br /&gt;
&lt;br /&gt;
In OCEOS system time is based on two chained 32-bit timers.&lt;br /&gt;
&lt;br /&gt;
No interrupts are involved, the current system time is obtained by reading the two timer counter registers (in an atomic way) and then inverting the&lt;br /&gt;
values since the timers count down.&lt;br /&gt;
&lt;br /&gt;
The scaler associated with the timers is configured based on the system clock frequency to decrement the low order timer every microsecond. This&lt;br /&gt;
decrements the high order timer when it rolls over, every 71.6 minutes approximately. The 64-bit time range is very long, over 584,000 years.&lt;br /&gt;
&lt;br /&gt;
'''ARM Cortex-M'''&lt;br /&gt;
&lt;br /&gt;
In OCEOS for ARM Cortex-M, system time is based on SysTick. The processor has a 24-bit system timer, SysTick, that counts down from the reload value to zero, reloads (wraps to) the value in the LOAD register on the next clock edge, then counts down on subsequent clocks.&lt;br /&gt;
&lt;br /&gt;
Note: When the processor is halted for debugging the counter does not decrement.&lt;br /&gt;
&lt;br /&gt;
OCEOS initializes the timer to be driven from MCK and counting down to zero asserts SysTick exception request.&lt;br /&gt;
OCEOS has 64 bit counter which is increased by 0xFFFFFF value every time timer reloads.&lt;br /&gt;
&lt;br /&gt;
'''RISC-V'''&lt;br /&gt;
&lt;br /&gt;
In OCEOS for RISC-V systems time is based internally on clock cycles.&lt;br /&gt;
The RISC-V processor typically has a 64 bit counter (typically mtime) that  updates automatically on each clock cycle. Each hart typically has its own comparison register (typically mtimecmp) that can be used to interrupt that hart when a certain cycle count has been exceeded.&lt;br /&gt;
If a particular RISC-V implementation provides a more restricted clock cycle count this will be used with appropriate modifications as clock cycles give the best timing precision available.&lt;br /&gt;
&lt;br /&gt;
Note: The application configuration provides the constant needed to allow microseconds (as used in OCEOS directives) be converted to clock cycles. Time is reported by OCEOSmp as the number of microseconds since OCEOS was initialized.&lt;br /&gt;
&lt;br /&gt;
A potential difficulty arises if the main system clock rate can change for power saving or other reasons, each system is probably different with regard to this. OCEOSmp can handle this, if needed.&lt;br /&gt;
&lt;br /&gt;
The units of OCEOS system time are microseconds on SPARC and ARM and on RISC-V the period of the clock cycle.&lt;br /&gt;
&lt;br /&gt;
The system time is reset to 0 by oceos_init()&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_time_sys_get64()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''oceos_timer.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the current system time as a 64-bit number.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
**&lt;br /&gt;
 * Get the current system time (64-bit)&lt;br /&gt;
 *&lt;br /&gt;
 * @return U64_t&lt;br /&gt;
 */&lt;br /&gt;
U64_t oceos_time_sys_get64(void);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There are no parameters to this function.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S64_t with the current system time.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S64_t now;&lt;br /&gt;
...&lt;br /&gt;
// Get the time&lt;br /&gt;
now = oceos_time_sys_get64();&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_time_sys_get32()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''oceos_timer.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the low 32 bits of the system time.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Get the current system time (low 32 bits of 64 bit value)&lt;br /&gt;
 *&lt;br /&gt;
 * @return U32_t&lt;br /&gt;
 */&lt;br /&gt;
U32_t oceos_time_sys_get32(void);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
There are no parameters to this function.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with the current system time.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t now;&lt;br /&gt;
...&lt;br /&gt;
// Get the time&lt;br /&gt;
now = oceos_time_sys_get32();&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:backup]]&lt;/div&gt;</summary>
		<author><name>Bkavanagh</name></author>
	</entry>
	<entry>
		<id>https://wiki.ocetechnology.com/mediawiki/index.php?title=OCEOSmp/directive_reference&amp;diff=1716</id>
		<title>OCEOSmp/directive reference</title>
		<link rel="alternate" type="text/html" href="https://wiki.ocetechnology.com/mediawiki/index.php?title=OCEOSmp/directive_reference&amp;diff=1716"/>
		<updated>2024-06-24T16:08:50Z</updated>

		<summary type="html">&lt;p&gt;Bkavanagh: /* Timed Actions */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Introduction =&lt;br /&gt;
&lt;br /&gt;
To be added&lt;br /&gt;
&lt;br /&gt;
= Directives =&lt;br /&gt;
&lt;br /&gt;
== Initialisation directives ==&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_init()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''initialisation.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Initialises OCEOS and  must be the first directive used.&lt;br /&gt;
&lt;br /&gt;
Initialises the OCEOS system meta data using the information supplied in the application configuration and prepares for creation of tasks etc.&lt;br /&gt;
&lt;br /&gt;
The values provided in the application configuration are checked as much as possible before being used.&lt;br /&gt;
&lt;br /&gt;
The system log also is created here.&lt;br /&gt;
&lt;br /&gt;
This function sets up sysMetaPtr and init_meta_ptr and must have completed successfully before tasks etc. can be created.&lt;br /&gt;
&lt;br /&gt;
It disables interrupts and leaves them disabled, they will be re-enabled to the previous level after all tasks etc. have been created and [[OCEOSmp/directive_reference#oceos_init_finish()|oceos_init_finish()]] has completed successfully.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Initialises OCEOS and  must be the first directive used.&lt;br /&gt;
 *&lt;br /&gt;
 * Initialises the OCEOS system meta data using the information supplied in&lt;br /&gt;
 * the application configuration and prepares for creation of tasks etc.&lt;br /&gt;
 *&lt;br /&gt;
 * The values provided in the application configuration are checked as much&lt;br /&gt;
 * as possible before being used.&lt;br /&gt;
 *&lt;br /&gt;
 * The system log also is created here.&lt;br /&gt;
 *&lt;br /&gt;
 * This function sets up sysMetaPtr and init_meta_ptr and must have completed&lt;br /&gt;
 * successfully before tasks etc. can be created.&lt;br /&gt;
 *&lt;br /&gt;
 * It disables interrupts and leaves them disabled, they will be re-enabled to&lt;br /&gt;
 * the previous level after all tasks etc. have been created and&lt;br /&gt;
 * oceos_init_finish() has completed successfully.&lt;br /&gt;
 *&lt;br /&gt;
 * @param app_config Pointer to configuration struct&lt;br /&gt;
 * @return SUCCESSFUL                        All OK&lt;br /&gt;
 *         WARN_LOG_SIZE_DEFAULT             Warning, log size is set to default value of 64 entries&lt;br /&gt;
 *         WARN_NO_ERROR_FUNCTION            Warning, user defined function for ERROR handling is not provided&lt;br /&gt;
 *         ERR_CPU_FIRST_CORE_INVALID        Start CPU not in a range of available cores for this target; or greater than end CPU&lt;br /&gt;
 *         ERR_CPU_LAST_CORE_INVALID         Last CPU not in a range of available cores for this target&lt;br /&gt;
 *         ERR_NOT_START_CPU_CORE            Executing oceos_init on wrong CPU&lt;br /&gt;
 *         ERR_STACK_START_MISALIGNED        Stack start address is not set by user misaligned&lt;br /&gt;
 *         ERR_STACK_PER_CORE_INVALID        Stack per CPU size is zero, or not 8byte aligned, or less then min require&lt;br /&gt;
 *         ERR_LOG_ADDR_MISALIGNED           Log start address is not 8 byte aligned&lt;br /&gt;
 *         ERR_FIX_ADDR_MISALIGNED           Fixed area start address is not 8 byte aligned&lt;br /&gt;
 *         ERR_DYN_ADDR_MISALIGNED           Dynamic area start address is not 8 byte aligned&lt;br /&gt;
 *         ERR_CPU_CORE_RANGE_WRONG          CPU cores in use exceed available CPUs on the SoC&lt;br /&gt;
 *         ERR_STACK_SPACE_WRONG             Current CPU SP is not within user provided stack range&lt;br /&gt;
 *         ERR_LOG_SIZE_INVALID              Log size outside expected range&lt;br /&gt;
 *         ERR_CS_LOG_SIZE_INVALID           Context switch log size invalid&lt;br /&gt;
 *         ERR_TASK_NUMBER_INVALID           Number of tasks invalid&lt;br /&gt;
 *         ERR_MUTEX_NUMBER_INVALID          Number of mutexes invalid&lt;br /&gt;
 *         ERR_RWMUTEX_NUMBER_INVALID        Number of rwmutexes invalid&lt;br /&gt;
 *         ERR_SEM_NUMBER_INVALID            Number of semaphores invalid&lt;br /&gt;
 *         ERR_DATAQ_NUMBER_INVALID          Number of datqs invalid&lt;br /&gt;
 *         ERR_TIMED_ACTIONS_NUMBER_INVALID  Number of timed actions invalid&lt;br /&gt;
 *         ERR_OVERLAP_STACK                 Overlap stack end address with (two overlap areas are set)&lt;br /&gt;
 *         ERR_OVERLAP_LOG                   Overlap log with (two overlap areas are set)&lt;br /&gt;
 *         ERR_OVERLAP_FIXED                 Overlap fixed area with (two overlap areas are set)&lt;br /&gt;
 *         ERR_OVERLAP_DYNAMIC               Overlap dynamic area with (two overlap areas are set)&lt;br /&gt;
 *         ERR_FIXED_MEMORY_FAILED           Fixed area memory write fail&lt;br /&gt;
 *         ERR_DYNAMIC_MEMORY_FAILED         Dynamic area memory write fail&lt;br /&gt;
 *         ERR_TIMER_ADDR_INVALID            Timer address not provided by user (null). SPARC only&lt;br /&gt;
 *         ERR_SYS_TIMER_INDEX_INVALID       System timer index of subtimer invalid; SPARC only; Subtimers start from index 1; Need index of subtimer plus one in front&lt;br /&gt;
 *         ERR_PERIPHERAL_CLOCK_INVALID      System peripheral code invalid&lt;br /&gt;
 *&lt;br /&gt;
 */&lt;br /&gt;
S32_t   oceos_init(&lt;br /&gt;
    const struct application_configuration app_config&lt;br /&gt;
);&lt;br /&gt;
 &amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| app_config || Pointer to configuration struct.  struct application_configuration defined in '''''basic_structs.h'''''&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| WARN_LOG_SIZE_DEFAULT             || Warning, log size is set to default value of 64 entries&lt;br /&gt;
|-&lt;br /&gt;
| WARN_NO_ERROR_FUNCTION            || Warning, user defined function for ERROR handling is not provided&lt;br /&gt;
|-&lt;br /&gt;
| ERR_CPU_FIRST_CORE_INVALID        || Start CPU not in a range of available cores for this target; or greater than end CPU&lt;br /&gt;
|-&lt;br /&gt;
| ERR_CPU_LAST_CORE_INVALID         || Last CPU not in a range of available cores for this target&lt;br /&gt;
|-&lt;br /&gt;
| ERR_NOT_START_CPU_CORE            || Executing oceos_init on wrong CPU&lt;br /&gt;
|-&lt;br /&gt;
| ERR_STACK_START_MISALIGNED        || Stack start address is not set by user misaligned&lt;br /&gt;
|-&lt;br /&gt;
| ERR_STACK_PER_CORE_INVALID        || Stack per CPU size is zero, or not 8byte aligned, or less then min require&lt;br /&gt;
|-&lt;br /&gt;
| ERR_LOG_ADDR_MISALIGNED           || Log start address is not 8 byte aligned&lt;br /&gt;
|-&lt;br /&gt;
| ERR_FIX_ADDR_MISALIGNED           || Fixed area start address is not 8 byte aligned&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DYN_ADDR_MISALIGNED           || Dynamic area start address is not 8 byte aligned&lt;br /&gt;
|-&lt;br /&gt;
| ERR_CPU_CORE_RANGE_WRONG          || CPU cores in use exceed available CPUs on the SoC&lt;br /&gt;
|-&lt;br /&gt;
| ERR_STACK_SPACE_WRONG             || Current CPU SP is not within user provided stack range&lt;br /&gt;
|-&lt;br /&gt;
| ERR_LOG_SIZE_INVALID              || Log size outside expected range&lt;br /&gt;
|-&lt;br /&gt;
| ERR_CS_LOG_SIZE_INVALID           || Context switch log size invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TASK_NUMBER_INVALID           || Number of tasks invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_MUTEX_NUMBER_INVALID          || Number of mutexes invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_RWMUTEX_NUMBER_INVALID        || Number of rwmutexes invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SEM_NUMBER_INVALID            || Number of semaphores invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DATAQ_NUMBER_INVALID          || Number of datqs invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TIMED_ACTIONS_NUMBER_INVALID  || Number of timed actions invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_OVERLAP_STACK                 || Overlap stack end address with (two overlap areas are set)&lt;br /&gt;
|-&lt;br /&gt;
| ERR_OVERLAP_LOG                   || Overlap log with (two overlap areas are set)&lt;br /&gt;
|-&lt;br /&gt;
| ERR_OVERLAP_FIXED                 || Overlap fixed area with (two overlap areas are set)&lt;br /&gt;
|-&lt;br /&gt;
| ERR_OVERLAP_DYNAMIC               || Overlap dynamic area with (two overlap areas are set)&lt;br /&gt;
|-&lt;br /&gt;
| ERR_FIXED_MEMORY_FAILED           || Fixed area memory write fail&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DYNAMIC_MEMORY_FAILED         || Dynamic area memory write fail&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TIMER_ADDR_INVALID            || Timer address not provided by user (null). SPARC only&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_TIMER_INDEX_INVALID       || System timer index of subtimer invalid; SPARC only; Subtimers start from index 1; Need index of subtimer plus one in front&lt;br /&gt;
|-&lt;br /&gt;
| ERR_PERIPHERAL_CLOCK_INVALID      || System peripheral code invalid&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
    /*&lt;br /&gt;
     * Create the application configuration structure&lt;br /&gt;
     */&lt;br /&gt;
    struct application_configuration           app_config = {0};&lt;br /&gt;
&lt;br /&gt;
    /*&lt;br /&gt;
     * Fill in the application parameters&lt;br /&gt;
     */&lt;br /&gt;
    app_config.log_address                   = (log_t)log_data;              // required&lt;br /&gt;
    app_config.fixed_data_address            = (adrs_t)fixed_data;            // required&lt;br /&gt;
    app_config.dynamic_data_address          = (adrs_t)dynamic_data;          // required&lt;br /&gt;
&lt;br /&gt;
    app_config.stack_start_address           = start_stack_array[OCEOS_START_CPU_INDEX];// OCEOSMP_STACK_START_ADDRESS;&lt;br /&gt;
    app_config.stack_size_per_cpu            = (U32_t)&amp;amp;__oceos_stack_size_per_cpu;  // OCEOSMP_STACK_LOW_BOUND_ADDRESS;&lt;br /&gt;
&lt;br /&gt;
    app_config.system_error_function         = oceosmp_on_error;               // NULL =&amp;gt; ignore&lt;br /&gt;
    app_config.log_full_function             = oceosmp_on_full_log;            // NULL =&amp;gt; ignore&lt;br /&gt;
&lt;br /&gt;
    // used in setting up system log and fixed data array&lt;br /&gt;
    app_config.log_number_of_entries         = NUMBER_OF_LOG_ENTRIES;          // 0 =&amp;gt; use default&lt;br /&gt;
&lt;br /&gt;
    app_config.number_of_tasks               = NUMBER_OF_TASKS;                // &amp;gt;= 1&lt;br /&gt;
&lt;br /&gt;
    app_config.number_of_mutexes             = NUMBER_OF_MUTEXES;&lt;br /&gt;
	app_config.number_of_rwmutexes			 = NUMBER_OF_RWMUTEXES;&lt;br /&gt;
    app_config.number_of_counting_semaphores = NUMBER_OF_SEMAPHORES;&lt;br /&gt;
    app_config.number_of_data_queues         = NUMBER_OF_DATAQS;&lt;br /&gt;
&lt;br /&gt;
    /**&lt;br /&gt;
     * FOR SPARC TARGET ONLY.&lt;br /&gt;
     */&lt;br /&gt;
    app_config.sys_time_timer_index          = SYS_TIME_TIMER_INDEX;           // 0 =&amp;gt; invalid index&lt;br /&gt;
    /**&lt;br /&gt;
     * FOR SPARC TARGET ONLY.&lt;br /&gt;
     * Not Used for ARM. Always Nested&lt;br /&gt;
     */&lt;br /&gt;
    app_config.interrupt_nesting_enabled     = TRUE;                           // TRUE =&amp;gt; single vector&lt;br /&gt;
    app_config.oceos_cpu_switch_int_number   = OCEOS_CPU_INTER_COM_INT_NUMBER; // User should provide SGI ID (0-15)&lt;br /&gt;
&lt;br /&gt;
    app_config.timed_actions_queue_size      = NUMBER_OF_ACTION_ENTRIES;&lt;br /&gt;
    app_config.CS_log_entries_base2          = CS_LOG_DEF_ENTRIES_BASE2;&lt;br /&gt;
    /**&lt;br /&gt;
     * Set starting index of CPU that will be used by OCEOSMP&lt;br /&gt;
     */&lt;br /&gt;
    app_config.oceos_cpu_start_index         = OCEOS_START_CPU_INDEX;&lt;br /&gt;
    /**&lt;br /&gt;
     * Set last index of CPU that will be used by OCEOSMP&lt;br /&gt;
     */&lt;br /&gt;
    app_config.oceos_cpu_last_index          = OCEOS_LAST_CPU_INDEX;&lt;br /&gt;
    /*&lt;br /&gt;
     * Set system/peripheral clock used to initialise system timer&lt;br /&gt;
     */&lt;br /&gt;
    app_config.soc_peripheral_clck           = BSP_SYSFREQ * 1000 * 1000;&lt;br /&gt;
&lt;br /&gt;
    // initialise OCEOSMP&lt;br /&gt;
    S32_t status;&lt;br /&gt;
    status = oceos_init(app_config);&lt;br /&gt;
    if (OCEOS_SUCCESS &amp;gt; status) {&lt;br /&gt;
      oceosmp_print(&amp;quot;\n oceos_init failure\n\r&amp;quot;);&lt;br /&gt;
      return 0;&lt;br /&gt;
    } else {&lt;br /&gt;
      return 1;&lt;br /&gt;
    }   // else&lt;br /&gt;
 &amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_init_finish()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''initialisation.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Finalizes the fixed data array after all tasks etc. have been created&lt;br /&gt;
&lt;br /&gt;
All information needed to start OCEOS can be found in the fixed data area&lt;br /&gt;
when oceos_init_finish() has completed.&lt;br /&gt;
&lt;br /&gt;
Once all tasks etc. have been created oceos_init_finish() checks the&lt;br /&gt;
accumulated information against the application configuration data&lt;br /&gt;
stored in the fixed meta structure.&lt;br /&gt;
&lt;br /&gt;
oceos_init_finish also calculates the size of the dynamic data area and&lt;br /&gt;
checks it does not overlap with the system stack, the system log, or the&lt;br /&gt;
fixed data, and if all ok sets up pointers to the various dynamic area&lt;br /&gt;
components in the fixed data.&lt;br /&gt;
&lt;br /&gt;
It then adds an XOR checksum to the fixed data area, and checks that this&lt;br /&gt;
is followed by FILLER, which it replaces with the end sentinel.&lt;br /&gt;
&lt;br /&gt;
On successful completion it restores the interrupt level to its value&lt;br /&gt;
before oceos_init() was called, otherwise interrupts remain disabled.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Finalizes the fixed data array after all tasks etc. have been created&lt;br /&gt;
 *&lt;br /&gt;
 * All information needed to start OCEOS can be found in the fixed data area&lt;br /&gt;
 * when oceos_init_finish() has completed.&lt;br /&gt;
 *&lt;br /&gt;
 * Once all tasks etc. have been created oceos_init_finish() checks the&lt;br /&gt;
 * accumulated information against the application configuration data&lt;br /&gt;
 * stored in the fixed meta structure.&lt;br /&gt;
 *&lt;br /&gt;
 * oceos_init_finish also calculates the size of the dynamic data area and&lt;br /&gt;
 * checks it does not overlap with the system stack, the system log, or the&lt;br /&gt;
 * fixed data, and if all ok sets up pointers to the various dynamic area&lt;br /&gt;
 * components in the fixed data.&lt;br /&gt;
 *&lt;br /&gt;
 * It then adds an XOR checksum to the fixed data area, and checks that this&lt;br /&gt;
 * is followed by FILLER, which it replaces with the end sentinel.&lt;br /&gt;
 *&lt;br /&gt;
 * On successful completion it restores the interrupt level to its value&lt;br /&gt;
 * before oceos_init() was called, otherwise interrupts remain disabled.&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS                             All OK&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT               System Meta data is NULL or corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT                 System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_CPU_CORE                  Executing directive on wrong CPU&lt;br /&gt;
 *          ERR_WRONG_PHASE                     Called before oceos_init()&lt;br /&gt;
 *          ERR_TASKS_INCOMPLETE                Created wrong number of tasks&lt;br /&gt;
 *          ERR_MUTEX_INCOMPLETE                Created wrong number of mutexes&lt;br /&gt;
 *          ERR_RWMUTEX_INCOMPLETE              Created wrong number of rwmutexes&lt;br /&gt;
 *          ERR_SEM_INCOMPLETE                  Created wrong number of semaphores&lt;br /&gt;
 *          ERR_DATAQ_INCOMPLETE                Created wrong number of dataqs&lt;br /&gt;
 *          ERR_TASK_MAX_ID_INVALID             Task's max id invalid&lt;br /&gt;
 *          ERR_MUTEX_MAX_ID_INVALID            Mutexe's max id invalid&lt;br /&gt;
 *          ERR_RWMUTEX_MAX_ID_INVALID          Rwmutexe's max id invalid&lt;br /&gt;
 *          ERR_SEM_MAX_ID_INVALID              Semaphore's max id invalid&lt;br /&gt;
 *          ERR_DATAQ_MAX_ID_INVALID            Dataq's max id invalid&lt;br /&gt;
 *          ERR_TOTAL_JOBS_NUMBER_WRONG         Wrong number of total jobs created&lt;br /&gt;
 *          ERR_ORDER_ARRAY_PTR_INVALID         Order array pointer is NULL or mis-aligned&lt;br /&gt;
 *          ERR_FIXED_AREA_TOO_SMALL            Not enough space for fixed data area&lt;br /&gt;
 */&lt;br /&gt;
S32_t   oceos_init_finish(void);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
There are no input parameters to this function.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit  || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT               || System Meta data is NULL or corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT                 || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_CPU_CORE                  || Executing directive on wrong CPU&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE                     || Called before oceos_init()&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TASKS_INCOMPLETE                || Created wrong number of tasks&lt;br /&gt;
|-&lt;br /&gt;
| ERR_MUTEX_INCOMPLETE                || Created wrong number of mutexes&lt;br /&gt;
|-&lt;br /&gt;
| ERR_RWMUTEX_INCOMPLETE              || Created wrong number of rwmutexes&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SEM_INCOMPLETE                  || Created wrong number of semaphores&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DATAQ_INCOMPLETE                || Created wrong number of dataqs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TASK_MAX_ID_INVALID             || Task's max id invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_MUTEX_MAX_ID_INVALID            || Mutexe's max id invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_RWMUTEX_MAX_ID_INVALID          || Rwmutexe's max id invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SEM_MAX_ID_INVALID              || Semaphore's max id invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DATAQ_MAX_ID_INVALID            || Dataq's max id invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TOTAL_JOBS_NUMBER_WRONG         || Wrong number of total jobs created&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ORDER_ARRAY_PTR_INVALID         || Order array pointer is NULL or mis-aligned&lt;br /&gt;
|-&lt;br /&gt;
| ERR_FIXED_AREA_TOO_SMALL            || Not enough space for fixed data area&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
    /*&lt;br /&gt;
     * Finish initialising OCEOS and setting up the fixed data&lt;br /&gt;
     */&lt;br /&gt;
    status = oceos_init_finish();&lt;br /&gt;
    if(OCEOS_SUCCESS &amp;gt; status){&lt;br /&gt;
        // LOG&lt;br /&gt;
      oceosmp_print(&amp;quot;\nAbandoning, problem ending OCEOS initialisation\n\r&amp;quot;);&lt;br /&gt;
        return -1;&lt;br /&gt;
    }   // if&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_start()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''initialisation.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Starts OCEOS scheduling.&amp;lt;br&amp;gt;&lt;br /&gt;
Create dynamic OCEOS structures and start scheduling.&amp;lt;br&amp;gt;&lt;br /&gt;
This function should only be called once and only after [[OCEOSmp/directive_reference#oceos_init()|oceos_init()]] and [[OCEOSmp/directive_reference#oceos_init_finish()|oceos_init_finish()]] have been called successfully.&amp;lt;br&amp;gt;&lt;br /&gt;
Normally this function does not return. &amp;lt;br&amp;gt;&lt;br /&gt;
If a problem is detected the function terminates and returns an appropriate DIRECTIVE_STATUS code, with interrupts disabled.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Starts OCEOS scheduling&lt;br /&gt;
 *&lt;br /&gt;
 * Create dynamic OCEOS structures and start scheduling&lt;br /&gt;
 *&lt;br /&gt;
 * This function should only be called once&lt;br /&gt;
 * and only after oceos_init()&lt;br /&gt;
 * and oceos_init_finish() have&lt;br /&gt;
 *  been called successfully.&lt;br /&gt;
 * Normally this function does not return.&lt;br /&gt;
 * If a problem is detected the function&lt;br /&gt;
 * terminates and returns an appropriate&lt;br /&gt;
 * DIRECTIVE_STATUS code, with interrupts disabled.&lt;br /&gt;
 *&lt;br /&gt;
 * @param fixed_array_ptr   Pointer to fixed data array&lt;br /&gt;
 * @param start_task        Task ID&lt;br /&gt;
 * @param data_ptr          Pointer to data to be passed to the task&lt;br /&gt;
 * @return  OCEOSMP_EXIT                        OCEOSMP return from scheduling and exit&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT               Fixed area pointer is null or bad sentinel&lt;br /&gt;
 *          ERR_FIXED_AREA_SIZE_WRONG           Fixed area size is zero&lt;br /&gt;
 *          ERR_FIXED_AREA_END_SENTINEL_BAD     Fixed data end sentinel corrupt&lt;br /&gt;
 *          ERR_FIXED_AREA_BAD_XOR              Fixed area bad checksum or checksum mis-match&lt;br /&gt;
 *          ERR_INIT_NOT_DONE                   oceos_start() called without initialisation&lt;br /&gt;
 *          ERR_DYN_AREA_PTR_BAD                Dynamic area pointer invalid in sysMetaPtr&lt;br /&gt;
 *          ERR_INT_HANDLER_BAD                 IRQ controller pointer provided by BCC is NULL;or OCEOS handler is not set&lt;br /&gt;
 *          ERR_DYN_JOB_PTR_BAD                 Job array pointer is NULL&lt;br /&gt;
 *          ERR_FIXED_TASK_PTR_BAD              Tasks array pointer is NULL&lt;br /&gt;
 *          ERR_JOB_COUNT_WRONG                 Total job count inconsistent&lt;br /&gt;
 *          ERR_DYN_MUTEX_PTR_BAD               Mutex dynamic pointer is NULL&lt;br /&gt;
 *          ERR_DYN_LOCK_PTR_BAD                Mutex lock array pointer is NULL&lt;br /&gt;
 *          ERR_DYN_RWMUTEX_PTR_BAD             Rwmutex dynamic pointer is NULL&lt;br /&gt;
 *          ERR_DYN_RWLOCK_PTR_BAD              Rwmutex lock array pointer is NULL&lt;br /&gt;
 *          ERR_FIXED_SEM_PTR_BAD               Semaphore fixed pointer is NULL&lt;br /&gt;
 *          ERR_DYN_SEM_PTR_BAD                 Semaphore dynamic pointer is NULL&lt;br /&gt;
 *          ERR_SEM_PEND_PTR_BAD                Semaphore pending queue pointer is NULL&lt;br /&gt;
 *          ERR_FIXED_DATAQ_PTR_BAD             Dataq fixed pointer is NULL&lt;br /&gt;
 *          ERR_DYN_DATAQ_PTR_BAD               Dataq dynamic pointer is NULL&lt;br /&gt;
 *          ERR_DATAQ_PEND_PTR_BAD              Dataq pending queue pointer is NULL&lt;br /&gt;
 *          ERR_DATAQ_DATA_PTR_BAD              Dataq data pointer is NULL&lt;br /&gt;
 *          ERR_CPU_INT_NUMBER_INVALID          SPARC only.IRQ number for CPU inter-comunication invalid(zero or used by timer)&lt;br /&gt;
 *          ERR_REGISTER_CPU_IRQ_FAILED         SPARC only. Failed to set CPU IRQ handler in BCC&lt;br /&gt;
 *          ERR_CPU_STACK_INVALID               Current CPU stack not within specified range&lt;br /&gt;
 *          ERR_CPU_PRIORITY_STACK_INVALID      Per CPU priority stack invalid&lt;br /&gt;
 *          ERR_LOG_AREA_END_SENTINEL_BAD       Log area end sentinel override&lt;br /&gt;
 *          ERR_TA_CONFIG_PTR_BAD               SPARC only; Timed action configuration data pointer is NULL&lt;br /&gt;
 *          ERR_TA_TIMER_INDEX_INVALID          SPARC only; Timed action sub-timer index in timer unit is invalid&lt;br /&gt;
 *          ERR_TA_IRQ_NUMBER_INVALID           SPARC only; Timer action timer IRQ number is invalid&lt;br /&gt;
 *          ERR_TA_BCC_IRQ_REGISTER_FAILED      SPARC only; Timed action timer IRQ handler failed to register&lt;br /&gt;
 */&lt;br /&gt;
S32_t   oceos_start(&lt;br /&gt;
    const U32_t * const fixed_array_ptr,// pointer to fixed data array&lt;br /&gt;
    const U32_t start_task,             // taskID&lt;br /&gt;
    void * const data_ptr               // pointer to data to be passed to task&lt;br /&gt;
);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| fixed_array_ptr || Pointer to fixed data array&lt;br /&gt;
|-&lt;br /&gt;
| start_task      || Task ID&lt;br /&gt;
|-&lt;br /&gt;
| data_ptr        || Pointer to data to be passed to the task&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit  || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT               || Fixed area pointer is null or bad sentinel&lt;br /&gt;
|-&lt;br /&gt;
| ERR_FIXED_AREA_SIZE_WRONG           || Fixed area size is zero&lt;br /&gt;
|-&lt;br /&gt;
| ERR_FIXED_AREA_END_SENTINEL_BAD     || Fixed data end sentinel corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_FIXED_AREA_BAD_XOR              || Fixed area bad checksum or checksum mis-match&lt;br /&gt;
|-&lt;br /&gt;
| ERR_INIT_NOT_DONE                   || oceos_start() called without initialisation&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DYN_AREA_PTR_BAD                || Dynamic area pointer invalid in sysMetaPtr&lt;br /&gt;
|-&lt;br /&gt;
| ERR_INT_HANDLER_BAD                 || IRQ controller pointer provided by BCC is NULL;or OCEOS handler is not set&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DYN_JOB_PTR_BAD                 || Job array pointer is NULL&lt;br /&gt;
|-&lt;br /&gt;
| ERR_FIXED_TASK_PTR_BAD              || Tasks array pointer is NULL&lt;br /&gt;
|-&lt;br /&gt;
| ERR_JOB_COUNT_WRONG                 || Total job count inconsistent&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DYN_MUTEX_PTR_BAD               || Mutex dynamic pointer is NULL&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DYN_LOCK_PTR_BAD                || Mutex lock array pointer is NULL&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DYN_RWMUTEX_PTR_BAD             || Rwmutex dynamic pointer is NULL&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DYN_RWLOCK_PTR_BAD              || Rwmutex lock array pointer is NULL&lt;br /&gt;
|-&lt;br /&gt;
| ERR_FIXED_SEM_PTR_BAD               || Semaphore fixed pointer is NULL&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DYN_SEM_PTR_BAD                 || Semaphore dynamic pointer is NULL&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SEM_PEND_PTR_BAD                || Semaphore pending queue pointer is NULL&lt;br /&gt;
|-&lt;br /&gt;
| ERR_FIXED_DATAQ_PTR_BAD             || Dataq fixed pointer is NULL&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DYN_DATAQ_PTR_BAD               || Dataq dynamic pointer is NULL&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DATAQ_PEND_PTR_BAD              || Dataq pending queue pointer is NULL&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DATAQ_DATA_PTR_BAD              || Dataq data pointer is NULL&lt;br /&gt;
|-&lt;br /&gt;
| ERR_CPU_INT_NUMBER_INVALID          || SPARC only.IRQ number for CPU inter-comunication invalid(zero or used by timer)&lt;br /&gt;
|-&lt;br /&gt;
| ERR_REGISTER_CPU_IRQ_FAILED         || SPARC only. Failed to set CPU IRQ handler in BCC&lt;br /&gt;
|-&lt;br /&gt;
| ERR_CPU_STACK_INVALID               || Current CPU stack not within specified range&lt;br /&gt;
|-&lt;br /&gt;
| ERR_CPU_PRIORITY_STACK_INVALID      || Per CPU priority stack invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_LOG_AREA_END_SENTINEL_BAD       || Log area end sentinel override&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_CONFIG_PTR_BAD               || SPARC only; Timed action configuration data pointer is NULL&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_TIMER_INDEX_INVALID          || SPARC only; Timed action sub-timer index in timer unit is invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_IRQ_NUMBER_INVALID           || SPARC only; Timer action timer IRQ number is invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_BCC_IRQ_REGISTER_FAILED      || SPARC only; Timed action timer IRQ handler failed to register&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/* Sample Task names - all here start with t_ to help avoid name confusion */&lt;br /&gt;
enum TASK_NAME{&lt;br /&gt;
    t_tom,                      // will have task ID 0&lt;br /&gt;
    t_dick,                     // will have task ID 1&lt;br /&gt;
};&lt;br /&gt;
extern U32_t fixed_data[];&lt;br /&gt;
...&lt;br /&gt;
S32_t status;&lt;br /&gt;
&lt;br /&gt;
status = oceos_start(fixed_data, t_tom, NULL);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_exit()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''initialisation.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Ends scheduling and exit from [[OCEOSmp/directive_reference#oceos_start()|oceos_start()]].&lt;br /&gt;
No task can be started after this.&amp;lt;br&amp;gt;&lt;br /&gt;
OCEOS will exit when the current job ends.&amp;lt;br&amp;gt;&lt;br /&gt;
An idle task in an endless loop should check that scheduling is enabled.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Ends scheduling and exit from oceos_start.&lt;br /&gt;
 * No task can be started after this.&lt;br /&gt;
 * OCEOS will exit when the current job ends.&lt;br /&gt;
 * An idle task in an endless loop should check that scheduling is enabled.&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Called before scheduling started&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_exit(void);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
There are no input parameters to this function.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit  || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Called before scheduling started&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
// Exit OCEOS&lt;br /&gt;
oceos_exit();&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_CPU_sleep()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''initialisation.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
 Puts CPU in sleep mode.&amp;lt;br&amp;gt;&lt;br /&gt;
 User must to be sure that interrupts are enabled.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Puts CPU in sleep mode.&lt;br /&gt;
 * User must to be sure that interrupts are enabled.&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_CPU_sleep(void);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
There are no input parameters to this function.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
// Put CPU to sleep&lt;br /&gt;
oceos_CPU_sleep();&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceosmp_cpu_disable()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''initialisation.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function ends execution of all tasks running on particular CPU and removes the CPU from scheduling.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Ends execution of all tasks running on particular CPU and removes this CPU from scheduling.&lt;br /&gt;
 * @param cpu_id&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              CPU ID outside allowed range 0 to 254&lt;br /&gt;
 *          ERR_ID_WRONG                CPU ID &amp;gt;= number of available CPUs&lt;br /&gt;
 *          ERR_CPU_ALREADY_DISABLED    CPU already disabled&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceosmp_cpu_disable(&lt;br /&gt;
    U32_t cpu_id&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| cpu_id || ID of CPU core to be disabled.&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit  || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || CPU ID outside allowed range 0 to 254&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || CPU ID &amp;gt;= number of available CPUs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_CPU_ALREADY_DISABLED    || CPU already disabled&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, faulty_cpu;&lt;br /&gt;
...&lt;br /&gt;
// Disable faulty CPU core&lt;br /&gt;
status = oceosmp_cpu_disable(faulty_cpu));&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceosmp_cpu_enable()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''initialisation.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function adds a disabled CPU core to the OCEOSmp scheduler. It should only be called after scheduling has started&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 *  Adds disabled CPU to OCEOSmp scheduler&lt;br /&gt;
 *&lt;br /&gt;
 *  N.B. This function should only be called after scheduling has started&lt;br /&gt;
 *&lt;br /&gt;
 * @param cpu_id&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              CPU ID outside allowed range 0 to 254&lt;br /&gt;
 *          ERR_ID_WRONG                CPU ID &amp;gt;= number of available CPUs; or the same as currently running&lt;br /&gt;
 *          ERR_CPU_ALREADY_ENABLED     CPU already enabled&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceosmp_cpu_enable(&lt;br /&gt;
    U32_t cpu_id&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| cpu_id || ID of CPU core to be enabled.&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit  || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || CPU ID outside allowed range 0 to 254&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || CPU ID &amp;gt;= number of available CPUs; or the same as currently running&lt;br /&gt;
|-&lt;br /&gt;
| ERR_CPU_ALREADY_ENABLED     || CPU already enabled&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, good_cpu;&lt;br /&gt;
...&lt;br /&gt;
// Enable CPU core&lt;br /&gt;
status = oceosmp_cpu_enable(good_cpu));&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceosmp_cpu_terminate()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''initialisation.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function removes a CPU core from the OCEOSmp scheduler and marks it so it cannot be restarted. It puts CPU to sleep with interrupts disabled. It should only be called after scheduling has started.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 *  Removes CPU from OCEOSMP scheduler and terminates, cannot be restarted.&lt;br /&gt;
 *  Puts CPU to sleep with interrupts disabled&lt;br /&gt;
 *&lt;br /&gt;
 *  N.B. This function should only be called after scheduling has started&lt;br /&gt;
 *  Steps:&lt;br /&gt;
 *     1. Set terminate flag on this CPU;&lt;br /&gt;
 *     2. Trigger software interrupt to transfer execution to IRQ handler;&lt;br /&gt;
 *     3. Check flag and if set =&amp;gt; put CPU to sleep in while loop with interrupts disabled;&lt;br /&gt;
 *     4. Set MAX priority on this CPU priority stack;&lt;br /&gt;
 *     5. Remove CPU from scheduling;&lt;br /&gt;
 *     6. Clean up all the tasks by calling task terminate function and free up all the&lt;br /&gt;
 *        preempted jobs by this CPU;&lt;br /&gt;
 *&lt;br /&gt;
 * @param cpu_id&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              CPU ID outside allowed range 0 to 254&lt;br /&gt;
 *          ERR_ID_WRONG                CPU ID &amp;gt;= number of available CPUs; or the same as currently running&lt;br /&gt;
 *          ERR_CPU_ALREADY_TERMINATED  CPU already terminated&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceosmp_cpu_terminate(&lt;br /&gt;
    U32_t cpu_id&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| cpu_id || ID of CPU core to be terminated.&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit  || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || CPU ID outside allowed range 0 to 254&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || CPU ID &amp;gt;= number of available CPUs; or the same as currently running&lt;br /&gt;
|-&lt;br /&gt;
| ERR_CPU_ALREADY_TERMINATED  || CPU already terminated&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, faulty_cpu;&lt;br /&gt;
...&lt;br /&gt;
// Terminate CPU core&lt;br /&gt;
status = oceosmp_cpu_terminate(faulty_cpu));&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;Task directives&amp;lt;/span&amp;gt;==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ API Functions&lt;br /&gt;
|-&lt;br /&gt;
| Directive                                                                     || Description                          || main || task || IRQ handler&lt;br /&gt;
|-&lt;br /&gt;
| [[OCEOSmp/directive reference#oceos_task_create()| oceos_task_create()]]             || Create Task                        || *    ||      || &lt;br /&gt;
|-&lt;br /&gt;
| [[OCEOSmp/directive reference#oceos_task_start()| oceos_task_start()]]               || Start Task                         ||      ||  *   || *&lt;br /&gt;
|-&lt;br /&gt;
| [[OCEOSmp/directive reference#oceos_task_timed_start()| oceos_task_timed_start()]]   || Schedule a task to start execution at a given system time||      ||  *   || *&lt;br /&gt;
|-&lt;br /&gt;
| [[OCEOSmp/directive reference#oceos_task_disable()| oceos_task_disable()]]           || Disable Task                       ||      ||  *   || *&lt;br /&gt;
|-&lt;br /&gt;
| [[OCEOSmp/directive reference#oceos_task_enable()| oceos_task_enable()]]             || Enable Task                        ||      ||  *   || *&lt;br /&gt;
|-&lt;br /&gt;
| [[OCEOSmp/directive reference#oceos_task_self()| oceos_task_self()]]                 || Returns the task ID of the currently executing task ||    ||  *   || *&lt;br /&gt;
|-&lt;br /&gt;
| [[OCEOSmp/directive reference#oceos_task_get_priority()| oceos_task_get_priority()]] || Get priority of a task             ||      ||  *   || *&lt;br /&gt;
|-&lt;br /&gt;
| [[OCEOSmp/directive reference#oceos_task_get_status()| oceos_task_get_status()]]     || Get status of a task               ||      ||  *   || *&lt;br /&gt;
|-&lt;br /&gt;
| [[OCEOSmp/directive reference#oceos_task_kill()| oceos_task_kill()]]                 || Directive to terminate current task||      ||  *   || *&lt;br /&gt;
|-&lt;br /&gt;
| [[OCEOSmp/directive reference#oceos_task_get_info()| oceos_task_get_info()]]         || Get task information               ||      ||  *   || *&lt;br /&gt;
|-&lt;br /&gt;
| [[OCEOSmp/directive reference#oceosmp_task_kill()| oceosmp_task_kill()]]                 || Directive to terminate current task||      ||  *   || *&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;Task data structures&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''tasks.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The following data structures are used by some of the task directives.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Data structures'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * A pointer to this structure is passed to oceos_task_create().&lt;br /&gt;
 * The structure is first initialised according to a tasks's parameters,&lt;br /&gt;
 * and is not used again after the task is created and may then be discarded.&lt;br /&gt;
 */&lt;br /&gt;
struct task_descriptor {&lt;br /&gt;
&lt;br /&gt;
	void (*function_start)(void*);	// name of task start function&lt;br /&gt;
	void (*function_end)(void*);	// optional, NULL or task end function&lt;br /&gt;
&lt;br /&gt;
	U32_t task_id;					// 0 to 254, usually an enum&lt;br /&gt;
	U32_t task_jobs_max;			// 1 to 15, max concurrent 'jobs'&lt;br /&gt;
	U32_t task_priority;			// 1 (highest) to 254 (lowest)&lt;br /&gt;
	U32_t task_threshold;			// &amp;gt;=1, &amp;lt;= task_priority (higher or same priority)&lt;br /&gt;
	U32_t task_turned_on_initially;	// 0: disabled initially, else enabled&lt;br /&gt;
&lt;br /&gt;
	U32_t time_deadline_microsecs;	// start request to finish, 0 to ignore&lt;br /&gt;
	U32_t time_min_interval_microsecs;	// between start requests, 0 to ignore&lt;br /&gt;
&lt;br /&gt;
	U32_t uses_cpu_affinity;		// 0: not restricted, else core restricted&lt;br /&gt;
	U32_t uses_cpu_affinity_core_id;// core ID to which restricted if affinity used&lt;br /&gt;
}__attribute__ ((aligned (8)));&lt;br /&gt;
&lt;br /&gt;
/**&lt;br /&gt;
 * Task info used with oceos_task_get_info&lt;br /&gt;
 */&lt;br /&gt;
struct task_info {&lt;br /&gt;
  U64_t           time_max_delay;               // maximum time job is waiting on ready queue before becoming active&lt;br /&gt;
  U64_t           time_max_finish;              // maximum time to finish job execution after starting&lt;br /&gt;
  U64_t           time_max_exec;                // maximum time spent executing&lt;br /&gt;
  U64_t           time_total_exec;              // total CPU time used by this task&lt;br /&gt;
  U64_t           time_min_gap_starts;          // minimum time between job creations, can be reset&lt;br /&gt;
  U64_t           time_min_gap_finish_start;    // minimum time between job ending and new job creation, can be reset&lt;br /&gt;
&lt;br /&gt;
  U64_t           time_last_start;              // time of most recent job creation&lt;br /&gt;
  U64_t           time_last_finish;             // time of most recent job finish&lt;br /&gt;
&lt;br /&gt;
  unsigned int    jobs_current_max  :16;        // maximum number of current jobs for this task, no roll over, can be reset&lt;br /&gt;
  unsigned int    jobs_total        :16;        // number of times this task was started, no roll-over, can be reset&lt;br /&gt;
  U32_t           jobs_current;                 // Number of task instances currently in use by oceos&lt;br /&gt;
&lt;br /&gt;
  U32_t           preempt_max;                  // maximum times any job was pre-empted, no roll-over, can be reset&lt;br /&gt;
}__attribute__ ((aligned (8)));&lt;br /&gt;
&lt;br /&gt;
/* A task's status is returned as below if queried */&lt;br /&gt;
enum TASK_STATUS {&lt;br /&gt;
    TASK_DISABLED,      // cannot be scheduled, and no current jobs&lt;br /&gt;
    TASK_ENABLED,       // can be scheduled, but no current jobs&lt;br /&gt;
    TASK_INVALID,       // task does not exist&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_task_create()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''tasks.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Create a task.&lt;br /&gt;
Can only be use before OCEOS starts. Stores the task information in the OCEOS fixed data area.&lt;br /&gt;
This directive populates the data structures for a task. It should be called after [[OCEOSmp/directive_reference#oceos_init()|oceos_init()]] and before [[OCEOSmp/directive_reference#oceos_init_finish()|oceos_init_finish()]].&amp;lt;br&amp;gt;&lt;br /&gt;
It must be called for each task otherwise [[OCEOSmp/directive_reference#oceos_start()|oceos_start()]] will return an error.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Create a task using a task descriptor structure&lt;br /&gt;
 *&lt;br /&gt;
 * Can only be used in Initialisation Phase.&lt;br /&gt;
 *&lt;br /&gt;
 * A task has twelve constant parameters set when the task is created.&lt;br /&gt;
 * Rather than setting a list of these parameters the named fields of a&lt;br /&gt;
 * task_descriptor structure are set and a pointer to it passed here.&lt;br /&gt;
 *&lt;br /&gt;
 * The task_descriptor structure fields are described above.&lt;br /&gt;
 * Once the task has been created the structure can be discarded.&lt;br /&gt;
 *&lt;br /&gt;
 * To create a task:&lt;br /&gt;
 *		set up a task_descriptor structure,&lt;br /&gt;
 *		set its fields to the parameter values for the task,&lt;br /&gt;
 *		pass a pointer to the structure to this directive.&lt;br /&gt;
 *&lt;br /&gt;
 * The structure is checked for validity by oceos_task_create and its&lt;br /&gt;
 * information used to set the task details in the OCEOS fixed data area.&lt;br /&gt;
 *&lt;br /&gt;
 * @param  struct task_descriptor *	fields give task characteristics&lt;br /&gt;
 *&lt;br /&gt;
 * @return OCEOS_SUCCESS            No errors or warnings&lt;br /&gt;
 *         WARN_NO_END_FUNCTION     Warning, no end task function specified&lt;br /&gt;
 *&lt;br /&gt;
 *         ERR_SYS_FIXED_CORRUPT    System Fixed area corrupt&lt;br /&gt;
 *         ERR_WRONG_CPU_CORE       Executing directive on wrong CPU&lt;br /&gt;
 *         ERR_WRONG_PHASE          Called before oceos_init() is done&lt;br /&gt;
 *         ERR_TOO_MANY             MAX number of tasks already created&lt;br /&gt;
 *         ERR_ID_INVALID           Task ID outside allowed range 0 to 254&lt;br /&gt;
 *         ERR_ID_WRONG             Task ID outside &amp;gt;= number of tasks&lt;br /&gt;
 *         ERR_T_ALREADY_ALLOCATED  Task ID already in use&lt;br /&gt;
 *         ERR_T_PRIORITY_INVALID   Task priority outside allowed range 1 to 254&lt;br /&gt;
 *         ERR_THRESHOLD_INVALID    Task threshold outside range 1 to 254&lt;br /&gt;
 *         ERR_THRESHOLD_WRONG      Task threshold  higher priority than task priority&lt;br /&gt;
 *         ERR_JOBS_MAX_INVALID     Job number outside range 1 to 15&lt;br /&gt;
 *         ERR_JOBS_TOO_MANY        System capacity exceeded&lt;br /&gt;
 *         ERR_AFFINITY_WRONG       CPU core specified is outside chosen range&lt;br /&gt;
 *         ERR_START_FUNCTION_BAD   Task start function address either NULL or misaligned&lt;br /&gt;
 */&lt;br /&gt;
S32_t   oceos_task_create(&lt;br /&gt;
    const struct task_descriptor * const task_description_ptr&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter           || Description&lt;br /&gt;
|-&lt;br /&gt;
|struct task_descriptor * || Pointer to task descriptor which contains task attributes&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit     || Description&lt;br /&gt;
|-&lt;br /&gt;
|WARN_NO_END_FUNCTION     || Warning, no end task function specified&lt;br /&gt;
|-&lt;br /&gt;
|ERR_SYS_FIXED_CORRUPT    || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
|ERR_WRONG_CPU_CORE       || Executing directive on wrong CPU&lt;br /&gt;
|-&lt;br /&gt;
|ERR_WRONG_PHASE          || Called before oceos_init() is done&lt;br /&gt;
|-&lt;br /&gt;
|ERR_TOO_MANY             || MAX number of tasks already created&lt;br /&gt;
|-&lt;br /&gt;
|ERR_ID_INVALID           || Task ID outside allowed range 0 to 254&lt;br /&gt;
|-&lt;br /&gt;
|ERR_ID_WRONG             || Task ID outside &amp;gt;= number of tasks&lt;br /&gt;
|-&lt;br /&gt;
|ERR_T_ALREADY_ALLOCATED  || Task ID already in use&lt;br /&gt;
|-&lt;br /&gt;
|ERR_T_PRIORITY_INVALID   || Task priority outside allowed range 1 to 254&lt;br /&gt;
|-&lt;br /&gt;
|ERR_THRESHOLD_INVALID    || Task threshold outside range 1 to 254&lt;br /&gt;
|-&lt;br /&gt;
|ERR_THRESHOLD_WRONG      || Task threshold  higher priority than task priority&lt;br /&gt;
|-&lt;br /&gt;
|ERR_JOBS_MAX_INVALID     || Job number outside range 1 to 15&lt;br /&gt;
|-&lt;br /&gt;
|ERR_JOBS_TOO_MANY        || System capacity exceeded&lt;br /&gt;
|-&lt;br /&gt;
|ERR_AFFINITY_WRONG       || CPU core specified is outside chosen range&lt;br /&gt;
|-&lt;br /&gt;
|ERR_START_FUNCTION_BAD   || Task start function address either NULL or misaligned&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
/* Sample Task names - all here start with t_ to help avoid name confusion */&lt;br /&gt;
enum TASK_NAME{&lt;br /&gt;
      t_0,&lt;br /&gt;
      t_1,&lt;br /&gt;
      t_2&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
/*&lt;br /&gt;
 * APPLICATION FUNCTION DECLARATIONS&lt;br /&gt;
 */&lt;br /&gt;
void fun0(void *);&lt;br /&gt;
void fun1(void *);&lt;br /&gt;
void fun2(void *);&lt;br /&gt;
void end_function(void *);&lt;br /&gt;
&lt;br /&gt;
const struct task_descriptor tasks_data[NUMBER_OF_TASKS] = {&lt;br /&gt;
    {fun0, end_function, t_0, 2, 10, 8, TASK_ENABLED, 0, 0, 0, 0},&lt;br /&gt;
    {fun1, end_function, t_1, 2, 10, 8, TASK_ENABLED, 0, 0, 0, 0},&lt;br /&gt;
    {fun2, end_function, t_2, 2, 10, 8, TASK_ENABLED, 0, 0, 0, 0}&lt;br /&gt;
}; &lt;br /&gt;
&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
    // create tasks (names are defined in the application header)&lt;br /&gt;
    for (i=0; i&amp;lt;NUMBER_OF_TASKS; i++){&lt;br /&gt;
        if ( oceos_task_create(&amp;amp;tasks_data[i]) != OCEOS_SUCCESS ){&lt;br /&gt;
        	oceosmp_print(&amp;quot;\nFailed to create task\n\r&amp;quot;);&lt;br /&gt;
        	return -i;&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_task_start()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''tasks.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function starts an instance of a task. An instance of a task is called a job in OCEOS terminology.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 *  Starting a task involves three main stages&lt;br /&gt;
 *      1 setting up a job&lt;br /&gt;
 *          finding a free job entry if available&lt;br /&gt;
 *          setting up this entry including passing it the data void *&lt;br /&gt;
 *&lt;br /&gt;
 *      2 placing the job on readyQ&lt;br /&gt;
 *&lt;br /&gt;
 *      3 doing a context switch&lt;br /&gt;
 * This function should only be called after OCEOS is initialised&lt;br /&gt;
 *       and the dynamic task and job structures set up&lt;br /&gt;
 *&lt;br /&gt;
 *  When used from an interrupt handler,&lt;br /&gt;
 *  the context switch is only done&lt;br /&gt;
 *  after all nested interrupts have unwound&lt;br /&gt;
 *&lt;br /&gt;
 * @param task_id Task ID must be in range 0 to 254&lt;br /&gt;
 * @param ptr     Pointer to task data&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT    System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT      System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE          Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID           Task ID is invalid&lt;br /&gt;
 *          ERR_ID_WRONG             Task ID is wrong&lt;br /&gt;
 *          ERR_START_TASK_DISABLED  Starting task is disabled&lt;br /&gt;
 *          ERR_TOO_MANY             There is no free job&lt;br /&gt;
 *          ERR_SYS_BUSY             Failed to grab the lock&lt;br /&gt;
 */&lt;br /&gt;
S32_t   oceos_task_start(&lt;br /&gt;
    const U32_t task_id, // task ID, must be in range 0 to 254&lt;br /&gt;
    void * const ptr    // pointer to data&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| task_id || U32_t with Task ID in range 0 to 254.&lt;br /&gt;
|-&lt;br /&gt;
| ptr    || void * pointer to task data&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit  || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT    || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT      || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE          || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID           || Task ID is invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG             || Task ID is wrong&lt;br /&gt;
|-&lt;br /&gt;
| ERR_START_TASK_DISABLED  || Starting task is disabled&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TOO_MANY             || There is no free job&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY             || Failed to grab the lock&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
void *ptr;&lt;br /&gt;
...&lt;br /&gt;
// Start instance of task T_1 passing pointer ptr&lt;br /&gt;
status = oceos_task_start(t_1,ptr);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_task_timed_start()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''tasks.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function schedules a task to start execution at a given system time.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 *  Schedule a task to start execution at a given system time&lt;br /&gt;
 *&lt;br /&gt;
 *  The before and after offsets define a window around the selected time&lt;br /&gt;
 *  in which the task may be started.&lt;br /&gt;
 *&lt;br /&gt;
 *  If the current system time is before the start window a job is created&lt;br /&gt;
 *  and a corresponding action put on the timed action queue.&lt;br /&gt;
 *&lt;br /&gt;
 *  If the current system time is within the time window for starting the task,&lt;br /&gt;
 *  it is started immediately.&lt;br /&gt;
 *&lt;br /&gt;
 *  If the current system time is after the window, an error is reported.&lt;br /&gt;
 *&lt;br /&gt;
 *  Times are in microseconds.&lt;br /&gt;
 *&lt;br /&gt;
 *  This function should only be called after OCEOS is initialised&lt;br /&gt;
 *  and the dynamic task and job structures set up&lt;br /&gt;
 *&lt;br /&gt;
 * @param taskID        Task ID must be in range 0 to 254&lt;br /&gt;
 * @param ptr           Pointer to data&lt;br /&gt;
 * @param start_time    System time at which job should start&lt;br /&gt;
 * @param before        Forward tolerance for time&lt;br /&gt;
 * @param after         Backward tolerance for time&lt;br /&gt;
 * @param return_job_id Return job_id to the user, to remove this job from timed action if needed&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              Task ID invalid&lt;br /&gt;
 *          ERR_ID_WRONG                Task ID is wrong&lt;br /&gt;
 *          ERR_TA_NOT_INIT             Timed action inialisation is not done and tried to be used&lt;br /&gt;
 *          ERR_START_TASK_DISABLED     Starting task is disabled&lt;br /&gt;
 *          ERR_TOO_MANY                There is no free job&lt;br /&gt;
 *          ERR_TOO_LATE                Starting task is too late(out of time frame)&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to grab the lock&lt;br /&gt;
 *          ERR_TA_Q_FULL               Timed action queue is full&lt;br /&gt;
 *          ERR_TA_START_FAILED         Timed action execute failed; See log&lt;br /&gt;
 */&lt;br /&gt;
S32_t   oceos_task_timed_start(&lt;br /&gt;
    const U32_t task_id,     // task ID, must be in range 0 to 254&lt;br /&gt;
    void * const ptr,        // pointer to data&lt;br /&gt;
    const U64_t start_time,  // system time at which job should start&lt;br /&gt;
    const U32_t before,      // forward tolerance for time&lt;br /&gt;
    const U32_t after,       // backward tolerance for time&lt;br /&gt;
    U32_t * return_job_id    // return job_id to the user, to remove this job from timed action if needed&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| taskID        || U32_t task ID must be in range 0 to 254&lt;br /&gt;
|-&lt;br /&gt;
| ptr           || void * pointer to data&lt;br /&gt;
|-&lt;br /&gt;
| start_time    || U64_t system time at which job should start&lt;br /&gt;
|-&lt;br /&gt;
| before        || U32_t forward tolerance for time&lt;br /&gt;
|-&lt;br /&gt;
| after         || U32_t backward tolerance for time&lt;br /&gt;
|-&lt;br /&gt;
| return_job_id || U32_t return job_id to the user, to remove this job from timed action if needed&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit  || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || Task ID invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || Task ID is wrong&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_NOT_INIT             || Timed action inialisation is not done and tried to be used&lt;br /&gt;
|-&lt;br /&gt;
| ERR_START_TASK_DISABLED     || Starting task is disabled&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TOO_MANY                || There is no free job&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TOO_LATE                || Starting task is too late(out of time frame)&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to grab the lock&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_Q_FULL               || Timed action queue is full&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_START_FAILED         || Timed action execute failed; See log&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
U32_t job_id;&lt;br /&gt;
U64_t cur_sys_time;&lt;br /&gt;
...&lt;br /&gt;
  cur_sys_time = oceos_time_sys_get64();&lt;br /&gt;
&lt;br /&gt;
  // Start task 10,000 microseconds (us) from now and advise if started more than 1,000 us before or 2,000 us after.&lt;br /&gt;
  status = oceos_task_timed_start(t_2, ptr, cur_sys_time + 10000, 1000, 2000, &amp;amp;job_id);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_task_disable()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''initialisation.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function disables a task and removes any current pending jobs from the readyQ.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 *  Disable a task and remove any current pending jobs on readyQ.&lt;br /&gt;
 *&lt;br /&gt;
 *  A disabled task's jobs  will not be put into execution nor put on readyQ.&lt;br /&gt;
 *&lt;br /&gt;
 *  Note that where execution of a task has already commenced,&lt;br /&gt;
 *  disabling the task will not prevent it from completing.&lt;br /&gt;
 *&lt;br /&gt;
 *  This function should only be called after OCEOS is initialised&lt;br /&gt;
 *  and the dynamic task and job structures set up&lt;br /&gt;
 *&lt;br /&gt;
 * @param taskID  Task ID must be in range 0 to 254&lt;br /&gt;
 * @return: OCEOS_SUCCESS&lt;br /&gt;
 *          WARN_ALREADY_DISABLED        Task already disabled&lt;br /&gt;
 *          WARN_SEM_PEND_REMOVE_FAILED  Failed to remove job from semaphore pending queue&lt;br /&gt;
 *          WARN_DQ_PEND_REMOVE_FAILED   Failed to remove job from dataq pending queue&lt;br /&gt;
 *&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT        System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT          System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE              Directive was called before OCEOS init is finished&lt;br /&gt;
 *          ERR_ID_INVALID               Task ID is invalid&lt;br /&gt;
 *          ERR_ID_WRONG                 Task ID is wrong&lt;br /&gt;
 *          ERR_SYS_BUSY                 Failed to grab the lock&lt;br /&gt;
 */&lt;br /&gt;
S32_t   oceos_task_disable(&lt;br /&gt;
    const U32_t task_id // task ID, must be in range 0 to 254&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| taskID || U32_t task ID must be in range 0 to 254&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit  || Description&lt;br /&gt;
|-&lt;br /&gt;
| WARN_ALREADY_DISABLED        || Task already disabled&lt;br /&gt;
|-&lt;br /&gt;
| WARN_SEM_PEND_REMOVE_FAILED  || Failed to remove job from semaphore pending queue&lt;br /&gt;
|-&lt;br /&gt;
| WARN_DQ_PEND_REMOVE_FAILED   || Failed to remove job from dataq pending queue&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT        || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT          || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE              || Directive was called before OCEOS init is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID               || Task ID is invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                 || Task ID is wrong&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                 || Failed to grab the lock&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Disable task t_1&lt;br /&gt;
status = oceos_task_disable(t_1);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_task_enable()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''tasks.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function enables a task. Only enabled tasks may be started.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 *  Enable a task - only enabled tasks are placed on readyQ or started.&lt;br /&gt;
 *&lt;br /&gt;
 *  This function should only be called after OCEOS is initialised&lt;br /&gt;
 *  and the dynamic task and job structures set up&lt;br /&gt;
 *&lt;br /&gt;
 * @param taskID   Task ID must be in range 0 to 254&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          WARN_ALREADY_ENABLED     Task already enabled&lt;br /&gt;
 *&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT    System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT      System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE          Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID           Task ID is invalid&lt;br /&gt;
 *          ERR_ID_WRONG             Task ID is wrong&lt;br /&gt;
 *          ERR_SYS_BUSY             Failed to grab the lock&lt;br /&gt;
 */&lt;br /&gt;
S32_t   oceos_task_enable(&lt;br /&gt;
    const U32_t task_id // task ID, must be in range 0 to 254&lt;br /&gt;
);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| taskID  || U32_t task ID must be in range 0 to 254&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit  || Description&lt;br /&gt;
|-&lt;br /&gt;
| WARN_ALREADY_ENABLED     || Task already enabled&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT    || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT      || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE          || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID           || Task ID is invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG             || Task ID is wrong&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY             || Failed to grab the lock&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Enable task t_2&lt;br /&gt;
status = oceos_task_enable(t_2);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_task_self()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''tasks.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the task number of the currently running task on the calling CPU.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Get currently running task on calling CPU&lt;br /&gt;
 *&lt;br /&gt;
 * @param t_id  Task ID holder&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT        System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT          System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE              Directive was called before OCEOS init is finished&lt;br /&gt;
 *          ERR_CPU_DYN_PTR_BAD          CPU dynamic area pointer corrupt&lt;br /&gt;
 */&lt;br /&gt;
S32_t  oceos_task_self(&lt;br /&gt;
    U32_t *t_id&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| t_id || S32_t * pointer to variable where task ID will be written.&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit  || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT        || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT          || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE              || Directive was called before OCEOS init is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_CPU_DYN_PTR_BAD          || CPU dynamic area pointer corrupt&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, task_running;&lt;br /&gt;
...&lt;br /&gt;
// Return task ID that's running on this core&lt;br /&gt;
status = oceos_task_self(&amp;amp;task_running);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_task_get_priority()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''tasks.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the priority of the task ID passed to it.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Get priority of the task&lt;br /&gt;
 *&lt;br /&gt;
 * @param taskID        ID of task, must be in range 0 to 254&lt;br /&gt;
 * @param t_priority    Pointer to task priority holder&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT        System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT          System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE              Directive was called before OCEOS init is finished&lt;br /&gt;
 *          ERR_ID_INVALID               Task ID is invalid&lt;br /&gt;
 *          ERR_ID_WRONG                 Task ID is wrong&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_task_get_priority(&lt;br /&gt;
    const U32_t task_id, // task ID, must be in range 0 to 254&lt;br /&gt;
    U32_t *t_priority   // Pointer to task priority holder&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| task_id || S32_t task ID of task whose priority is required&lt;br /&gt;
|-&lt;br /&gt;
| t_priority || S32_t * pointer to variable where priority will be written&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit  || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT        || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT          || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE              || Directive was called before OCEOS init is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID               || Task ID is invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                 || Task ID is wrong&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
U32_t t_priority;&lt;br /&gt;
...&lt;br /&gt;
// Return the priority of task ID t_4 &lt;br /&gt;
status = oceos_task_get_priority(t_4, &amp;amp;t_priority);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_task_get_status()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''tasks.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the status of the task ID passed to it.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Get status of the task;&lt;br /&gt;
 * if OK t_status holds enum TASK_STATUS&lt;br /&gt;
 *&lt;br /&gt;
 * @param taskID    ID of task, must be in range 0 to 254&lt;br /&gt;
 * @param t_status  enum TASK_STATUS holder&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT        System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT          System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE              Directive was called before OCEOS init is finished&lt;br /&gt;
 *          ERR_ID_INVALID               Task ID is invalid&lt;br /&gt;
 *          ERR_ID_WRONG                 Task ID is wrong&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_task_get_status(&lt;br /&gt;
    const U32_t task_id,&lt;br /&gt;
    U32_t *t_status&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| task_id || S32_t task ID of task whose priority is required&lt;br /&gt;
|-&lt;br /&gt;
| t_status || S32_t * pointer to variable where status will be written&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit  || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT        || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT          || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE              || Directive was called before OCEOS init is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID               || Task ID is invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                 || Task ID is wrong&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
U32_t t_status;&lt;br /&gt;
...&lt;br /&gt;
// Return the status of task ID t_4 &lt;br /&gt;
status = oceos_task_get_status(t_4, &amp;amp;t_status);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_task_get_info()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''tasks.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the task information for the specified task.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Get task information for task with ID.&lt;br /&gt;
 *&lt;br /&gt;
 * User must pass pointer to struct task_info in order to retrieve data.&lt;br /&gt;
 *&lt;br /&gt;
 * @param task_id  Task ID&lt;br /&gt;
 * @param info     Pointer to struct task_info&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT    System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT      System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE          Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID           Task ID invalid&lt;br /&gt;
 *          ERR_ID_WRONG             Task ID wrong&lt;br /&gt;
 *          ERR_TASK_INFO_PTR_BAD    Task info pointer provided by user is NULL&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_task_get_info (&lt;br /&gt;
    const U32_t task_id,   // Task ID&lt;br /&gt;
    struct task_info *info // Pointer to struct task_info&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| task_id || ID of task for which information is required&lt;br /&gt;
|-&lt;br /&gt;
| task_info || struct task_info * pointer to the structure where task information is to be written&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit  || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT    || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT      || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE          || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID           || Task ID invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG             || Task ID wrong&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TASK_INFO_PTR_BAD    || Task info pointer provided by user is NULL&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
struct task_info info;&lt;br /&gt;
...&lt;br /&gt;
// Get information for task T3&lt;br /&gt;
status = oceos_task_get_info(t_3, &amp;amp;info);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceosmp_task_kill()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''tasks.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function kills the specified task running on the specified CPU.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 *  Function to kill currently running task on CPU;&lt;br /&gt;
 *  Can be used:&lt;br /&gt;
 *      From Mode_SVC  =&amp;gt; normal running mode for application&lt;br /&gt;
 *          If nesting level is zero and Mode_SVC&lt;br /&gt;
 *      From Mode_IRQ  =&amp;gt; from IRQ handler&lt;br /&gt;
 *          If nesting level is not zero, set flag to call this function within IRQ handler&lt;br /&gt;
 *      From Exception =&amp;gt; Mode_ABT and Mode_UND&lt;br /&gt;
 *          If nesting level is zero and NOT Mode_SVC, it is exception;&lt;br /&gt;
 *              Disable IRQs on current CPU;&lt;br /&gt;
 *              Set kill current task flag to TRUE;&lt;br /&gt;
 *              Issue SGI on current CPU, will be interrupted on return from Exception and&lt;br /&gt;
 *              this function will be called within IRQ handler&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT    System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT      System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE          Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_CPU_DYN_PTR_BAD      CPU dynamic area pointer corrupt&lt;br /&gt;
 *          ERR_ID_INVALID           Task ID invalid&lt;br /&gt;
 *          ERR_ID_WRONG             Task ID wrong&lt;br /&gt;
 *          ERR_CPU_ID_WRONG         CPU ID wrong&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceosmp_task_kill(&lt;br /&gt;
    U32_t task_id,&lt;br /&gt;
    U32_t cpu_id&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| task_id  || U32_t task ID to be killed (must be in range 0 to 254)&lt;br /&gt;
|-&lt;br /&gt;
| cpu_id  || U32_t CPU ID where task_id is to be killed&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT    || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT      || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE          || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_CPU_DYN_PTR_BAD      || CPU dynamic area pointer corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID           || Task ID invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG             || Task ID wrong&lt;br /&gt;
|-&lt;br /&gt;
| ERR_CPU_ID_WRONG         || CPU ID wrong&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Kill task t_2 on CPU cpu_1&lt;br /&gt;
status = oceosmp_task_kill(t_2, cpu_1);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;Mutex directives&amp;lt;/span&amp;gt;==&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_mutex_create()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''mutex.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function creates a mutex of specified ID with a specified priority ceiling.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Creates a mutex with priority ceiling&lt;br /&gt;
 *&lt;br /&gt;
 * NOTE: This function should only be called after OCEOSmp is initialised with&lt;br /&gt;
 *  oceos_init() and before initialisation ends with oceos_init_finish()&lt;br /&gt;
 *  and scheduling starts with oceos_start()&lt;br /&gt;
 *&lt;br /&gt;
 * @param mutex_id  mutex ID value 0 to 62&lt;br /&gt;
 * @param priority  mutex priority ceiling 1 to 254 (high to low task priority)&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_WRONG_CPU_CORE          Executing directive on wrong CPU&lt;br /&gt;
 *          ERR_WRONG_PHASE             Called before oceos_init() is done&lt;br /&gt;
 *          ERR_TOO_MANY                MAX number of MUTEXs already created&lt;br /&gt;
 *          ERR_ID_INVALID              MUTEX ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                MUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
 *          ERR_MX_ALREADY_ALLOCATED    MUTEX ID already used&lt;br /&gt;
 *          ERR_MX_PRIORITY_WRONG       MUTEX priority ceiling outside allowed range 1 to 254&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_mutex_create(&lt;br /&gt;
    const U32_t mutex_id,  // mutex ID, must be in range 0 to 62&lt;br /&gt;
    const U8_t  priority  // mutex priority ceiling&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| mutex_id  || u32_t mutex ID to be created (value 0 to 62).&lt;br /&gt;
|-&lt;br /&gt;
| priority_ceiling ||  U32_t mutex priority ceiling 1 to 254 (high to low task priority)&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_CPU_CORE          || Executing directive on wrong CPU&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Called before oceos_init() is done&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TOO_MANY                || MAX number of MUTEXs already created&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || MUTEX ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || MUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_MX_ALREADY_ALLOCATED    || MUTEX ID already used&lt;br /&gt;
|-&lt;br /&gt;
| ERR_MX_PRIORITY_WRONG       || MUTEX priority ceiling outside allowed range 1 to 254&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Create mutex with ID print_mutex and priority ceiling of 5&lt;br /&gt;
status = oceos_mutex_create(print_mutex, 5);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_mutex_wait()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''mutex.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function makes the task wait until the specified mutex is available.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
 /*&lt;br /&gt;
  * Wait on mutex with ID.&lt;br /&gt;
  * If task succeeds in grabbing mutex, system level priority rises to&lt;br /&gt;
  * priority of this mutex, so tasks with lower or equal priority will&lt;br /&gt;
  * not be able to start till mutex is released.&lt;br /&gt;
  *&lt;br /&gt;
  * This should only be called after OCEOSmp scheduling has started.&lt;br /&gt;
  *&lt;br /&gt;
  * @param mutex_id     const U32_t  : value 0 to 62&lt;br /&gt;
  *&lt;br /&gt;
  * @return  OCEOS_SUCCESS&lt;br /&gt;
  *          WARN_MX_INCORRECT_ORDER     MUTEX acquired in incorrect order&lt;br /&gt;
  *&lt;br /&gt;
  *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
  *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
  *          ERR_WRONG_PHASE             Directive was called before OCEOSmp initialisation is finished&lt;br /&gt;
  *          ERR_ID_INVALID              MUTEX ID outside allowed range 0 to 62&lt;br /&gt;
  *           ERR_ID_WRONG                MUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
  *          ERR_MX_CEILING_BAD          MUTEX ceiling not lower priority than job priority&lt;br /&gt;
  *          ERR_MX_ALREADY_HELD         MUTEX already held by this job&lt;br /&gt;
  *          ERR_SYS_BUSY                Failed to grab context switch guard&lt;br /&gt;
  */&lt;br /&gt;
S32_t oceos_mutex_wait(&lt;br /&gt;
    const U32_t  mutex_id      // mutex ID, must be in range 0 to 62&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| mutex_id  || u32_t mutex ID to be waited on (value 0 to 62).&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| WARN_MX_INCORRECT_ORDER     || MUTEX acquired in incorrect order&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOSmp initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || MUTEX ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || MUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_MX_CEILING_BAD          || MUTEX ceiling not lower priority than job priority&lt;br /&gt;
|-&lt;br /&gt;
| ERR_MX_ALREADY_HELD         || MUTEX already held by this job&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to grab context switch guard&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Wait on mutex m_2&lt;br /&gt;
status = oceos_mutex_wait(m_2);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_mutex_signal()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''mutex.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function signals the specified mutex.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Signal a mutex with ID&lt;br /&gt;
 *&lt;br /&gt;
 * N.B. :&lt;br /&gt;
 *      This function should not be called from an interrupt handler&lt;br /&gt;
 *      This should only be called after OCEOSmp scheduling has started.&lt;br /&gt;
 *&lt;br /&gt;
 * @param mutex_id     const U32_t  : value 0 to 62&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          WARN_MX_ALREADY_FREE        MUTEX is free already&lt;br /&gt;
 *          WARN_MX_NESTING_BAD         MUTEX nesting incorrect&lt;br /&gt;
 *&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOSmp initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              MUTEX ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                MUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
 *          ERR_MX_WRONG_JOB            MUTEX not held by this job&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to grab context switch guard&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_mutex_signal(&lt;br /&gt;
    const U32_t  mutex_id     // mutex ID, must be in range 0 to 62&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| mutex_id  || u32_t mutex ID to be signalled (value 0 to 62).&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| WARN_MX_ALREADY_FREE        || MUTEX is free already&lt;br /&gt;
|-&lt;br /&gt;
| WARN_MX_NESTING_BAD         || MUTEX nesting incorrect&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOSmp initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || MUTEX ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || MUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_MX_WRONG_JOB            || MUTEX not held by this job&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to grab context switch guard&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Signal mutex m_2&lt;br /&gt;
status = oceos_mutex_signal(m_2);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_mutex_get_value()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''mutex.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the value of the specified mutex.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Get current value of mutex with ID&lt;br /&gt;
 *&lt;br /&gt;
 * @param mutex_id      const U32_t  : value 0 to 62&lt;br /&gt;
 * @param m_value       pointer to MUTEX value holder&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOSmp initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              MUTEX ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                MUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
 *          ERR_MX_DATA_PTR_BAD         Pointer to MUTEX value return holder is null&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_mutex_get_value(&lt;br /&gt;
    const U32_t  mutex_id,      // mutex ID, must be in range 0 to 62&lt;br /&gt;
    U32_t *m_value              // Pointer to MUTEX value holder&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| mutex_id  || u32_t mutex ID to be signalled (value 0 to 62)&lt;br /&gt;
|-&lt;br /&gt;
| m_value  || u32_t * pointer where mutex value is to be written&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOSmp initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || MUTEX ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || MUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_MX_DATA_PTR_BAD         || Pointer to MUTEX value return holder is null&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
U32_t value;&lt;br /&gt;
...&lt;br /&gt;
// Get value of mutex m_2&lt;br /&gt;
status = oceos_mutex_get_value(m_2, &amp;amp;value);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;Read/write mutex directives&amp;lt;/span&amp;gt;==&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;Read/write mutex overview&amp;lt;/span&amp;gt;===&lt;br /&gt;
&lt;br /&gt;
Contents:&lt;br /&gt;
&lt;br /&gt;
 1.  Read/Write Mutex features&lt;br /&gt;
 2.  Read/Write Mutex data structures&lt;br /&gt;
 3.  Read/Write Mutex constants&lt;br /&gt;
 4.  Read/Write Mutex manager Directives&lt;br /&gt;
&lt;br /&gt;
==== Read/Write Mutex Features ====&lt;br /&gt;
&lt;br /&gt;
Read/Write Mutexes (rwmutexes) can be held for 'read' at the same time&lt;br /&gt;
by multiple jobs on different CPUs, but once held for 'write' by any job&lt;br /&gt;
cannot be obtained for 'read' or for 'write' by another job until released.&lt;br /&gt;
&lt;br /&gt;
They can be used to allow data be read simultaneously by multiple jobs when&lt;br /&gt;
the data is not being updated while ensuring that no updating can take&lt;br /&gt;
place while any job is reading the data.&lt;br /&gt;
&lt;br /&gt;
Pending write requests take precedence over pending read requests and are&lt;br /&gt;
done on a first come, first served basis. Once any job on a CPU has a&lt;br /&gt;
rwmutex for 'read' no other job on that CPU can acquire it so as to avoid&lt;br /&gt;
potential problems and minimise delays in servicing write requests by other&lt;br /&gt;
CPUs.&lt;br /&gt;
&lt;br /&gt;
While any job holds a rwmutex for reading any job on another CPU can also&lt;br /&gt;
acquire it for reading. Other jobs on the same CPU that may attempt to&lt;br /&gt;
acquire the rwmutex are delayed in starting until return of the rwmutex.&lt;br /&gt;
No job can acquire the rwmutex for writing until all read acquisitions&lt;br /&gt;
have been returned.&lt;br /&gt;
&lt;br /&gt;
No job will acquire a rwmutex for reading if any job is trying to acquire&lt;br /&gt;
it for writing, giving write precedence over read. Multiple write requests&lt;br /&gt;
waiting for existing read acquisitions to complete are serviced in the&lt;br /&gt;
order in which they were made when the current read acquisitions complete.&lt;br /&gt;
&lt;br /&gt;
If a task waits on a rwmutex that it already holds a system log entry is&lt;br /&gt;
made (LOG_RWMUTEX_ALREADY_HELD) and an INTERNAL_ERROR status code returned.&lt;br /&gt;
&lt;br /&gt;
If a task attempts to release a rwmutex it does not hold a system log entry&lt;br /&gt;
is made (LOG_RWMUTEX_ALREADY_FREE) and an INTERNAL_ERROR status code returned.&lt;br /&gt;
&lt;br /&gt;
If a job holds more than one rwmutex at the same time these must be&lt;br /&gt;
acquired and released in a nested manner&lt;br /&gt;
(e.g. wait 1, wait 2, wait 3, signal 3, signal 2, signal 1).&lt;br /&gt;
&lt;br /&gt;
If a task exits while holding one or more rwmutexes these are returned and&lt;br /&gt;
a system log entry made (LOG_RWMUTEX_NOT_RETURNED).&lt;br /&gt;
&lt;br /&gt;
==== Read/Write Mutex data structures ====&lt;br /&gt;
&lt;br /&gt;
In OCEOSmp each rwmutex has a priority ceiling, the priority of the highest&lt;br /&gt;
priority task that acquires the rwmutex for read or for write.&lt;br /&gt;
OCEOSmp uses this to ensure that once a job on a particular CPU has the&lt;br /&gt;
rwmutex for reading or for writing no other job on that CPU can be started&lt;br /&gt;
that might try to obtain that rwmutex.&lt;br /&gt;
&lt;br /&gt;
The priority ceiling of a rwmutex is specified when the rwmutex is created&lt;br /&gt;
and does not change subsequently. Priority ceilings are stored in the&lt;br /&gt;
fixed data area as an array U8_t rwmutexCeilings[] indexed by mutex ID.&lt;br /&gt;
This array is extended to be a whole number of 32-bit words.&lt;br /&gt;
&lt;br /&gt;
A rwmutex has a unique rwmutex ID, an unsigned integer usually defined in&lt;br /&gt;
the application header file as an enum RWMUTEX_NAME{} thus allowing a&lt;br /&gt;
user-friendly name be associated with each rwmutex ID.&lt;br /&gt;
&lt;br /&gt;
Using an enum is strongly recommended as it allows a user-friendly name be&lt;br /&gt;
associated with each ID, and helps ensure IDs are contiguous from 0.&lt;br /&gt;
&lt;br /&gt;
These rwmutex IDs are used as indices into both fixed and dynamic data&lt;br /&gt;
arrays and must cover the range 0 to ((number of rwmutexes) -1). Using&lt;br /&gt;
enum RWMUTEX_NAME{} automatically assigns names to IDs 0, 1, 2...&lt;br /&gt;
&lt;br /&gt;
Read write mutex dynamic data such as the current write requests and&lt;br /&gt;
current read count are stored in the dynamic data area in an array of&lt;br /&gt;
struct rwmutex_dyn_block also indexed by the rwmutex ID.&lt;br /&gt;
&lt;br /&gt;
A further dynamic area array of guard_t is used in providing mutual&lt;br /&gt;
exclusion when updating the rwmutex dynamic data.&lt;br /&gt;
&lt;br /&gt;
==== Read/Write Mutex constants ====&lt;br /&gt;
&lt;br /&gt;
In OCEOSmp there can be a maximum of 63 rwmutexes,&lt;br /&gt;
with IDs from 0 to 62 (the value 63 is used as an invalid ID).&lt;br /&gt;
&lt;br /&gt;
The rwmutexes can be created in any order, but OCEOSmp will return an error&lt;br /&gt;
and fail to start if the resulting IDs fail to be contiguous from 0 as IDs&lt;br /&gt;
are used by OCEOS as indices into arrays.&lt;br /&gt;
&lt;br /&gt;
Each rwmutex has a priority ceiling, the priority of the highest priority&lt;br /&gt;
task that uses the rwmutex for reading or for writing. This is specified&lt;br /&gt;
when the rwmutex is created, does not change subsequently, and must be in&lt;br /&gt;
the range 1 (TASK_MAX_PRIORITY) to 254 (TASK_MIN_PRIORITY).&lt;br /&gt;
The application developer must ensure that the correct rwmutex ceiling&lt;br /&gt;
is used. OCEOSmp will detect an attempt to acquire a rwmutex by a task&lt;br /&gt;
with higher priority than that rwmutex's priority ceiling, make a&lt;br /&gt;
system log entry (LOG_RWMUTEX_BAD_CEILING) and return an INTERNAL_ERROR&lt;br /&gt;
status code.&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_rwmutex_create()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''rwmutex.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function ees a read/write mutex.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Creates a Read/Write Mutex (RWMUTEX)&lt;br /&gt;
 *&lt;br /&gt;
 * This function should only be called after OCEOSmp is initialised with&lt;br /&gt;
 * oceos_init() and before initialisation ends with oceos_init_finish()&lt;br /&gt;
 * and scheduling starts with oceos_start()&lt;br /&gt;
 *&lt;br /&gt;
 * @param rwm_id    Read/Write RWMUTEX ID, must be in range 0 to 62&lt;br /&gt;
 * @param priority  Priority ceiling of highest priority task that uses the RWMUTEX&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_WRONG_CPU_CORE          Executing directive on wrong CPU&lt;br /&gt;
 *          ERR_WRONG_PHASE             Called before oceos_init() is done&lt;br /&gt;
 *          ERR_TOO_MANY                MAX number of RWMUTEXs already created&lt;br /&gt;
 *          ERR_ID_INVALID              RWMUTEX ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                RWMUTEX ID &amp;gt;= number of RWMUTEXs&lt;br /&gt;
 *          ERR_RWMX_ALREADY_ALLOCATED  RWMUTEX ID already used&lt;br /&gt;
 *          ERR_RWMX_PRIORITY_WRONG     RWMUTEX priority ceiling outside allowed range 1 to 254&lt;br /&gt;
 */&lt;br /&gt;
S32_t   oceos_rwmutex_create(&lt;br /&gt;
    const U32_t rwm_id,   // RWMUTEX ID, must be in range 0 to max rwm&lt;br /&gt;
    const U8_t priority   // RWMUTEX priority ceiling&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| rwm_id || Read/Write RWMUTEX ID, must be in range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| priority || Priority ceiling of highest priority task that uses the RWMUTEX&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_CPU_CORE          || Executing directive on wrong CPU&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Called before oceos_init() is done&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TOO_MANY                || MAX number of RWMUTEXs already created&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || RWMUTEX ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || RWMUTEX ID &amp;gt;= number of RWMUTEXs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_RWMX_ALREADY_ALLOCATED  || RWMUTEX ID already used&lt;br /&gt;
|-&lt;br /&gt;
| ERR_RWMX_PRIORITY_WRONG     || RWMUTEX priority ceiling outside allowed range 1 to 254&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Create read/write mutex with ID rwm_2 and priority ceiling of 100 &lt;br /&gt;
status = oceos_rwmutex_create(rwm_1, 100);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_rwmutex_read_wait()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''rwmutex.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function acquires a read/write mutex for read. If successful, jobs on other CPUs can also acquire it for read, but no job will be able to acquire it for write while any read is under way. If job already holds RWMUTEX for read or for write the appropriate status code is returned, a system log entry made, and the job continues. It will not succeed while any job is waiting to obtain RWMUTEX for write, and will loop waiting for all pending writes on this RWMUTEX to complete.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Read wait on RWMUTEX.&lt;br /&gt;
 *&lt;br /&gt;
 * If successful jobs on other CPUs can also acquire it for read, but no job&lt;br /&gt;
 * will be able to acquire it for write while any read is under way.&lt;br /&gt;
 * If job already holds RWMUTEX for read or for write appropriate status code&lt;br /&gt;
 * is returned, a system log entry made, and the job continues.&lt;br /&gt;
 * Will not succeed while any job is waiting to obtain RWMUTEX for write,&lt;br /&gt;
 * will loop waiting for all pending writes on this RWMUTEX to complete.&lt;br /&gt;
 *&lt;br /&gt;
 * This should only be called after OCEOS scheduling has started.&lt;br /&gt;
 *&lt;br /&gt;
 * N.B.	The returned status code must be checked and appropriate action&lt;br /&gt;
 * 		taken.&lt;br /&gt;
 *&lt;br /&gt;
 * @param rwm_id    const U32_t  : value 0 to 62&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          WARN_RWMX_NOT_HIGHEST       Already holds a RWMUTEX higher in the RWMUTEX order&lt;br /&gt;
 *                                      (there then may be a risk of deadlock)&lt;br /&gt;
 *&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              RWMUTEX ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                RWMUTEX ID &amp;gt;= number of RWMUTEXs&lt;br /&gt;
 *          ERR_RWMX_CEILING_BAD        RWMUTEX ceiling not lower priority than job priority&lt;br /&gt;
 *          ERR_RWMX_ALREADY_HELD       RWMUTEX already held by this job&lt;br /&gt;
 *          ERR_RWMX_CPU_STACK_FULL     CPU priority ceiling stack full&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_rwmutex_read_wait(&lt;br /&gt;
    const U32_t rwm_id  // RWMUTEX ID, must be in range 0 to 62&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| rwm_id || U32_t rwmutex to be acquired for read (value 0 to 62)&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| WARN_RWMX_NOT_HIGHEST       || Already holds a RWMUTEX higher in the RWMUTEX order (deadlock risk)&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || RWMUTEX ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || RWMUTEX ID &amp;gt;= number of RWMUTEXs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_RWMX_CEILING_BAD        || RWMUTEX ceiling not lower priority than job priority&lt;br /&gt;
|-&lt;br /&gt;
| ERR_RWMX_ALREADY_HELD       || RWMUTEX already held by this job&lt;br /&gt;
|-&lt;br /&gt;
| ERR_RWMX_CPU_STACK_FULL     || CPU priority ceiling stack full&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Acquire read/write mutex rwm_1 for read&lt;br /&gt;
status = oceos_rwmutex_read_wait(rwm_1);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_rwmutex_write_wait()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''rwmutex.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function acquires the specified read/write mutex for write.&lt;br /&gt;
If successful, no other job can also obtain it for reading or for writing. Will not succeed while any other job has acquired RWMUTEX for write,&lt;br /&gt;
or any jobs have obtained RWMUTEX for read. Will then loop until the RWMUTEX is released and for its turn in the sequence of jobs that have tried to acquire the RWMUTEX for writing. If already holds the RWMUTEX for writing or reading an appropriate status code is returned, a system log entry made, and the job continues. While there are any outstanding attempts to obtain the RWMUTEX for write no job will be able to acquire it for reading.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Write wait on RWMUTEX.&lt;br /&gt;
 *&lt;br /&gt;
 * If successful no other job can also obtain it for reading or for writing.&lt;br /&gt;
 * Will not succeed while any other job has acquired RWMUTEX for write,&lt;br /&gt;
 * or any jobs have obtained RWMUTEX for read. Will then loop until the&lt;br /&gt;
 * RWMUTEX is released and for its turn in the sequence of jobs that have&lt;br /&gt;
 * tried to acquire the RWMUTEX for writing.&lt;br /&gt;
 * If already holds the RWMUTEX for writing or reading an appropriate status&lt;br /&gt;
 * code is returned, a system log entry made, and the job continues.&lt;br /&gt;
 * While there are any outstanding attempts to obtain the RWMUTEX for write&lt;br /&gt;
 * no job will be able to acquire it for reading.&lt;br /&gt;
 *&lt;br /&gt;
 * This should only be called after OCEOS scheduling has started.&lt;br /&gt;
 *&lt;br /&gt;
 * N.B.	The returned status code must be checked and appropriate action&lt;br /&gt;
 * 		taken.&lt;br /&gt;
 *&lt;br /&gt;
 * @param rwm_id     const U32_t  : value 0 to 62&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          WARN_RWMX_NOT_HIGHEST       Already holds a RWMUTEX higher in the RWMUTEX order&lt;br /&gt;
 *                                      (there then may be a risk of deadlock)&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              RWMUTEX ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                RWMUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
 *          ERR_RWMX_CEILING_BAD        RWMUTEX ceiling not lower priority than job priority&lt;br /&gt;
 *          ERR_RWMX_ALREADY_HELD       RWMUTEX already held by this job&lt;br /&gt;
 *          ERR_RWMX_CPU_STACK_FULL     CPU priority ceiling stack full&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_rwmutex_write_wait(&lt;br /&gt;
    const U32_t rwm_id  // RWMUTEX ID, must be in range 0 to 62&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| rwm_id || U32_t rwmutex to be acquired for write(value 0 to 62)&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| WARN_RWMX_NOT_HIGHEST       || Already holds a RWMUTEX higher in the RWMUTEX order (deadlock risk)&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || RWMUTEX ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || RWMUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_RWMX_CEILING_BAD        || RWMUTEX ceiling not lower priority than job priority&lt;br /&gt;
|-&lt;br /&gt;
| ERR_RWMX_ALREADY_HELD       || RWMUTEX already held by this job&lt;br /&gt;
|-&lt;br /&gt;
| ERR_RWMX_CPU_STACK_FULL     || CPU priority ceiling stack full&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Acquire read/write mutex rwm_1 for write&lt;br /&gt;
status = oceos_rwmutex_read_wait(rwm_1);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_rwmutex_signal()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''rwmutex.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function signals the specified read/write mutex.&lt;br /&gt;
It frees the RWMUTEX for use by other jobs, irrespective of whether the RWMUTEX is held for reading or for writing. If the RWMUTEX is not held by the job then it returns an appropriate status code. It does not take into account how many times a job has obtained the RWMUTEX for read or for write.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Signal a RWMUTEX&lt;br /&gt;
 *&lt;br /&gt;
 * Frees the RWMUTEX for use by other jobs, irrespective of whether&lt;br /&gt;
 * RWMUTEX is held for reading or for writing.&lt;br /&gt;
 * if the RWMUTEX is not held by the job returns an appropriate status code.&lt;br /&gt;
 * Does not take into account how many times a job has obtained the RWMUTEX&lt;br /&gt;
 * for read or for write.&lt;br /&gt;
 *&lt;br /&gt;
 * This should only be called after OCEOS scheduling has started.&lt;br /&gt;
 *&lt;br /&gt;
 * N.B. The returned status code must be checked and appropriate action taken.&lt;br /&gt;
 *&lt;br /&gt;
 * @param rwm_id    const U32_t  : value 0 to 62&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          WARN_RWMX_ALREADY_FREE      RWMUTEX is free already&lt;br /&gt;
 *&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              RWMUTEX ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                RWMUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
 *          ERR_RWMX_CEILING_BAD        RWMUTEX ceiling not lower priority than job priority&lt;br /&gt;
 *          ERR_RWMX_CPU_STACK_EMPTY    CPU priority ceiling stack empty&lt;br /&gt;
 *          ERR_RWMX_CEILING_INVALID    CPU current priority ceiling on the priority stack is invalid&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_rwmutex_signal(&lt;br /&gt;
    const U32_t rwm_id // RWMUTEX ID, must be in range 0 to 62&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| rwm_id || U32_t rwmutex to be signaled(value 0 to 62)&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| WARN_RWMX_ALREADY_FREE      || RWMUTEX is free already&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || RWMUTEX ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || RWMUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_RWMX_CEILING_BAD        || RWMUTEX ceiling not lower priority than job priority&lt;br /&gt;
|-&lt;br /&gt;
| ERR_RWMX_CPU_STACK_EMPTY    || CPU priority ceiling stack empty&lt;br /&gt;
|-&lt;br /&gt;
| ERR_RWMX_CEILING_INVALID    || CPU current priority ceiling on the priority stack is invalid&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Signal read/write mutex number rwm_4&lt;br /&gt;
status = oceos_rwmutex_signal(rwm_4);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_rwmutex_check_status()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''rwmutex.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function checks the status of a read/write mutex. The possible states are free, in-use for read, and in-use for write.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Check whether RWMUTEX is free&lt;br /&gt;
 *&lt;br /&gt;
 * @param rwm_id        must be in range 0 to 62&lt;br /&gt;
 * @param m_status      pointer to RWMUTEX status holder;&lt;br /&gt;
 *                      if return code OCEOS_SUCCESS RWMUTEX status:&lt;br /&gt;
 *                          0 =&amp;gt; Free for use&lt;br /&gt;
 *                          1 =&amp;gt; In use for read&lt;br /&gt;
 *                          2 =&amp;gt; In use for write&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              RWMUTEX ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                RWMUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
 *          ERR_RWMX_DATA_PTR_BAD       Pointer to RWMUTEX status return holder is null&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_rwmutex_check_status(&lt;br /&gt;
    const U32_t rwm_id, // RWMUTEX ID, must be in range 0 to 62&lt;br /&gt;
    U32_t *m_status&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| rwm_id || read/write mutex number in range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| m_status || U32_t pointer to RWMUTEX status holder (0 = free, 1 = in-use for read, 2 = in-use for write &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || RWMUTEX ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || RWMUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_RWMX_DATA_PTR_BAD       || Pointer to RWMUTEX status return holder is null&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, rwm_status;&lt;br /&gt;
...&lt;br /&gt;
// Check the status of read/write mutex rwm_2&lt;br /&gt;
status = oceos_rwmutex_check_status(rwm_2, &amp;amp;rwm_status);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_rwmutex_reading_count()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''rwmutex.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the current number of jobs holding a specified read/write mutex for read.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 *&lt;br /&gt;
 * Get current number of jobs holding RWMUTEX for read&lt;br /&gt;
 *&lt;br /&gt;
 * @param rwm_id    must be in range 0 to 62&lt;br /&gt;
 * @param m_count   pointer to RWMUTEX count holder&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              RWMUTEX ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                RWMUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
 *          ERR_RWMX_DATA_PTR_BAD       Pointer to RWMUTEX count return holder is null&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_rwmutex_reading_count(&lt;br /&gt;
    const U32_t rwm_id, // RWMUTEX ID, must be in range 0 to 62&lt;br /&gt;
    U32_t *m_count&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| rwm_id || U32 value of read/write mutex (in range 0 to 62)&lt;br /&gt;
|-&lt;br /&gt;
| m_count || U32_t pointer to read/write mutex count holder&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || RWMUTEX ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || RWMUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_RWMX_DATA_PTR_BAD       || Pointer to RWMUTEX count return holder is null&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, rwm_count;&lt;br /&gt;
...&lt;br /&gt;
// Get the number of jobs holding the read/write mutex rwm_2 for read&lt;br /&gt;
status = oceos_rwmutex_reading_count(rwm_2, &amp;amp;rwm_count);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_rwmutex_write_reqs_count()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''header.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the current number of write requests for the specified read/write mutex .&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Get current RWMUTEX write requests count&lt;br /&gt;
 *&lt;br /&gt;
 * @param rwm_id    must be in range 0 to 62&lt;br /&gt;
 * @param m_count   pointer to RWMUTEX count holder&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              RWMUTEX ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                RWMUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
 *          ERR_RWMX_DATA_PTR_BAD       Pointer to RWMUTEX count return holder is null&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_rwmutex_write_reqs_count(&lt;br /&gt;
    const U32_t rwm_id, // RWMUTEX ID, must be in range 0 to 62&lt;br /&gt;
    U32_t *m_count&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| rwm_id || U32_t value of read/write mutex (must be in range 0 to 62)&lt;br /&gt;
|-&lt;br /&gt;
| m_count || U32_t pointer to read/write mutex count holder&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || RWMUTEX ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || RWMUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_RWMX_DATA_PTR_BAD       || Pointer to RWMUTEX count return holder is null&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, rwm_count;&lt;br /&gt;
...&lt;br /&gt;
// Get the count of cuurent write requests for read/write mutex rwm_1&lt;br /&gt;
status = oceos_rwmutex_write_reqs_count(rwm_1, &amp;amp;rwm_count);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_rwmutex_writes_pending_count()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''rwmutex.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the current number of pending writes for the specified read/write mutex.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Get current RWMUTEX writes pending count&lt;br /&gt;
 *&lt;br /&gt;
 * @param rwm_id    must be in range 0 to 62&lt;br /&gt;
 * @param m_count   pointer to RWMUTEX count holder&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              RWMUTEX ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                RWMUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
 *          ERR_RWMX_DATA_PTR_BAD       Pointer to RWMUTEX pending count return holder is null&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_rwmutex_writes_pending_count(&lt;br /&gt;
    const U32_t rwm_id, // RWMUTEX ID, must be in range 0 to 62&lt;br /&gt;
    U32_t *m_count&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| rwm_id || U32_t value of read/write mutex (must be in range 0 to 62)&lt;br /&gt;
|-&lt;br /&gt;
| m_count || U32_t pointer to read/write mutex count holder&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || RWMUTEX ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || RWMUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_RWMX_DATA_PTR_BAD       || Pointer to RWMUTEX count return holder is null&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, rwm_count;&lt;br /&gt;
...&lt;br /&gt;
// Get the count of cuurent write requests for read/write mutex rwm_1&lt;br /&gt;
status = oceos_rwmutex_writes_pending_count(rwm_1, &amp;amp;rwm_count);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_rwmutex_holding()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''header.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the read/write mutexes currently held by this instance of this task (job).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Get RWMUTEXs currently held by this instance of the task (job)&lt;br /&gt;
 *&lt;br /&gt;
 * @param m_data    U64_t pointer, each bit indicating RWMUTEX held by current task&lt;br /&gt;
 *                          0 =&amp;gt; Not held by job&lt;br /&gt;
 *                          1 =&amp;gt; Held by job&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_RWMX_DATA_PTR_BAD       Pointer to RWMUTEX status return holder is null&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_rwmutex_holding(&lt;br /&gt;
    U64_t *m_data&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| m_data || U64_t pointer, each bit indicating RWMUTEX held by current task, 0 =&amp;gt; not held, 1 =&amp;gt; held &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_RWMX_DATA_PTR_BAD       || Pointer to RWMUTEX status return holder is null&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
U64_t rwm_held;&lt;br /&gt;
...&lt;br /&gt;
// Which read/write mutexes does this job hold&lt;br /&gt;
status = oceos_rwmutex_holding(&amp;amp;rwm_held);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Semaphores directives ==&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_sem_create()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''semaphore.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function creates a semaphore.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Create a counting semaphore&lt;br /&gt;
 *&lt;br /&gt;
 * @param sem_id            SEMAPHORE ID (from 0 to 62)&lt;br /&gt;
 * @param max_permits       number of max permits allowed for this SEMAPHORE, 1 to 4095&lt;br /&gt;
 * @param count_permits     starting number of permits available 0 to 4095&lt;br /&gt;
 * @param pending_q_size    MAX Number of tasks on SEMAPHORE pending queue 1 to 253&lt;br /&gt;
 * @param use_timeout       if TRUE, directive oceos_sem_wait_restart_timeout can be used&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_WRONG_CPU_CORE          Executing directive on wrong CPU&lt;br /&gt;
 *          ERR_WRONG_PHASE             Called before oceos_init() is done&lt;br /&gt;
 *          ERR_TOO_MANY                MAX number of SEMAPHOREs already created&lt;br /&gt;
 *          ERR_ID_INVALID              SEMAPHORE ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                SEMAPHORE ID &amp;gt;= number of SEMAPHOREs&lt;br /&gt;
 *          ERR_SM_ALREADY_ALLOCATED    SEMAPHORE ID already used&lt;br /&gt;
 *          ERR_SM_MAX_PERMIT_WRONG     MAX permits outside allowed range 1 to 4095&lt;br /&gt;
 *          ERR_SM_COUNT_PERMIT_WRONG   Count permits outside allowed range 0 to 4095&lt;br /&gt;
 *          ERR_SM_COUNT_PERMIT_INVALID Count permits is greater than MAX permits for this SEMAPHORE&lt;br /&gt;
 *          ERR_SM_PENQ_SIZE_WRONG      SEMAPHORE pending queue size outside allowed range 1 to 253&lt;br /&gt;
 *          ERR_SM_TA_MAX_NUM_REACHED   Number of timed actions exceeds MAX allowed 255,&lt;br /&gt;
 *                                      each task on SEMAPHORE pending queue is timed action&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_sem_create(&lt;br /&gt;
    sem_t sem_id,         // counting semaphore ID (MAX 63)&lt;br /&gt;
    U16_t max_permits,    // max number of permits (MAX 4095)&lt;br /&gt;
    U16_t count_permits,  // initial number of permits (MAX 4095)&lt;br /&gt;
    U8_t  pending_q_size, // max number of pending queue jobs (MAX 253)&lt;br /&gt;
    BOOLE_t use_timeout   // whether timeout is used in oceos_sem_wait_restart_timeout&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| sem_id || Semaphore ID to be created (from 0 to 62)&lt;br /&gt;
|-&lt;br /&gt;
| max_permits || number of max permits allowed for this semaphore, 1 to 4095&lt;br /&gt;
|-&lt;br /&gt;
| count_permits || starting number of permits available 0 to 4095&lt;br /&gt;
|-&lt;br /&gt;
| pending_q_size || Maximum Number of tasks on SEMAPHORE pending queue 1 to 253&lt;br /&gt;
|-&lt;br /&gt;
| use_timeout || if TRUE, directive oceos_sem_wait_restart_timeout can be used&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_CPU_CORE          || Executing directive on wrong CPU&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Called before oceos_init() is done&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TOO_MANY                || MAX number of SEMAPHOREs already created&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || SEMAPHORE ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || SEMAPHORE ID &amp;gt;= number of SEMAPHOREs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SM_ALREADY_ALLOCATED    || SEMAPHORE ID already used&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SM_MAX_PERMIT_WRONG     || MAX permits outside allowed range 1 to 4095&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SM_COUNT_PERMIT_WRONG   || Count permits outside allowed range 0 to 4095&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SM_COUNT_PERMIT_INVALID || Count permits is greater than MAX permits for this SEMAPHORE&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SM_PENQ_SIZE_WRONG      || SEMAPHORE pending queue size outside allowed range 1 to 253&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SM_TA_MAX_NUM_REACHED   || Number of timed actions exceeds MAX allowed 255&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, param;&lt;br /&gt;
...&lt;br /&gt;
// Create semaphore called s_audi with max permits of 1000, starting permits of zero, max of 10 tasks on pending queue, and no timeouts &lt;br /&gt;
status = oceos_sem_create(s_audi, 1000, 0, 10, FALSE);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_sem_signal()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''semaphore.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function signals a semaphore, increments its count and transfers pending jobs to the ready queue.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Signals a semaphore, increments and transfers pending jobs to ready queue&lt;br /&gt;
 *&lt;br /&gt;
 * @param sem_id counting SEM ID&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          WARN_JOB_NOT_GUARDED&lt;br /&gt;
 *&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              SEM ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                SEM ID &amp;gt;= number of SEMs&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to grab SEM guard&lt;br /&gt;
 *          ERR_TOO_MANY                SEM max permits count already reached&lt;br /&gt;
 *          ERR_SM_JOB_ID_WRONG         Job ID of the task on SEM pending queue is wrong&lt;br /&gt;
 *          ERR_TA_NOT_FOUND            Timed action index to be removed for job not found&lt;br /&gt;
 *          ERR_TA_START_FAILED         Timed action re-start failed after job remove from timed action queue&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_sem_signal(&lt;br /&gt;
    sem_t sem_id // counting SEM ID&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| sem_id || U32_t value of semaphore to be signalled (incremented)&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| WARN_JOB_NOT_GUARDED        || job not guarded, application should check system log&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || SEM ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || SEM ID &amp;gt;= number of SEMs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to grab SEM guard&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TOO_MANY                || SEM max permits count already reached&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SM_JOB_ID_WRONG         || Job ID of the task on SEM pending queue is wrong&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_NOT_FOUND            || Timed action index to be removed for job not found&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_START_FAILED         || Timed action re-start failed after job remove from timed action queue&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Signal s_audi semaphore (increment its count)&lt;br /&gt;
status = oceos_sem_signal(s_audi);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_sem_wait_continue()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''semaphore.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function decrements the available permits of a sempahore otherwise returns an unsuccessful status code.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Wait on semaphore,&lt;br /&gt;
 * decrement the number of available permits for semaphore,&lt;br /&gt;
 * if no permits continue and task should handle unsuccessful result&lt;br /&gt;
 *&lt;br /&gt;
 * @param sem_id SEM ID&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              SEM ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                SEM ID &amp;gt;= number of SEMs&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to grab SEM guard&lt;br /&gt;
 *          ERR_SM_NOT_AVAILABLE        No more permits available for this SEM&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_sem_wait_continue(&lt;br /&gt;
    sem_t sem_id // counting SEM ID&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| sem_id || U32_t value of semaphore to be decremented&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || SEM ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || SEM ID &amp;gt;= number of SEMs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to grab SEM guard&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SM_NOT_AVAILABLE        || No more permits available for this SEM&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Decrement available permits on semaphore s_1&lt;br /&gt;
status = oceos_sem_wait_continue(s_1);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_sem_wait_restart()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''semaphore.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function decrements the available permits of a sempahore and if none available, the job is put on the pending queue.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Waits on semaphore,&lt;br /&gt;
 * if fail, put job on pending queue and exit task&lt;br /&gt;
 *&lt;br /&gt;
 * @param sem_id SEM ID&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              SEM ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                SEM ID &amp;gt;= number of SEMs&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to grab SEM guard&lt;br /&gt;
 *          ERR_SM_J_START_FROM_TIMOUT  Task started from timeout already, SEM no permits available second time&lt;br /&gt;
 *          ERR_FAILED                  Should never return this&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_sem_wait_restart(&lt;br /&gt;
    sem_t sem_id  // counting SEM ID&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| sem_id || U32_t value of semaphore to be decremented&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || SEM ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || SEM ID &amp;gt;= number of SEMs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to grab SEM guard&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SM_J_START_FROM_TIMOUT  || Task started from timeout already, SEM no permits available second time&lt;br /&gt;
|-&lt;br /&gt;
| ERR_FAILED                  || Should never return this&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Decrement available permits on semaphore s_1 otherwise job is put on pending queue&lt;br /&gt;
status = oceos_sem_wait_restart(s_1);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_sem_wait_restart_timeout()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''semaphore.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function decrements the available permits of a sempahore and if none available, the job is put on the pending queue with a timeout enabled. The job is restarted either when a permit is available to be decremented or when the timeout has expired. In order to use this directive, semaphore must be created with flag use_timeout is set to TRUE.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Waits on semaphore,&lt;br /&gt;
 * if fail, put job on pending queue with optional timeout.&lt;br /&gt;
 * In order to use this directive, semaphore must be created with&lt;br /&gt;
 * flag use_timeout is set to TRUE&lt;br /&gt;
 *&lt;br /&gt;
 * @param sem_id         SEM ID&lt;br /&gt;
 * @param U64_t timeout  Restart time if no permits, 0 =&amp;gt; ignore&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_TA_NOT_INIT             Timed action intialisation is not done and tried to be used; or SEM created without timeouts&lt;br /&gt;
 *          ERR_ID_INVALID              SEM ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                SEM ID &amp;gt;= number of SEMs&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to grab SEM guard&lt;br /&gt;
 *          ERR_SM_J_START_FROM_TIMOUT  Task started from timeout already, SEM no permits available second time&lt;br /&gt;
 *          ERR_TOO_MANY                SEM pending queue is full&lt;br /&gt;
 *          ERR_FAILED                  Should never return this&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_sem_wait_restart_timeout(&lt;br /&gt;
    sem_t sem_id, // counting SEM ID&lt;br /&gt;
    U64_t timeout // timeout, restart time if no permits, 0 =&amp;gt; ignore&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| sem_id || U32_t value of semaphore to be decremented&lt;br /&gt;
|-&lt;br /&gt;
| timeout | U64_t timeout in time units. A value of 0 causes timeout to be ignored.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_NOT_INIT             || Timed action intialisation is not done and tried to be used; or SEM created without&lt;br /&gt;
timeouts&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || SEM ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || SEM ID &amp;gt;= number of SEMs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to grab SEM guard&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SM_J_START_FROM_TIMOUT  || Task started from timeout already, SEM no permits available second time&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TOO_MANY                || SEM pending queue is full&lt;br /&gt;
|-&lt;br /&gt;
| ERR_FAILED                  || Should never return this&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Decrement available permits on semaphore s_1 otherwise job is put on pending queue with timeout of 10,000 time units (usually usecs)&lt;br /&gt;
status = oceos_sem_wait_restart_timeout(s_1);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_sem_get_value()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''semaphore.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the number of available permits for the specified semaphore.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Returns number of available permits&lt;br /&gt;
 * for SEM ID&lt;br /&gt;
 *&lt;br /&gt;
 * @param sem_id        SEM id&lt;br /&gt;
 * @param s_permits     pointer to permits count holder&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              SEM ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                SEM ID &amp;gt;= number of SEMs&lt;br /&gt;
 *          ERR_SM_DATA_BAD             Data holder pointer is null&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_sem_get_value(&lt;br /&gt;
    sem_t sem_id,    // counting SEM ID&lt;br /&gt;
    U32_t *s_permits // pointer to permits count holder&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| sem_id || U32_t value of semaphore whose permit count is required&lt;br /&gt;
|-&lt;br /&gt;
| s_permits || U32_t pointer to permits count holder&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || SEM ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || SEM ID &amp;gt;= number of SEMs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SM_DATA_BAD             || Data holder pointer is null&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, permit_count;&lt;br /&gt;
...&lt;br /&gt;
// Get the available permits for semaphore s_1&lt;br /&gt;
status = oceos_sem_get_value(s_1, &amp;amp;permit_count);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_sem_penq_get_size()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''semaphore.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the number of jobs on the specified semaphore pending queue.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Returns number of jobs on semaphore pending queue&lt;br /&gt;
 * for semaphore ID&lt;br /&gt;
 *&lt;br /&gt;
 * @param sem_id    SEM id&lt;br /&gt;
 * @param s_size    pointer to pending queue size holder&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              SEM ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                SEM ID &amp;gt;= number of SEMs&lt;br /&gt;
 *          ERR_SM_DATA_BAD             Data holder pointer is null&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_sem_penq_get_size(&lt;br /&gt;
    sem_t sem_id,   // counting SEM ID&lt;br /&gt;
    U32_t *s_size   // pointer to pending queue size holder&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| sem_id || U32_t value of semaphore whose permit count is required&lt;br /&gt;
|-&lt;br /&gt;
| s_size || U32_t pointer to pending queue jobs count holder&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || SEM ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || SEM ID &amp;gt;= number of SEMs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SM_DATA_BAD             || Data holder pointer is null&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, job_count;&lt;br /&gt;
...&lt;br /&gt;
// Get the available permits for semaphore s_1&lt;br /&gt;
status = oceos_sem_penq_get_size(s_1, &amp;amp;job_count);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_sem_reset()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''semaphore.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function restores the permits to the original semaphore initial value and removes any jobs from the pending queue.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Restore permits to original value and&lt;br /&gt;
 * remove jobs from pending queue&lt;br /&gt;
 *&lt;br /&gt;
 * @param sem_id    SEM ID&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              SEM ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                SEM ID &amp;gt;= number of SEMs&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to grab SEM guard&lt;br /&gt;
 *          ERR_SM_JOB_ID_WRONG         Job ID of the task on SEM pending queue is wrong&lt;br /&gt;
 *          ERR_TA_NOT_FOUND            Timed action index to be removed for job not found&lt;br /&gt;
 *          ERR_TA_START_FAILED         Timed action re-start failed after job remove from timed action queue&lt;br /&gt;
 */&lt;br /&gt;
S32_t   oceos_sem_reset(&lt;br /&gt;
    sem_t sem_id   // counting SEM ID&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| sem_id || U32_t value of semaphore to be reset&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || SEM ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || SEM ID &amp;gt;= number of SEMs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to grab SEM guard&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SM_JOB_ID_WRONG         || Job ID of the task on SEM pending queue is wrong&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_NOT_FOUND            || Timed action index to be removed for job not found&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_START_FAILED         || Timed action re-start failed after job remove from timed action queue&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Reset semaphore s_1&lt;br /&gt;
status = oceos_sem_reset(s_1);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Data Queues ==&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_dataq_create()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''dataq.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function creates a data queue with the specified characteristics.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Create data queue&lt;br /&gt;
 * If use_timeout = TRUE, timed actions must be initialised&lt;br /&gt;
 *&lt;br /&gt;
 * @param dataq_id      data queue ID&lt;br /&gt;
 * @param dataq_size    data queue size&lt;br /&gt;
 * @param pen_q_size    pending jobs queue size&lt;br /&gt;
 * @param roll_over     whether to roll over when full&lt;br /&gt;
 * @param use_timeout   if TRUE, directive oceos_dataq_read_restart_timeout can be used&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_WRONG_CPU_CORE          Executing directive on wrong CPU&lt;br /&gt;
 *          ERR_WRONG_PHASE             Called before oceos_init() is done&lt;br /&gt;
 *          ERR_TOO_MANY                MAX number of DATAQs already created&lt;br /&gt;
 *          ERR_ID_INVALID              DATAQ ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                DATAQ ID &amp;gt;= number of DATAQs&lt;br /&gt;
 *          ERR_DQ_ALREADY_ALLOCATED    DATAQ ID already used&lt;br /&gt;
 *          ERR_DQ_SIZE_WRONG           DATAQ size outside allowed range 1 to 255&lt;br /&gt;
 *          ERR_DQ_PENQ_SIZE_WRONG      DATAQ pending queue size outside allowed range 1 to 253&lt;br /&gt;
 *          ERR_DQ_TA_MAX_NUM_REACHED   Number of timed actions exceeds MAX allowed 255,&lt;br /&gt;
 *                                      each task on DATAQ pending queue is timed action&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_dataq_create(&lt;br /&gt;
                         dataq_t dataq_id,    // data queue ID&lt;br /&gt;
                         U16_t dataq_size,    // data queue size&lt;br /&gt;
                         U16_t pen_q_size,    // pending jobs queue size&lt;br /&gt;
                         BOOLE_t roll_over,   // whether to roll over when full&lt;br /&gt;
                         BOOLE_t use_timeout  // whether timeout is used oceos_dataq_read_restart_timeout&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| dataq_id ||   dataq_t data queue ID (number between 0 and 62)&lt;br /&gt;
|-&lt;br /&gt;
| dataq_size ||   data queue size (max number of pointers than can be added to the queue)&lt;br /&gt;
|-&lt;br /&gt;
| pen_q_size ||   pending jobs queue size&lt;br /&gt;
|-&lt;br /&gt;
| roll_over ||    whether to roll over when full (0 =&amp;gt; disabled, 1 =&amp;gt; enabled)&lt;br /&gt;
|-&lt;br /&gt;
| use_timeout ||  if TRUE, directive oceos_dataq_read_restart_timeout can be used&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_CPU_CORE          || Executing directive on wrong CPU&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Called before oceos_init() is done&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TOO_MANY                || MAX number of DATAQs already created&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || DATAQ ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || DATAQ ID &amp;gt;= number of DATAQs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DQ_ALREADY_ALLOCATED    || DATAQ ID already used&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DQ_SIZE_WRONG           || DATAQ size outside allowed range 1 to 255&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DQ_PENQ_SIZE_WRONG      || DATAQ pending queue size outside allowed range 1 to 253&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DQ_TA_MAX_NUM_REACHED   || Number of timed actions exceeds MAX allowed 255, each task on DATAQ pending queue is timed action&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Create data queue d_3 with size 20, max pending jobs of 10, rollover enabled, timeouts disabled &lt;br /&gt;
status = oceos_dataq_create(d_3, 20, 10, 1, 0));&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_dataq_write()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''dataq.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function puts a non-null pointer on the specified data queue.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Puts pointer to the data on data queue.&lt;br /&gt;
 * Pointer to the data must not be NULL&lt;br /&gt;
 *&lt;br /&gt;
 * @param dataq_t dataq_id Data queue ID&lt;br /&gt;
 * @param void* data       Non-null pointer to data&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          WARN_DQ_NOW_FULL            Warning, DATAQ is full now&lt;br /&gt;
 *          WARN_JOB_NOT_GUARDED&lt;br /&gt;
 *&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              DATAQ ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                DATAQ ID &amp;gt;= number of DATAQs&lt;br /&gt;
 *          ERR_DQ_DATA_BAD             Data pointer is null&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to acquire guard&lt;br /&gt;
 *          ERR_TOO_MANY                DATAQ is full&lt;br /&gt;
 *          ERR_DQ_JOB_ID_WRONG         Job ID of the task on pending queue is wrong&lt;br /&gt;
 *          ERR_TA_NOT_FOUND            Timed action index to be removed for job not found&lt;br /&gt;
 *          ERR_TA_START_FAILED         Timed action re-start failed after job remove from timed action queue&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_dataq_write(&lt;br /&gt;
    dataq_t dataq_id, // data queue ID&lt;br /&gt;
    void *data        // non-null pointer to data&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| dataq_id || dataq_t with value of Data queue ID&lt;br /&gt;
|-&lt;br /&gt;
| ptr || void* pointer to application data (non-null pointer)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| WARN_DQ_NOW_FULL            || Warning, DATAQ is full now&lt;br /&gt;
|-&lt;br /&gt;
| WARN_JOB_NOT_GUARDED        || &lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || DATAQ ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || DATAQ ID &amp;gt;= number of DATAQs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DQ_DATA_BAD             || Data pointer is null&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to acquire guard&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TOO_MANY                || DATAQ is full&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DQ_JOB_ID_WRONG         || Job ID of the task on pending queue is wrong&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_NOT_FOUND            || Timed action index to be removed for job not found&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_START_FAILED         || Timed action re-start failed after job remove from timed action queue&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
char[100] message_in;&lt;br /&gt;
...&lt;br /&gt;
// Put pointer to message_in on data queue s_2 &lt;br /&gt;
status = oceos_dataq_write(s_2, (void *)message_in);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_dataq_read_continue()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''dataq.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns a pointer from the specified data queue.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Read data queue&lt;br /&gt;
 *&lt;br /&gt;
 * @param dataq_t dataq_id  Data queue ID&lt;br /&gt;
 * @param void*   data      Pointer to data&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              DATAQ ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                DATAQ ID &amp;gt;= number of DATAQs&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to acquire guard&lt;br /&gt;
 *          ERR_DQ_EMPTY                DATAQ empty(count zero)&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_dataq_read_continue(&lt;br /&gt;
    dataq_t dataq_id, // data queue ID&lt;br /&gt;
    void* *data        // return data&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Descriptionn&lt;br /&gt;
|-&lt;br /&gt;
| dataq_id || dataq_t with value of Data queue ID&lt;br /&gt;
|-&lt;br /&gt;
| ptr || void* pointer to store returned data queue pointer removed from the queue&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || DATAQ ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || DATAQ ID &amp;gt;= number of DATAQs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to acquire guard&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DQ_EMPTY                || DATAQ empty(count zero)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
char *data_ptr;&lt;br /&gt;
...&lt;br /&gt;
// Read pointer from data queue s_2 &lt;br /&gt;
status = oceos_dataq_read_continue(s_2, (void *)data_ptr);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_dataq_read_restart()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''dataq.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns a pointer from the specified data queue. If the queue is empty, the job is added top the dataq pending queue. The job will be restarted when data is available. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Read data queue next item.&lt;br /&gt;
 * If dataq is empty, task is put on pending Q for dataq and&lt;br /&gt;
 * restarted by oceos_dataq_write&lt;br /&gt;
 *&lt;br /&gt;
 * @param dataq_id Data queue ID&lt;br /&gt;
 * @param data     Pointer to return data&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              DATAQ ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                DATAQ ID &amp;gt;= number of DATAQs&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to acquire guard&lt;br /&gt;
 *          ERR_DQ_J_START_FROM_TIMOUT  Job started from timeout already, DATAQ empty second time&lt;br /&gt;
 *          ERR_FAILED                  Should never return this&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_dataq_read_restart(&lt;br /&gt;
    dataq_t dataq_id,    // data queue ID&lt;br /&gt;
    void* *data           // pointer to return data&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| dataq_id || dataq_t with value of Data queue ID&lt;br /&gt;
|-&lt;br /&gt;
| ptr || void* pointer to store returned data queue pointer removed from the queue&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || DATAQ ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || DATAQ ID &amp;gt;= number of DATAQs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to acquire guard&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DQ_J_START_FROM_TIMOUT  || Job started from timeout already, DATAQ empty second time&lt;br /&gt;
|-&lt;br /&gt;
| ERR_FAILED                  || Should never return this&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
char *data_ptr;&lt;br /&gt;
...&lt;br /&gt;
// Read pointer from data queue s_2 with restart when data is available&lt;br /&gt;
status = oceos_dataq_read_restart(s_2, (void *)data_ptr);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_dataq_read_restart_timeout()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''dataq.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns a pointer from the specified data queue. If the queue is empty, the job is added top the dataq pending queue. The job will be restarted either when data is available or the timeout has expired. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Read data queue next item.&lt;br /&gt;
 * If dataq is empty, task is put on pending Q for dataq and&lt;br /&gt;
 * restarted by oceos_dataq_write or by timeout if timeout != 0&lt;br /&gt;
 * In order to use this feature timed actions must be configured and&lt;br /&gt;
 * dataq created with use timeout set to true&lt;br /&gt;
 *&lt;br /&gt;
 * @param dataq_id          Data queue ID&lt;br /&gt;
 * @param data              Pointer to return data&lt;br /&gt;
 * @param timeout           Timeout, restart time if no entry, 0 =&amp;gt; ignore&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_TA_NOT_INIT             Timed action intialisation is not done and tried to be used; or DATAQ created without timeouts&lt;br /&gt;
 *          ERR_ID_INVALID              DATAQ ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                DATAQ ID &amp;gt;= number of DATAQs&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to acquire guard&lt;br /&gt;
 *          ERR_DQ_EMPTY                DATAQ empty(count zero)&lt;br /&gt;
 *          ERR_DQ_J_START_FROM_TIMOUT  Job started from timeout already, DATAQ empty second time&lt;br /&gt;
 *          ERR_TOO_MANY                DATAQ pending queue is full&lt;br /&gt;
 *          ERR_FAILED                  Should never return this&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_dataq_read_restart_timeout(&lt;br /&gt;
    dataq_t dataq_id,   // data queue ID&lt;br /&gt;
    void* *data,         // Pointer to return data&lt;br /&gt;
    U64_t timeout       // timeout, restart time if no entry, 0 =&amp;gt; ignore&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| dataq_id || dataq_t with value of Data queue ID&lt;br /&gt;
|-&lt;br /&gt;
| ptr || void* pointer to store returned data queue pointer removed from the queue&lt;br /&gt;
|-&lt;br /&gt;
| timeout || U64_t containing timeout value, restart time if no entry, 0 =&amp;gt; ignore&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_NOT_INIT             || Timed action intialisation is not done and tried to be used; or DATAQ created without timeouts&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || DATAQ ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || DATAQ ID &amp;gt;= number of DATAQs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to acquire guard&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DQ_EMPTY                || DATAQ empty(count zero)&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DQ_J_START_FROM_TIMOUT  || Job started from timeout already, DATAQ empty second time&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TOO_MANY                || DATAQ pending queue is full&lt;br /&gt;
|-&lt;br /&gt;
| ERR_FAILED                  || Should never return this&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
char *data_ptr;&lt;br /&gt;
...&lt;br /&gt;
// Read pointer from data queue s_2 with timeout after 10,000 time units if no data is available&lt;br /&gt;
status = oceos_dataq_read_restart_timeout(s_2, (void *)data_ptr, 10000ull);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_dataq_get_size()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''dataq.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the number of items on the specified data queue.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Returns number of items on the data queue with ID&lt;br /&gt;
 *&lt;br /&gt;
 * @param dataq_id   DATAQ Id&lt;br /&gt;
 * @param d_size     Pointer to size holder&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              DATAQ ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                DATAQ ID &amp;gt;= number of DATAQs&lt;br /&gt;
 *          ERR_DQ_DATA_BAD             DATAQ size holder pointer is null&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_dataq_get_size(&lt;br /&gt;
    dataq_t dataq_id,   // data queue ID&lt;br /&gt;
    U32_t *d_size&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| dataq_id ||  dataq_t with the ID of the data queue (value between 0 and 62)&lt;br /&gt;
|-&lt;br /&gt;
| d_size || U32_t *d_size pointer to the variable to store the size&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || DATAQ ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || DATAQ ID &amp;gt;= number of DATAQs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DQ_DATA_BAD             || DATAQ size holder pointer is null&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, d_size;&lt;br /&gt;
...&lt;br /&gt;
// Get the number of entries on data queue d_0&lt;br /&gt;
status = oceos_dataq_get_size(d_0, &amp;amp;d_size);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_dataq_penq_get_size()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''dataq.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns number of jobs on the specified data queue pending job's queue.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Returns number of jobs on the dataq pending job's queue&lt;br /&gt;
 *&lt;br /&gt;
 * @param dataq_id  DATAQ Id&lt;br /&gt;
 * @param d_size    Pointer to pending queue size holder&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              DATAQ ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                DATAQ ID &amp;gt;= number of DATAQs&lt;br /&gt;
 *          ERR_DQ_DATA_BAD             DATAQ pending size holder pointer is null&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_dataq_penq_get_size(&lt;br /&gt;
    dataq_t dataq_id,&lt;br /&gt;
    U32_t *d_size&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| dataq_id ||  dataq_t with the ID of the data queue (value between 0 and 62)&lt;br /&gt;
|-&lt;br /&gt;
| d_jobs || U32_t *d_jobs pointer to the variable to store the number of jobs on the pending queue&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || DATAQ ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || DATAQ ID &amp;gt;= number of DATAQs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DQ_DATA_BAD             || DATAQ pending size holder pointer is null&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, d_jobs;&lt;br /&gt;
...&lt;br /&gt;
// Get the number of jobs the the pending jubs queue for data queue d_1&lt;br /&gt;
status = oceos_dataq_penq_get_size(d_1, &amp;amp;d_jobs);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_dataq_clear()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''dataq.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function clears the specified data queue including pending jobs for that queue.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Clears data queue and&lt;br /&gt;
 * frees tasks on pending queue&lt;br /&gt;
 *&lt;br /&gt;
 * @param dataq_t dataq_id Data queue ID&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              DATAQ ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                DATAQ ID &amp;gt;= number of DATAQs&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to acquire guard&lt;br /&gt;
 *          ERR_DQ_JOB_ID_WRONG         Job ID of the task on DATAQ pending queue is wrong&lt;br /&gt;
 *          ERR_TA_NOT_FOUND            Timed action index to be removed for job not found&lt;br /&gt;
 *          ERR_TA_START_FAILED         Timed action re-start failed after job remove from timed action queue&lt;br /&gt;
 */&lt;br /&gt;
S32_t  oceos_dataq_clear(&lt;br /&gt;
    dataq_t dataq_id    // data queue ID&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| dataq_id ||  dataq_t with the ID of the data queue to be cleared (value between 0 and 62)&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || DATAQ ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || DATAQ ID &amp;gt;= number of DATAQs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to acquire guard&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DQ_JOB_ID_WRONG         || Job ID of the task on DATAQ pending queue is wrong&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_NOT_FOUND            || Timed action index to be removed for job not found&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_START_FAILED         || Timed action re-start failed after job remove from timed action queue&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Clear data queue d_1&lt;br /&gt;
status = oceos_dataq_penq_get_size(d_1);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Timed Actions ==&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_timed_output_add()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''timed_action.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function adds a timed action to the timed action queue. It writes a value to an address at a specified system time. An optional mask can be applied so that only those bits are changed.&lt;br /&gt;
The action types are WRITE_ACTION, RMW_ACTION. WRITE_ACTION writes the value to the address. RMW_ACTION reads the values at the address and modifies the bits specified by the mask and value.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Add output action to timed actions queue :&lt;br /&gt;
 *  1. Create timed output action&lt;br /&gt;
 *  2. Stop timer&lt;br /&gt;
 *  3. Add action to action_array&lt;br /&gt;
 *  4. Start timer or execute if time is right&lt;br /&gt;
 *&lt;br /&gt;
 * Returns timed action ID that can be used later to remove&lt;br /&gt;
 * if need by oceos_timed_output_remove&lt;br /&gt;
 *&lt;br /&gt;
 * @param enum ACTION_TYPE action_type  Action type&lt;br /&gt;
 * @param U64_t act_time                System time at which action should be done&lt;br /&gt;
 * @param U32_t before_time             Forward tolerance for time&lt;br /&gt;
 * @param U32_t after_time              Backward tolerance for time&lt;br /&gt;
 * @param adrs_t address                Output address&lt;br /&gt;
 * @param U32_t value                   Output value&lt;br /&gt;
 * @param U32_t mask                    Output mask&lt;br /&gt;
 * @param U32_ *ta_index                Pointer to store timed action index&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_TA_NOT_INIT             Timed action inialisation is not done and tried to be used&lt;br /&gt;
 *          ERR_TA_PTR_BAD              Timed action pointer is null&lt;br /&gt;
 *          ERR_TA_TYPE_WRONG           Timed action type is wrong&lt;br /&gt;
 *          ERR_TOO_LATE                Timed action time is too late&lt;br /&gt;
 *          ERR_SYS_BUSY                Timed action guard failed to acquire&lt;br /&gt;
 *          ERR_TA_Q_FULL               Timed action queue is full&lt;br /&gt;
 *          ERR_TA_START_FAILED         Timed action execute failed; See log&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_timed_output_add(&lt;br /&gt;
    const enum ACTION_TYPE action_type,// Action type&lt;br /&gt;
    U64_t act_time,                    // system time at which action should be done&lt;br /&gt;
    U32_t before_time,                 // forward tolerance for time&lt;br /&gt;
    U32_t after_time,                  // backward tolerance for time&lt;br /&gt;
    const adrs_t address,              // output address&lt;br /&gt;
    const U32_t value,                 // output value&lt;br /&gt;
    const U32_t mask,                  // output mask&lt;br /&gt;
    U32_t *ta_index                    // Pointer to store timed action index&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| enum ACTION_TYPE action_type  || Action type&lt;br /&gt;
|-&lt;br /&gt;
| U64_t act_time                || System time at which action should be done&lt;br /&gt;
|-&lt;br /&gt;
| U32_t before_time             || Forward tolerance for time&lt;br /&gt;
|-&lt;br /&gt;
| U32_t after_time              || Backward tolerance for time&lt;br /&gt;
|-&lt;br /&gt;
| adrs_t address                || Output address&lt;br /&gt;
|-&lt;br /&gt;
| U32_t value                   || Output value&lt;br /&gt;
|-&lt;br /&gt;
| U32_t mask                    || Output mask&lt;br /&gt;
|-&lt;br /&gt;
| U32_ *ta_index                || Pointer to store timed action index&lt;br /&gt;
|-&lt;br /&gt;
| param || parameter to function&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_NOT_INIT             || Timed action inialisation is not done and tried to be used&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_PTR_BAD              || Timed action pointer is null&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_TYPE_WRONG           || Timed action type is wrong&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TOO_LATE                || Timed action time is too late&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Timed action guard failed to acquire&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_Q_FULL               || Timed action queue is full&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_START_FAILED         || Timed action execute failed; See log&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
#define OUTPUT_TIMED_VAL    0xDEADBEEF&lt;br /&gt;
#define OUTPUT_TIMED_MASK   0x1000001&lt;br /&gt;
#define OUTPUT_TIME         0xfffff&lt;br /&gt;
#define OUTPUT_TIME_FW      0x1000&lt;br /&gt;
#define OUTPUT_TIME_BW      0x1000&lt;br /&gt;
&lt;br /&gt;
static U32_t test_data[16] = { 0 };&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Write OUTPUT_TIMED_VAL to test_data[0] at 0xfffff time units from now with a tolerance of 0x1000 before and after the specified time   &lt;br /&gt;
status = oceos_timed_output_add(&lt;br /&gt;
                                       WRITE_ACTION,&lt;br /&gt;
                                       OUTPUT_TIME,&lt;br /&gt;
                                       OUTPUT_TIME_FW,&lt;br /&gt;
                                       OUTPUT_TIME_BW,&lt;br /&gt;
                                       (adrs_t) &amp;amp;test_data[0],&lt;br /&gt;
                                       OUTPUT_TIMED_VAL,&lt;br /&gt;
                                       0,&lt;br /&gt;
                                       &amp;amp;timed_action_index));&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_timed_jobs_number()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''timed_action.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the number of jobs on the timed actions queue.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Get number of Jobs (request to start the task) waiting on timed action queue.&lt;br /&gt;
 * These jobs are added by oceos_task_timed_start() or&lt;br /&gt;
 * oceos_dataq_read_restart_timeout when data is not available (NULL) or&lt;br /&gt;
 * oceos_sem_wait_restart_timeout when counting semaphore is 0&lt;br /&gt;
 *&lt;br /&gt;
 * @param total_jobs    Pointer to store total jobs number waiting on timed action Q&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_TA_NOT_INIT             Timed action inialisation is not done and tried to be used&lt;br /&gt;
 *          ERR_TA_PTR_BAD              Timed action pointer is null&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_timed_jobs_number(U32_t *total_jobs);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| total_jobs || s32_t pointer to store total jobs number waiting on timed action Q&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_NOT_INIT             || Timed action inialisation is not done and tried to be used&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_PTR_BAD              || Timed action pointer is null&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, no_of_jobs;&lt;br /&gt;
...&lt;br /&gt;
// Get the number of jobs on the timed actions queue&lt;br /&gt;
status = oceos_timed_jobs_number(&amp;amp;no_of_jobs);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_timed_output_number()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''timed_action.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the number of jobs on the timed actions queue.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Get number of Jobs (request to start the task) waiting on timed action queue.&lt;br /&gt;
 * These jobs are added by oceos_task_timed_start() or&lt;br /&gt;
 * oceos_dataq_read_restart_timeout when data is not available (NULL) or&lt;br /&gt;
 * oceos_sem_wait_restart_timeout when counting semaphore is 0&lt;br /&gt;
 *&lt;br /&gt;
 * @param total_jobs    Pointer to store total jobs number waiting on timed action Q&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_TA_NOT_INIT             Timed action inialisation is not done and tried to be used&lt;br /&gt;
 *          ERR_TA_PTR_BAD              Timed action pointer is null&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_timed_jobs_number(U32_t *total_jobs);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| total_jobs || s32_t pointer to store total jobs number waiting on timed action Q&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_NOT_INIT             || Timed action inialisation is not done and tried to be used&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_PTR_BAD              || Timed action pointer is null&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, no_of_jobs;&lt;br /&gt;
...&lt;br /&gt;
// Get the number of jobs on the timed actions queue&lt;br /&gt;
status = oceos_timed_jobs_number(&amp;amp;no_of_jobs);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_timed_jobs_remove()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''timed_action.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function removes the specified timed action from the queue.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Remove job from timed action queue&lt;br /&gt;
 * When task started using oceos_task_timed_start(),&lt;br /&gt;
 * this directive requires pointer to store ID&lt;br /&gt;
 * of job that put on the timed action queue.&lt;br /&gt;
 * This job can be removed later using this directive and stored job ID.&lt;br /&gt;
 *&lt;br /&gt;
 * @param U32_t job_id  Job ID&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_TA_NOT_INIT             Timed action intialisation is not done and tried to be used&lt;br /&gt;
 *          ERR_TA_PTR_BAD              Timed action pointer corrupt&lt;br /&gt;
 *          ERR_ID_WRONG                Job ID is wrong&lt;br /&gt;
 *          ERR_TA_NOT_FOUND            Timed action ID not found for action with job_id or removed already&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to acquire timed action guard&lt;br /&gt;
 *          WARN_TA_Q_EMPTY             Timed action queue is empty&lt;br /&gt;
 *          ERR_TA_START_FAILED         Timed action execute failed; See log&lt;br /&gt;
 */&lt;br /&gt;
S32_t   oceos_timed_jobs_remove(&lt;br /&gt;
    U32_t job_id                             // Job ID&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| job_id || U32_t Job ID to be removed from the timed actions queue&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_NOT_INIT             || Timed action intialisation is not done and tried to be used&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_PTR_BAD              || Timed action pointer corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || Job ID is wrong&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_NOT_FOUND            || Timed action ID not found for action with job_id or removed already&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to acquire timed action guard&lt;br /&gt;
|-&lt;br /&gt;
| WARN_TA_Q_EMPTY             || Timed action queue is empty&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_START_FAILED         || Timed action execute failed; See log&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, job_id;&lt;br /&gt;
...&lt;br /&gt;
// Remove job_id from the timed actions queue&lt;br /&gt;
status = oceos_timed_jobs_remove(job_id);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_timed_jobs_reset()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''timed_action.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function removes all jobs from timed actions queue.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Remove all jobs (requests to start a task) from timed actions queue&lt;br /&gt;
 * These jobs were added by oceos_task_timed_start() or&lt;br /&gt;
 * oceos_dataq_read_restart_timeout when data is not available (NULL) or&lt;br /&gt;
 * oceos_sem_wait_restart_timeout when counting semaphore is 0&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_TA_NOT_INIT             Timed action intialisation is not done and tried to be used&lt;br /&gt;
 *          ERR_TA_PTR_BAD              Timed action pointer is null&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to acquire timed action guard&lt;br /&gt;
 *          WARN_TA_Q_EMPTY             Timed action queue is empty&lt;br /&gt;
 *          ERR_TA_NOT_FOUND            Timed action index not found&lt;br /&gt;
 *          ERR_TA_START_FAILED         Timed action execute failed; See log&lt;br /&gt;
 */&lt;br /&gt;
S32_t   oceos_timed_jobs_reset(void);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
There are no input parameters to this function&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_NOT_INIT             || Timed action intialisation is not done and tried to be used&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_PTR_BAD              || Timed action pointer is null&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to acquire timed action guard&lt;br /&gt;
|-&lt;br /&gt;
| WARN_TA_Q_EMPTY             || Timed action queue is empty&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_NOT_FOUND            || Timed action index not found&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_START_FAILED         || Timed action execute failed; See log&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Remove all jobs from the timed actions queue&lt;br /&gt;
status = oceos_timed_jobs_reset(job_id);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_timed_output_remove()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''timed_action.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function removes the specified timed output action from timed actions queue.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Remove timed output action from timed actions queue.&lt;br /&gt;
 * When action is created, action index should be stored&lt;br /&gt;
 * to remove if need&lt;br /&gt;
 *&lt;br /&gt;
 * @param action_index&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_TA_NOT_INIT             Timed action intialisation is not done and tried to be used&lt;br /&gt;
 *          ERR_TA_PTR_BAD              Timed action pointer is null&lt;br /&gt;
 *          ERR_ID_WRONG                Timed action id is wrong&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to acquire timed action guard&lt;br /&gt;
 *          ERR_TA_NOT_FOUND            Timed action index not found&lt;br /&gt;
 *          ERR_TA_START_FAILED         Timed action execute failed&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_timed_output_remove(&lt;br /&gt;
    const U8_t  action_index    // Index in action array, returned when action was created&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| action_index|| S32_t specifying the timed output action index returned when the timed output was added.&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| Error bit  || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_NOT_INIT             || Timed action intialisation is not done and tried to be used&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_PTR_BAD              || Timed action pointer is null&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || Timed action id is wrong&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to acquire timed action guard&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_NOT_FOUND            || Timed action index not found&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_START_FAILED         || Timed action execute failed&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
U8_t action_index;&lt;br /&gt;
...&lt;br /&gt;
// Remove timed output with specified action_index&lt;br /&gt;
status = oceos_timed_output_remove(action_index);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_timed_output_reset()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''timed_action.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function removes all timed output actions from timed actions queue.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Remove all timed output actions from timed actions queue&lt;br /&gt;
 * These timed output actions were created by oceos_timed_output_add&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_TA_NOT_INIT             Timed action intialisation is not done and tried to be used&lt;br /&gt;
 *          ERR_TA_PTR_BAD              Timed action pointer is null&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to acquire timed action guard&lt;br /&gt;
 *          WARN_TA_Q_EMPTY             Timed action queue is empty&lt;br /&gt;
 *          ERR_TA_NOT_FOUND            Timed action index not found&lt;br /&gt;
 *          ERR_TA_START_FAILED         Timed action execute failed; See log&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_timed_output_reset(void);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
There are no input parameters to this function. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| Error bit  || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_NOT_INIT             || Timed action intialisation is not done and tried to be used&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_PTR_BAD              || Timed action pointer is null&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to acquire timed action guard&lt;br /&gt;
|-&lt;br /&gt;
| WARN_TA_Q_EMPTY             || Timed action queue is empty&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_NOT_FOUND            || Timed action index not found&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_START_FAILED         || Timed action execute failed; See log&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Remove all timed outputs from the timed actions queue&lt;br /&gt;
status = oceos_timed_output_reset();&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Logging directives ==&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;Introduction&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Log Area Features  (for details of other areas see oceos_areas.h)&lt;br /&gt;
&lt;br /&gt;
The system log area holds the system log and the records of the present and previous values of the system state variable.&lt;br /&gt;
&lt;br /&gt;
It is set up initially as an array of 32-bit words that starts at a 32-bit aligned address provided by the application developer.&lt;br /&gt;
&lt;br /&gt;
It is recommended that this address be in non-volatile RAM memory if this is available to allow information be preserved across power-up cycles.&lt;br /&gt;
&lt;br /&gt;
OCEOS preserves log area information across resets as far as possible.&lt;br /&gt;
&lt;br /&gt;
The system log itself is a circular buffer of struct log entry. Older entries are overwritten by new entries once all entries are in use.&lt;br /&gt;
&lt;br /&gt;
The application developer can specify a function to be called when 3/4 of log entries are in use. This function is called again only after 3/4 of log entries have been read and the log has again become 3/4 full.&lt;br /&gt;
&lt;br /&gt;
The read and write indices are stored in the log area and if equal indicate that the log is empty.&lt;br /&gt;
&lt;br /&gt;
As with other OCEOS data areas, the log area starts with a header&lt;br /&gt;
*a 32-bit word holding a constant OCEOS_VERSION&lt;br /&gt;
*a 32-bit word holding the log area size in 32-bit words&lt;br /&gt;
*a 32-bit word, the system status variable&lt;br /&gt;
*a 32-bit word, the system status mask&lt;br /&gt;
*a 32-bit word, the accumulated system status&lt;br /&gt;
*a 32-bit word, the previous system status mask&lt;br /&gt;
*a 32-bit word, the log control, that gives whether the log full function was called&lt;br /&gt;
*the read index&lt;br /&gt;
*the write index&lt;br /&gt;
*an array of struct log_entry making up the system log itself&lt;br /&gt;
*ending with a 32-bit constant END_SENTINEL&lt;br /&gt;
&lt;br /&gt;
The system fixed meta structure at sysMetaPtr provides&lt;br /&gt;
&lt;br /&gt;
*system_log_ptr      the start address of the log area&lt;br /&gt;
*logEntries          the number of log entries&lt;br /&gt;
*logCreated          flag indicating log was created successfully&lt;br /&gt;
*logFullFunction     user defined function, called when the log becomes 3/4 full (or NULL if not used)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Log Entry Types and Structure'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/*****************************************************************************&lt;br /&gt;
 * LOG ENTRY TYPES&lt;br /&gt;
 *&lt;br /&gt;
 * A log entry type is an 8-bit number.&lt;br /&gt;
 * Values from 0 to 127 can be defined by the application.&lt;br /&gt;
 * Values from 128 to 255 are used by OCEOS as below.&lt;br /&gt;
 *&lt;br /&gt;
 *&lt;br /&gt;
 * NOTE: Add new log types at the end for backward compatibility&lt;br /&gt;
 */&lt;br /&gt;
enum LOG_ENTRY_TYPE{&lt;br /&gt;
  LOG_SYS_OK = 0x80U,&lt;br /&gt;
  LOG_OCEOS_ABORT,				// when exiting from oceos_start&lt;br /&gt;
  LOG_LOG_NOT_VALID_ENTRY,		// used to initialise log and when log empty&lt;br /&gt;
  LOG_INIT_TASK_START_FAIL,		// initial task passed to oceos_start failed&lt;br /&gt;
  LOG_DEADLINE_MISSED,			// task deadline missed&lt;br /&gt;
  LOG_JOB_NOT_ACTIVE,			// cpu_terminate but job not active, absurd&lt;br /&gt;
  LOG_JOB_NOT_FREE,				// job guarded but not free&lt;br /&gt;
  LOG_JOBS_INC_FAILED, 			// pending jobs increment failed&lt;br /&gt;
  LOG_JOB_NOT_GUARDED,			// paranoia&lt;br /&gt;
  LOG_CS_LOG_SPIN_FAIL,			// oceos_CPU_sleep, trying to update CS log&lt;br /&gt;
  LOG_MUTEX_ALREADY_HELD,		// oceos_mutex_wait, code returned, not needed&lt;br /&gt;
  LOG_MUTEX_INCORRECT_ORDER,	// oceos_mutex_wait&lt;br /&gt;
  LOG_MUTEX_EXIT_HOLDING,		// task exits holding one or more mutexes&lt;br /&gt;
  LOG_MUTEX_EXIT_NONE,			// __oceos_tasks_remove_mutexes called but no mutex held&lt;br /&gt;
  LOG_SEMAPHORE_PENDING_REMOVE_FAIL,	// timed_action.c&lt;br /&gt;
  LOG_SEMAPHORE_PENDING_QUEUE_FULL,		// __oceos_semaphore_add_pend&lt;br /&gt;
  LOG_SEMAPHORE_SPIN_FAILED,			// trying to access semaphore&lt;br /&gt;
  LOG_DATAQ_PENDING_QUEUE_FULL,&lt;br /&gt;
  LOG_DATAQ_PENDING_REMOVE_FAIL,&lt;br /&gt;
  LOG_DATAQ_SPIN_FAILED,&lt;br /&gt;
  LOG_TIMED_ACTION_TIMER_NULL,&lt;br /&gt;
  LOG_TIMED_ACTION_INVALID,&lt;br /&gt;
  LOG_TIMED_ACTION_BAD_INDEX,&lt;br /&gt;
  LOG_TIMED_ACTION_MISSED,&lt;br /&gt;
  LOG_TIMED_ACTION_Q_EMPTY,&lt;br /&gt;
  LOG_TIMED_ACTION_REMOVE_FAIL,&lt;br /&gt;
  LOG_TIMED_ACTION_BAD_JOB_ID,&lt;br /&gt;
  LOG_TIMED_Q_SPIN_FAIL,&lt;br /&gt;
  LOG_SYSTEM_ERROR,&lt;br /&gt;
  LOG_ATOMICINC_FAILED,&lt;br /&gt;
  LOG_PENDING_PRI_UPDATE_FAILED,&lt;br /&gt;
  LOG_KILL_TASK_INVALID_ID,      // Tried to kill task with invalid ID&lt;br /&gt;
  LOG_OCEOS_EXIT_REQUEST,         // oceos_exit command was called&lt;br /&gt;
  LOG_RWMUTEX_NOT_RETURNED,&lt;br /&gt;
  LOG_RWMUTEX_NOT_HIGHEST&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
/*****************************************************************************&lt;br /&gt;
 * Structures&lt;br /&gt;
 */&lt;br /&gt;
/**&lt;br /&gt;
 * Log entry structure&lt;br /&gt;
 */&lt;br /&gt;
struct log_entry{&lt;br /&gt;
  U64_t             time64;&lt;br /&gt;
&lt;br /&gt;
  unsigned int      entry_cpu          :8;&lt;br /&gt;
  unsigned int      entry_type         :8;&lt;br /&gt;
  unsigned int      entry_note         :16;	// not used at present&lt;br /&gt;
&lt;br /&gt;
  U32_t             entry_comment;&lt;br /&gt;
}__attribute__ ((aligned (8)));&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_log_add_entry()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''system_log.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function adds an entry to the log. The entry overwrites the oldest unread entry if the log is full.&lt;br /&gt;
Custom log entries can be added to enum LOG_ENTRY from 0 to 128.&lt;br /&gt;
The indices are incremented in a circular fashion. If the write index reaches the read_index the read index is moved on, as read and write indices equal would indicate an empty log.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Add an entry to the log.&lt;br /&gt;
 * this overwrites the oldest unread entry if the log is full.&lt;br /&gt;
 * Custom log entries can be added to enum LOG_ENTRY from 0 to 128&lt;br /&gt;
 *&lt;br /&gt;
 * N.B. The indices are incremented in a circular fashion.&lt;br /&gt;
 *      If the write index reaches the read_index the read index is moved on,&lt;br /&gt;
 *      as read and write indices equal would indicate an empty log.&lt;br /&gt;
 *&lt;br /&gt;
 * @param type  enum LOG_ENTRY_TYPE&lt;br /&gt;
 * @param info  extra information to be logged&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_LOG_CORRUPT         System Log area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Log directive called in wrong phase; can be used after oceos_init() called&lt;br /&gt;
 *          ERR_ID_INVALID              Log type invalid&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to acquire log guard&lt;br /&gt;
 *          ERR_LOG_INDEX_WRONG         Read/write log index is wrong&lt;br /&gt;
 */&lt;br /&gt;
S32_t   oceos_log_add_entry(&lt;br /&gt;
    enum LOG_ENTRY_TYPE type,   // 8 bits enum LOG_ENTRY_TYPE&lt;br /&gt;
    const U32_t        info     // information&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| enum LOG_ENTRY_TYPE || Log entry type (see previous section for a list)&lt;br /&gt;
|-&lt;br /&gt;
| info | U32_t with the log information&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit  !! Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_LOG_CORRUPT         || System Log area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Log directive called in wrong phase; can be used after oceos_init() called&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || Log type invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to acquire log guard&lt;br /&gt;
|-&lt;br /&gt;
| ERR_LOG_INDEX_WRONG         || Read/write log index is wrong&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, info;&lt;br /&gt;
...&lt;br /&gt;
// Log LOG_APP_COMMS__ERROR (defined in enum LOG_ENTRY_TYPE) and info with more details&lt;br /&gt;
status = oceos_log_add_entry(LOG_APP_COMMS__ERROR, info);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_log_get_indexed_entry()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''system_log.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the entry at the specified position in the log. The entry is not removed and the log and log indices are not changed.&lt;br /&gt;
One use of this function is to allow the log be examined after a reset.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Returns the entry at the specified position in the log.&lt;br /&gt;
 * The entry is not removed and the log and log indices are not changed.&lt;br /&gt;
 * (intended to allow the log be examined for example after reset)&lt;br /&gt;
 *&lt;br /&gt;
 * @param index         position in the log&lt;br /&gt;
 * @param outputPtr     pointer to return log entry&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_LOG_CORRUPT         System Log area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Log directive called in wrong phase; can be used after oceos_init() called&lt;br /&gt;
 *          ERR_LOG_INDEX_WRONG         Read log index is wrong&lt;br /&gt;
 *          ERR_LOG_DATA_PTR_BAD        Data holder pointer is null&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_log_get_indexed_entry(&lt;br /&gt;
    const unsigned int index,&lt;br /&gt;
    struct log_entry * const outputPtr&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| index || U32_t with position in the log&lt;br /&gt;
|-&lt;br /&gt;
| outputPtr || pointer to struct log_entry to hold the returned entry&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit  !! Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_LOG_CORRUPT         || System Log area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Log directive called in wrong phase; can be used after oceos_init() called&lt;br /&gt;
|-&lt;br /&gt;
| ERR_LOG_INDEX_WRONG         || Read log index is wrong&lt;br /&gt;
|-&lt;br /&gt;
| ERR_LOG_DATA_PTR_BAD        || Data holder pointer is null&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, index;&lt;br /&gt;
struct log_entry store_entry;&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
// Read log_entry at specified index into outputPtr&lt;br /&gt;
status = oceos_log_get_indexed_entry(index, &amp;amp;store_entry);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_log_remove_entry()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''system_log.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function reads and removes the oldest unread log entry. &lt;br /&gt;
If the log is not empty use the entry at the read index to update the value at the output pointer, returning OCEOS_SUCCESS.&lt;br /&gt;
If outputPtr is NULL, entry is removed but no returned.&lt;br /&gt;
If the log is empty, set the value at the output pointer to LOG_LOG_NOT_VALID_ENTRY and return ERR_LOG_EMPTY.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Read and remove the oldest unread log entry&lt;br /&gt;
 *&lt;br /&gt;
 * If the log is not empty use the entry at the read index to update the value&lt;br /&gt;
 * at the output pointer, returning OCEOS_SUCCESS.&lt;br /&gt;
 *&lt;br /&gt;
 * If outputPtr is NULL, entry is removed but no returned&lt;br /&gt;
 *&lt;br /&gt;
 * If the log is empty, set the value at the output pointer to LOG_LOG_NOT_VALID_ENTRY&lt;br /&gt;
 * and return ERR_LOG_EMPTY&lt;br /&gt;
 *&lt;br /&gt;
 * @param outputPtr   pointer to struct log_entry&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_LOG_CORRUPT         System Log area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Log directive called in wrong phase; can be used after oceos_init() called&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to acquire log guard&lt;br /&gt;
 *          ERR_LOG_INDEX_WRONG         Read/write log index is wrong&lt;br /&gt;
 *          ERR_LOG_EMPTY               Log is empty&lt;br /&gt;
 */&lt;br /&gt;
S32_t   oceos_log_remove_entry(&lt;br /&gt;
    struct log_entry * const outputPtr&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| outputPtr || pointer to struct log_entry&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit  !! Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_LOG_CORRUPT         || System Log area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Log directive called in wrong phase; can be used after oceos_init() called&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to acquire log guard&lt;br /&gt;
|-&lt;br /&gt;
| ERR_LOG_INDEX_WRONG         || Read/write log index is wrong&lt;br /&gt;
|-&lt;br /&gt;
| ERR_LOG_EMPTY               || Log is empty&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
struct log_entry *outputPtr;&lt;br /&gt;
...&lt;br /&gt;
// Read log_entry into outputPtr and remove the oldest unread log entry&lt;br /&gt;
status = oceos_log_remove_entry(outputPtr);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_log_reset()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''system_log.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function sets all log entries to LOG_LOG_NOT_VALID_ENTRY and the log to empty, with the read and write indices set to 0.&lt;br /&gt;
The log is empty if the index of the next write is the same as the index of the next read. It does not affect the system status variable. It does not affect the context switch log.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * oceos_log_reset()&lt;br /&gt;
 *&lt;br /&gt;
 * Set all log entries to LOG_LOG_NOT_VALID_ENTRY and the log to empty, with the&lt;br /&gt;
 * read and write indices set to 0. and function called flag 0&lt;br /&gt;
 *&lt;br /&gt;
 * The log is empty if the index of the next write&lt;br /&gt;
 * is the same as the index of the next read.&lt;br /&gt;
 *&lt;br /&gt;
 * Does not affect the system status variable&lt;br /&gt;
 * Does not affect the context switch log&lt;br /&gt;
 *&lt;br /&gt;
 * N.B The fixed data area may no longer be writable&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_LOG_CORRUPT         System Log area corrupt; reset failed&lt;br /&gt;
 *          ERR_WRONG_PHASE             Log directive called in wrong phase; can be used after oceos_init() called&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to acquire log guard&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_log_reset(void);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
There are no input parameters to this function.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit  !! Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_LOG_CORRUPT         || System Log area corrupt; reset failed&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Log directive called in wrong phase; can be used after oceos_init() called&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to acquire log guard&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
// Clear down the system log&lt;br /&gt;
status = oceos_log_reset();&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_log_get_size()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''system_log.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the number of entries in the log according to the current values of the read and write indices.&lt;br /&gt;
The value will be zero if the current values of the read and write indices are the same. There may still be useful information in the log, e.g. after system reset, this can be accessed using oceos_log_get_indexed_entry().&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Return the number of entries in the log&lt;br /&gt;
 * according to the current values of the read and write indices.&lt;br /&gt;
 *&lt;br /&gt;
 * The value will be zero if the current values of the read and write indices&lt;br /&gt;
 * are the same.&lt;br /&gt;
 *&lt;br /&gt;
 * There may still be useful information in the log, e.g. after system reset,&lt;br /&gt;
 * this can be accessed using oceos_log_get_indexed_entry()&lt;br /&gt;
 *&lt;br /&gt;
 * @param l_size        pointer to log size holder&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_LOG_CORRUPT         System Log area corrupt;&lt;br /&gt;
 *          ERR_WRONG_PHASE             Log directive called in wrong phase; can be used after oceos_init() called&lt;br /&gt;
 *          ERR_LOG_DATA_PTR_BAD        Pointer to log size holder is NULL&lt;br /&gt;
 *          ERR_LOG_INDEX_WRONG         Read/write log index is wrong&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_log_get_size(&lt;br /&gt;
    U32_t *l_size&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| l_size|| U32_t pointer where size will be written.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit  !! Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_LOG_CORRUPT         || System Log area corrupt;&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Log directive called in wrong phase; can be used after oceos_init() called&lt;br /&gt;
|-&lt;br /&gt;
| ERR_LOG_DATA_PTR_BAD        || Pointer to log size holder is NULL&lt;br /&gt;
|-&lt;br /&gt;
| ERR_LOG_INDEX_WRONG         || Read/write log index is wrong&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, size;&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
// Clear down the system log&lt;br /&gt;
status = oceos_log_get_size(&amp;amp;size);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;System State Variable and System State Mask&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The System State variable provides a record of anomalies or problems detected by OCEOSmp's automatic consistency checks. An application handler for these can be set to be called automatically.&lt;br /&gt;
&lt;br /&gt;
An anomaly or problem results in a flag bit being set in the 32-bit word used to store the system state variable. The flags are identified below.&lt;br /&gt;
&lt;br /&gt;
All flags are reset to zero by oceos_init() when OCEOSmp is initialised, and may also be reset by the application using the directive provided.&lt;br /&gt;
&lt;br /&gt;
To provide a record across OCEOSmp restarts a copy is updated automatically whenever the state variable is updated. This is not cleared by oceos_init() but may be cleared by the application using a directive.&lt;br /&gt;
&lt;br /&gt;
Application software can define a problem handling function to be called automatically when specified system state flags are set. The flags are specified by setting the corresponding bits in the system state mask. The function and the state mask are defined in the system configuration.&lt;br /&gt;
&lt;br /&gt;
Changing a state flag from clear to set results in the function being called (if defined). Subsequent settings of that flag have no effect until after it has been cleared using the directive provided.&lt;br /&gt;
&lt;br /&gt;
N.B. In many cases when OCEOSmp sets a System State flag it also makes an entry in the system log that provides further information.&lt;br /&gt;
&lt;br /&gt;
SYSTEM STATE VARIABLE FLAGS&lt;br /&gt;
&lt;br /&gt;
These flags are updated by OCEOSmp using inclusive 'OR' when a consistency check detects a problem or anomaly. A copy of the system state variable is updated also and accumulates a record of flag settings that is preserved across restarts of OCEOSmp. OCEOSmp restarts reset the system state variable but not the copy.&lt;br /&gt;
&lt;br /&gt;
Resetting the state variables is the responsibility of the application (except for the state variable reset done when OCEOSmp is restarted).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''System Status Bits'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
#define  STATUS_NORMAL                    0u    // No flag set                              YES&lt;br /&gt;
#define  STATUS_INVALID          0xffffffffu    // System status is invalid                 YES BUT NO DETAIL!!!&lt;br /&gt;
&lt;br /&gt;
#define  STATUS_MASK_NORMAL      0xffffffffu    // Always call user def fn                  YES&lt;br /&gt;
&lt;br /&gt;
/* Task related problems */&lt;br /&gt;
#define  STATUS_DISABLED_TASK_START    0x1U    // An attempt to start a disabled task&lt;br /&gt;
#define  STATUS_TASK_JOB_LIMIT_OVER    0x2U    // An attempt to execute a task when its jobs limit is already reached.&lt;br /&gt;
#define  STATUS_JOB_OVER_TIME          0x4U    // Job time from creation to completion exceeds allowed maximum for task. YES&lt;br /&gt;
#define  STATUS_JOB_INTERVAL_SHORT     0x8U    // Minimum time between job creations is less than the allowed minimum for task&lt;br /&gt;
#define  STATUS_READYQ_FULL           0x10U    // Ready queue unable to accept job as result of being full&lt;br /&gt;
#define  STATUS_READYQ_NO_REMOVE      0x20U    // Remove job from ready queue failed&lt;br /&gt;
&lt;br /&gt;
/* Mutex related problems */&lt;br /&gt;
#define  STATUS_MUTEX_ALREADY_HELD    0x40U    // Mutex wait() when mutex already held&lt;br /&gt;
#define  STATUS_MUTEX_NOT_HELD        0x80U    // Mutex signal() when not already held&lt;br /&gt;
#define  STATUS_MUTEX_NOT_RETURNED   0x100U    // Mutex not returned before job terminates&lt;br /&gt;
#define  STATUS_MUTEX_NOT_NESTED     0x200U    // Use of multiple mutexes not nested&lt;br /&gt;
&lt;br /&gt;
/* Counting semaphore and data queue related problems */&lt;br /&gt;
#define  STATUS_SEMAPHORE_JOBS_FULL  0x400U    // Attempt to add job to semaphore pending list when list full&lt;br /&gt;
#define  STATUS_DATAQ_JOBS_FULL      0x800U    // Attempt to add job to data queue pending list when list full&lt;br /&gt;
#define  STATUS_DATAQ_FULL          0x1000U    // Data queue write when queue already full&lt;br /&gt;
&lt;br /&gt;
/* Timed actions related problems */&lt;br /&gt;
#define  STATUS_TIMED_JOBS_FULL     0x2000U    // Timed actions queue already full for timed task start&lt;br /&gt;
#define  STATUS_TIMED_OUTPUT_FULL   0x4000U    // Timed actions queue already full for timed output&lt;br /&gt;
#define  STATUS_TIMED_ACTION_LATE   0x8000U    // Timed action late                          YES&lt;br /&gt;
&lt;br /&gt;
/* Default trap handler should have been replaced&lt;br /&gt;
 * NOT USED AT THE MOMENT*/&lt;br /&gt;
#define  STATUS_SYSTEM_ERROR       0x10000U    // ERROR was handled by default trap handler  YES&lt;br /&gt;
&lt;br /&gt;
/* Flag to indicate problem with Stack Pointer&lt;br /&gt;
 * NOT USED AT THE MOMENT*/&lt;br /&gt;
#define  STATUS_SP_WARNING         0x20000U    // SP not in expected range&lt;br /&gt;
/* Log system error */&lt;br /&gt;
#define  STATUS_BAD_LOG            0x40000U    // System log problem&lt;br /&gt;
#define  STATUS_SPIN_FAILED        0x80000U    // Get SPIN lock failed&lt;br /&gt;
/* Not using next few bits */&lt;br /&gt;
&lt;br /&gt;
/* Will have to exit */&lt;br /&gt;
#define  STATUS_BAD_SENTINEL     0x40000000U    // Area sentinel corrupt&lt;br /&gt;
#define  STATUS_BAD_META_PTR     0x80000000U    // Null meta pointer&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_system_state_get()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''system_log.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns of the system state variable.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Returns the value of the system state variable&lt;br /&gt;
 *&lt;br /&gt;
 * @param state  pointer to state holder&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_LOG_DATA_PTR_BAD        Data holder pointer is null&lt;br /&gt;
 *          ERR_SYS_LOG_CORRUPT         LOG dynamic pointer is null&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_system_state_get(&lt;br /&gt;
    U32_t *state // pointer to state holder&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| state || U32_t pointer to state holder&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit  !! Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_LOG_DATA_PTR_BAD        || Data holder pointer is null&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_LOG_CORRUPT         || LOG dynamic pointer is null&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, state;&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
// Get the system state&lt;br /&gt;
status = oceos_system_state_get(&amp;amp;state);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_system_state_set()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''system_log.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function sets system state variable.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Sets system state variable&lt;br /&gt;
 *&lt;br /&gt;
 * @param new_state&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_LOG_CORRUPT         LOG dynamic pointer is null&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_system_state_set(&lt;br /&gt;
    U32_t new_state   // new value of system state variable&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| new_state || U32_t containing new system state&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit  !! Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_LOG_CORRUPT         || LOG dynamic pointer is null&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, new_state;&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
// Set new system state&lt;br /&gt;
status = oceos_system_state_set(new_state);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_system_state_copy_get()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''system_log.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the value of the system state copy variable.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Returns the value of the copy of system state variable&lt;br /&gt;
 *&lt;br /&gt;
 * @param state  pointer to state holder&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_LOG_DATA_PTR_BAD        Data holder pointer is null&lt;br /&gt;
 *          ERR_SYS_LOG_CORRUPT         LOG dynamic pointer is null&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_system_state_copy_get(&lt;br /&gt;
    U32_t *state // pointer to state copy holder&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| state || U32_t pointer to state copy holder&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit  !! Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_LOG_DATA_PTR_BAD        || Data holder pointer is null&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_LOG_CORRUPT         || LOG dynamic pointer is null&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, copy_state;&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
// Get the system state copy&lt;br /&gt;
status = oceos_system_state_copy_get(&amp;amp;copy_state);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_system_state_copy_set()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''system_log.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function loads a value to tha system state copy variable.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Sets system state copy variable&lt;br /&gt;
 *&lt;br /&gt;
 * @param new_state&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_LOG_CORRUPT         LOG dynamic pointer is null&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_system_state_copy_set(&lt;br /&gt;
    U32_t new_state   // new value of system state variable&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| new_state || U32_t containing new system state copy&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit  !! Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_LOG_CORRUPT         || LOG dynamic pointer is null&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, new_state;&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
// Set new system state copy&lt;br /&gt;
status = oceos_system_state_copy_set(new_state);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Timing directives ==&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;Introduction&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''SPARC'''&lt;br /&gt;
&lt;br /&gt;
In OCEOS system time is based on two chained 32-bit timers.&lt;br /&gt;
&lt;br /&gt;
No interrupts are involved, the current system time is obtained by reading the two timer counter registers (in an atomic way) and then inverting the&lt;br /&gt;
values since the timers count down.&lt;br /&gt;
&lt;br /&gt;
The scaler associated with the timers is configured based on the system clock frequency to decrement the low order timer every microsecond. This&lt;br /&gt;
decrements the high order timer when it rolls over, every 71.6 minutes approximately. The 64-bit time range is very long, over 584,000 years.&lt;br /&gt;
&lt;br /&gt;
'''ARM Cortex-M'''&lt;br /&gt;
&lt;br /&gt;
In OCEOS for ARM Cortex-M, system time is based on SysTick. The processor has a 24-bit system timer, SysTick, that counts down from the reload value to zero, reloads (wraps to) the value in the LOAD register on the next clock edge, then counts down on subsequent clocks.&lt;br /&gt;
&lt;br /&gt;
Note: When the processor is halted for debugging the counter does not decrement.&lt;br /&gt;
&lt;br /&gt;
OCEOS initializes the timer to be driven from MCK and counting down to zero asserts SysTick exception request.&lt;br /&gt;
OCEOS has 64 bit counter which is increased by 0xFFFFFF value every time timer reloads.&lt;br /&gt;
&lt;br /&gt;
'''RISC-V'''&lt;br /&gt;
&lt;br /&gt;
In OCEOS for RISC-V systems time is based internally on clock cycles.&lt;br /&gt;
The RISC-V processor typically has a 64 bit counter (typically mtime) that  updates automatically on each clock cycle. Each hart typically has its own comparison register (typically mtimecmp) that can be used to interrupt that hart when a certain cycle count has been exceeded.&lt;br /&gt;
If a particular RISC-V implementation provides a more restricted clock cycle count this will be used with appropriate modifications as clock cycles give the best timing precision available.&lt;br /&gt;
&lt;br /&gt;
Note: The application configuration provides the constant needed to allow microseconds (as used in OCEOS directives) be converted to clock cycles. Time is reported by OCEOSmp as the number of microseconds since OCEOS was initialized.&lt;br /&gt;
&lt;br /&gt;
A potential difficulty arises if the main system clock rate can change for power saving or other reasons, each system is probably different with regard to this. OCEOSmp can handle this, if needed.&lt;br /&gt;
&lt;br /&gt;
The units of OCEOS system time are microseconds on SPARC and ARM and on RISC-V the period of the clock cycle.&lt;br /&gt;
&lt;br /&gt;
The system time is reset to 0 by oceos_init()&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_time_sys_get64()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''oceos_timer.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the current system time as a 64-bit number.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
**&lt;br /&gt;
 * Get the current system time (64-bit)&lt;br /&gt;
 *&lt;br /&gt;
 * @return U64_t&lt;br /&gt;
 */&lt;br /&gt;
U64_t oceos_time_sys_get64(void);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There are no parameters to this function.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S64_t with the current system time.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S64_t now;&lt;br /&gt;
...&lt;br /&gt;
// Get the time&lt;br /&gt;
now = oceos_time_sys_get64();&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_time_sys_get32()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''oceos_timer.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the low 32 bits of the system time.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Get the current system time (low 32 bits of 64 bit value)&lt;br /&gt;
 *&lt;br /&gt;
 * @return U32_t&lt;br /&gt;
 */&lt;br /&gt;
U32_t oceos_time_sys_get32(void);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
There are no parameters to this function.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with the current system time.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t now;&lt;br /&gt;
...&lt;br /&gt;
// Get the time&lt;br /&gt;
now = oceos_time_sys_get32();&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:backup]]&lt;/div&gt;</summary>
		<author><name>Bkavanagh</name></author>
	</entry>
	<entry>
		<id>https://wiki.ocetechnology.com/mediawiki/index.php?title=OCEOSmp/directive_reference&amp;diff=1715</id>
		<title>OCEOSmp/directive reference</title>
		<link rel="alternate" type="text/html" href="https://wiki.ocetechnology.com/mediawiki/index.php?title=OCEOSmp/directive_reference&amp;diff=1715"/>
		<updated>2024-06-24T13:21:00Z</updated>

		<summary type="html">&lt;p&gt;Bkavanagh: /* Timed Actions */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Introduction =&lt;br /&gt;
&lt;br /&gt;
To be added&lt;br /&gt;
&lt;br /&gt;
= Directives =&lt;br /&gt;
&lt;br /&gt;
== Initialisation directives ==&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_init()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''initialisation.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Initialises OCEOS and  must be the first directive used.&lt;br /&gt;
&lt;br /&gt;
Initialises the OCEOS system meta data using the information supplied in the application configuration and prepares for creation of tasks etc.&lt;br /&gt;
&lt;br /&gt;
The values provided in the application configuration are checked as much as possible before being used.&lt;br /&gt;
&lt;br /&gt;
The system log also is created here.&lt;br /&gt;
&lt;br /&gt;
This function sets up sysMetaPtr and init_meta_ptr and must have completed successfully before tasks etc. can be created.&lt;br /&gt;
&lt;br /&gt;
It disables interrupts and leaves them disabled, they will be re-enabled to the previous level after all tasks etc. have been created and [[OCEOSmp/directive_reference#oceos_init_finish()|oceos_init_finish()]] has completed successfully.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Initialises OCEOS and  must be the first directive used.&lt;br /&gt;
 *&lt;br /&gt;
 * Initialises the OCEOS system meta data using the information supplied in&lt;br /&gt;
 * the application configuration and prepares for creation of tasks etc.&lt;br /&gt;
 *&lt;br /&gt;
 * The values provided in the application configuration are checked as much&lt;br /&gt;
 * as possible before being used.&lt;br /&gt;
 *&lt;br /&gt;
 * The system log also is created here.&lt;br /&gt;
 *&lt;br /&gt;
 * This function sets up sysMetaPtr and init_meta_ptr and must have completed&lt;br /&gt;
 * successfully before tasks etc. can be created.&lt;br /&gt;
 *&lt;br /&gt;
 * It disables interrupts and leaves them disabled, they will be re-enabled to&lt;br /&gt;
 * the previous level after all tasks etc. have been created and&lt;br /&gt;
 * oceos_init_finish() has completed successfully.&lt;br /&gt;
 *&lt;br /&gt;
 * @param app_config Pointer to configuration struct&lt;br /&gt;
 * @return SUCCESSFUL                        All OK&lt;br /&gt;
 *         WARN_LOG_SIZE_DEFAULT             Warning, log size is set to default value of 64 entries&lt;br /&gt;
 *         WARN_NO_ERROR_FUNCTION            Warning, user defined function for ERROR handling is not provided&lt;br /&gt;
 *         ERR_CPU_FIRST_CORE_INVALID        Start CPU not in a range of available cores for this target; or greater than end CPU&lt;br /&gt;
 *         ERR_CPU_LAST_CORE_INVALID         Last CPU not in a range of available cores for this target&lt;br /&gt;
 *         ERR_NOT_START_CPU_CORE            Executing oceos_init on wrong CPU&lt;br /&gt;
 *         ERR_STACK_START_MISALIGNED        Stack start address is not set by user misaligned&lt;br /&gt;
 *         ERR_STACK_PER_CORE_INVALID        Stack per CPU size is zero, or not 8byte aligned, or less then min require&lt;br /&gt;
 *         ERR_LOG_ADDR_MISALIGNED           Log start address is not 8 byte aligned&lt;br /&gt;
 *         ERR_FIX_ADDR_MISALIGNED           Fixed area start address is not 8 byte aligned&lt;br /&gt;
 *         ERR_DYN_ADDR_MISALIGNED           Dynamic area start address is not 8 byte aligned&lt;br /&gt;
 *         ERR_CPU_CORE_RANGE_WRONG          CPU cores in use exceed available CPUs on the SoC&lt;br /&gt;
 *         ERR_STACK_SPACE_WRONG             Current CPU SP is not within user provided stack range&lt;br /&gt;
 *         ERR_LOG_SIZE_INVALID              Log size outside expected range&lt;br /&gt;
 *         ERR_CS_LOG_SIZE_INVALID           Context switch log size invalid&lt;br /&gt;
 *         ERR_TASK_NUMBER_INVALID           Number of tasks invalid&lt;br /&gt;
 *         ERR_MUTEX_NUMBER_INVALID          Number of mutexes invalid&lt;br /&gt;
 *         ERR_RWMUTEX_NUMBER_INVALID        Number of rwmutexes invalid&lt;br /&gt;
 *         ERR_SEM_NUMBER_INVALID            Number of semaphores invalid&lt;br /&gt;
 *         ERR_DATAQ_NUMBER_INVALID          Number of datqs invalid&lt;br /&gt;
 *         ERR_TIMED_ACTIONS_NUMBER_INVALID  Number of timed actions invalid&lt;br /&gt;
 *         ERR_OVERLAP_STACK                 Overlap stack end address with (two overlap areas are set)&lt;br /&gt;
 *         ERR_OVERLAP_LOG                   Overlap log with (two overlap areas are set)&lt;br /&gt;
 *         ERR_OVERLAP_FIXED                 Overlap fixed area with (two overlap areas are set)&lt;br /&gt;
 *         ERR_OVERLAP_DYNAMIC               Overlap dynamic area with (two overlap areas are set)&lt;br /&gt;
 *         ERR_FIXED_MEMORY_FAILED           Fixed area memory write fail&lt;br /&gt;
 *         ERR_DYNAMIC_MEMORY_FAILED         Dynamic area memory write fail&lt;br /&gt;
 *         ERR_TIMER_ADDR_INVALID            Timer address not provided by user (null). SPARC only&lt;br /&gt;
 *         ERR_SYS_TIMER_INDEX_INVALID       System timer index of subtimer invalid; SPARC only; Subtimers start from index 1; Need index of subtimer plus one in front&lt;br /&gt;
 *         ERR_PERIPHERAL_CLOCK_INVALID      System peripheral code invalid&lt;br /&gt;
 *&lt;br /&gt;
 */&lt;br /&gt;
S32_t   oceos_init(&lt;br /&gt;
    const struct application_configuration app_config&lt;br /&gt;
);&lt;br /&gt;
 &amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| app_config || Pointer to configuration struct.  struct application_configuration defined in '''''basic_structs.h'''''&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| WARN_LOG_SIZE_DEFAULT             || Warning, log size is set to default value of 64 entries&lt;br /&gt;
|-&lt;br /&gt;
| WARN_NO_ERROR_FUNCTION            || Warning, user defined function for ERROR handling is not provided&lt;br /&gt;
|-&lt;br /&gt;
| ERR_CPU_FIRST_CORE_INVALID        || Start CPU not in a range of available cores for this target; or greater than end CPU&lt;br /&gt;
|-&lt;br /&gt;
| ERR_CPU_LAST_CORE_INVALID         || Last CPU not in a range of available cores for this target&lt;br /&gt;
|-&lt;br /&gt;
| ERR_NOT_START_CPU_CORE            || Executing oceos_init on wrong CPU&lt;br /&gt;
|-&lt;br /&gt;
| ERR_STACK_START_MISALIGNED        || Stack start address is not set by user misaligned&lt;br /&gt;
|-&lt;br /&gt;
| ERR_STACK_PER_CORE_INVALID        || Stack per CPU size is zero, or not 8byte aligned, or less then min require&lt;br /&gt;
|-&lt;br /&gt;
| ERR_LOG_ADDR_MISALIGNED           || Log start address is not 8 byte aligned&lt;br /&gt;
|-&lt;br /&gt;
| ERR_FIX_ADDR_MISALIGNED           || Fixed area start address is not 8 byte aligned&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DYN_ADDR_MISALIGNED           || Dynamic area start address is not 8 byte aligned&lt;br /&gt;
|-&lt;br /&gt;
| ERR_CPU_CORE_RANGE_WRONG          || CPU cores in use exceed available CPUs on the SoC&lt;br /&gt;
|-&lt;br /&gt;
| ERR_STACK_SPACE_WRONG             || Current CPU SP is not within user provided stack range&lt;br /&gt;
|-&lt;br /&gt;
| ERR_LOG_SIZE_INVALID              || Log size outside expected range&lt;br /&gt;
|-&lt;br /&gt;
| ERR_CS_LOG_SIZE_INVALID           || Context switch log size invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TASK_NUMBER_INVALID           || Number of tasks invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_MUTEX_NUMBER_INVALID          || Number of mutexes invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_RWMUTEX_NUMBER_INVALID        || Number of rwmutexes invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SEM_NUMBER_INVALID            || Number of semaphores invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DATAQ_NUMBER_INVALID          || Number of datqs invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TIMED_ACTIONS_NUMBER_INVALID  || Number of timed actions invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_OVERLAP_STACK                 || Overlap stack end address with (two overlap areas are set)&lt;br /&gt;
|-&lt;br /&gt;
| ERR_OVERLAP_LOG                   || Overlap log with (two overlap areas are set)&lt;br /&gt;
|-&lt;br /&gt;
| ERR_OVERLAP_FIXED                 || Overlap fixed area with (two overlap areas are set)&lt;br /&gt;
|-&lt;br /&gt;
| ERR_OVERLAP_DYNAMIC               || Overlap dynamic area with (two overlap areas are set)&lt;br /&gt;
|-&lt;br /&gt;
| ERR_FIXED_MEMORY_FAILED           || Fixed area memory write fail&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DYNAMIC_MEMORY_FAILED         || Dynamic area memory write fail&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TIMER_ADDR_INVALID            || Timer address not provided by user (null). SPARC only&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_TIMER_INDEX_INVALID       || System timer index of subtimer invalid; SPARC only; Subtimers start from index 1; Need index of subtimer plus one in front&lt;br /&gt;
|-&lt;br /&gt;
| ERR_PERIPHERAL_CLOCK_INVALID      || System peripheral code invalid&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
    /*&lt;br /&gt;
     * Create the application configuration structure&lt;br /&gt;
     */&lt;br /&gt;
    struct application_configuration           app_config = {0};&lt;br /&gt;
&lt;br /&gt;
    /*&lt;br /&gt;
     * Fill in the application parameters&lt;br /&gt;
     */&lt;br /&gt;
    app_config.log_address                   = (log_t)log_data;              // required&lt;br /&gt;
    app_config.fixed_data_address            = (adrs_t)fixed_data;            // required&lt;br /&gt;
    app_config.dynamic_data_address          = (adrs_t)dynamic_data;          // required&lt;br /&gt;
&lt;br /&gt;
    app_config.stack_start_address           = start_stack_array[OCEOS_START_CPU_INDEX];// OCEOSMP_STACK_START_ADDRESS;&lt;br /&gt;
    app_config.stack_size_per_cpu            = (U32_t)&amp;amp;__oceos_stack_size_per_cpu;  // OCEOSMP_STACK_LOW_BOUND_ADDRESS;&lt;br /&gt;
&lt;br /&gt;
    app_config.system_error_function         = oceosmp_on_error;               // NULL =&amp;gt; ignore&lt;br /&gt;
    app_config.log_full_function             = oceosmp_on_full_log;            // NULL =&amp;gt; ignore&lt;br /&gt;
&lt;br /&gt;
    // used in setting up system log and fixed data array&lt;br /&gt;
    app_config.log_number_of_entries         = NUMBER_OF_LOG_ENTRIES;          // 0 =&amp;gt; use default&lt;br /&gt;
&lt;br /&gt;
    app_config.number_of_tasks               = NUMBER_OF_TASKS;                // &amp;gt;= 1&lt;br /&gt;
&lt;br /&gt;
    app_config.number_of_mutexes             = NUMBER_OF_MUTEXES;&lt;br /&gt;
	app_config.number_of_rwmutexes			 = NUMBER_OF_RWMUTEXES;&lt;br /&gt;
    app_config.number_of_counting_semaphores = NUMBER_OF_SEMAPHORES;&lt;br /&gt;
    app_config.number_of_data_queues         = NUMBER_OF_DATAQS;&lt;br /&gt;
&lt;br /&gt;
    /**&lt;br /&gt;
     * FOR SPARC TARGET ONLY.&lt;br /&gt;
     */&lt;br /&gt;
    app_config.sys_time_timer_index          = SYS_TIME_TIMER_INDEX;           // 0 =&amp;gt; invalid index&lt;br /&gt;
    /**&lt;br /&gt;
     * FOR SPARC TARGET ONLY.&lt;br /&gt;
     * Not Used for ARM. Always Nested&lt;br /&gt;
     */&lt;br /&gt;
    app_config.interrupt_nesting_enabled     = TRUE;                           // TRUE =&amp;gt; single vector&lt;br /&gt;
    app_config.oceos_cpu_switch_int_number   = OCEOS_CPU_INTER_COM_INT_NUMBER; // User should provide SGI ID (0-15)&lt;br /&gt;
&lt;br /&gt;
    app_config.timed_actions_queue_size      = NUMBER_OF_ACTION_ENTRIES;&lt;br /&gt;
    app_config.CS_log_entries_base2          = CS_LOG_DEF_ENTRIES_BASE2;&lt;br /&gt;
    /**&lt;br /&gt;
     * Set starting index of CPU that will be used by OCEOSMP&lt;br /&gt;
     */&lt;br /&gt;
    app_config.oceos_cpu_start_index         = OCEOS_START_CPU_INDEX;&lt;br /&gt;
    /**&lt;br /&gt;
     * Set last index of CPU that will be used by OCEOSMP&lt;br /&gt;
     */&lt;br /&gt;
    app_config.oceos_cpu_last_index          = OCEOS_LAST_CPU_INDEX;&lt;br /&gt;
    /*&lt;br /&gt;
     * Set system/peripheral clock used to initialise system timer&lt;br /&gt;
     */&lt;br /&gt;
    app_config.soc_peripheral_clck           = BSP_SYSFREQ * 1000 * 1000;&lt;br /&gt;
&lt;br /&gt;
    // initialise OCEOSMP&lt;br /&gt;
    S32_t status;&lt;br /&gt;
    status = oceos_init(app_config);&lt;br /&gt;
    if (OCEOS_SUCCESS &amp;gt; status) {&lt;br /&gt;
      oceosmp_print(&amp;quot;\n oceos_init failure\n\r&amp;quot;);&lt;br /&gt;
      return 0;&lt;br /&gt;
    } else {&lt;br /&gt;
      return 1;&lt;br /&gt;
    }   // else&lt;br /&gt;
 &amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_init_finish()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''initialisation.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Finalizes the fixed data array after all tasks etc. have been created&lt;br /&gt;
&lt;br /&gt;
All information needed to start OCEOS can be found in the fixed data area&lt;br /&gt;
when oceos_init_finish() has completed.&lt;br /&gt;
&lt;br /&gt;
Once all tasks etc. have been created oceos_init_finish() checks the&lt;br /&gt;
accumulated information against the application configuration data&lt;br /&gt;
stored in the fixed meta structure.&lt;br /&gt;
&lt;br /&gt;
oceos_init_finish also calculates the size of the dynamic data area and&lt;br /&gt;
checks it does not overlap with the system stack, the system log, or the&lt;br /&gt;
fixed data, and if all ok sets up pointers to the various dynamic area&lt;br /&gt;
components in the fixed data.&lt;br /&gt;
&lt;br /&gt;
It then adds an XOR checksum to the fixed data area, and checks that this&lt;br /&gt;
is followed by FILLER, which it replaces with the end sentinel.&lt;br /&gt;
&lt;br /&gt;
On successful completion it restores the interrupt level to its value&lt;br /&gt;
before oceos_init() was called, otherwise interrupts remain disabled.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Finalizes the fixed data array after all tasks etc. have been created&lt;br /&gt;
 *&lt;br /&gt;
 * All information needed to start OCEOS can be found in the fixed data area&lt;br /&gt;
 * when oceos_init_finish() has completed.&lt;br /&gt;
 *&lt;br /&gt;
 * Once all tasks etc. have been created oceos_init_finish() checks the&lt;br /&gt;
 * accumulated information against the application configuration data&lt;br /&gt;
 * stored in the fixed meta structure.&lt;br /&gt;
 *&lt;br /&gt;
 * oceos_init_finish also calculates the size of the dynamic data area and&lt;br /&gt;
 * checks it does not overlap with the system stack, the system log, or the&lt;br /&gt;
 * fixed data, and if all ok sets up pointers to the various dynamic area&lt;br /&gt;
 * components in the fixed data.&lt;br /&gt;
 *&lt;br /&gt;
 * It then adds an XOR checksum to the fixed data area, and checks that this&lt;br /&gt;
 * is followed by FILLER, which it replaces with the end sentinel.&lt;br /&gt;
 *&lt;br /&gt;
 * On successful completion it restores the interrupt level to its value&lt;br /&gt;
 * before oceos_init() was called, otherwise interrupts remain disabled.&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS                             All OK&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT               System Meta data is NULL or corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT                 System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_CPU_CORE                  Executing directive on wrong CPU&lt;br /&gt;
 *          ERR_WRONG_PHASE                     Called before oceos_init()&lt;br /&gt;
 *          ERR_TASKS_INCOMPLETE                Created wrong number of tasks&lt;br /&gt;
 *          ERR_MUTEX_INCOMPLETE                Created wrong number of mutexes&lt;br /&gt;
 *          ERR_RWMUTEX_INCOMPLETE              Created wrong number of rwmutexes&lt;br /&gt;
 *          ERR_SEM_INCOMPLETE                  Created wrong number of semaphores&lt;br /&gt;
 *          ERR_DATAQ_INCOMPLETE                Created wrong number of dataqs&lt;br /&gt;
 *          ERR_TASK_MAX_ID_INVALID             Task's max id invalid&lt;br /&gt;
 *          ERR_MUTEX_MAX_ID_INVALID            Mutexe's max id invalid&lt;br /&gt;
 *          ERR_RWMUTEX_MAX_ID_INVALID          Rwmutexe's max id invalid&lt;br /&gt;
 *          ERR_SEM_MAX_ID_INVALID              Semaphore's max id invalid&lt;br /&gt;
 *          ERR_DATAQ_MAX_ID_INVALID            Dataq's max id invalid&lt;br /&gt;
 *          ERR_TOTAL_JOBS_NUMBER_WRONG         Wrong number of total jobs created&lt;br /&gt;
 *          ERR_ORDER_ARRAY_PTR_INVALID         Order array pointer is NULL or mis-aligned&lt;br /&gt;
 *          ERR_FIXED_AREA_TOO_SMALL            Not enough space for fixed data area&lt;br /&gt;
 */&lt;br /&gt;
S32_t   oceos_init_finish(void);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
There are no input parameters to this function.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit  || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT               || System Meta data is NULL or corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT                 || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_CPU_CORE                  || Executing directive on wrong CPU&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE                     || Called before oceos_init()&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TASKS_INCOMPLETE                || Created wrong number of tasks&lt;br /&gt;
|-&lt;br /&gt;
| ERR_MUTEX_INCOMPLETE                || Created wrong number of mutexes&lt;br /&gt;
|-&lt;br /&gt;
| ERR_RWMUTEX_INCOMPLETE              || Created wrong number of rwmutexes&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SEM_INCOMPLETE                  || Created wrong number of semaphores&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DATAQ_INCOMPLETE                || Created wrong number of dataqs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TASK_MAX_ID_INVALID             || Task's max id invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_MUTEX_MAX_ID_INVALID            || Mutexe's max id invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_RWMUTEX_MAX_ID_INVALID          || Rwmutexe's max id invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SEM_MAX_ID_INVALID              || Semaphore's max id invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DATAQ_MAX_ID_INVALID            || Dataq's max id invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TOTAL_JOBS_NUMBER_WRONG         || Wrong number of total jobs created&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ORDER_ARRAY_PTR_INVALID         || Order array pointer is NULL or mis-aligned&lt;br /&gt;
|-&lt;br /&gt;
| ERR_FIXED_AREA_TOO_SMALL            || Not enough space for fixed data area&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
    /*&lt;br /&gt;
     * Finish initialising OCEOS and setting up the fixed data&lt;br /&gt;
     */&lt;br /&gt;
    status = oceos_init_finish();&lt;br /&gt;
    if(OCEOS_SUCCESS &amp;gt; status){&lt;br /&gt;
        // LOG&lt;br /&gt;
      oceosmp_print(&amp;quot;\nAbandoning, problem ending OCEOS initialisation\n\r&amp;quot;);&lt;br /&gt;
        return -1;&lt;br /&gt;
    }   // if&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_start()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''initialisation.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Starts OCEOS scheduling.&amp;lt;br&amp;gt;&lt;br /&gt;
Create dynamic OCEOS structures and start scheduling.&amp;lt;br&amp;gt;&lt;br /&gt;
This function should only be called once and only after [[OCEOSmp/directive_reference#oceos_init()|oceos_init()]] and [[OCEOSmp/directive_reference#oceos_init_finish()|oceos_init_finish()]] have been called successfully.&amp;lt;br&amp;gt;&lt;br /&gt;
Normally this function does not return. &amp;lt;br&amp;gt;&lt;br /&gt;
If a problem is detected the function terminates and returns an appropriate DIRECTIVE_STATUS code, with interrupts disabled.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Starts OCEOS scheduling&lt;br /&gt;
 *&lt;br /&gt;
 * Create dynamic OCEOS structures and start scheduling&lt;br /&gt;
 *&lt;br /&gt;
 * This function should only be called once&lt;br /&gt;
 * and only after oceos_init()&lt;br /&gt;
 * and oceos_init_finish() have&lt;br /&gt;
 *  been called successfully.&lt;br /&gt;
 * Normally this function does not return.&lt;br /&gt;
 * If a problem is detected the function&lt;br /&gt;
 * terminates and returns an appropriate&lt;br /&gt;
 * DIRECTIVE_STATUS code, with interrupts disabled.&lt;br /&gt;
 *&lt;br /&gt;
 * @param fixed_array_ptr   Pointer to fixed data array&lt;br /&gt;
 * @param start_task        Task ID&lt;br /&gt;
 * @param data_ptr          Pointer to data to be passed to the task&lt;br /&gt;
 * @return  OCEOSMP_EXIT                        OCEOSMP return from scheduling and exit&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT               Fixed area pointer is null or bad sentinel&lt;br /&gt;
 *          ERR_FIXED_AREA_SIZE_WRONG           Fixed area size is zero&lt;br /&gt;
 *          ERR_FIXED_AREA_END_SENTINEL_BAD     Fixed data end sentinel corrupt&lt;br /&gt;
 *          ERR_FIXED_AREA_BAD_XOR              Fixed area bad checksum or checksum mis-match&lt;br /&gt;
 *          ERR_INIT_NOT_DONE                   oceos_start() called without initialisation&lt;br /&gt;
 *          ERR_DYN_AREA_PTR_BAD                Dynamic area pointer invalid in sysMetaPtr&lt;br /&gt;
 *          ERR_INT_HANDLER_BAD                 IRQ controller pointer provided by BCC is NULL;or OCEOS handler is not set&lt;br /&gt;
 *          ERR_DYN_JOB_PTR_BAD                 Job array pointer is NULL&lt;br /&gt;
 *          ERR_FIXED_TASK_PTR_BAD              Tasks array pointer is NULL&lt;br /&gt;
 *          ERR_JOB_COUNT_WRONG                 Total job count inconsistent&lt;br /&gt;
 *          ERR_DYN_MUTEX_PTR_BAD               Mutex dynamic pointer is NULL&lt;br /&gt;
 *          ERR_DYN_LOCK_PTR_BAD                Mutex lock array pointer is NULL&lt;br /&gt;
 *          ERR_DYN_RWMUTEX_PTR_BAD             Rwmutex dynamic pointer is NULL&lt;br /&gt;
 *          ERR_DYN_RWLOCK_PTR_BAD              Rwmutex lock array pointer is NULL&lt;br /&gt;
 *          ERR_FIXED_SEM_PTR_BAD               Semaphore fixed pointer is NULL&lt;br /&gt;
 *          ERR_DYN_SEM_PTR_BAD                 Semaphore dynamic pointer is NULL&lt;br /&gt;
 *          ERR_SEM_PEND_PTR_BAD                Semaphore pending queue pointer is NULL&lt;br /&gt;
 *          ERR_FIXED_DATAQ_PTR_BAD             Dataq fixed pointer is NULL&lt;br /&gt;
 *          ERR_DYN_DATAQ_PTR_BAD               Dataq dynamic pointer is NULL&lt;br /&gt;
 *          ERR_DATAQ_PEND_PTR_BAD              Dataq pending queue pointer is NULL&lt;br /&gt;
 *          ERR_DATAQ_DATA_PTR_BAD              Dataq data pointer is NULL&lt;br /&gt;
 *          ERR_CPU_INT_NUMBER_INVALID          SPARC only.IRQ number for CPU inter-comunication invalid(zero or used by timer)&lt;br /&gt;
 *          ERR_REGISTER_CPU_IRQ_FAILED         SPARC only. Failed to set CPU IRQ handler in BCC&lt;br /&gt;
 *          ERR_CPU_STACK_INVALID               Current CPU stack not within specified range&lt;br /&gt;
 *          ERR_CPU_PRIORITY_STACK_INVALID      Per CPU priority stack invalid&lt;br /&gt;
 *          ERR_LOG_AREA_END_SENTINEL_BAD       Log area end sentinel override&lt;br /&gt;
 *          ERR_TA_CONFIG_PTR_BAD               SPARC only; Timed action configuration data pointer is NULL&lt;br /&gt;
 *          ERR_TA_TIMER_INDEX_INVALID          SPARC only; Timed action sub-timer index in timer unit is invalid&lt;br /&gt;
 *          ERR_TA_IRQ_NUMBER_INVALID           SPARC only; Timer action timer IRQ number is invalid&lt;br /&gt;
 *          ERR_TA_BCC_IRQ_REGISTER_FAILED      SPARC only; Timed action timer IRQ handler failed to register&lt;br /&gt;
 */&lt;br /&gt;
S32_t   oceos_start(&lt;br /&gt;
    const U32_t * const fixed_array_ptr,// pointer to fixed data array&lt;br /&gt;
    const U32_t start_task,             // taskID&lt;br /&gt;
    void * const data_ptr               // pointer to data to be passed to task&lt;br /&gt;
);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| fixed_array_ptr || Pointer to fixed data array&lt;br /&gt;
|-&lt;br /&gt;
| start_task      || Task ID&lt;br /&gt;
|-&lt;br /&gt;
| data_ptr        || Pointer to data to be passed to the task&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit  || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT               || Fixed area pointer is null or bad sentinel&lt;br /&gt;
|-&lt;br /&gt;
| ERR_FIXED_AREA_SIZE_WRONG           || Fixed area size is zero&lt;br /&gt;
|-&lt;br /&gt;
| ERR_FIXED_AREA_END_SENTINEL_BAD     || Fixed data end sentinel corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_FIXED_AREA_BAD_XOR              || Fixed area bad checksum or checksum mis-match&lt;br /&gt;
|-&lt;br /&gt;
| ERR_INIT_NOT_DONE                   || oceos_start() called without initialisation&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DYN_AREA_PTR_BAD                || Dynamic area pointer invalid in sysMetaPtr&lt;br /&gt;
|-&lt;br /&gt;
| ERR_INT_HANDLER_BAD                 || IRQ controller pointer provided by BCC is NULL;or OCEOS handler is not set&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DYN_JOB_PTR_BAD                 || Job array pointer is NULL&lt;br /&gt;
|-&lt;br /&gt;
| ERR_FIXED_TASK_PTR_BAD              || Tasks array pointer is NULL&lt;br /&gt;
|-&lt;br /&gt;
| ERR_JOB_COUNT_WRONG                 || Total job count inconsistent&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DYN_MUTEX_PTR_BAD               || Mutex dynamic pointer is NULL&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DYN_LOCK_PTR_BAD                || Mutex lock array pointer is NULL&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DYN_RWMUTEX_PTR_BAD             || Rwmutex dynamic pointer is NULL&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DYN_RWLOCK_PTR_BAD              || Rwmutex lock array pointer is NULL&lt;br /&gt;
|-&lt;br /&gt;
| ERR_FIXED_SEM_PTR_BAD               || Semaphore fixed pointer is NULL&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DYN_SEM_PTR_BAD                 || Semaphore dynamic pointer is NULL&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SEM_PEND_PTR_BAD                || Semaphore pending queue pointer is NULL&lt;br /&gt;
|-&lt;br /&gt;
| ERR_FIXED_DATAQ_PTR_BAD             || Dataq fixed pointer is NULL&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DYN_DATAQ_PTR_BAD               || Dataq dynamic pointer is NULL&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DATAQ_PEND_PTR_BAD              || Dataq pending queue pointer is NULL&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DATAQ_DATA_PTR_BAD              || Dataq data pointer is NULL&lt;br /&gt;
|-&lt;br /&gt;
| ERR_CPU_INT_NUMBER_INVALID          || SPARC only.IRQ number for CPU inter-comunication invalid(zero or used by timer)&lt;br /&gt;
|-&lt;br /&gt;
| ERR_REGISTER_CPU_IRQ_FAILED         || SPARC only. Failed to set CPU IRQ handler in BCC&lt;br /&gt;
|-&lt;br /&gt;
| ERR_CPU_STACK_INVALID               || Current CPU stack not within specified range&lt;br /&gt;
|-&lt;br /&gt;
| ERR_CPU_PRIORITY_STACK_INVALID      || Per CPU priority stack invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_LOG_AREA_END_SENTINEL_BAD       || Log area end sentinel override&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_CONFIG_PTR_BAD               || SPARC only; Timed action configuration data pointer is NULL&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_TIMER_INDEX_INVALID          || SPARC only; Timed action sub-timer index in timer unit is invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_IRQ_NUMBER_INVALID           || SPARC only; Timer action timer IRQ number is invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_BCC_IRQ_REGISTER_FAILED      || SPARC only; Timed action timer IRQ handler failed to register&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/* Sample Task names - all here start with t_ to help avoid name confusion */&lt;br /&gt;
enum TASK_NAME{&lt;br /&gt;
    t_tom,                      // will have task ID 0&lt;br /&gt;
    t_dick,                     // will have task ID 1&lt;br /&gt;
};&lt;br /&gt;
extern U32_t fixed_data[];&lt;br /&gt;
...&lt;br /&gt;
S32_t status;&lt;br /&gt;
&lt;br /&gt;
status = oceos_start(fixed_data, t_tom, NULL);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_exit()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''initialisation.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Ends scheduling and exit from [[OCEOSmp/directive_reference#oceos_start()|oceos_start()]].&lt;br /&gt;
No task can be started after this.&amp;lt;br&amp;gt;&lt;br /&gt;
OCEOS will exit when the current job ends.&amp;lt;br&amp;gt;&lt;br /&gt;
An idle task in an endless loop should check that scheduling is enabled.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Ends scheduling and exit from oceos_start.&lt;br /&gt;
 * No task can be started after this.&lt;br /&gt;
 * OCEOS will exit when the current job ends.&lt;br /&gt;
 * An idle task in an endless loop should check that scheduling is enabled.&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Called before scheduling started&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_exit(void);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
There are no input parameters to this function.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit  || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Called before scheduling started&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
// Exit OCEOS&lt;br /&gt;
oceos_exit();&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_CPU_sleep()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''initialisation.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
 Puts CPU in sleep mode.&amp;lt;br&amp;gt;&lt;br /&gt;
 User must to be sure that interrupts are enabled.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Puts CPU in sleep mode.&lt;br /&gt;
 * User must to be sure that interrupts are enabled.&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_CPU_sleep(void);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
There are no input parameters to this function.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
// Put CPU to sleep&lt;br /&gt;
oceos_CPU_sleep();&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceosmp_cpu_disable()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''initialisation.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function ends execution of all tasks running on particular CPU and removes the CPU from scheduling.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Ends execution of all tasks running on particular CPU and removes this CPU from scheduling.&lt;br /&gt;
 * @param cpu_id&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              CPU ID outside allowed range 0 to 254&lt;br /&gt;
 *          ERR_ID_WRONG                CPU ID &amp;gt;= number of available CPUs&lt;br /&gt;
 *          ERR_CPU_ALREADY_DISABLED    CPU already disabled&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceosmp_cpu_disable(&lt;br /&gt;
    U32_t cpu_id&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| cpu_id || ID of CPU core to be disabled.&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit  || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || CPU ID outside allowed range 0 to 254&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || CPU ID &amp;gt;= number of available CPUs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_CPU_ALREADY_DISABLED    || CPU already disabled&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, faulty_cpu;&lt;br /&gt;
...&lt;br /&gt;
// Disable faulty CPU core&lt;br /&gt;
status = oceosmp_cpu_disable(faulty_cpu));&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceosmp_cpu_enable()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''initialisation.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function adds a disabled CPU core to the OCEOSmp scheduler. It should only be called after scheduling has started&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 *  Adds disabled CPU to OCEOSmp scheduler&lt;br /&gt;
 *&lt;br /&gt;
 *  N.B. This function should only be called after scheduling has started&lt;br /&gt;
 *&lt;br /&gt;
 * @param cpu_id&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              CPU ID outside allowed range 0 to 254&lt;br /&gt;
 *          ERR_ID_WRONG                CPU ID &amp;gt;= number of available CPUs; or the same as currently running&lt;br /&gt;
 *          ERR_CPU_ALREADY_ENABLED     CPU already enabled&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceosmp_cpu_enable(&lt;br /&gt;
    U32_t cpu_id&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| cpu_id || ID of CPU core to be enabled.&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit  || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || CPU ID outside allowed range 0 to 254&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || CPU ID &amp;gt;= number of available CPUs; or the same as currently running&lt;br /&gt;
|-&lt;br /&gt;
| ERR_CPU_ALREADY_ENABLED     || CPU already enabled&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, good_cpu;&lt;br /&gt;
...&lt;br /&gt;
// Enable CPU core&lt;br /&gt;
status = oceosmp_cpu_enable(good_cpu));&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceosmp_cpu_terminate()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''initialisation.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function removes a CPU core from the OCEOSmp scheduler and marks it so it cannot be restarted. It puts CPU to sleep with interrupts disabled. It should only be called after scheduling has started.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 *  Removes CPU from OCEOSMP scheduler and terminates, cannot be restarted.&lt;br /&gt;
 *  Puts CPU to sleep with interrupts disabled&lt;br /&gt;
 *&lt;br /&gt;
 *  N.B. This function should only be called after scheduling has started&lt;br /&gt;
 *  Steps:&lt;br /&gt;
 *     1. Set terminate flag on this CPU;&lt;br /&gt;
 *     2. Trigger software interrupt to transfer execution to IRQ handler;&lt;br /&gt;
 *     3. Check flag and if set =&amp;gt; put CPU to sleep in while loop with interrupts disabled;&lt;br /&gt;
 *     4. Set MAX priority on this CPU priority stack;&lt;br /&gt;
 *     5. Remove CPU from scheduling;&lt;br /&gt;
 *     6. Clean up all the tasks by calling task terminate function and free up all the&lt;br /&gt;
 *        preempted jobs by this CPU;&lt;br /&gt;
 *&lt;br /&gt;
 * @param cpu_id&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              CPU ID outside allowed range 0 to 254&lt;br /&gt;
 *          ERR_ID_WRONG                CPU ID &amp;gt;= number of available CPUs; or the same as currently running&lt;br /&gt;
 *          ERR_CPU_ALREADY_TERMINATED  CPU already terminated&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceosmp_cpu_terminate(&lt;br /&gt;
    U32_t cpu_id&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| cpu_id || ID of CPU core to be terminated.&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit  || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || CPU ID outside allowed range 0 to 254&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || CPU ID &amp;gt;= number of available CPUs; or the same as currently running&lt;br /&gt;
|-&lt;br /&gt;
| ERR_CPU_ALREADY_TERMINATED  || CPU already terminated&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, faulty_cpu;&lt;br /&gt;
...&lt;br /&gt;
// Terminate CPU core&lt;br /&gt;
status = oceosmp_cpu_terminate(faulty_cpu));&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;Task directives&amp;lt;/span&amp;gt;==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ API Functions&lt;br /&gt;
|-&lt;br /&gt;
| Directive                                                                     || Description                          || main || task || IRQ handler&lt;br /&gt;
|-&lt;br /&gt;
| [[OCEOSmp/directive reference#oceos_task_create()| oceos_task_create()]]             || Create Task                        || *    ||      || &lt;br /&gt;
|-&lt;br /&gt;
| [[OCEOSmp/directive reference#oceos_task_start()| oceos_task_start()]]               || Start Task                         ||      ||  *   || *&lt;br /&gt;
|-&lt;br /&gt;
| [[OCEOSmp/directive reference#oceos_task_timed_start()| oceos_task_timed_start()]]   || Schedule a task to start execution at a given system time||      ||  *   || *&lt;br /&gt;
|-&lt;br /&gt;
| [[OCEOSmp/directive reference#oceos_task_disable()| oceos_task_disable()]]           || Disable Task                       ||      ||  *   || *&lt;br /&gt;
|-&lt;br /&gt;
| [[OCEOSmp/directive reference#oceos_task_enable()| oceos_task_enable()]]             || Enable Task                        ||      ||  *   || *&lt;br /&gt;
|-&lt;br /&gt;
| [[OCEOSmp/directive reference#oceos_task_self()| oceos_task_self()]]                 || Returns the task ID of the currently executing task ||    ||  *   || *&lt;br /&gt;
|-&lt;br /&gt;
| [[OCEOSmp/directive reference#oceos_task_get_priority()| oceos_task_get_priority()]] || Get priority of a task             ||      ||  *   || *&lt;br /&gt;
|-&lt;br /&gt;
| [[OCEOSmp/directive reference#oceos_task_get_status()| oceos_task_get_status()]]     || Get status of a task               ||      ||  *   || *&lt;br /&gt;
|-&lt;br /&gt;
| [[OCEOSmp/directive reference#oceos_task_kill()| oceos_task_kill()]]                 || Directive to terminate current task||      ||  *   || *&lt;br /&gt;
|-&lt;br /&gt;
| [[OCEOSmp/directive reference#oceos_task_get_info()| oceos_task_get_info()]]         || Get task information               ||      ||  *   || *&lt;br /&gt;
|-&lt;br /&gt;
| [[OCEOSmp/directive reference#oceosmp_task_kill()| oceosmp_task_kill()]]                 || Directive to terminate current task||      ||  *   || *&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;Task data structures&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''tasks.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The following data structures are used by some of the task directives.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Data structures'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * A pointer to this structure is passed to oceos_task_create().&lt;br /&gt;
 * The structure is first initialised according to a tasks's parameters,&lt;br /&gt;
 * and is not used again after the task is created and may then be discarded.&lt;br /&gt;
 */&lt;br /&gt;
struct task_descriptor {&lt;br /&gt;
&lt;br /&gt;
	void (*function_start)(void*);	// name of task start function&lt;br /&gt;
	void (*function_end)(void*);	// optional, NULL or task end function&lt;br /&gt;
&lt;br /&gt;
	U32_t task_id;					// 0 to 254, usually an enum&lt;br /&gt;
	U32_t task_jobs_max;			// 1 to 15, max concurrent 'jobs'&lt;br /&gt;
	U32_t task_priority;			// 1 (highest) to 254 (lowest)&lt;br /&gt;
	U32_t task_threshold;			// &amp;gt;=1, &amp;lt;= task_priority (higher or same priority)&lt;br /&gt;
	U32_t task_turned_on_initially;	// 0: disabled initially, else enabled&lt;br /&gt;
&lt;br /&gt;
	U32_t time_deadline_microsecs;	// start request to finish, 0 to ignore&lt;br /&gt;
	U32_t time_min_interval_microsecs;	// between start requests, 0 to ignore&lt;br /&gt;
&lt;br /&gt;
	U32_t uses_cpu_affinity;		// 0: not restricted, else core restricted&lt;br /&gt;
	U32_t uses_cpu_affinity_core_id;// core ID to which restricted if affinity used&lt;br /&gt;
}__attribute__ ((aligned (8)));&lt;br /&gt;
&lt;br /&gt;
/**&lt;br /&gt;
 * Task info used with oceos_task_get_info&lt;br /&gt;
 */&lt;br /&gt;
struct task_info {&lt;br /&gt;
  U64_t           time_max_delay;               // maximum time job is waiting on ready queue before becoming active&lt;br /&gt;
  U64_t           time_max_finish;              // maximum time to finish job execution after starting&lt;br /&gt;
  U64_t           time_max_exec;                // maximum time spent executing&lt;br /&gt;
  U64_t           time_total_exec;              // total CPU time used by this task&lt;br /&gt;
  U64_t           time_min_gap_starts;          // minimum time between job creations, can be reset&lt;br /&gt;
  U64_t           time_min_gap_finish_start;    // minimum time between job ending and new job creation, can be reset&lt;br /&gt;
&lt;br /&gt;
  U64_t           time_last_start;              // time of most recent job creation&lt;br /&gt;
  U64_t           time_last_finish;             // time of most recent job finish&lt;br /&gt;
&lt;br /&gt;
  unsigned int    jobs_current_max  :16;        // maximum number of current jobs for this task, no roll over, can be reset&lt;br /&gt;
  unsigned int    jobs_total        :16;        // number of times this task was started, no roll-over, can be reset&lt;br /&gt;
  U32_t           jobs_current;                 // Number of task instances currently in use by oceos&lt;br /&gt;
&lt;br /&gt;
  U32_t           preempt_max;                  // maximum times any job was pre-empted, no roll-over, can be reset&lt;br /&gt;
}__attribute__ ((aligned (8)));&lt;br /&gt;
&lt;br /&gt;
/* A task's status is returned as below if queried */&lt;br /&gt;
enum TASK_STATUS {&lt;br /&gt;
    TASK_DISABLED,      // cannot be scheduled, and no current jobs&lt;br /&gt;
    TASK_ENABLED,       // can be scheduled, but no current jobs&lt;br /&gt;
    TASK_INVALID,       // task does not exist&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_task_create()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''tasks.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Create a task.&lt;br /&gt;
Can only be use before OCEOS starts. Stores the task information in the OCEOS fixed data area.&lt;br /&gt;
This directive populates the data structures for a task. It should be called after [[OCEOSmp/directive_reference#oceos_init()|oceos_init()]] and before [[OCEOSmp/directive_reference#oceos_init_finish()|oceos_init_finish()]].&amp;lt;br&amp;gt;&lt;br /&gt;
It must be called for each task otherwise [[OCEOSmp/directive_reference#oceos_start()|oceos_start()]] will return an error.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Create a task using a task descriptor structure&lt;br /&gt;
 *&lt;br /&gt;
 * Can only be used in Initialisation Phase.&lt;br /&gt;
 *&lt;br /&gt;
 * A task has twelve constant parameters set when the task is created.&lt;br /&gt;
 * Rather than setting a list of these parameters the named fields of a&lt;br /&gt;
 * task_descriptor structure are set and a pointer to it passed here.&lt;br /&gt;
 *&lt;br /&gt;
 * The task_descriptor structure fields are described above.&lt;br /&gt;
 * Once the task has been created the structure can be discarded.&lt;br /&gt;
 *&lt;br /&gt;
 * To create a task:&lt;br /&gt;
 *		set up a task_descriptor structure,&lt;br /&gt;
 *		set its fields to the parameter values for the task,&lt;br /&gt;
 *		pass a pointer to the structure to this directive.&lt;br /&gt;
 *&lt;br /&gt;
 * The structure is checked for validity by oceos_task_create and its&lt;br /&gt;
 * information used to set the task details in the OCEOS fixed data area.&lt;br /&gt;
 *&lt;br /&gt;
 * @param  struct task_descriptor *	fields give task characteristics&lt;br /&gt;
 *&lt;br /&gt;
 * @return OCEOS_SUCCESS            No errors or warnings&lt;br /&gt;
 *         WARN_NO_END_FUNCTION     Warning, no end task function specified&lt;br /&gt;
 *&lt;br /&gt;
 *         ERR_SYS_FIXED_CORRUPT    System Fixed area corrupt&lt;br /&gt;
 *         ERR_WRONG_CPU_CORE       Executing directive on wrong CPU&lt;br /&gt;
 *         ERR_WRONG_PHASE          Called before oceos_init() is done&lt;br /&gt;
 *         ERR_TOO_MANY             MAX number of tasks already created&lt;br /&gt;
 *         ERR_ID_INVALID           Task ID outside allowed range 0 to 254&lt;br /&gt;
 *         ERR_ID_WRONG             Task ID outside &amp;gt;= number of tasks&lt;br /&gt;
 *         ERR_T_ALREADY_ALLOCATED  Task ID already in use&lt;br /&gt;
 *         ERR_T_PRIORITY_INVALID   Task priority outside allowed range 1 to 254&lt;br /&gt;
 *         ERR_THRESHOLD_INVALID    Task threshold outside range 1 to 254&lt;br /&gt;
 *         ERR_THRESHOLD_WRONG      Task threshold  higher priority than task priority&lt;br /&gt;
 *         ERR_JOBS_MAX_INVALID     Job number outside range 1 to 15&lt;br /&gt;
 *         ERR_JOBS_TOO_MANY        System capacity exceeded&lt;br /&gt;
 *         ERR_AFFINITY_WRONG       CPU core specified is outside chosen range&lt;br /&gt;
 *         ERR_START_FUNCTION_BAD   Task start function address either NULL or misaligned&lt;br /&gt;
 */&lt;br /&gt;
S32_t   oceos_task_create(&lt;br /&gt;
    const struct task_descriptor * const task_description_ptr&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter           || Description&lt;br /&gt;
|-&lt;br /&gt;
|struct task_descriptor * || Pointer to task descriptor which contains task attributes&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit     || Description&lt;br /&gt;
|-&lt;br /&gt;
|WARN_NO_END_FUNCTION     || Warning, no end task function specified&lt;br /&gt;
|-&lt;br /&gt;
|ERR_SYS_FIXED_CORRUPT    || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
|ERR_WRONG_CPU_CORE       || Executing directive on wrong CPU&lt;br /&gt;
|-&lt;br /&gt;
|ERR_WRONG_PHASE          || Called before oceos_init() is done&lt;br /&gt;
|-&lt;br /&gt;
|ERR_TOO_MANY             || MAX number of tasks already created&lt;br /&gt;
|-&lt;br /&gt;
|ERR_ID_INVALID           || Task ID outside allowed range 0 to 254&lt;br /&gt;
|-&lt;br /&gt;
|ERR_ID_WRONG             || Task ID outside &amp;gt;= number of tasks&lt;br /&gt;
|-&lt;br /&gt;
|ERR_T_ALREADY_ALLOCATED  || Task ID already in use&lt;br /&gt;
|-&lt;br /&gt;
|ERR_T_PRIORITY_INVALID   || Task priority outside allowed range 1 to 254&lt;br /&gt;
|-&lt;br /&gt;
|ERR_THRESHOLD_INVALID    || Task threshold outside range 1 to 254&lt;br /&gt;
|-&lt;br /&gt;
|ERR_THRESHOLD_WRONG      || Task threshold  higher priority than task priority&lt;br /&gt;
|-&lt;br /&gt;
|ERR_JOBS_MAX_INVALID     || Job number outside range 1 to 15&lt;br /&gt;
|-&lt;br /&gt;
|ERR_JOBS_TOO_MANY        || System capacity exceeded&lt;br /&gt;
|-&lt;br /&gt;
|ERR_AFFINITY_WRONG       || CPU core specified is outside chosen range&lt;br /&gt;
|-&lt;br /&gt;
|ERR_START_FUNCTION_BAD   || Task start function address either NULL or misaligned&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
/* Sample Task names - all here start with t_ to help avoid name confusion */&lt;br /&gt;
enum TASK_NAME{&lt;br /&gt;
      t_0,&lt;br /&gt;
      t_1,&lt;br /&gt;
      t_2&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
/*&lt;br /&gt;
 * APPLICATION FUNCTION DECLARATIONS&lt;br /&gt;
 */&lt;br /&gt;
void fun0(void *);&lt;br /&gt;
void fun1(void *);&lt;br /&gt;
void fun2(void *);&lt;br /&gt;
void end_function(void *);&lt;br /&gt;
&lt;br /&gt;
const struct task_descriptor tasks_data[NUMBER_OF_TASKS] = {&lt;br /&gt;
    {fun0, end_function, t_0, 2, 10, 8, TASK_ENABLED, 0, 0, 0, 0},&lt;br /&gt;
    {fun1, end_function, t_1, 2, 10, 8, TASK_ENABLED, 0, 0, 0, 0},&lt;br /&gt;
    {fun2, end_function, t_2, 2, 10, 8, TASK_ENABLED, 0, 0, 0, 0}&lt;br /&gt;
}; &lt;br /&gt;
&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
    // create tasks (names are defined in the application header)&lt;br /&gt;
    for (i=0; i&amp;lt;NUMBER_OF_TASKS; i++){&lt;br /&gt;
        if ( oceos_task_create(&amp;amp;tasks_data[i]) != OCEOS_SUCCESS ){&lt;br /&gt;
        	oceosmp_print(&amp;quot;\nFailed to create task\n\r&amp;quot;);&lt;br /&gt;
        	return -i;&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_task_start()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''tasks.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function starts an instance of a task. An instance of a task is called a job in OCEOS terminology.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 *  Starting a task involves three main stages&lt;br /&gt;
 *      1 setting up a job&lt;br /&gt;
 *          finding a free job entry if available&lt;br /&gt;
 *          setting up this entry including passing it the data void *&lt;br /&gt;
 *&lt;br /&gt;
 *      2 placing the job on readyQ&lt;br /&gt;
 *&lt;br /&gt;
 *      3 doing a context switch&lt;br /&gt;
 * This function should only be called after OCEOS is initialised&lt;br /&gt;
 *       and the dynamic task and job structures set up&lt;br /&gt;
 *&lt;br /&gt;
 *  When used from an interrupt handler,&lt;br /&gt;
 *  the context switch is only done&lt;br /&gt;
 *  after all nested interrupts have unwound&lt;br /&gt;
 *&lt;br /&gt;
 * @param task_id Task ID must be in range 0 to 254&lt;br /&gt;
 * @param ptr     Pointer to task data&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT    System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT      System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE          Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID           Task ID is invalid&lt;br /&gt;
 *          ERR_ID_WRONG             Task ID is wrong&lt;br /&gt;
 *          ERR_START_TASK_DISABLED  Starting task is disabled&lt;br /&gt;
 *          ERR_TOO_MANY             There is no free job&lt;br /&gt;
 *          ERR_SYS_BUSY             Failed to grab the lock&lt;br /&gt;
 */&lt;br /&gt;
S32_t   oceos_task_start(&lt;br /&gt;
    const U32_t task_id, // task ID, must be in range 0 to 254&lt;br /&gt;
    void * const ptr    // pointer to data&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| task_id || U32_t with Task ID in range 0 to 254.&lt;br /&gt;
|-&lt;br /&gt;
| ptr    || void * pointer to task data&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit  || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT    || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT      || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE          || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID           || Task ID is invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG             || Task ID is wrong&lt;br /&gt;
|-&lt;br /&gt;
| ERR_START_TASK_DISABLED  || Starting task is disabled&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TOO_MANY             || There is no free job&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY             || Failed to grab the lock&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
void *ptr;&lt;br /&gt;
...&lt;br /&gt;
// Start instance of task T_1 passing pointer ptr&lt;br /&gt;
status = oceos_task_start(t_1,ptr);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_task_timed_start()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''tasks.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function schedules a task to start execution at a given system time.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 *  Schedule a task to start execution at a given system time&lt;br /&gt;
 *&lt;br /&gt;
 *  The before and after offsets define a window around the selected time&lt;br /&gt;
 *  in which the task may be started.&lt;br /&gt;
 *&lt;br /&gt;
 *  If the current system time is before the start window a job is created&lt;br /&gt;
 *  and a corresponding action put on the timed action queue.&lt;br /&gt;
 *&lt;br /&gt;
 *  If the current system time is within the time window for starting the task,&lt;br /&gt;
 *  it is started immediately.&lt;br /&gt;
 *&lt;br /&gt;
 *  If the current system time is after the window, an error is reported.&lt;br /&gt;
 *&lt;br /&gt;
 *  Times are in microseconds.&lt;br /&gt;
 *&lt;br /&gt;
 *  This function should only be called after OCEOS is initialised&lt;br /&gt;
 *  and the dynamic task and job structures set up&lt;br /&gt;
 *&lt;br /&gt;
 * @param taskID        Task ID must be in range 0 to 254&lt;br /&gt;
 * @param ptr           Pointer to data&lt;br /&gt;
 * @param start_time    System time at which job should start&lt;br /&gt;
 * @param before        Forward tolerance for time&lt;br /&gt;
 * @param after         Backward tolerance for time&lt;br /&gt;
 * @param return_job_id Return job_id to the user, to remove this job from timed action if needed&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              Task ID invalid&lt;br /&gt;
 *          ERR_ID_WRONG                Task ID is wrong&lt;br /&gt;
 *          ERR_TA_NOT_INIT             Timed action inialisation is not done and tried to be used&lt;br /&gt;
 *          ERR_START_TASK_DISABLED     Starting task is disabled&lt;br /&gt;
 *          ERR_TOO_MANY                There is no free job&lt;br /&gt;
 *          ERR_TOO_LATE                Starting task is too late(out of time frame)&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to grab the lock&lt;br /&gt;
 *          ERR_TA_Q_FULL               Timed action queue is full&lt;br /&gt;
 *          ERR_TA_START_FAILED         Timed action execute failed; See log&lt;br /&gt;
 */&lt;br /&gt;
S32_t   oceos_task_timed_start(&lt;br /&gt;
    const U32_t task_id,     // task ID, must be in range 0 to 254&lt;br /&gt;
    void * const ptr,        // pointer to data&lt;br /&gt;
    const U64_t start_time,  // system time at which job should start&lt;br /&gt;
    const U32_t before,      // forward tolerance for time&lt;br /&gt;
    const U32_t after,       // backward tolerance for time&lt;br /&gt;
    U32_t * return_job_id    // return job_id to the user, to remove this job from timed action if needed&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| taskID        || U32_t task ID must be in range 0 to 254&lt;br /&gt;
|-&lt;br /&gt;
| ptr           || void * pointer to data&lt;br /&gt;
|-&lt;br /&gt;
| start_time    || U64_t system time at which job should start&lt;br /&gt;
|-&lt;br /&gt;
| before        || U32_t forward tolerance for time&lt;br /&gt;
|-&lt;br /&gt;
| after         || U32_t backward tolerance for time&lt;br /&gt;
|-&lt;br /&gt;
| return_job_id || U32_t return job_id to the user, to remove this job from timed action if needed&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit  || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || Task ID invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || Task ID is wrong&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_NOT_INIT             || Timed action inialisation is not done and tried to be used&lt;br /&gt;
|-&lt;br /&gt;
| ERR_START_TASK_DISABLED     || Starting task is disabled&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TOO_MANY                || There is no free job&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TOO_LATE                || Starting task is too late(out of time frame)&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to grab the lock&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_Q_FULL               || Timed action queue is full&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_START_FAILED         || Timed action execute failed; See log&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
U32_t job_id;&lt;br /&gt;
U64_t cur_sys_time;&lt;br /&gt;
...&lt;br /&gt;
  cur_sys_time = oceos_time_sys_get64();&lt;br /&gt;
&lt;br /&gt;
  // Start task 10,000 microseconds (us) from now and advise if started more than 1,000 us before or 2,000 us after.&lt;br /&gt;
  status = oceos_task_timed_start(t_2, ptr, cur_sys_time + 10000, 1000, 2000, &amp;amp;job_id);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_task_disable()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''initialisation.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function disables a task and removes any current pending jobs from the readyQ.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 *  Disable a task and remove any current pending jobs on readyQ.&lt;br /&gt;
 *&lt;br /&gt;
 *  A disabled task's jobs  will not be put into execution nor put on readyQ.&lt;br /&gt;
 *&lt;br /&gt;
 *  Note that where execution of a task has already commenced,&lt;br /&gt;
 *  disabling the task will not prevent it from completing.&lt;br /&gt;
 *&lt;br /&gt;
 *  This function should only be called after OCEOS is initialised&lt;br /&gt;
 *  and the dynamic task and job structures set up&lt;br /&gt;
 *&lt;br /&gt;
 * @param taskID  Task ID must be in range 0 to 254&lt;br /&gt;
 * @return: OCEOS_SUCCESS&lt;br /&gt;
 *          WARN_ALREADY_DISABLED        Task already disabled&lt;br /&gt;
 *          WARN_SEM_PEND_REMOVE_FAILED  Failed to remove job from semaphore pending queue&lt;br /&gt;
 *          WARN_DQ_PEND_REMOVE_FAILED   Failed to remove job from dataq pending queue&lt;br /&gt;
 *&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT        System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT          System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE              Directive was called before OCEOS init is finished&lt;br /&gt;
 *          ERR_ID_INVALID               Task ID is invalid&lt;br /&gt;
 *          ERR_ID_WRONG                 Task ID is wrong&lt;br /&gt;
 *          ERR_SYS_BUSY                 Failed to grab the lock&lt;br /&gt;
 */&lt;br /&gt;
S32_t   oceos_task_disable(&lt;br /&gt;
    const U32_t task_id // task ID, must be in range 0 to 254&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| taskID || U32_t task ID must be in range 0 to 254&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit  || Description&lt;br /&gt;
|-&lt;br /&gt;
| WARN_ALREADY_DISABLED        || Task already disabled&lt;br /&gt;
|-&lt;br /&gt;
| WARN_SEM_PEND_REMOVE_FAILED  || Failed to remove job from semaphore pending queue&lt;br /&gt;
|-&lt;br /&gt;
| WARN_DQ_PEND_REMOVE_FAILED   || Failed to remove job from dataq pending queue&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT        || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT          || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE              || Directive was called before OCEOS init is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID               || Task ID is invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                 || Task ID is wrong&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                 || Failed to grab the lock&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Disable task t_1&lt;br /&gt;
status = oceos_task_disable(t_1);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_task_enable()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''tasks.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function enables a task. Only enabled tasks may be started.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 *  Enable a task - only enabled tasks are placed on readyQ or started.&lt;br /&gt;
 *&lt;br /&gt;
 *  This function should only be called after OCEOS is initialised&lt;br /&gt;
 *  and the dynamic task and job structures set up&lt;br /&gt;
 *&lt;br /&gt;
 * @param taskID   Task ID must be in range 0 to 254&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          WARN_ALREADY_ENABLED     Task already enabled&lt;br /&gt;
 *&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT    System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT      System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE          Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID           Task ID is invalid&lt;br /&gt;
 *          ERR_ID_WRONG             Task ID is wrong&lt;br /&gt;
 *          ERR_SYS_BUSY             Failed to grab the lock&lt;br /&gt;
 */&lt;br /&gt;
S32_t   oceos_task_enable(&lt;br /&gt;
    const U32_t task_id // task ID, must be in range 0 to 254&lt;br /&gt;
);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| taskID  || U32_t task ID must be in range 0 to 254&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit  || Description&lt;br /&gt;
|-&lt;br /&gt;
| WARN_ALREADY_ENABLED     || Task already enabled&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT    || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT      || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE          || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID           || Task ID is invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG             || Task ID is wrong&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY             || Failed to grab the lock&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Enable task t_2&lt;br /&gt;
status = oceos_task_enable(t_2);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_task_self()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''tasks.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the task number of the currently running task on the calling CPU.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Get currently running task on calling CPU&lt;br /&gt;
 *&lt;br /&gt;
 * @param t_id  Task ID holder&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT        System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT          System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE              Directive was called before OCEOS init is finished&lt;br /&gt;
 *          ERR_CPU_DYN_PTR_BAD          CPU dynamic area pointer corrupt&lt;br /&gt;
 */&lt;br /&gt;
S32_t  oceos_task_self(&lt;br /&gt;
    U32_t *t_id&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| t_id || S32_t * pointer to variable where task ID will be written.&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit  || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT        || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT          || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE              || Directive was called before OCEOS init is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_CPU_DYN_PTR_BAD          || CPU dynamic area pointer corrupt&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, task_running;&lt;br /&gt;
...&lt;br /&gt;
// Return task ID that's running on this core&lt;br /&gt;
status = oceos_task_self(&amp;amp;task_running);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_task_get_priority()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''tasks.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the priority of the task ID passed to it.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Get priority of the task&lt;br /&gt;
 *&lt;br /&gt;
 * @param taskID        ID of task, must be in range 0 to 254&lt;br /&gt;
 * @param t_priority    Pointer to task priority holder&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT        System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT          System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE              Directive was called before OCEOS init is finished&lt;br /&gt;
 *          ERR_ID_INVALID               Task ID is invalid&lt;br /&gt;
 *          ERR_ID_WRONG                 Task ID is wrong&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_task_get_priority(&lt;br /&gt;
    const U32_t task_id, // task ID, must be in range 0 to 254&lt;br /&gt;
    U32_t *t_priority   // Pointer to task priority holder&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| task_id || S32_t task ID of task whose priority is required&lt;br /&gt;
|-&lt;br /&gt;
| t_priority || S32_t * pointer to variable where priority will be written&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit  || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT        || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT          || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE              || Directive was called before OCEOS init is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID               || Task ID is invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                 || Task ID is wrong&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
U32_t t_priority;&lt;br /&gt;
...&lt;br /&gt;
// Return the priority of task ID t_4 &lt;br /&gt;
status = oceos_task_get_priority(t_4, &amp;amp;t_priority);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_task_get_status()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''tasks.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the status of the task ID passed to it.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Get status of the task;&lt;br /&gt;
 * if OK t_status holds enum TASK_STATUS&lt;br /&gt;
 *&lt;br /&gt;
 * @param taskID    ID of task, must be in range 0 to 254&lt;br /&gt;
 * @param t_status  enum TASK_STATUS holder&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT        System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT          System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE              Directive was called before OCEOS init is finished&lt;br /&gt;
 *          ERR_ID_INVALID               Task ID is invalid&lt;br /&gt;
 *          ERR_ID_WRONG                 Task ID is wrong&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_task_get_status(&lt;br /&gt;
    const U32_t task_id,&lt;br /&gt;
    U32_t *t_status&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| task_id || S32_t task ID of task whose priority is required&lt;br /&gt;
|-&lt;br /&gt;
| t_status || S32_t * pointer to variable where status will be written&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit  || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT        || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT          || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE              || Directive was called before OCEOS init is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID               || Task ID is invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                 || Task ID is wrong&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
U32_t t_status;&lt;br /&gt;
...&lt;br /&gt;
// Return the status of task ID t_4 &lt;br /&gt;
status = oceos_task_get_status(t_4, &amp;amp;t_status);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_task_get_info()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''tasks.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the task information for the specified task.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Get task information for task with ID.&lt;br /&gt;
 *&lt;br /&gt;
 * User must pass pointer to struct task_info in order to retrieve data.&lt;br /&gt;
 *&lt;br /&gt;
 * @param task_id  Task ID&lt;br /&gt;
 * @param info     Pointer to struct task_info&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT    System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT      System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE          Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID           Task ID invalid&lt;br /&gt;
 *          ERR_ID_WRONG             Task ID wrong&lt;br /&gt;
 *          ERR_TASK_INFO_PTR_BAD    Task info pointer provided by user is NULL&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_task_get_info (&lt;br /&gt;
    const U32_t task_id,   // Task ID&lt;br /&gt;
    struct task_info *info // Pointer to struct task_info&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| task_id || ID of task for which information is required&lt;br /&gt;
|-&lt;br /&gt;
| task_info || struct task_info * pointer to the structure where task information is to be written&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit  || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT    || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT      || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE          || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID           || Task ID invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG             || Task ID wrong&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TASK_INFO_PTR_BAD    || Task info pointer provided by user is NULL&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
struct task_info info;&lt;br /&gt;
...&lt;br /&gt;
// Get information for task T3&lt;br /&gt;
status = oceos_task_get_info(t_3, &amp;amp;info);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceosmp_task_kill()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''tasks.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function kills the specified task running on the specified CPU.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 *  Function to kill currently running task on CPU;&lt;br /&gt;
 *  Can be used:&lt;br /&gt;
 *      From Mode_SVC  =&amp;gt; normal running mode for application&lt;br /&gt;
 *          If nesting level is zero and Mode_SVC&lt;br /&gt;
 *      From Mode_IRQ  =&amp;gt; from IRQ handler&lt;br /&gt;
 *          If nesting level is not zero, set flag to call this function within IRQ handler&lt;br /&gt;
 *      From Exception =&amp;gt; Mode_ABT and Mode_UND&lt;br /&gt;
 *          If nesting level is zero and NOT Mode_SVC, it is exception;&lt;br /&gt;
 *              Disable IRQs on current CPU;&lt;br /&gt;
 *              Set kill current task flag to TRUE;&lt;br /&gt;
 *              Issue SGI on current CPU, will be interrupted on return from Exception and&lt;br /&gt;
 *              this function will be called within IRQ handler&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT    System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT      System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE          Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_CPU_DYN_PTR_BAD      CPU dynamic area pointer corrupt&lt;br /&gt;
 *          ERR_ID_INVALID           Task ID invalid&lt;br /&gt;
 *          ERR_ID_WRONG             Task ID wrong&lt;br /&gt;
 *          ERR_CPU_ID_WRONG         CPU ID wrong&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceosmp_task_kill(&lt;br /&gt;
    U32_t task_id,&lt;br /&gt;
    U32_t cpu_id&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| task_id  || U32_t task ID to be killed (must be in range 0 to 254)&lt;br /&gt;
|-&lt;br /&gt;
| cpu_id  || U32_t CPU ID where task_id is to be killed&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT    || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT      || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE          || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_CPU_DYN_PTR_BAD      || CPU dynamic area pointer corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID           || Task ID invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG             || Task ID wrong&lt;br /&gt;
|-&lt;br /&gt;
| ERR_CPU_ID_WRONG         || CPU ID wrong&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Kill task t_2 on CPU cpu_1&lt;br /&gt;
status = oceosmp_task_kill(t_2, cpu_1);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;Mutex directives&amp;lt;/span&amp;gt;==&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_mutex_create()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''mutex.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function creates a mutex of specified ID with a specified priority ceiling.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Creates a mutex with priority ceiling&lt;br /&gt;
 *&lt;br /&gt;
 * NOTE: This function should only be called after OCEOSmp is initialised with&lt;br /&gt;
 *  oceos_init() and before initialisation ends with oceos_init_finish()&lt;br /&gt;
 *  and scheduling starts with oceos_start()&lt;br /&gt;
 *&lt;br /&gt;
 * @param mutex_id  mutex ID value 0 to 62&lt;br /&gt;
 * @param priority  mutex priority ceiling 1 to 254 (high to low task priority)&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_WRONG_CPU_CORE          Executing directive on wrong CPU&lt;br /&gt;
 *          ERR_WRONG_PHASE             Called before oceos_init() is done&lt;br /&gt;
 *          ERR_TOO_MANY                MAX number of MUTEXs already created&lt;br /&gt;
 *          ERR_ID_INVALID              MUTEX ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                MUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
 *          ERR_MX_ALREADY_ALLOCATED    MUTEX ID already used&lt;br /&gt;
 *          ERR_MX_PRIORITY_WRONG       MUTEX priority ceiling outside allowed range 1 to 254&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_mutex_create(&lt;br /&gt;
    const U32_t mutex_id,  // mutex ID, must be in range 0 to 62&lt;br /&gt;
    const U8_t  priority  // mutex priority ceiling&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| mutex_id  || u32_t mutex ID to be created (value 0 to 62).&lt;br /&gt;
|-&lt;br /&gt;
| priority_ceiling ||  U32_t mutex priority ceiling 1 to 254 (high to low task priority)&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_CPU_CORE          || Executing directive on wrong CPU&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Called before oceos_init() is done&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TOO_MANY                || MAX number of MUTEXs already created&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || MUTEX ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || MUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_MX_ALREADY_ALLOCATED    || MUTEX ID already used&lt;br /&gt;
|-&lt;br /&gt;
| ERR_MX_PRIORITY_WRONG       || MUTEX priority ceiling outside allowed range 1 to 254&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Create mutex with ID print_mutex and priority ceiling of 5&lt;br /&gt;
status = oceos_mutex_create(print_mutex, 5);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_mutex_wait()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''mutex.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function makes the task wait until the specified mutex is available.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
 /*&lt;br /&gt;
  * Wait on mutex with ID.&lt;br /&gt;
  * If task succeeds in grabbing mutex, system level priority rises to&lt;br /&gt;
  * priority of this mutex, so tasks with lower or equal priority will&lt;br /&gt;
  * not be able to start till mutex is released.&lt;br /&gt;
  *&lt;br /&gt;
  * This should only be called after OCEOSmp scheduling has started.&lt;br /&gt;
  *&lt;br /&gt;
  * @param mutex_id     const U32_t  : value 0 to 62&lt;br /&gt;
  *&lt;br /&gt;
  * @return  OCEOS_SUCCESS&lt;br /&gt;
  *          WARN_MX_INCORRECT_ORDER     MUTEX acquired in incorrect order&lt;br /&gt;
  *&lt;br /&gt;
  *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
  *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
  *          ERR_WRONG_PHASE             Directive was called before OCEOSmp initialisation is finished&lt;br /&gt;
  *          ERR_ID_INVALID              MUTEX ID outside allowed range 0 to 62&lt;br /&gt;
  *           ERR_ID_WRONG                MUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
  *          ERR_MX_CEILING_BAD          MUTEX ceiling not lower priority than job priority&lt;br /&gt;
  *          ERR_MX_ALREADY_HELD         MUTEX already held by this job&lt;br /&gt;
  *          ERR_SYS_BUSY                Failed to grab context switch guard&lt;br /&gt;
  */&lt;br /&gt;
S32_t oceos_mutex_wait(&lt;br /&gt;
    const U32_t  mutex_id      // mutex ID, must be in range 0 to 62&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| mutex_id  || u32_t mutex ID to be waited on (value 0 to 62).&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| WARN_MX_INCORRECT_ORDER     || MUTEX acquired in incorrect order&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOSmp initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || MUTEX ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || MUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_MX_CEILING_BAD          || MUTEX ceiling not lower priority than job priority&lt;br /&gt;
|-&lt;br /&gt;
| ERR_MX_ALREADY_HELD         || MUTEX already held by this job&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to grab context switch guard&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Wait on mutex m_2&lt;br /&gt;
status = oceos_mutex_wait(m_2);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_mutex_signal()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''mutex.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function signals the specified mutex.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Signal a mutex with ID&lt;br /&gt;
 *&lt;br /&gt;
 * N.B. :&lt;br /&gt;
 *      This function should not be called from an interrupt handler&lt;br /&gt;
 *      This should only be called after OCEOSmp scheduling has started.&lt;br /&gt;
 *&lt;br /&gt;
 * @param mutex_id     const U32_t  : value 0 to 62&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          WARN_MX_ALREADY_FREE        MUTEX is free already&lt;br /&gt;
 *          WARN_MX_NESTING_BAD         MUTEX nesting incorrect&lt;br /&gt;
 *&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOSmp initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              MUTEX ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                MUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
 *          ERR_MX_WRONG_JOB            MUTEX not held by this job&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to grab context switch guard&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_mutex_signal(&lt;br /&gt;
    const U32_t  mutex_id     // mutex ID, must be in range 0 to 62&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| mutex_id  || u32_t mutex ID to be signalled (value 0 to 62).&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| WARN_MX_ALREADY_FREE        || MUTEX is free already&lt;br /&gt;
|-&lt;br /&gt;
| WARN_MX_NESTING_BAD         || MUTEX nesting incorrect&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOSmp initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || MUTEX ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || MUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_MX_WRONG_JOB            || MUTEX not held by this job&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to grab context switch guard&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Signal mutex m_2&lt;br /&gt;
status = oceos_mutex_signal(m_2);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_mutex_get_value()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''mutex.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the value of the specified mutex.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Get current value of mutex with ID&lt;br /&gt;
 *&lt;br /&gt;
 * @param mutex_id      const U32_t  : value 0 to 62&lt;br /&gt;
 * @param m_value       pointer to MUTEX value holder&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOSmp initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              MUTEX ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                MUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
 *          ERR_MX_DATA_PTR_BAD         Pointer to MUTEX value return holder is null&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_mutex_get_value(&lt;br /&gt;
    const U32_t  mutex_id,      // mutex ID, must be in range 0 to 62&lt;br /&gt;
    U32_t *m_value              // Pointer to MUTEX value holder&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| mutex_id  || u32_t mutex ID to be signalled (value 0 to 62)&lt;br /&gt;
|-&lt;br /&gt;
| m_value  || u32_t * pointer where mutex value is to be written&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOSmp initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || MUTEX ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || MUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_MX_DATA_PTR_BAD         || Pointer to MUTEX value return holder is null&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
U32_t value;&lt;br /&gt;
...&lt;br /&gt;
// Get value of mutex m_2&lt;br /&gt;
status = oceos_mutex_get_value(m_2, &amp;amp;value);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;Read/write mutex directives&amp;lt;/span&amp;gt;==&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;Read/write mutex overview&amp;lt;/span&amp;gt;===&lt;br /&gt;
&lt;br /&gt;
Contents:&lt;br /&gt;
&lt;br /&gt;
 1.  Read/Write Mutex features&lt;br /&gt;
 2.  Read/Write Mutex data structures&lt;br /&gt;
 3.  Read/Write Mutex constants&lt;br /&gt;
 4.  Read/Write Mutex manager Directives&lt;br /&gt;
&lt;br /&gt;
==== Read/Write Mutex Features ====&lt;br /&gt;
&lt;br /&gt;
Read/Write Mutexes (rwmutexes) can be held for 'read' at the same time&lt;br /&gt;
by multiple jobs on different CPUs, but once held for 'write' by any job&lt;br /&gt;
cannot be obtained for 'read' or for 'write' by another job until released.&lt;br /&gt;
&lt;br /&gt;
They can be used to allow data be read simultaneously by multiple jobs when&lt;br /&gt;
the data is not being updated while ensuring that no updating can take&lt;br /&gt;
place while any job is reading the data.&lt;br /&gt;
&lt;br /&gt;
Pending write requests take precedence over pending read requests and are&lt;br /&gt;
done on a first come, first served basis. Once any job on a CPU has a&lt;br /&gt;
rwmutex for 'read' no other job on that CPU can acquire it so as to avoid&lt;br /&gt;
potential problems and minimise delays in servicing write requests by other&lt;br /&gt;
CPUs.&lt;br /&gt;
&lt;br /&gt;
While any job holds a rwmutex for reading any job on another CPU can also&lt;br /&gt;
acquire it for reading. Other jobs on the same CPU that may attempt to&lt;br /&gt;
acquire the rwmutex are delayed in starting until return of the rwmutex.&lt;br /&gt;
No job can acquire the rwmutex for writing until all read acquisitions&lt;br /&gt;
have been returned.&lt;br /&gt;
&lt;br /&gt;
No job will acquire a rwmutex for reading if any job is trying to acquire&lt;br /&gt;
it for writing, giving write precedence over read. Multiple write requests&lt;br /&gt;
waiting for existing read acquisitions to complete are serviced in the&lt;br /&gt;
order in which they were made when the current read acquisitions complete.&lt;br /&gt;
&lt;br /&gt;
If a task waits on a rwmutex that it already holds a system log entry is&lt;br /&gt;
made (LOG_RWMUTEX_ALREADY_HELD) and an INTERNAL_ERROR status code returned.&lt;br /&gt;
&lt;br /&gt;
If a task attempts to release a rwmutex it does not hold a system log entry&lt;br /&gt;
is made (LOG_RWMUTEX_ALREADY_FREE) and an INTERNAL_ERROR status code returned.&lt;br /&gt;
&lt;br /&gt;
If a job holds more than one rwmutex at the same time these must be&lt;br /&gt;
acquired and released in a nested manner&lt;br /&gt;
(e.g. wait 1, wait 2, wait 3, signal 3, signal 2, signal 1).&lt;br /&gt;
&lt;br /&gt;
If a task exits while holding one or more rwmutexes these are returned and&lt;br /&gt;
a system log entry made (LOG_RWMUTEX_NOT_RETURNED).&lt;br /&gt;
&lt;br /&gt;
==== Read/Write Mutex data structures ====&lt;br /&gt;
&lt;br /&gt;
In OCEOSmp each rwmutex has a priority ceiling, the priority of the highest&lt;br /&gt;
priority task that acquires the rwmutex for read or for write.&lt;br /&gt;
OCEOSmp uses this to ensure that once a job on a particular CPU has the&lt;br /&gt;
rwmutex for reading or for writing no other job on that CPU can be started&lt;br /&gt;
that might try to obtain that rwmutex.&lt;br /&gt;
&lt;br /&gt;
The priority ceiling of a rwmutex is specified when the rwmutex is created&lt;br /&gt;
and does not change subsequently. Priority ceilings are stored in the&lt;br /&gt;
fixed data area as an array U8_t rwmutexCeilings[] indexed by mutex ID.&lt;br /&gt;
This array is extended to be a whole number of 32-bit words.&lt;br /&gt;
&lt;br /&gt;
A rwmutex has a unique rwmutex ID, an unsigned integer usually defined in&lt;br /&gt;
the application header file as an enum RWMUTEX_NAME{} thus allowing a&lt;br /&gt;
user-friendly name be associated with each rwmutex ID.&lt;br /&gt;
&lt;br /&gt;
Using an enum is strongly recommended as it allows a user-friendly name be&lt;br /&gt;
associated with each ID, and helps ensure IDs are contiguous from 0.&lt;br /&gt;
&lt;br /&gt;
These rwmutex IDs are used as indices into both fixed and dynamic data&lt;br /&gt;
arrays and must cover the range 0 to ((number of rwmutexes) -1). Using&lt;br /&gt;
enum RWMUTEX_NAME{} automatically assigns names to IDs 0, 1, 2...&lt;br /&gt;
&lt;br /&gt;
Read write mutex dynamic data such as the current write requests and&lt;br /&gt;
current read count are stored in the dynamic data area in an array of&lt;br /&gt;
struct rwmutex_dyn_block also indexed by the rwmutex ID.&lt;br /&gt;
&lt;br /&gt;
A further dynamic area array of guard_t is used in providing mutual&lt;br /&gt;
exclusion when updating the rwmutex dynamic data.&lt;br /&gt;
&lt;br /&gt;
==== Read/Write Mutex constants ====&lt;br /&gt;
&lt;br /&gt;
In OCEOSmp there can be a maximum of 63 rwmutexes,&lt;br /&gt;
with IDs from 0 to 62 (the value 63 is used as an invalid ID).&lt;br /&gt;
&lt;br /&gt;
The rwmutexes can be created in any order, but OCEOSmp will return an error&lt;br /&gt;
and fail to start if the resulting IDs fail to be contiguous from 0 as IDs&lt;br /&gt;
are used by OCEOS as indices into arrays.&lt;br /&gt;
&lt;br /&gt;
Each rwmutex has a priority ceiling, the priority of the highest priority&lt;br /&gt;
task that uses the rwmutex for reading or for writing. This is specified&lt;br /&gt;
when the rwmutex is created, does not change subsequently, and must be in&lt;br /&gt;
the range 1 (TASK_MAX_PRIORITY) to 254 (TASK_MIN_PRIORITY).&lt;br /&gt;
The application developer must ensure that the correct rwmutex ceiling&lt;br /&gt;
is used. OCEOSmp will detect an attempt to acquire a rwmutex by a task&lt;br /&gt;
with higher priority than that rwmutex's priority ceiling, make a&lt;br /&gt;
system log entry (LOG_RWMUTEX_BAD_CEILING) and return an INTERNAL_ERROR&lt;br /&gt;
status code.&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_rwmutex_create()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''rwmutex.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function ees a read/write mutex.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Creates a Read/Write Mutex (RWMUTEX)&lt;br /&gt;
 *&lt;br /&gt;
 * This function should only be called after OCEOSmp is initialised with&lt;br /&gt;
 * oceos_init() and before initialisation ends with oceos_init_finish()&lt;br /&gt;
 * and scheduling starts with oceos_start()&lt;br /&gt;
 *&lt;br /&gt;
 * @param rwm_id    Read/Write RWMUTEX ID, must be in range 0 to 62&lt;br /&gt;
 * @param priority  Priority ceiling of highest priority task that uses the RWMUTEX&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_WRONG_CPU_CORE          Executing directive on wrong CPU&lt;br /&gt;
 *          ERR_WRONG_PHASE             Called before oceos_init() is done&lt;br /&gt;
 *          ERR_TOO_MANY                MAX number of RWMUTEXs already created&lt;br /&gt;
 *          ERR_ID_INVALID              RWMUTEX ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                RWMUTEX ID &amp;gt;= number of RWMUTEXs&lt;br /&gt;
 *          ERR_RWMX_ALREADY_ALLOCATED  RWMUTEX ID already used&lt;br /&gt;
 *          ERR_RWMX_PRIORITY_WRONG     RWMUTEX priority ceiling outside allowed range 1 to 254&lt;br /&gt;
 */&lt;br /&gt;
S32_t   oceos_rwmutex_create(&lt;br /&gt;
    const U32_t rwm_id,   // RWMUTEX ID, must be in range 0 to max rwm&lt;br /&gt;
    const U8_t priority   // RWMUTEX priority ceiling&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| rwm_id || Read/Write RWMUTEX ID, must be in range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| priority || Priority ceiling of highest priority task that uses the RWMUTEX&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_CPU_CORE          || Executing directive on wrong CPU&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Called before oceos_init() is done&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TOO_MANY                || MAX number of RWMUTEXs already created&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || RWMUTEX ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || RWMUTEX ID &amp;gt;= number of RWMUTEXs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_RWMX_ALREADY_ALLOCATED  || RWMUTEX ID already used&lt;br /&gt;
|-&lt;br /&gt;
| ERR_RWMX_PRIORITY_WRONG     || RWMUTEX priority ceiling outside allowed range 1 to 254&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Create read/write mutex with ID rwm_2 and priority ceiling of 100 &lt;br /&gt;
status = oceos_rwmutex_create(rwm_1, 100);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_rwmutex_read_wait()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''rwmutex.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function acquires a read/write mutex for read. If successful, jobs on other CPUs can also acquire it for read, but no job will be able to acquire it for write while any read is under way. If job already holds RWMUTEX for read or for write the appropriate status code is returned, a system log entry made, and the job continues. It will not succeed while any job is waiting to obtain RWMUTEX for write, and will loop waiting for all pending writes on this RWMUTEX to complete.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Read wait on RWMUTEX.&lt;br /&gt;
 *&lt;br /&gt;
 * If successful jobs on other CPUs can also acquire it for read, but no job&lt;br /&gt;
 * will be able to acquire it for write while any read is under way.&lt;br /&gt;
 * If job already holds RWMUTEX for read or for write appropriate status code&lt;br /&gt;
 * is returned, a system log entry made, and the job continues.&lt;br /&gt;
 * Will not succeed while any job is waiting to obtain RWMUTEX for write,&lt;br /&gt;
 * will loop waiting for all pending writes on this RWMUTEX to complete.&lt;br /&gt;
 *&lt;br /&gt;
 * This should only be called after OCEOS scheduling has started.&lt;br /&gt;
 *&lt;br /&gt;
 * N.B.	The returned status code must be checked and appropriate action&lt;br /&gt;
 * 		taken.&lt;br /&gt;
 *&lt;br /&gt;
 * @param rwm_id    const U32_t  : value 0 to 62&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          WARN_RWMX_NOT_HIGHEST       Already holds a RWMUTEX higher in the RWMUTEX order&lt;br /&gt;
 *                                      (there then may be a risk of deadlock)&lt;br /&gt;
 *&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              RWMUTEX ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                RWMUTEX ID &amp;gt;= number of RWMUTEXs&lt;br /&gt;
 *          ERR_RWMX_CEILING_BAD        RWMUTEX ceiling not lower priority than job priority&lt;br /&gt;
 *          ERR_RWMX_ALREADY_HELD       RWMUTEX already held by this job&lt;br /&gt;
 *          ERR_RWMX_CPU_STACK_FULL     CPU priority ceiling stack full&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_rwmutex_read_wait(&lt;br /&gt;
    const U32_t rwm_id  // RWMUTEX ID, must be in range 0 to 62&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| rwm_id || U32_t rwmutex to be acquired for read (value 0 to 62)&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| WARN_RWMX_NOT_HIGHEST       || Already holds a RWMUTEX higher in the RWMUTEX order (deadlock risk)&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || RWMUTEX ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || RWMUTEX ID &amp;gt;= number of RWMUTEXs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_RWMX_CEILING_BAD        || RWMUTEX ceiling not lower priority than job priority&lt;br /&gt;
|-&lt;br /&gt;
| ERR_RWMX_ALREADY_HELD       || RWMUTEX already held by this job&lt;br /&gt;
|-&lt;br /&gt;
| ERR_RWMX_CPU_STACK_FULL     || CPU priority ceiling stack full&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Acquire read/write mutex rwm_1 for read&lt;br /&gt;
status = oceos_rwmutex_read_wait(rwm_1);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_rwmutex_write_wait()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''rwmutex.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function acquires the specified read/write mutex for write.&lt;br /&gt;
If successful, no other job can also obtain it for reading or for writing. Will not succeed while any other job has acquired RWMUTEX for write,&lt;br /&gt;
or any jobs have obtained RWMUTEX for read. Will then loop until the RWMUTEX is released and for its turn in the sequence of jobs that have tried to acquire the RWMUTEX for writing. If already holds the RWMUTEX for writing or reading an appropriate status code is returned, a system log entry made, and the job continues. While there are any outstanding attempts to obtain the RWMUTEX for write no job will be able to acquire it for reading.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Write wait on RWMUTEX.&lt;br /&gt;
 *&lt;br /&gt;
 * If successful no other job can also obtain it for reading or for writing.&lt;br /&gt;
 * Will not succeed while any other job has acquired RWMUTEX for write,&lt;br /&gt;
 * or any jobs have obtained RWMUTEX for read. Will then loop until the&lt;br /&gt;
 * RWMUTEX is released and for its turn in the sequence of jobs that have&lt;br /&gt;
 * tried to acquire the RWMUTEX for writing.&lt;br /&gt;
 * If already holds the RWMUTEX for writing or reading an appropriate status&lt;br /&gt;
 * code is returned, a system log entry made, and the job continues.&lt;br /&gt;
 * While there are any outstanding attempts to obtain the RWMUTEX for write&lt;br /&gt;
 * no job will be able to acquire it for reading.&lt;br /&gt;
 *&lt;br /&gt;
 * This should only be called after OCEOS scheduling has started.&lt;br /&gt;
 *&lt;br /&gt;
 * N.B.	The returned status code must be checked and appropriate action&lt;br /&gt;
 * 		taken.&lt;br /&gt;
 *&lt;br /&gt;
 * @param rwm_id     const U32_t  : value 0 to 62&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          WARN_RWMX_NOT_HIGHEST       Already holds a RWMUTEX higher in the RWMUTEX order&lt;br /&gt;
 *                                      (there then may be a risk of deadlock)&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              RWMUTEX ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                RWMUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
 *          ERR_RWMX_CEILING_BAD        RWMUTEX ceiling not lower priority than job priority&lt;br /&gt;
 *          ERR_RWMX_ALREADY_HELD       RWMUTEX already held by this job&lt;br /&gt;
 *          ERR_RWMX_CPU_STACK_FULL     CPU priority ceiling stack full&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_rwmutex_write_wait(&lt;br /&gt;
    const U32_t rwm_id  // RWMUTEX ID, must be in range 0 to 62&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| rwm_id || U32_t rwmutex to be acquired for write(value 0 to 62)&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| WARN_RWMX_NOT_HIGHEST       || Already holds a RWMUTEX higher in the RWMUTEX order (deadlock risk)&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || RWMUTEX ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || RWMUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_RWMX_CEILING_BAD        || RWMUTEX ceiling not lower priority than job priority&lt;br /&gt;
|-&lt;br /&gt;
| ERR_RWMX_ALREADY_HELD       || RWMUTEX already held by this job&lt;br /&gt;
|-&lt;br /&gt;
| ERR_RWMX_CPU_STACK_FULL     || CPU priority ceiling stack full&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Acquire read/write mutex rwm_1 for write&lt;br /&gt;
status = oceos_rwmutex_read_wait(rwm_1);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_rwmutex_signal()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''rwmutex.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function signals the specified read/write mutex.&lt;br /&gt;
It frees the RWMUTEX for use by other jobs, irrespective of whether the RWMUTEX is held for reading or for writing. If the RWMUTEX is not held by the job then it returns an appropriate status code. It does not take into account how many times a job has obtained the RWMUTEX for read or for write.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Signal a RWMUTEX&lt;br /&gt;
 *&lt;br /&gt;
 * Frees the RWMUTEX for use by other jobs, irrespective of whether&lt;br /&gt;
 * RWMUTEX is held for reading or for writing.&lt;br /&gt;
 * if the RWMUTEX is not held by the job returns an appropriate status code.&lt;br /&gt;
 * Does not take into account how many times a job has obtained the RWMUTEX&lt;br /&gt;
 * for read or for write.&lt;br /&gt;
 *&lt;br /&gt;
 * This should only be called after OCEOS scheduling has started.&lt;br /&gt;
 *&lt;br /&gt;
 * N.B. The returned status code must be checked and appropriate action taken.&lt;br /&gt;
 *&lt;br /&gt;
 * @param rwm_id    const U32_t  : value 0 to 62&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          WARN_RWMX_ALREADY_FREE      RWMUTEX is free already&lt;br /&gt;
 *&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              RWMUTEX ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                RWMUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
 *          ERR_RWMX_CEILING_BAD        RWMUTEX ceiling not lower priority than job priority&lt;br /&gt;
 *          ERR_RWMX_CPU_STACK_EMPTY    CPU priority ceiling stack empty&lt;br /&gt;
 *          ERR_RWMX_CEILING_INVALID    CPU current priority ceiling on the priority stack is invalid&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_rwmutex_signal(&lt;br /&gt;
    const U32_t rwm_id // RWMUTEX ID, must be in range 0 to 62&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| rwm_id || U32_t rwmutex to be signaled(value 0 to 62)&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| WARN_RWMX_ALREADY_FREE      || RWMUTEX is free already&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || RWMUTEX ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || RWMUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_RWMX_CEILING_BAD        || RWMUTEX ceiling not lower priority than job priority&lt;br /&gt;
|-&lt;br /&gt;
| ERR_RWMX_CPU_STACK_EMPTY    || CPU priority ceiling stack empty&lt;br /&gt;
|-&lt;br /&gt;
| ERR_RWMX_CEILING_INVALID    || CPU current priority ceiling on the priority stack is invalid&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Signal read/write mutex number rwm_4&lt;br /&gt;
status = oceos_rwmutex_signal(rwm_4);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_rwmutex_check_status()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''rwmutex.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function checks the status of a read/write mutex. The possible states are free, in-use for read, and in-use for write.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Check whether RWMUTEX is free&lt;br /&gt;
 *&lt;br /&gt;
 * @param rwm_id        must be in range 0 to 62&lt;br /&gt;
 * @param m_status      pointer to RWMUTEX status holder;&lt;br /&gt;
 *                      if return code OCEOS_SUCCESS RWMUTEX status:&lt;br /&gt;
 *                          0 =&amp;gt; Free for use&lt;br /&gt;
 *                          1 =&amp;gt; In use for read&lt;br /&gt;
 *                          2 =&amp;gt; In use for write&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              RWMUTEX ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                RWMUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
 *          ERR_RWMX_DATA_PTR_BAD       Pointer to RWMUTEX status return holder is null&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_rwmutex_check_status(&lt;br /&gt;
    const U32_t rwm_id, // RWMUTEX ID, must be in range 0 to 62&lt;br /&gt;
    U32_t *m_status&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| rwm_id || read/write mutex number in range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| m_status || U32_t pointer to RWMUTEX status holder (0 = free, 1 = in-use for read, 2 = in-use for write &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || RWMUTEX ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || RWMUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_RWMX_DATA_PTR_BAD       || Pointer to RWMUTEX status return holder is null&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, rwm_status;&lt;br /&gt;
...&lt;br /&gt;
// Check the status of read/write mutex rwm_2&lt;br /&gt;
status = oceos_rwmutex_check_status(rwm_2, &amp;amp;rwm_status);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_rwmutex_reading_count()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''rwmutex.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the current number of jobs holding a specified read/write mutex for read.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 *&lt;br /&gt;
 * Get current number of jobs holding RWMUTEX for read&lt;br /&gt;
 *&lt;br /&gt;
 * @param rwm_id    must be in range 0 to 62&lt;br /&gt;
 * @param m_count   pointer to RWMUTEX count holder&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              RWMUTEX ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                RWMUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
 *          ERR_RWMX_DATA_PTR_BAD       Pointer to RWMUTEX count return holder is null&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_rwmutex_reading_count(&lt;br /&gt;
    const U32_t rwm_id, // RWMUTEX ID, must be in range 0 to 62&lt;br /&gt;
    U32_t *m_count&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| rwm_id || U32 value of read/write mutex (in range 0 to 62)&lt;br /&gt;
|-&lt;br /&gt;
| m_count || U32_t pointer to read/write mutex count holder&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || RWMUTEX ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || RWMUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_RWMX_DATA_PTR_BAD       || Pointer to RWMUTEX count return holder is null&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, rwm_count;&lt;br /&gt;
...&lt;br /&gt;
// Get the number of jobs holding the read/write mutex rwm_2 for read&lt;br /&gt;
status = oceos_rwmutex_reading_count(rwm_2, &amp;amp;rwm_count);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_rwmutex_write_reqs_count()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''header.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the current number of write requests for the specified read/write mutex .&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Get current RWMUTEX write requests count&lt;br /&gt;
 *&lt;br /&gt;
 * @param rwm_id    must be in range 0 to 62&lt;br /&gt;
 * @param m_count   pointer to RWMUTEX count holder&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              RWMUTEX ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                RWMUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
 *          ERR_RWMX_DATA_PTR_BAD       Pointer to RWMUTEX count return holder is null&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_rwmutex_write_reqs_count(&lt;br /&gt;
    const U32_t rwm_id, // RWMUTEX ID, must be in range 0 to 62&lt;br /&gt;
    U32_t *m_count&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| rwm_id || U32_t value of read/write mutex (must be in range 0 to 62)&lt;br /&gt;
|-&lt;br /&gt;
| m_count || U32_t pointer to read/write mutex count holder&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || RWMUTEX ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || RWMUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_RWMX_DATA_PTR_BAD       || Pointer to RWMUTEX count return holder is null&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, rwm_count;&lt;br /&gt;
...&lt;br /&gt;
// Get the count of cuurent write requests for read/write mutex rwm_1&lt;br /&gt;
status = oceos_rwmutex_write_reqs_count(rwm_1, &amp;amp;rwm_count);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_rwmutex_writes_pending_count()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''rwmutex.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the current number of pending writes for the specified read/write mutex.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Get current RWMUTEX writes pending count&lt;br /&gt;
 *&lt;br /&gt;
 * @param rwm_id    must be in range 0 to 62&lt;br /&gt;
 * @param m_count   pointer to RWMUTEX count holder&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              RWMUTEX ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                RWMUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
 *          ERR_RWMX_DATA_PTR_BAD       Pointer to RWMUTEX pending count return holder is null&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_rwmutex_writes_pending_count(&lt;br /&gt;
    const U32_t rwm_id, // RWMUTEX ID, must be in range 0 to 62&lt;br /&gt;
    U32_t *m_count&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| rwm_id || U32_t value of read/write mutex (must be in range 0 to 62)&lt;br /&gt;
|-&lt;br /&gt;
| m_count || U32_t pointer to read/write mutex count holder&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || RWMUTEX ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || RWMUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_RWMX_DATA_PTR_BAD       || Pointer to RWMUTEX count return holder is null&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, rwm_count;&lt;br /&gt;
...&lt;br /&gt;
// Get the count of cuurent write requests for read/write mutex rwm_1&lt;br /&gt;
status = oceos_rwmutex_writes_pending_count(rwm_1, &amp;amp;rwm_count);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_rwmutex_holding()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''header.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the read/write mutexes currently held by this instance of this task (job).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Get RWMUTEXs currently held by this instance of the task (job)&lt;br /&gt;
 *&lt;br /&gt;
 * @param m_data    U64_t pointer, each bit indicating RWMUTEX held by current task&lt;br /&gt;
 *                          0 =&amp;gt; Not held by job&lt;br /&gt;
 *                          1 =&amp;gt; Held by job&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_RWMX_DATA_PTR_BAD       Pointer to RWMUTEX status return holder is null&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_rwmutex_holding(&lt;br /&gt;
    U64_t *m_data&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| m_data || U64_t pointer, each bit indicating RWMUTEX held by current task, 0 =&amp;gt; not held, 1 =&amp;gt; held &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_RWMX_DATA_PTR_BAD       || Pointer to RWMUTEX status return holder is null&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
U64_t rwm_held;&lt;br /&gt;
...&lt;br /&gt;
// Which read/write mutexes does this job hold&lt;br /&gt;
status = oceos_rwmutex_holding(&amp;amp;rwm_held);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Semaphores directives ==&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_sem_create()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''semaphore.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function creates a semaphore.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Create a counting semaphore&lt;br /&gt;
 *&lt;br /&gt;
 * @param sem_id            SEMAPHORE ID (from 0 to 62)&lt;br /&gt;
 * @param max_permits       number of max permits allowed for this SEMAPHORE, 1 to 4095&lt;br /&gt;
 * @param count_permits     starting number of permits available 0 to 4095&lt;br /&gt;
 * @param pending_q_size    MAX Number of tasks on SEMAPHORE pending queue 1 to 253&lt;br /&gt;
 * @param use_timeout       if TRUE, directive oceos_sem_wait_restart_timeout can be used&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_WRONG_CPU_CORE          Executing directive on wrong CPU&lt;br /&gt;
 *          ERR_WRONG_PHASE             Called before oceos_init() is done&lt;br /&gt;
 *          ERR_TOO_MANY                MAX number of SEMAPHOREs already created&lt;br /&gt;
 *          ERR_ID_INVALID              SEMAPHORE ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                SEMAPHORE ID &amp;gt;= number of SEMAPHOREs&lt;br /&gt;
 *          ERR_SM_ALREADY_ALLOCATED    SEMAPHORE ID already used&lt;br /&gt;
 *          ERR_SM_MAX_PERMIT_WRONG     MAX permits outside allowed range 1 to 4095&lt;br /&gt;
 *          ERR_SM_COUNT_PERMIT_WRONG   Count permits outside allowed range 0 to 4095&lt;br /&gt;
 *          ERR_SM_COUNT_PERMIT_INVALID Count permits is greater than MAX permits for this SEMAPHORE&lt;br /&gt;
 *          ERR_SM_PENQ_SIZE_WRONG      SEMAPHORE pending queue size outside allowed range 1 to 253&lt;br /&gt;
 *          ERR_SM_TA_MAX_NUM_REACHED   Number of timed actions exceeds MAX allowed 255,&lt;br /&gt;
 *                                      each task on SEMAPHORE pending queue is timed action&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_sem_create(&lt;br /&gt;
    sem_t sem_id,         // counting semaphore ID (MAX 63)&lt;br /&gt;
    U16_t max_permits,    // max number of permits (MAX 4095)&lt;br /&gt;
    U16_t count_permits,  // initial number of permits (MAX 4095)&lt;br /&gt;
    U8_t  pending_q_size, // max number of pending queue jobs (MAX 253)&lt;br /&gt;
    BOOLE_t use_timeout   // whether timeout is used in oceos_sem_wait_restart_timeout&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| sem_id || Semaphore ID to be created (from 0 to 62)&lt;br /&gt;
|-&lt;br /&gt;
| max_permits || number of max permits allowed for this semaphore, 1 to 4095&lt;br /&gt;
|-&lt;br /&gt;
| count_permits || starting number of permits available 0 to 4095&lt;br /&gt;
|-&lt;br /&gt;
| pending_q_size || Maximum Number of tasks on SEMAPHORE pending queue 1 to 253&lt;br /&gt;
|-&lt;br /&gt;
| use_timeout || if TRUE, directive oceos_sem_wait_restart_timeout can be used&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_CPU_CORE          || Executing directive on wrong CPU&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Called before oceos_init() is done&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TOO_MANY                || MAX number of SEMAPHOREs already created&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || SEMAPHORE ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || SEMAPHORE ID &amp;gt;= number of SEMAPHOREs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SM_ALREADY_ALLOCATED    || SEMAPHORE ID already used&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SM_MAX_PERMIT_WRONG     || MAX permits outside allowed range 1 to 4095&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SM_COUNT_PERMIT_WRONG   || Count permits outside allowed range 0 to 4095&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SM_COUNT_PERMIT_INVALID || Count permits is greater than MAX permits for this SEMAPHORE&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SM_PENQ_SIZE_WRONG      || SEMAPHORE pending queue size outside allowed range 1 to 253&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SM_TA_MAX_NUM_REACHED   || Number of timed actions exceeds MAX allowed 255&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, param;&lt;br /&gt;
...&lt;br /&gt;
// Create semaphore called s_audi with max permits of 1000, starting permits of zero, max of 10 tasks on pending queue, and no timeouts &lt;br /&gt;
status = oceos_sem_create(s_audi, 1000, 0, 10, FALSE);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_sem_signal()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''semaphore.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function signals a semaphore, increments its count and transfers pending jobs to the ready queue.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Signals a semaphore, increments and transfers pending jobs to ready queue&lt;br /&gt;
 *&lt;br /&gt;
 * @param sem_id counting SEM ID&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          WARN_JOB_NOT_GUARDED&lt;br /&gt;
 *&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              SEM ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                SEM ID &amp;gt;= number of SEMs&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to grab SEM guard&lt;br /&gt;
 *          ERR_TOO_MANY                SEM max permits count already reached&lt;br /&gt;
 *          ERR_SM_JOB_ID_WRONG         Job ID of the task on SEM pending queue is wrong&lt;br /&gt;
 *          ERR_TA_NOT_FOUND            Timed action index to be removed for job not found&lt;br /&gt;
 *          ERR_TA_START_FAILED         Timed action re-start failed after job remove from timed action queue&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_sem_signal(&lt;br /&gt;
    sem_t sem_id // counting SEM ID&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| sem_id || U32_t value of semaphore to be signalled (incremented)&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| WARN_JOB_NOT_GUARDED        || job not guarded, application should check system log&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || SEM ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || SEM ID &amp;gt;= number of SEMs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to grab SEM guard&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TOO_MANY                || SEM max permits count already reached&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SM_JOB_ID_WRONG         || Job ID of the task on SEM pending queue is wrong&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_NOT_FOUND            || Timed action index to be removed for job not found&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_START_FAILED         || Timed action re-start failed after job remove from timed action queue&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Signal s_audi semaphore (increment its count)&lt;br /&gt;
status = oceos_sem_signal(s_audi);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_sem_wait_continue()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''semaphore.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function decrements the available permits of a sempahore otherwise returns an unsuccessful status code.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Wait on semaphore,&lt;br /&gt;
 * decrement the number of available permits for semaphore,&lt;br /&gt;
 * if no permits continue and task should handle unsuccessful result&lt;br /&gt;
 *&lt;br /&gt;
 * @param sem_id SEM ID&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              SEM ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                SEM ID &amp;gt;= number of SEMs&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to grab SEM guard&lt;br /&gt;
 *          ERR_SM_NOT_AVAILABLE        No more permits available for this SEM&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_sem_wait_continue(&lt;br /&gt;
    sem_t sem_id // counting SEM ID&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| sem_id || U32_t value of semaphore to be decremented&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || SEM ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || SEM ID &amp;gt;= number of SEMs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to grab SEM guard&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SM_NOT_AVAILABLE        || No more permits available for this SEM&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Decrement available permits on semaphore s_1&lt;br /&gt;
status = oceos_sem_wait_continue(s_1);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_sem_wait_restart()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''semaphore.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function decrements the available permits of a sempahore and if none available, the job is put on the pending queue.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Waits on semaphore,&lt;br /&gt;
 * if fail, put job on pending queue and exit task&lt;br /&gt;
 *&lt;br /&gt;
 * @param sem_id SEM ID&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              SEM ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                SEM ID &amp;gt;= number of SEMs&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to grab SEM guard&lt;br /&gt;
 *          ERR_SM_J_START_FROM_TIMOUT  Task started from timeout already, SEM no permits available second time&lt;br /&gt;
 *          ERR_FAILED                  Should never return this&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_sem_wait_restart(&lt;br /&gt;
    sem_t sem_id  // counting SEM ID&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| sem_id || U32_t value of semaphore to be decremented&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || SEM ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || SEM ID &amp;gt;= number of SEMs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to grab SEM guard&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SM_J_START_FROM_TIMOUT  || Task started from timeout already, SEM no permits available second time&lt;br /&gt;
|-&lt;br /&gt;
| ERR_FAILED                  || Should never return this&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Decrement available permits on semaphore s_1 otherwise job is put on pending queue&lt;br /&gt;
status = oceos_sem_wait_restart(s_1);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_sem_wait_restart_timeout()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''semaphore.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function decrements the available permits of a sempahore and if none available, the job is put on the pending queue with a timeout enabled. The job is restarted either when a permit is available to be decremented or when the timeout has expired. In order to use this directive, semaphore must be created with flag use_timeout is set to TRUE.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Waits on semaphore,&lt;br /&gt;
 * if fail, put job on pending queue with optional timeout.&lt;br /&gt;
 * In order to use this directive, semaphore must be created with&lt;br /&gt;
 * flag use_timeout is set to TRUE&lt;br /&gt;
 *&lt;br /&gt;
 * @param sem_id         SEM ID&lt;br /&gt;
 * @param U64_t timeout  Restart time if no permits, 0 =&amp;gt; ignore&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_TA_NOT_INIT             Timed action intialisation is not done and tried to be used; or SEM created without timeouts&lt;br /&gt;
 *          ERR_ID_INVALID              SEM ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                SEM ID &amp;gt;= number of SEMs&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to grab SEM guard&lt;br /&gt;
 *          ERR_SM_J_START_FROM_TIMOUT  Task started from timeout already, SEM no permits available second time&lt;br /&gt;
 *          ERR_TOO_MANY                SEM pending queue is full&lt;br /&gt;
 *          ERR_FAILED                  Should never return this&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_sem_wait_restart_timeout(&lt;br /&gt;
    sem_t sem_id, // counting SEM ID&lt;br /&gt;
    U64_t timeout // timeout, restart time if no permits, 0 =&amp;gt; ignore&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| sem_id || U32_t value of semaphore to be decremented&lt;br /&gt;
|-&lt;br /&gt;
| timeout | U64_t timeout in time units. A value of 0 causes timeout to be ignored.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_NOT_INIT             || Timed action intialisation is not done and tried to be used; or SEM created without&lt;br /&gt;
timeouts&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || SEM ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || SEM ID &amp;gt;= number of SEMs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to grab SEM guard&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SM_J_START_FROM_TIMOUT  || Task started from timeout already, SEM no permits available second time&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TOO_MANY                || SEM pending queue is full&lt;br /&gt;
|-&lt;br /&gt;
| ERR_FAILED                  || Should never return this&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Decrement available permits on semaphore s_1 otherwise job is put on pending queue with timeout of 10,000 time units (usually usecs)&lt;br /&gt;
status = oceos_sem_wait_restart_timeout(s_1);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_sem_get_value()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''semaphore.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the number of available permits for the specified semaphore.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Returns number of available permits&lt;br /&gt;
 * for SEM ID&lt;br /&gt;
 *&lt;br /&gt;
 * @param sem_id        SEM id&lt;br /&gt;
 * @param s_permits     pointer to permits count holder&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              SEM ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                SEM ID &amp;gt;= number of SEMs&lt;br /&gt;
 *          ERR_SM_DATA_BAD             Data holder pointer is null&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_sem_get_value(&lt;br /&gt;
    sem_t sem_id,    // counting SEM ID&lt;br /&gt;
    U32_t *s_permits // pointer to permits count holder&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| sem_id || U32_t value of semaphore whose permit count is required&lt;br /&gt;
|-&lt;br /&gt;
| s_permits || U32_t pointer to permits count holder&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || SEM ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || SEM ID &amp;gt;= number of SEMs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SM_DATA_BAD             || Data holder pointer is null&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, permit_count;&lt;br /&gt;
...&lt;br /&gt;
// Get the available permits for semaphore s_1&lt;br /&gt;
status = oceos_sem_get_value(s_1, &amp;amp;permit_count);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_sem_penq_get_size()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''semaphore.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the number of jobs on the specified semaphore pending queue.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Returns number of jobs on semaphore pending queue&lt;br /&gt;
 * for semaphore ID&lt;br /&gt;
 *&lt;br /&gt;
 * @param sem_id    SEM id&lt;br /&gt;
 * @param s_size    pointer to pending queue size holder&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              SEM ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                SEM ID &amp;gt;= number of SEMs&lt;br /&gt;
 *          ERR_SM_DATA_BAD             Data holder pointer is null&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_sem_penq_get_size(&lt;br /&gt;
    sem_t sem_id,   // counting SEM ID&lt;br /&gt;
    U32_t *s_size   // pointer to pending queue size holder&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| sem_id || U32_t value of semaphore whose permit count is required&lt;br /&gt;
|-&lt;br /&gt;
| s_size || U32_t pointer to pending queue jobs count holder&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || SEM ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || SEM ID &amp;gt;= number of SEMs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SM_DATA_BAD             || Data holder pointer is null&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, job_count;&lt;br /&gt;
...&lt;br /&gt;
// Get the available permits for semaphore s_1&lt;br /&gt;
status = oceos_sem_penq_get_size(s_1, &amp;amp;job_count);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_sem_reset()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''semaphore.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function restores the permits to the original semaphore initial value and removes any jobs from the pending queue.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Restore permits to original value and&lt;br /&gt;
 * remove jobs from pending queue&lt;br /&gt;
 *&lt;br /&gt;
 * @param sem_id    SEM ID&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              SEM ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                SEM ID &amp;gt;= number of SEMs&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to grab SEM guard&lt;br /&gt;
 *          ERR_SM_JOB_ID_WRONG         Job ID of the task on SEM pending queue is wrong&lt;br /&gt;
 *          ERR_TA_NOT_FOUND            Timed action index to be removed for job not found&lt;br /&gt;
 *          ERR_TA_START_FAILED         Timed action re-start failed after job remove from timed action queue&lt;br /&gt;
 */&lt;br /&gt;
S32_t   oceos_sem_reset(&lt;br /&gt;
    sem_t sem_id   // counting SEM ID&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| sem_id || U32_t value of semaphore to be reset&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || SEM ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || SEM ID &amp;gt;= number of SEMs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to grab SEM guard&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SM_JOB_ID_WRONG         || Job ID of the task on SEM pending queue is wrong&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_NOT_FOUND            || Timed action index to be removed for job not found&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_START_FAILED         || Timed action re-start failed after job remove from timed action queue&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Reset semaphore s_1&lt;br /&gt;
status = oceos_sem_reset(s_1);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Data Queues ==&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_dataq_create()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''dataq.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function creates a data queue with the specified characteristics.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Create data queue&lt;br /&gt;
 * If use_timeout = TRUE, timed actions must be initialised&lt;br /&gt;
 *&lt;br /&gt;
 * @param dataq_id      data queue ID&lt;br /&gt;
 * @param dataq_size    data queue size&lt;br /&gt;
 * @param pen_q_size    pending jobs queue size&lt;br /&gt;
 * @param roll_over     whether to roll over when full&lt;br /&gt;
 * @param use_timeout   if TRUE, directive oceos_dataq_read_restart_timeout can be used&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_WRONG_CPU_CORE          Executing directive on wrong CPU&lt;br /&gt;
 *          ERR_WRONG_PHASE             Called before oceos_init() is done&lt;br /&gt;
 *          ERR_TOO_MANY                MAX number of DATAQs already created&lt;br /&gt;
 *          ERR_ID_INVALID              DATAQ ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                DATAQ ID &amp;gt;= number of DATAQs&lt;br /&gt;
 *          ERR_DQ_ALREADY_ALLOCATED    DATAQ ID already used&lt;br /&gt;
 *          ERR_DQ_SIZE_WRONG           DATAQ size outside allowed range 1 to 255&lt;br /&gt;
 *          ERR_DQ_PENQ_SIZE_WRONG      DATAQ pending queue size outside allowed range 1 to 253&lt;br /&gt;
 *          ERR_DQ_TA_MAX_NUM_REACHED   Number of timed actions exceeds MAX allowed 255,&lt;br /&gt;
 *                                      each task on DATAQ pending queue is timed action&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_dataq_create(&lt;br /&gt;
                         dataq_t dataq_id,    // data queue ID&lt;br /&gt;
                         U16_t dataq_size,    // data queue size&lt;br /&gt;
                         U16_t pen_q_size,    // pending jobs queue size&lt;br /&gt;
                         BOOLE_t roll_over,   // whether to roll over when full&lt;br /&gt;
                         BOOLE_t use_timeout  // whether timeout is used oceos_dataq_read_restart_timeout&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| dataq_id ||   dataq_t data queue ID (number between 0 and 62)&lt;br /&gt;
|-&lt;br /&gt;
| dataq_size ||   data queue size (max number of pointers than can be added to the queue)&lt;br /&gt;
|-&lt;br /&gt;
| pen_q_size ||   pending jobs queue size&lt;br /&gt;
|-&lt;br /&gt;
| roll_over ||    whether to roll over when full (0 =&amp;gt; disabled, 1 =&amp;gt; enabled)&lt;br /&gt;
|-&lt;br /&gt;
| use_timeout ||  if TRUE, directive oceos_dataq_read_restart_timeout can be used&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_CPU_CORE          || Executing directive on wrong CPU&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Called before oceos_init() is done&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TOO_MANY                || MAX number of DATAQs already created&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || DATAQ ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || DATAQ ID &amp;gt;= number of DATAQs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DQ_ALREADY_ALLOCATED    || DATAQ ID already used&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DQ_SIZE_WRONG           || DATAQ size outside allowed range 1 to 255&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DQ_PENQ_SIZE_WRONG      || DATAQ pending queue size outside allowed range 1 to 253&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DQ_TA_MAX_NUM_REACHED   || Number of timed actions exceeds MAX allowed 255, each task on DATAQ pending queue is timed action&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Create data queue d_3 with size 20, max pending jobs of 10, rollover enabled, timeouts disabled &lt;br /&gt;
status = oceos_dataq_create(d_3, 20, 10, 1, 0));&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_dataq_write()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''dataq.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function puts a non-null pointer on the specified data queue.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Puts pointer to the data on data queue.&lt;br /&gt;
 * Pointer to the data must not be NULL&lt;br /&gt;
 *&lt;br /&gt;
 * @param dataq_t dataq_id Data queue ID&lt;br /&gt;
 * @param void* data       Non-null pointer to data&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          WARN_DQ_NOW_FULL            Warning, DATAQ is full now&lt;br /&gt;
 *          WARN_JOB_NOT_GUARDED&lt;br /&gt;
 *&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              DATAQ ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                DATAQ ID &amp;gt;= number of DATAQs&lt;br /&gt;
 *          ERR_DQ_DATA_BAD             Data pointer is null&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to acquire guard&lt;br /&gt;
 *          ERR_TOO_MANY                DATAQ is full&lt;br /&gt;
 *          ERR_DQ_JOB_ID_WRONG         Job ID of the task on pending queue is wrong&lt;br /&gt;
 *          ERR_TA_NOT_FOUND            Timed action index to be removed for job not found&lt;br /&gt;
 *          ERR_TA_START_FAILED         Timed action re-start failed after job remove from timed action queue&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_dataq_write(&lt;br /&gt;
    dataq_t dataq_id, // data queue ID&lt;br /&gt;
    void *data        // non-null pointer to data&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| dataq_id || dataq_t with value of Data queue ID&lt;br /&gt;
|-&lt;br /&gt;
| ptr || void* pointer to application data (non-null pointer)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| WARN_DQ_NOW_FULL            || Warning, DATAQ is full now&lt;br /&gt;
|-&lt;br /&gt;
| WARN_JOB_NOT_GUARDED        || &lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || DATAQ ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || DATAQ ID &amp;gt;= number of DATAQs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DQ_DATA_BAD             || Data pointer is null&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to acquire guard&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TOO_MANY                || DATAQ is full&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DQ_JOB_ID_WRONG         || Job ID of the task on pending queue is wrong&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_NOT_FOUND            || Timed action index to be removed for job not found&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_START_FAILED         || Timed action re-start failed after job remove from timed action queue&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
char[100] message_in;&lt;br /&gt;
...&lt;br /&gt;
// Put pointer to message_in on data queue s_2 &lt;br /&gt;
status = oceos_dataq_write(s_2, (void *)message_in);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_dataq_read_continue()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''dataq.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns a pointer from the specified data queue.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Read data queue&lt;br /&gt;
 *&lt;br /&gt;
 * @param dataq_t dataq_id  Data queue ID&lt;br /&gt;
 * @param void*   data      Pointer to data&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              DATAQ ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                DATAQ ID &amp;gt;= number of DATAQs&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to acquire guard&lt;br /&gt;
 *          ERR_DQ_EMPTY                DATAQ empty(count zero)&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_dataq_read_continue(&lt;br /&gt;
    dataq_t dataq_id, // data queue ID&lt;br /&gt;
    void* *data        // return data&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Descriptionn&lt;br /&gt;
|-&lt;br /&gt;
| dataq_id || dataq_t with value of Data queue ID&lt;br /&gt;
|-&lt;br /&gt;
| ptr || void* pointer to store returned data queue pointer removed from the queue&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || DATAQ ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || DATAQ ID &amp;gt;= number of DATAQs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to acquire guard&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DQ_EMPTY                || DATAQ empty(count zero)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
char *data_ptr;&lt;br /&gt;
...&lt;br /&gt;
// Read pointer from data queue s_2 &lt;br /&gt;
status = oceos_dataq_read_continue(s_2, (void *)data_ptr);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_dataq_read_restart()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''dataq.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns a pointer from the specified data queue. If the queue is empty, the job is added top the dataq pending queue. The job will be restarted when data is available. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Read data queue next item.&lt;br /&gt;
 * If dataq is empty, task is put on pending Q for dataq and&lt;br /&gt;
 * restarted by oceos_dataq_write&lt;br /&gt;
 *&lt;br /&gt;
 * @param dataq_id Data queue ID&lt;br /&gt;
 * @param data     Pointer to return data&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              DATAQ ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                DATAQ ID &amp;gt;= number of DATAQs&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to acquire guard&lt;br /&gt;
 *          ERR_DQ_J_START_FROM_TIMOUT  Job started from timeout already, DATAQ empty second time&lt;br /&gt;
 *          ERR_FAILED                  Should never return this&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_dataq_read_restart(&lt;br /&gt;
    dataq_t dataq_id,    // data queue ID&lt;br /&gt;
    void* *data           // pointer to return data&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| dataq_id || dataq_t with value of Data queue ID&lt;br /&gt;
|-&lt;br /&gt;
| ptr || void* pointer to store returned data queue pointer removed from the queue&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || DATAQ ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || DATAQ ID &amp;gt;= number of DATAQs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to acquire guard&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DQ_J_START_FROM_TIMOUT  || Job started from timeout already, DATAQ empty second time&lt;br /&gt;
|-&lt;br /&gt;
| ERR_FAILED                  || Should never return this&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
char *data_ptr;&lt;br /&gt;
...&lt;br /&gt;
// Read pointer from data queue s_2 with restart when data is available&lt;br /&gt;
status = oceos_dataq_read_restart(s_2, (void *)data_ptr);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_dataq_read_restart_timeout()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''dataq.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns a pointer from the specified data queue. If the queue is empty, the job is added top the dataq pending queue. The job will be restarted either when data is available or the timeout has expired. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Read data queue next item.&lt;br /&gt;
 * If dataq is empty, task is put on pending Q for dataq and&lt;br /&gt;
 * restarted by oceos_dataq_write or by timeout if timeout != 0&lt;br /&gt;
 * In order to use this feature timed actions must be configured and&lt;br /&gt;
 * dataq created with use timeout set to true&lt;br /&gt;
 *&lt;br /&gt;
 * @param dataq_id          Data queue ID&lt;br /&gt;
 * @param data              Pointer to return data&lt;br /&gt;
 * @param timeout           Timeout, restart time if no entry, 0 =&amp;gt; ignore&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_TA_NOT_INIT             Timed action intialisation is not done and tried to be used; or DATAQ created without timeouts&lt;br /&gt;
 *          ERR_ID_INVALID              DATAQ ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                DATAQ ID &amp;gt;= number of DATAQs&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to acquire guard&lt;br /&gt;
 *          ERR_DQ_EMPTY                DATAQ empty(count zero)&lt;br /&gt;
 *          ERR_DQ_J_START_FROM_TIMOUT  Job started from timeout already, DATAQ empty second time&lt;br /&gt;
 *          ERR_TOO_MANY                DATAQ pending queue is full&lt;br /&gt;
 *          ERR_FAILED                  Should never return this&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_dataq_read_restart_timeout(&lt;br /&gt;
    dataq_t dataq_id,   // data queue ID&lt;br /&gt;
    void* *data,         // Pointer to return data&lt;br /&gt;
    U64_t timeout       // timeout, restart time if no entry, 0 =&amp;gt; ignore&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| dataq_id || dataq_t with value of Data queue ID&lt;br /&gt;
|-&lt;br /&gt;
| ptr || void* pointer to store returned data queue pointer removed from the queue&lt;br /&gt;
|-&lt;br /&gt;
| timeout || U64_t containing timeout value, restart time if no entry, 0 =&amp;gt; ignore&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_NOT_INIT             || Timed action intialisation is not done and tried to be used; or DATAQ created without timeouts&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || DATAQ ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || DATAQ ID &amp;gt;= number of DATAQs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to acquire guard&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DQ_EMPTY                || DATAQ empty(count zero)&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DQ_J_START_FROM_TIMOUT  || Job started from timeout already, DATAQ empty second time&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TOO_MANY                || DATAQ pending queue is full&lt;br /&gt;
|-&lt;br /&gt;
| ERR_FAILED                  || Should never return this&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
char *data_ptr;&lt;br /&gt;
...&lt;br /&gt;
// Read pointer from data queue s_2 with timeout after 10,000 time units if no data is available&lt;br /&gt;
status = oceos_dataq_read_restart_timeout(s_2, (void *)data_ptr, 10000ull);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_dataq_get_size()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''dataq.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the number of items on the specified data queue.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Returns number of items on the data queue with ID&lt;br /&gt;
 *&lt;br /&gt;
 * @param dataq_id   DATAQ Id&lt;br /&gt;
 * @param d_size     Pointer to size holder&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              DATAQ ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                DATAQ ID &amp;gt;= number of DATAQs&lt;br /&gt;
 *          ERR_DQ_DATA_BAD             DATAQ size holder pointer is null&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_dataq_get_size(&lt;br /&gt;
    dataq_t dataq_id,   // data queue ID&lt;br /&gt;
    U32_t *d_size&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| dataq_id ||  dataq_t with the ID of the data queue (value between 0 and 62)&lt;br /&gt;
|-&lt;br /&gt;
| d_size || U32_t *d_size pointer to the variable to store the size&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || DATAQ ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || DATAQ ID &amp;gt;= number of DATAQs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DQ_DATA_BAD             || DATAQ size holder pointer is null&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, d_size;&lt;br /&gt;
...&lt;br /&gt;
// Get the number of entries on data queue d_0&lt;br /&gt;
status = oceos_dataq_get_size(d_0, &amp;amp;d_size);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_dataq_penq_get_size()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''dataq.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns number of jobs on the specified data queue pending job's queue.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Returns number of jobs on the dataq pending job's queue&lt;br /&gt;
 *&lt;br /&gt;
 * @param dataq_id  DATAQ Id&lt;br /&gt;
 * @param d_size    Pointer to pending queue size holder&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              DATAQ ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                DATAQ ID &amp;gt;= number of DATAQs&lt;br /&gt;
 *          ERR_DQ_DATA_BAD             DATAQ pending size holder pointer is null&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_dataq_penq_get_size(&lt;br /&gt;
    dataq_t dataq_id,&lt;br /&gt;
    U32_t *d_size&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| dataq_id ||  dataq_t with the ID of the data queue (value between 0 and 62)&lt;br /&gt;
|-&lt;br /&gt;
| d_jobs || U32_t *d_jobs pointer to the variable to store the number of jobs on the pending queue&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || DATAQ ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || DATAQ ID &amp;gt;= number of DATAQs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DQ_DATA_BAD             || DATAQ pending size holder pointer is null&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, d_jobs;&lt;br /&gt;
...&lt;br /&gt;
// Get the number of jobs the the pending jubs queue for data queue d_1&lt;br /&gt;
status = oceos_dataq_penq_get_size(d_1, &amp;amp;d_jobs);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_dataq_clear()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''dataq.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function clears the specified data queue including pending jobs for that queue.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Clears data queue and&lt;br /&gt;
 * frees tasks on pending queue&lt;br /&gt;
 *&lt;br /&gt;
 * @param dataq_t dataq_id Data queue ID&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              DATAQ ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                DATAQ ID &amp;gt;= number of DATAQs&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to acquire guard&lt;br /&gt;
 *          ERR_DQ_JOB_ID_WRONG         Job ID of the task on DATAQ pending queue is wrong&lt;br /&gt;
 *          ERR_TA_NOT_FOUND            Timed action index to be removed for job not found&lt;br /&gt;
 *          ERR_TA_START_FAILED         Timed action re-start failed after job remove from timed action queue&lt;br /&gt;
 */&lt;br /&gt;
S32_t  oceos_dataq_clear(&lt;br /&gt;
    dataq_t dataq_id    // data queue ID&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| dataq_id ||  dataq_t with the ID of the data queue to be cleared (value between 0 and 62)&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || DATAQ ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || DATAQ ID &amp;gt;= number of DATAQs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to acquire guard&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DQ_JOB_ID_WRONG         || Job ID of the task on DATAQ pending queue is wrong&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_NOT_FOUND            || Timed action index to be removed for job not found&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_START_FAILED         || Timed action re-start failed after job remove from timed action queue&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Clear data queue d_1&lt;br /&gt;
status = oceos_dataq_penq_get_size(d_1);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Timed Actions ==&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_timed_output_add()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''timed_action.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function adds a timed action to the timed action queue. It writes a value to an address at a specified system time. An optional mask can be applied so that only those bits are changed.&lt;br /&gt;
The action types are WRITE_ACTION, RMW_ACTION. WRITE_ACTION writes the value to the address. RMW_ACTION reads the values at the address and modifies the bits specified by the mask and value.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Add output action to timed actions queue :&lt;br /&gt;
 *  1. Create timed output action&lt;br /&gt;
 *  2. Stop timer&lt;br /&gt;
 *  3. Add action to action_array&lt;br /&gt;
 *  4. Start timer or execute if time is right&lt;br /&gt;
 *&lt;br /&gt;
 * Returns timed action ID that can be used later to remove&lt;br /&gt;
 * if need by oceos_timed_output_remove&lt;br /&gt;
 *&lt;br /&gt;
 * @param enum ACTION_TYPE action_type  Action type&lt;br /&gt;
 * @param U64_t act_time                System time at which action should be done&lt;br /&gt;
 * @param U32_t before_time             Forward tolerance for time&lt;br /&gt;
 * @param U32_t after_time              Backward tolerance for time&lt;br /&gt;
 * @param adrs_t address                Output address&lt;br /&gt;
 * @param U32_t value                   Output value&lt;br /&gt;
 * @param U32_t mask                    Output mask&lt;br /&gt;
 * @param U32_ *ta_index                Pointer to store timed action index&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_TA_NOT_INIT             Timed action inialisation is not done and tried to be used&lt;br /&gt;
 *          ERR_TA_PTR_BAD              Timed action pointer is null&lt;br /&gt;
 *          ERR_TA_TYPE_WRONG           Timed action type is wrong&lt;br /&gt;
 *          ERR_TOO_LATE                Timed action time is too late&lt;br /&gt;
 *          ERR_SYS_BUSY                Timed action guard failed to acquire&lt;br /&gt;
 *          ERR_TA_Q_FULL               Timed action queue is full&lt;br /&gt;
 *          ERR_TA_START_FAILED         Timed action execute failed; See log&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_timed_output_add(&lt;br /&gt;
    const enum ACTION_TYPE action_type,// Action type&lt;br /&gt;
    U64_t act_time,                    // system time at which action should be done&lt;br /&gt;
    U32_t before_time,                 // forward tolerance for time&lt;br /&gt;
    U32_t after_time,                  // backward tolerance for time&lt;br /&gt;
    const adrs_t address,              // output address&lt;br /&gt;
    const U32_t value,                 // output value&lt;br /&gt;
    const U32_t mask,                  // output mask&lt;br /&gt;
    U32_t *ta_index                    // Pointer to store timed action index&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| enum ACTION_TYPE action_type  || Action type&lt;br /&gt;
|-&lt;br /&gt;
| U64_t act_time                || System time at which action should be done&lt;br /&gt;
|-&lt;br /&gt;
| U32_t before_time             || Forward tolerance for time&lt;br /&gt;
|-&lt;br /&gt;
| U32_t after_time              || Backward tolerance for time&lt;br /&gt;
|-&lt;br /&gt;
| adrs_t address                || Output address&lt;br /&gt;
|-&lt;br /&gt;
| U32_t value                   || Output value&lt;br /&gt;
|-&lt;br /&gt;
| U32_t mask                    || Output mask&lt;br /&gt;
|-&lt;br /&gt;
| U32_ *ta_index                || Pointer to store timed action index&lt;br /&gt;
|-&lt;br /&gt;
| param || parameter to function&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_NOT_INIT             || Timed action inialisation is not done and tried to be used&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_PTR_BAD              || Timed action pointer is null&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_TYPE_WRONG           || Timed action type is wrong&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TOO_LATE                || Timed action time is too late&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Timed action guard failed to acquire&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_Q_FULL               || Timed action queue is full&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_START_FAILED         || Timed action execute failed; See log&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
#define OUTPUT_TIMED_VAL    0xDEADBEEF&lt;br /&gt;
#define OUTPUT_TIMED_MASK   0x1000001&lt;br /&gt;
#define OUTPUT_TIME         0xfffff&lt;br /&gt;
#define OUTPUT_TIME_FW      0x1000&lt;br /&gt;
#define OUTPUT_TIME_BW      0x1000&lt;br /&gt;
&lt;br /&gt;
static U32_t test_data[16] = { 0 };&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Write OUTPUT_TIMED_VAL to test_data[0] at 0xfffff time units from now with a tolerance of 0x1000 before and after the specified time   &lt;br /&gt;
status = oceos_timed_output_add(&lt;br /&gt;
                                       WRITE_ACTION,&lt;br /&gt;
                                       OUTPUT_TIME,&lt;br /&gt;
                                       OUTPUT_TIME_FW,&lt;br /&gt;
                                       OUTPUT_TIME_BW,&lt;br /&gt;
                                       (adrs_t) &amp;amp;test_data[0],&lt;br /&gt;
                                       OUTPUT_TIMED_VAL,&lt;br /&gt;
                                       0,&lt;br /&gt;
                                       &amp;amp;timed_action_index));&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_timed_jobs_number()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''timed_action.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the number of jobs on the timed actions queue.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Get number of Jobs (request to start the task) waiting on timed action queue.&lt;br /&gt;
 * These jobs are added by oceos_task_timed_start() or&lt;br /&gt;
 * oceos_dataq_read_restart_timeout when data is not available (NULL) or&lt;br /&gt;
 * oceos_sem_wait_restart_timeout when counting semaphore is 0&lt;br /&gt;
 *&lt;br /&gt;
 * @param total_jobs    Pointer to store total jobs number waiting on timed action Q&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_TA_NOT_INIT             Timed action inialisation is not done and tried to be used&lt;br /&gt;
 *          ERR_TA_PTR_BAD              Timed action pointer is null&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_timed_jobs_number(U32_t *total_jobs);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| total_jobs || s32_t pointer to store total jobs number waiting on timed action Q&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_NOT_INIT             || Timed action inialisation is not done and tried to be used&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_PTR_BAD              || Timed action pointer is null&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, no_of_jobs;&lt;br /&gt;
...&lt;br /&gt;
// Get the number of jobs on the timed actions queue&lt;br /&gt;
status = oceos_timed_jobs_number(&amp;amp;no_of_jobs);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_timed_jobs_remove()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''timed_action.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function removes the specified timed action from the queue.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Remove job from timed action queue&lt;br /&gt;
 * When task started using oceos_task_timed_start(),&lt;br /&gt;
 * this directive requires pointer to store ID&lt;br /&gt;
 * of job that put on the timed action queue.&lt;br /&gt;
 * This job can be removed later using this directive and stored job ID.&lt;br /&gt;
 *&lt;br /&gt;
 * @param U32_t job_id  Job ID&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_TA_NOT_INIT             Timed action intialisation is not done and tried to be used&lt;br /&gt;
 *          ERR_TA_PTR_BAD              Timed action pointer corrupt&lt;br /&gt;
 *          ERR_ID_WRONG                Job ID is wrong&lt;br /&gt;
 *          ERR_TA_NOT_FOUND            Timed action ID not found for action with job_id or removed already&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to acquire timed action guard&lt;br /&gt;
 *          WARN_TA_Q_EMPTY             Timed action queue is empty&lt;br /&gt;
 *          ERR_TA_START_FAILED         Timed action execute failed; See log&lt;br /&gt;
 */&lt;br /&gt;
S32_t   oceos_timed_jobs_remove(&lt;br /&gt;
    U32_t job_id                             // Job ID&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| job_id || U32_t Job ID to be removed from the timed actions queue&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_NOT_INIT             || Timed action intialisation is not done and tried to be used&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_PTR_BAD              || Timed action pointer corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || Job ID is wrong&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_NOT_FOUND            || Timed action ID not found for action with job_id or removed already&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to acquire timed action guard&lt;br /&gt;
|-&lt;br /&gt;
| WARN_TA_Q_EMPTY             || Timed action queue is empty&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_START_FAILED         || Timed action execute failed; See log&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, job_id;&lt;br /&gt;
...&lt;br /&gt;
// Remove job_id from the timed actions queue&lt;br /&gt;
status = oceos_timed_jobs_remove(job_id);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_timed_jobs_reset()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''timed_action.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function removes all jobs from timed actions queue.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Remove all jobs (requests to start a task) from timed actions queue&lt;br /&gt;
 * These jobs were added by oceos_task_timed_start() or&lt;br /&gt;
 * oceos_dataq_read_restart_timeout when data is not available (NULL) or&lt;br /&gt;
 * oceos_sem_wait_restart_timeout when counting semaphore is 0&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_TA_NOT_INIT             Timed action intialisation is not done and tried to be used&lt;br /&gt;
 *          ERR_TA_PTR_BAD              Timed action pointer is null&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to acquire timed action guard&lt;br /&gt;
 *          WARN_TA_Q_EMPTY             Timed action queue is empty&lt;br /&gt;
 *          ERR_TA_NOT_FOUND            Timed action index not found&lt;br /&gt;
 *          ERR_TA_START_FAILED         Timed action execute failed; See log&lt;br /&gt;
 */&lt;br /&gt;
S32_t   oceos_timed_jobs_reset(void);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
There are no input parameters to this function&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_NOT_INIT             || Timed action intialisation is not done and tried to be used&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_PTR_BAD              || Timed action pointer is null&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to acquire timed action guard&lt;br /&gt;
|-&lt;br /&gt;
| WARN_TA_Q_EMPTY             || Timed action queue is empty&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_NOT_FOUND            || Timed action index not found&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_START_FAILED         || Timed action execute failed; See log&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Remove all jobs from the timed actions queue&lt;br /&gt;
status = oceos_timed_jobs_reset(job_id);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_timed_output_remove()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''timed_action.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function removes the specified timed output action from timed actions queue.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Remove timed output action from timed actions queue.&lt;br /&gt;
 * When action is created, action index should be stored&lt;br /&gt;
 * to remove if need&lt;br /&gt;
 *&lt;br /&gt;
 * @param action_index&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_TA_NOT_INIT             Timed action intialisation is not done and tried to be used&lt;br /&gt;
 *          ERR_TA_PTR_BAD              Timed action pointer is null&lt;br /&gt;
 *          ERR_ID_WRONG                Timed action id is wrong&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to acquire timed action guard&lt;br /&gt;
 *          ERR_TA_NOT_FOUND            Timed action index not found&lt;br /&gt;
 *          ERR_TA_START_FAILED         Timed action execute failed&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_timed_output_remove(&lt;br /&gt;
    const U8_t  action_index    // Index in action array, returned when action was created&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| action_index|| S32_t specifying the timed output action index returned when the timed output was added.&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| Error bit  || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_NOT_INIT             || Timed action intialisation is not done and tried to be used&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_PTR_BAD              || Timed action pointer is null&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || Timed action id is wrong&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to acquire timed action guard&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_NOT_FOUND            || Timed action index not found&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_START_FAILED         || Timed action execute failed&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
U8_t action_index;&lt;br /&gt;
...&lt;br /&gt;
// Remove timed output with specified action_index&lt;br /&gt;
status = oceos_timed_output_remove(action_index);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_timed_output_reset()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''timed_action.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function removes all timed output actions from timed actions queue.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Remove all timed output actions from timed actions queue&lt;br /&gt;
 * These timed output actions were created by oceos_timed_output_add&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_TA_NOT_INIT             Timed action intialisation is not done and tried to be used&lt;br /&gt;
 *          ERR_TA_PTR_BAD              Timed action pointer is null&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to acquire timed action guard&lt;br /&gt;
 *          WARN_TA_Q_EMPTY             Timed action queue is empty&lt;br /&gt;
 *          ERR_TA_NOT_FOUND            Timed action index not found&lt;br /&gt;
 *          ERR_TA_START_FAILED         Timed action execute failed; See log&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_timed_output_reset(void);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
There are no input parameters to this function. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| Error bit  || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_NOT_INIT             || Timed action intialisation is not done and tried to be used&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_PTR_BAD              || Timed action pointer is null&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to acquire timed action guard&lt;br /&gt;
|-&lt;br /&gt;
| WARN_TA_Q_EMPTY             || Timed action queue is empty&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_NOT_FOUND            || Timed action index not found&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_START_FAILED         || Timed action execute failed; See log&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Remove all timed outputs from the timed actions queue&lt;br /&gt;
status = oceos_timed_output_reset();&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Logging directives ==&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;Introduction&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Log Area Features  (for details of other areas see oceos_areas.h)&lt;br /&gt;
&lt;br /&gt;
The system log area holds the system log and the records of the present and previous values of the system state variable.&lt;br /&gt;
&lt;br /&gt;
It is set up initially as an array of 32-bit words that starts at a 32-bit aligned address provided by the application developer.&lt;br /&gt;
&lt;br /&gt;
It is recommended that this address be in non-volatile RAM memory if this is available to allow information be preserved across power-up cycles.&lt;br /&gt;
&lt;br /&gt;
OCEOS preserves log area information across resets as far as possible.&lt;br /&gt;
&lt;br /&gt;
The system log itself is a circular buffer of struct log entry. Older entries are overwritten by new entries once all entries are in use.&lt;br /&gt;
&lt;br /&gt;
The application developer can specify a function to be called when 3/4 of log entries are in use. This function is called again only after 3/4 of log entries have been read and the log has again become 3/4 full.&lt;br /&gt;
&lt;br /&gt;
The read and write indices are stored in the log area and if equal indicate that the log is empty.&lt;br /&gt;
&lt;br /&gt;
As with other OCEOS data areas, the log area starts with a header&lt;br /&gt;
*a 32-bit word holding a constant OCEOS_VERSION&lt;br /&gt;
*a 32-bit word holding the log area size in 32-bit words&lt;br /&gt;
*a 32-bit word, the system status variable&lt;br /&gt;
*a 32-bit word, the system status mask&lt;br /&gt;
*a 32-bit word, the accumulated system status&lt;br /&gt;
*a 32-bit word, the previous system status mask&lt;br /&gt;
*a 32-bit word, the log control, that gives whether the log full function was called&lt;br /&gt;
*the read index&lt;br /&gt;
*the write index&lt;br /&gt;
*an array of struct log_entry making up the system log itself&lt;br /&gt;
*ending with a 32-bit constant END_SENTINEL&lt;br /&gt;
&lt;br /&gt;
The system fixed meta structure at sysMetaPtr provides&lt;br /&gt;
&lt;br /&gt;
*system_log_ptr      the start address of the log area&lt;br /&gt;
*logEntries          the number of log entries&lt;br /&gt;
*logCreated          flag indicating log was created successfully&lt;br /&gt;
*logFullFunction     user defined function, called when the log becomes 3/4 full (or NULL if not used)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Log Entry Types and Structure'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/*****************************************************************************&lt;br /&gt;
 * LOG ENTRY TYPES&lt;br /&gt;
 *&lt;br /&gt;
 * A log entry type is an 8-bit number.&lt;br /&gt;
 * Values from 0 to 127 can be defined by the application.&lt;br /&gt;
 * Values from 128 to 255 are used by OCEOS as below.&lt;br /&gt;
 *&lt;br /&gt;
 *&lt;br /&gt;
 * NOTE: Add new log types at the end for backward compatibility&lt;br /&gt;
 */&lt;br /&gt;
enum LOG_ENTRY_TYPE{&lt;br /&gt;
  LOG_SYS_OK = 0x80U,&lt;br /&gt;
  LOG_OCEOS_ABORT,				// when exiting from oceos_start&lt;br /&gt;
  LOG_LOG_NOT_VALID_ENTRY,		// used to initialise log and when log empty&lt;br /&gt;
  LOG_INIT_TASK_START_FAIL,		// initial task passed to oceos_start failed&lt;br /&gt;
  LOG_DEADLINE_MISSED,			// task deadline missed&lt;br /&gt;
  LOG_JOB_NOT_ACTIVE,			// cpu_terminate but job not active, absurd&lt;br /&gt;
  LOG_JOB_NOT_FREE,				// job guarded but not free&lt;br /&gt;
  LOG_JOBS_INC_FAILED, 			// pending jobs increment failed&lt;br /&gt;
  LOG_JOB_NOT_GUARDED,			// paranoia&lt;br /&gt;
  LOG_CS_LOG_SPIN_FAIL,			// oceos_CPU_sleep, trying to update CS log&lt;br /&gt;
  LOG_MUTEX_ALREADY_HELD,		// oceos_mutex_wait, code returned, not needed&lt;br /&gt;
  LOG_MUTEX_INCORRECT_ORDER,	// oceos_mutex_wait&lt;br /&gt;
  LOG_MUTEX_EXIT_HOLDING,		// task exits holding one or more mutexes&lt;br /&gt;
  LOG_MUTEX_EXIT_NONE,			// __oceos_tasks_remove_mutexes called but no mutex held&lt;br /&gt;
  LOG_SEMAPHORE_PENDING_REMOVE_FAIL,	// timed_action.c&lt;br /&gt;
  LOG_SEMAPHORE_PENDING_QUEUE_FULL,		// __oceos_semaphore_add_pend&lt;br /&gt;
  LOG_SEMAPHORE_SPIN_FAILED,			// trying to access semaphore&lt;br /&gt;
  LOG_DATAQ_PENDING_QUEUE_FULL,&lt;br /&gt;
  LOG_DATAQ_PENDING_REMOVE_FAIL,&lt;br /&gt;
  LOG_DATAQ_SPIN_FAILED,&lt;br /&gt;
  LOG_TIMED_ACTION_TIMER_NULL,&lt;br /&gt;
  LOG_TIMED_ACTION_INVALID,&lt;br /&gt;
  LOG_TIMED_ACTION_BAD_INDEX,&lt;br /&gt;
  LOG_TIMED_ACTION_MISSED,&lt;br /&gt;
  LOG_TIMED_ACTION_Q_EMPTY,&lt;br /&gt;
  LOG_TIMED_ACTION_REMOVE_FAIL,&lt;br /&gt;
  LOG_TIMED_ACTION_BAD_JOB_ID,&lt;br /&gt;
  LOG_TIMED_Q_SPIN_FAIL,&lt;br /&gt;
  LOG_SYSTEM_ERROR,&lt;br /&gt;
  LOG_ATOMICINC_FAILED,&lt;br /&gt;
  LOG_PENDING_PRI_UPDATE_FAILED,&lt;br /&gt;
  LOG_KILL_TASK_INVALID_ID,      // Tried to kill task with invalid ID&lt;br /&gt;
  LOG_OCEOS_EXIT_REQUEST,         // oceos_exit command was called&lt;br /&gt;
  LOG_RWMUTEX_NOT_RETURNED,&lt;br /&gt;
  LOG_RWMUTEX_NOT_HIGHEST&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
/*****************************************************************************&lt;br /&gt;
 * Structures&lt;br /&gt;
 */&lt;br /&gt;
/**&lt;br /&gt;
 * Log entry structure&lt;br /&gt;
 */&lt;br /&gt;
struct log_entry{&lt;br /&gt;
  U64_t             time64;&lt;br /&gt;
&lt;br /&gt;
  unsigned int      entry_cpu          :8;&lt;br /&gt;
  unsigned int      entry_type         :8;&lt;br /&gt;
  unsigned int      entry_note         :16;	// not used at present&lt;br /&gt;
&lt;br /&gt;
  U32_t             entry_comment;&lt;br /&gt;
}__attribute__ ((aligned (8)));&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_log_add_entry()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''system_log.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function adds an entry to the log. The entry overwrites the oldest unread entry if the log is full.&lt;br /&gt;
Custom log entries can be added to enum LOG_ENTRY from 0 to 128.&lt;br /&gt;
The indices are incremented in a circular fashion. If the write index reaches the read_index the read index is moved on, as read and write indices equal would indicate an empty log.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Add an entry to the log.&lt;br /&gt;
 * this overwrites the oldest unread entry if the log is full.&lt;br /&gt;
 * Custom log entries can be added to enum LOG_ENTRY from 0 to 128&lt;br /&gt;
 *&lt;br /&gt;
 * N.B. The indices are incremented in a circular fashion.&lt;br /&gt;
 *      If the write index reaches the read_index the read index is moved on,&lt;br /&gt;
 *      as read and write indices equal would indicate an empty log.&lt;br /&gt;
 *&lt;br /&gt;
 * @param type  enum LOG_ENTRY_TYPE&lt;br /&gt;
 * @param info  extra information to be logged&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_LOG_CORRUPT         System Log area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Log directive called in wrong phase; can be used after oceos_init() called&lt;br /&gt;
 *          ERR_ID_INVALID              Log type invalid&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to acquire log guard&lt;br /&gt;
 *          ERR_LOG_INDEX_WRONG         Read/write log index is wrong&lt;br /&gt;
 */&lt;br /&gt;
S32_t   oceos_log_add_entry(&lt;br /&gt;
    enum LOG_ENTRY_TYPE type,   // 8 bits enum LOG_ENTRY_TYPE&lt;br /&gt;
    const U32_t        info     // information&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| enum LOG_ENTRY_TYPE || Log entry type (see previous section for a list)&lt;br /&gt;
|-&lt;br /&gt;
| info | U32_t with the log information&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit  !! Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_LOG_CORRUPT         || System Log area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Log directive called in wrong phase; can be used after oceos_init() called&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || Log type invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to acquire log guard&lt;br /&gt;
|-&lt;br /&gt;
| ERR_LOG_INDEX_WRONG         || Read/write log index is wrong&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, info;&lt;br /&gt;
...&lt;br /&gt;
// Log LOG_APP_COMMS__ERROR (defined in enum LOG_ENTRY_TYPE) and info with more details&lt;br /&gt;
status = oceos_log_add_entry(LOG_APP_COMMS__ERROR, info);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_log_get_indexed_entry()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''system_log.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the entry at the specified position in the log. The entry is not removed and the log and log indices are not changed.&lt;br /&gt;
One use of this function is to allow the log be examined after a reset.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Returns the entry at the specified position in the log.&lt;br /&gt;
 * The entry is not removed and the log and log indices are not changed.&lt;br /&gt;
 * (intended to allow the log be examined for example after reset)&lt;br /&gt;
 *&lt;br /&gt;
 * @param index         position in the log&lt;br /&gt;
 * @param outputPtr     pointer to return log entry&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_LOG_CORRUPT         System Log area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Log directive called in wrong phase; can be used after oceos_init() called&lt;br /&gt;
 *          ERR_LOG_INDEX_WRONG         Read log index is wrong&lt;br /&gt;
 *          ERR_LOG_DATA_PTR_BAD        Data holder pointer is null&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_log_get_indexed_entry(&lt;br /&gt;
    const unsigned int index,&lt;br /&gt;
    struct log_entry * const outputPtr&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| index || U32_t with position in the log&lt;br /&gt;
|-&lt;br /&gt;
| outputPtr || pointer to struct log_entry to hold the returned entry&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit  !! Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_LOG_CORRUPT         || System Log area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Log directive called in wrong phase; can be used after oceos_init() called&lt;br /&gt;
|-&lt;br /&gt;
| ERR_LOG_INDEX_WRONG         || Read log index is wrong&lt;br /&gt;
|-&lt;br /&gt;
| ERR_LOG_DATA_PTR_BAD        || Data holder pointer is null&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, index;&lt;br /&gt;
struct log_entry store_entry;&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
// Read log_entry at specified index into outputPtr&lt;br /&gt;
status = oceos_log_get_indexed_entry(index, &amp;amp;store_entry);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_log_remove_entry()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''system_log.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function reads and removes the oldest unread log entry. &lt;br /&gt;
If the log is not empty use the entry at the read index to update the value at the output pointer, returning OCEOS_SUCCESS.&lt;br /&gt;
If outputPtr is NULL, entry is removed but no returned.&lt;br /&gt;
If the log is empty, set the value at the output pointer to LOG_LOG_NOT_VALID_ENTRY and return ERR_LOG_EMPTY.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Read and remove the oldest unread log entry&lt;br /&gt;
 *&lt;br /&gt;
 * If the log is not empty use the entry at the read index to update the value&lt;br /&gt;
 * at the output pointer, returning OCEOS_SUCCESS.&lt;br /&gt;
 *&lt;br /&gt;
 * If outputPtr is NULL, entry is removed but no returned&lt;br /&gt;
 *&lt;br /&gt;
 * If the log is empty, set the value at the output pointer to LOG_LOG_NOT_VALID_ENTRY&lt;br /&gt;
 * and return ERR_LOG_EMPTY&lt;br /&gt;
 *&lt;br /&gt;
 * @param outputPtr   pointer to struct log_entry&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_LOG_CORRUPT         System Log area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Log directive called in wrong phase; can be used after oceos_init() called&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to acquire log guard&lt;br /&gt;
 *          ERR_LOG_INDEX_WRONG         Read/write log index is wrong&lt;br /&gt;
 *          ERR_LOG_EMPTY               Log is empty&lt;br /&gt;
 */&lt;br /&gt;
S32_t   oceos_log_remove_entry(&lt;br /&gt;
    struct log_entry * const outputPtr&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| outputPtr || pointer to struct log_entry&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit  !! Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_LOG_CORRUPT         || System Log area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Log directive called in wrong phase; can be used after oceos_init() called&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to acquire log guard&lt;br /&gt;
|-&lt;br /&gt;
| ERR_LOG_INDEX_WRONG         || Read/write log index is wrong&lt;br /&gt;
|-&lt;br /&gt;
| ERR_LOG_EMPTY               || Log is empty&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
struct log_entry *outputPtr;&lt;br /&gt;
...&lt;br /&gt;
// Read log_entry into outputPtr and remove the oldest unread log entry&lt;br /&gt;
status = oceos_log_remove_entry(outputPtr);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_log_reset()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''system_log.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function sets all log entries to LOG_LOG_NOT_VALID_ENTRY and the log to empty, with the read and write indices set to 0.&lt;br /&gt;
The log is empty if the index of the next write is the same as the index of the next read. It does not affect the system status variable. It does not affect the context switch log.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * oceos_log_reset()&lt;br /&gt;
 *&lt;br /&gt;
 * Set all log entries to LOG_LOG_NOT_VALID_ENTRY and the log to empty, with the&lt;br /&gt;
 * read and write indices set to 0. and function called flag 0&lt;br /&gt;
 *&lt;br /&gt;
 * The log is empty if the index of the next write&lt;br /&gt;
 * is the same as the index of the next read.&lt;br /&gt;
 *&lt;br /&gt;
 * Does not affect the system status variable&lt;br /&gt;
 * Does not affect the context switch log&lt;br /&gt;
 *&lt;br /&gt;
 * N.B The fixed data area may no longer be writable&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_LOG_CORRUPT         System Log area corrupt; reset failed&lt;br /&gt;
 *          ERR_WRONG_PHASE             Log directive called in wrong phase; can be used after oceos_init() called&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to acquire log guard&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_log_reset(void);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
There are no input parameters to this function.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit  !! Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_LOG_CORRUPT         || System Log area corrupt; reset failed&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Log directive called in wrong phase; can be used after oceos_init() called&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to acquire log guard&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
// Clear down the system log&lt;br /&gt;
status = oceos_log_reset();&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_log_get_size()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''system_log.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the number of entries in the log according to the current values of the read and write indices.&lt;br /&gt;
The value will be zero if the current values of the read and write indices are the same. There may still be useful information in the log, e.g. after system reset, this can be accessed using oceos_log_get_indexed_entry().&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Return the number of entries in the log&lt;br /&gt;
 * according to the current values of the read and write indices.&lt;br /&gt;
 *&lt;br /&gt;
 * The value will be zero if the current values of the read and write indices&lt;br /&gt;
 * are the same.&lt;br /&gt;
 *&lt;br /&gt;
 * There may still be useful information in the log, e.g. after system reset,&lt;br /&gt;
 * this can be accessed using oceos_log_get_indexed_entry()&lt;br /&gt;
 *&lt;br /&gt;
 * @param l_size        pointer to log size holder&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_LOG_CORRUPT         System Log area corrupt;&lt;br /&gt;
 *          ERR_WRONG_PHASE             Log directive called in wrong phase; can be used after oceos_init() called&lt;br /&gt;
 *          ERR_LOG_DATA_PTR_BAD        Pointer to log size holder is NULL&lt;br /&gt;
 *          ERR_LOG_INDEX_WRONG         Read/write log index is wrong&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_log_get_size(&lt;br /&gt;
    U32_t *l_size&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| l_size|| U32_t pointer where size will be written.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit  !! Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_LOG_CORRUPT         || System Log area corrupt;&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Log directive called in wrong phase; can be used after oceos_init() called&lt;br /&gt;
|-&lt;br /&gt;
| ERR_LOG_DATA_PTR_BAD        || Pointer to log size holder is NULL&lt;br /&gt;
|-&lt;br /&gt;
| ERR_LOG_INDEX_WRONG         || Read/write log index is wrong&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, size;&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
// Clear down the system log&lt;br /&gt;
status = oceos_log_get_size(&amp;amp;size);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;System State Variable and System State Mask&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The System State variable provides a record of anomalies or problems detected by OCEOSmp's automatic consistency checks. An application handler for these can be set to be called automatically.&lt;br /&gt;
&lt;br /&gt;
An anomaly or problem results in a flag bit being set in the 32-bit word used to store the system state variable. The flags are identified below.&lt;br /&gt;
&lt;br /&gt;
All flags are reset to zero by oceos_init() when OCEOSmp is initialised, and may also be reset by the application using the directive provided.&lt;br /&gt;
&lt;br /&gt;
To provide a record across OCEOSmp restarts a copy is updated automatically whenever the state variable is updated. This is not cleared by oceos_init() but may be cleared by the application using a directive.&lt;br /&gt;
&lt;br /&gt;
Application software can define a problem handling function to be called automatically when specified system state flags are set. The flags are specified by setting the corresponding bits in the system state mask. The function and the state mask are defined in the system configuration.&lt;br /&gt;
&lt;br /&gt;
Changing a state flag from clear to set results in the function being called (if defined). Subsequent settings of that flag have no effect until after it has been cleared using the directive provided.&lt;br /&gt;
&lt;br /&gt;
N.B. In many cases when OCEOSmp sets a System State flag it also makes an entry in the system log that provides further information.&lt;br /&gt;
&lt;br /&gt;
SYSTEM STATE VARIABLE FLAGS&lt;br /&gt;
&lt;br /&gt;
These flags are updated by OCEOSmp using inclusive 'OR' when a consistency check detects a problem or anomaly. A copy of the system state variable is updated also and accumulates a record of flag settings that is preserved across restarts of OCEOSmp. OCEOSmp restarts reset the system state variable but not the copy.&lt;br /&gt;
&lt;br /&gt;
Resetting the state variables is the responsibility of the application (except for the state variable reset done when OCEOSmp is restarted).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''System Status Bits'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
#define  STATUS_NORMAL                    0u    // No flag set                              YES&lt;br /&gt;
#define  STATUS_INVALID          0xffffffffu    // System status is invalid                 YES BUT NO DETAIL!!!&lt;br /&gt;
&lt;br /&gt;
#define  STATUS_MASK_NORMAL      0xffffffffu    // Always call user def fn                  YES&lt;br /&gt;
&lt;br /&gt;
/* Task related problems */&lt;br /&gt;
#define  STATUS_DISABLED_TASK_START    0x1U    // An attempt to start a disabled task&lt;br /&gt;
#define  STATUS_TASK_JOB_LIMIT_OVER    0x2U    // An attempt to execute a task when its jobs limit is already reached.&lt;br /&gt;
#define  STATUS_JOB_OVER_TIME          0x4U    // Job time from creation to completion exceeds allowed maximum for task. YES&lt;br /&gt;
#define  STATUS_JOB_INTERVAL_SHORT     0x8U    // Minimum time between job creations is less than the allowed minimum for task&lt;br /&gt;
#define  STATUS_READYQ_FULL           0x10U    // Ready queue unable to accept job as result of being full&lt;br /&gt;
#define  STATUS_READYQ_NO_REMOVE      0x20U    // Remove job from ready queue failed&lt;br /&gt;
&lt;br /&gt;
/* Mutex related problems */&lt;br /&gt;
#define  STATUS_MUTEX_ALREADY_HELD    0x40U    // Mutex wait() when mutex already held&lt;br /&gt;
#define  STATUS_MUTEX_NOT_HELD        0x80U    // Mutex signal() when not already held&lt;br /&gt;
#define  STATUS_MUTEX_NOT_RETURNED   0x100U    // Mutex not returned before job terminates&lt;br /&gt;
#define  STATUS_MUTEX_NOT_NESTED     0x200U    // Use of multiple mutexes not nested&lt;br /&gt;
&lt;br /&gt;
/* Counting semaphore and data queue related problems */&lt;br /&gt;
#define  STATUS_SEMAPHORE_JOBS_FULL  0x400U    // Attempt to add job to semaphore pending list when list full&lt;br /&gt;
#define  STATUS_DATAQ_JOBS_FULL      0x800U    // Attempt to add job to data queue pending list when list full&lt;br /&gt;
#define  STATUS_DATAQ_FULL          0x1000U    // Data queue write when queue already full&lt;br /&gt;
&lt;br /&gt;
/* Timed actions related problems */&lt;br /&gt;
#define  STATUS_TIMED_JOBS_FULL     0x2000U    // Timed actions queue already full for timed task start&lt;br /&gt;
#define  STATUS_TIMED_OUTPUT_FULL   0x4000U    // Timed actions queue already full for timed output&lt;br /&gt;
#define  STATUS_TIMED_ACTION_LATE   0x8000U    // Timed action late                          YES&lt;br /&gt;
&lt;br /&gt;
/* Default trap handler should have been replaced&lt;br /&gt;
 * NOT USED AT THE MOMENT*/&lt;br /&gt;
#define  STATUS_SYSTEM_ERROR       0x10000U    // ERROR was handled by default trap handler  YES&lt;br /&gt;
&lt;br /&gt;
/* Flag to indicate problem with Stack Pointer&lt;br /&gt;
 * NOT USED AT THE MOMENT*/&lt;br /&gt;
#define  STATUS_SP_WARNING         0x20000U    // SP not in expected range&lt;br /&gt;
/* Log system error */&lt;br /&gt;
#define  STATUS_BAD_LOG            0x40000U    // System log problem&lt;br /&gt;
#define  STATUS_SPIN_FAILED        0x80000U    // Get SPIN lock failed&lt;br /&gt;
/* Not using next few bits */&lt;br /&gt;
&lt;br /&gt;
/* Will have to exit */&lt;br /&gt;
#define  STATUS_BAD_SENTINEL     0x40000000U    // Area sentinel corrupt&lt;br /&gt;
#define  STATUS_BAD_META_PTR     0x80000000U    // Null meta pointer&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_system_state_get()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''system_log.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns of the system state variable.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Returns the value of the system state variable&lt;br /&gt;
 *&lt;br /&gt;
 * @param state  pointer to state holder&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_LOG_DATA_PTR_BAD        Data holder pointer is null&lt;br /&gt;
 *          ERR_SYS_LOG_CORRUPT         LOG dynamic pointer is null&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_system_state_get(&lt;br /&gt;
    U32_t *state // pointer to state holder&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| state || U32_t pointer to state holder&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit  !! Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_LOG_DATA_PTR_BAD        || Data holder pointer is null&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_LOG_CORRUPT         || LOG dynamic pointer is null&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, state;&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
// Get the system state&lt;br /&gt;
status = oceos_system_state_get(&amp;amp;state);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_system_state_set()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''system_log.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function sets system state variable.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Sets system state variable&lt;br /&gt;
 *&lt;br /&gt;
 * @param new_state&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_LOG_CORRUPT         LOG dynamic pointer is null&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_system_state_set(&lt;br /&gt;
    U32_t new_state   // new value of system state variable&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| new_state || U32_t containing new system state&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit  !! Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_LOG_CORRUPT         || LOG dynamic pointer is null&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, new_state;&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
// Set new system state&lt;br /&gt;
status = oceos_system_state_set(new_state);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_system_state_copy_get()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''system_log.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the value of the system state copy variable.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Returns the value of the copy of system state variable&lt;br /&gt;
 *&lt;br /&gt;
 * @param state  pointer to state holder&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_LOG_DATA_PTR_BAD        Data holder pointer is null&lt;br /&gt;
 *          ERR_SYS_LOG_CORRUPT         LOG dynamic pointer is null&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_system_state_copy_get(&lt;br /&gt;
    U32_t *state // pointer to state copy holder&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| state || U32_t pointer to state copy holder&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit  !! Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_LOG_DATA_PTR_BAD        || Data holder pointer is null&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_LOG_CORRUPT         || LOG dynamic pointer is null&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, copy_state;&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
// Get the system state copy&lt;br /&gt;
status = oceos_system_state_copy_get(&amp;amp;copy_state);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_system_state_copy_set()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''system_log.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function loads a value to tha system state copy variable.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Sets system state copy variable&lt;br /&gt;
 *&lt;br /&gt;
 * @param new_state&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_LOG_CORRUPT         LOG dynamic pointer is null&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_system_state_copy_set(&lt;br /&gt;
    U32_t new_state   // new value of system state variable&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| new_state || U32_t containing new system state copy&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit  !! Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_LOG_CORRUPT         || LOG dynamic pointer is null&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, new_state;&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
// Set new system state copy&lt;br /&gt;
status = oceos_system_state_copy_set(new_state);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Timing directives ==&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;Introduction&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''SPARC'''&lt;br /&gt;
&lt;br /&gt;
In OCEOS system time is based on two chained 32-bit timers.&lt;br /&gt;
&lt;br /&gt;
No interrupts are involved, the current system time is obtained by reading the two timer counter registers (in an atomic way) and then inverting the&lt;br /&gt;
values since the timers count down.&lt;br /&gt;
&lt;br /&gt;
The scaler associated with the timers is configured based on the system clock frequency to decrement the low order timer every microsecond. This&lt;br /&gt;
decrements the high order timer when it rolls over, every 71.6 minutes approximately. The 64-bit time range is very long, over 584,000 years.&lt;br /&gt;
&lt;br /&gt;
'''ARM Cortex-M'''&lt;br /&gt;
&lt;br /&gt;
In OCEOS for ARM Cortex-M, system time is based on SysTick. The processor has a 24-bit system timer, SysTick, that counts down from the reload value to zero, reloads (wraps to) the value in the LOAD register on the next clock edge, then counts down on subsequent clocks.&lt;br /&gt;
&lt;br /&gt;
Note: When the processor is halted for debugging the counter does not decrement.&lt;br /&gt;
&lt;br /&gt;
OCEOS initializes the timer to be driven from MCK and counting down to zero asserts SysTick exception request.&lt;br /&gt;
OCEOS has 64 bit counter which is increased by 0xFFFFFF value every time timer reloads.&lt;br /&gt;
&lt;br /&gt;
'''RISC-V'''&lt;br /&gt;
&lt;br /&gt;
In OCEOS for RISC-V systems time is based internally on clock cycles.&lt;br /&gt;
The RISC-V processor typically has a 64 bit counter (typically mtime) that  updates automatically on each clock cycle. Each hart typically has its own comparison register (typically mtimecmp) that can be used to interrupt that hart when a certain cycle count has been exceeded.&lt;br /&gt;
If a particular RISC-V implementation provides a more restricted clock cycle count this will be used with appropriate modifications as clock cycles give the best timing precision available.&lt;br /&gt;
&lt;br /&gt;
Note: The application configuration provides the constant needed to allow microseconds (as used in OCEOS directives) be converted to clock cycles. Time is reported by OCEOSmp as the number of microseconds since OCEOS was initialized.&lt;br /&gt;
&lt;br /&gt;
A potential difficulty arises if the main system clock rate can change for power saving or other reasons, each system is probably different with regard to this. OCEOSmp can handle this, if needed.&lt;br /&gt;
&lt;br /&gt;
The units of OCEOS system time are microseconds on SPARC and ARM and on RISC-V the period of the clock cycle.&lt;br /&gt;
&lt;br /&gt;
The system time is reset to 0 by oceos_init()&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_time_sys_get64()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''oceos_timer.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the current system time as a 64-bit number.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
**&lt;br /&gt;
 * Get the current system time (64-bit)&lt;br /&gt;
 *&lt;br /&gt;
 * @return U64_t&lt;br /&gt;
 */&lt;br /&gt;
U64_t oceos_time_sys_get64(void);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There are no parameters to this function.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S64_t with the current system time.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S64_t now;&lt;br /&gt;
...&lt;br /&gt;
// Get the time&lt;br /&gt;
now = oceos_time_sys_get64();&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_time_sys_get32()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''oceos_timer.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the low 32 bits of the system time.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Get the current system time (low 32 bits of 64 bit value)&lt;br /&gt;
 *&lt;br /&gt;
 * @return U32_t&lt;br /&gt;
 */&lt;br /&gt;
U32_t oceos_time_sys_get32(void);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
There are no parameters to this function.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with the current system time.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t now;&lt;br /&gt;
...&lt;br /&gt;
// Get the time&lt;br /&gt;
now = oceos_time_sys_get32();&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:backup]]&lt;/div&gt;</summary>
		<author><name>Bkavanagh</name></author>
	</entry>
	<entry>
		<id>https://wiki.ocetechnology.com/mediawiki/index.php?title=OCEOSmp/directive_reference&amp;diff=1714</id>
		<title>OCEOSmp/directive reference</title>
		<link rel="alternate" type="text/html" href="https://wiki.ocetechnology.com/mediawiki/index.php?title=OCEOSmp/directive_reference&amp;diff=1714"/>
		<updated>2024-06-24T13:13:17Z</updated>

		<summary type="html">&lt;p&gt;Bkavanagh: /* oceos_timed_jobs_number() */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Introduction =&lt;br /&gt;
&lt;br /&gt;
To be added&lt;br /&gt;
&lt;br /&gt;
= Directives =&lt;br /&gt;
&lt;br /&gt;
== Initialisation directives ==&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_init()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''initialisation.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Initialises OCEOS and  must be the first directive used.&lt;br /&gt;
&lt;br /&gt;
Initialises the OCEOS system meta data using the information supplied in the application configuration and prepares for creation of tasks etc.&lt;br /&gt;
&lt;br /&gt;
The values provided in the application configuration are checked as much as possible before being used.&lt;br /&gt;
&lt;br /&gt;
The system log also is created here.&lt;br /&gt;
&lt;br /&gt;
This function sets up sysMetaPtr and init_meta_ptr and must have completed successfully before tasks etc. can be created.&lt;br /&gt;
&lt;br /&gt;
It disables interrupts and leaves them disabled, they will be re-enabled to the previous level after all tasks etc. have been created and [[OCEOSmp/directive_reference#oceos_init_finish()|oceos_init_finish()]] has completed successfully.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Initialises OCEOS and  must be the first directive used.&lt;br /&gt;
 *&lt;br /&gt;
 * Initialises the OCEOS system meta data using the information supplied in&lt;br /&gt;
 * the application configuration and prepares for creation of tasks etc.&lt;br /&gt;
 *&lt;br /&gt;
 * The values provided in the application configuration are checked as much&lt;br /&gt;
 * as possible before being used.&lt;br /&gt;
 *&lt;br /&gt;
 * The system log also is created here.&lt;br /&gt;
 *&lt;br /&gt;
 * This function sets up sysMetaPtr and init_meta_ptr and must have completed&lt;br /&gt;
 * successfully before tasks etc. can be created.&lt;br /&gt;
 *&lt;br /&gt;
 * It disables interrupts and leaves them disabled, they will be re-enabled to&lt;br /&gt;
 * the previous level after all tasks etc. have been created and&lt;br /&gt;
 * oceos_init_finish() has completed successfully.&lt;br /&gt;
 *&lt;br /&gt;
 * @param app_config Pointer to configuration struct&lt;br /&gt;
 * @return SUCCESSFUL                        All OK&lt;br /&gt;
 *         WARN_LOG_SIZE_DEFAULT             Warning, log size is set to default value of 64 entries&lt;br /&gt;
 *         WARN_NO_ERROR_FUNCTION            Warning, user defined function for ERROR handling is not provided&lt;br /&gt;
 *         ERR_CPU_FIRST_CORE_INVALID        Start CPU not in a range of available cores for this target; or greater than end CPU&lt;br /&gt;
 *         ERR_CPU_LAST_CORE_INVALID         Last CPU not in a range of available cores for this target&lt;br /&gt;
 *         ERR_NOT_START_CPU_CORE            Executing oceos_init on wrong CPU&lt;br /&gt;
 *         ERR_STACK_START_MISALIGNED        Stack start address is not set by user misaligned&lt;br /&gt;
 *         ERR_STACK_PER_CORE_INVALID        Stack per CPU size is zero, or not 8byte aligned, or less then min require&lt;br /&gt;
 *         ERR_LOG_ADDR_MISALIGNED           Log start address is not 8 byte aligned&lt;br /&gt;
 *         ERR_FIX_ADDR_MISALIGNED           Fixed area start address is not 8 byte aligned&lt;br /&gt;
 *         ERR_DYN_ADDR_MISALIGNED           Dynamic area start address is not 8 byte aligned&lt;br /&gt;
 *         ERR_CPU_CORE_RANGE_WRONG          CPU cores in use exceed available CPUs on the SoC&lt;br /&gt;
 *         ERR_STACK_SPACE_WRONG             Current CPU SP is not within user provided stack range&lt;br /&gt;
 *         ERR_LOG_SIZE_INVALID              Log size outside expected range&lt;br /&gt;
 *         ERR_CS_LOG_SIZE_INVALID           Context switch log size invalid&lt;br /&gt;
 *         ERR_TASK_NUMBER_INVALID           Number of tasks invalid&lt;br /&gt;
 *         ERR_MUTEX_NUMBER_INVALID          Number of mutexes invalid&lt;br /&gt;
 *         ERR_RWMUTEX_NUMBER_INVALID        Number of rwmutexes invalid&lt;br /&gt;
 *         ERR_SEM_NUMBER_INVALID            Number of semaphores invalid&lt;br /&gt;
 *         ERR_DATAQ_NUMBER_INVALID          Number of datqs invalid&lt;br /&gt;
 *         ERR_TIMED_ACTIONS_NUMBER_INVALID  Number of timed actions invalid&lt;br /&gt;
 *         ERR_OVERLAP_STACK                 Overlap stack end address with (two overlap areas are set)&lt;br /&gt;
 *         ERR_OVERLAP_LOG                   Overlap log with (two overlap areas are set)&lt;br /&gt;
 *         ERR_OVERLAP_FIXED                 Overlap fixed area with (two overlap areas are set)&lt;br /&gt;
 *         ERR_OVERLAP_DYNAMIC               Overlap dynamic area with (two overlap areas are set)&lt;br /&gt;
 *         ERR_FIXED_MEMORY_FAILED           Fixed area memory write fail&lt;br /&gt;
 *         ERR_DYNAMIC_MEMORY_FAILED         Dynamic area memory write fail&lt;br /&gt;
 *         ERR_TIMER_ADDR_INVALID            Timer address not provided by user (null). SPARC only&lt;br /&gt;
 *         ERR_SYS_TIMER_INDEX_INVALID       System timer index of subtimer invalid; SPARC only; Subtimers start from index 1; Need index of subtimer plus one in front&lt;br /&gt;
 *         ERR_PERIPHERAL_CLOCK_INVALID      System peripheral code invalid&lt;br /&gt;
 *&lt;br /&gt;
 */&lt;br /&gt;
S32_t   oceos_init(&lt;br /&gt;
    const struct application_configuration app_config&lt;br /&gt;
);&lt;br /&gt;
 &amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| app_config || Pointer to configuration struct.  struct application_configuration defined in '''''basic_structs.h'''''&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| WARN_LOG_SIZE_DEFAULT             || Warning, log size is set to default value of 64 entries&lt;br /&gt;
|-&lt;br /&gt;
| WARN_NO_ERROR_FUNCTION            || Warning, user defined function for ERROR handling is not provided&lt;br /&gt;
|-&lt;br /&gt;
| ERR_CPU_FIRST_CORE_INVALID        || Start CPU not in a range of available cores for this target; or greater than end CPU&lt;br /&gt;
|-&lt;br /&gt;
| ERR_CPU_LAST_CORE_INVALID         || Last CPU not in a range of available cores for this target&lt;br /&gt;
|-&lt;br /&gt;
| ERR_NOT_START_CPU_CORE            || Executing oceos_init on wrong CPU&lt;br /&gt;
|-&lt;br /&gt;
| ERR_STACK_START_MISALIGNED        || Stack start address is not set by user misaligned&lt;br /&gt;
|-&lt;br /&gt;
| ERR_STACK_PER_CORE_INVALID        || Stack per CPU size is zero, or not 8byte aligned, or less then min require&lt;br /&gt;
|-&lt;br /&gt;
| ERR_LOG_ADDR_MISALIGNED           || Log start address is not 8 byte aligned&lt;br /&gt;
|-&lt;br /&gt;
| ERR_FIX_ADDR_MISALIGNED           || Fixed area start address is not 8 byte aligned&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DYN_ADDR_MISALIGNED           || Dynamic area start address is not 8 byte aligned&lt;br /&gt;
|-&lt;br /&gt;
| ERR_CPU_CORE_RANGE_WRONG          || CPU cores in use exceed available CPUs on the SoC&lt;br /&gt;
|-&lt;br /&gt;
| ERR_STACK_SPACE_WRONG             || Current CPU SP is not within user provided stack range&lt;br /&gt;
|-&lt;br /&gt;
| ERR_LOG_SIZE_INVALID              || Log size outside expected range&lt;br /&gt;
|-&lt;br /&gt;
| ERR_CS_LOG_SIZE_INVALID           || Context switch log size invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TASK_NUMBER_INVALID           || Number of tasks invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_MUTEX_NUMBER_INVALID          || Number of mutexes invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_RWMUTEX_NUMBER_INVALID        || Number of rwmutexes invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SEM_NUMBER_INVALID            || Number of semaphores invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DATAQ_NUMBER_INVALID          || Number of datqs invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TIMED_ACTIONS_NUMBER_INVALID  || Number of timed actions invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_OVERLAP_STACK                 || Overlap stack end address with (two overlap areas are set)&lt;br /&gt;
|-&lt;br /&gt;
| ERR_OVERLAP_LOG                   || Overlap log with (two overlap areas are set)&lt;br /&gt;
|-&lt;br /&gt;
| ERR_OVERLAP_FIXED                 || Overlap fixed area with (two overlap areas are set)&lt;br /&gt;
|-&lt;br /&gt;
| ERR_OVERLAP_DYNAMIC               || Overlap dynamic area with (two overlap areas are set)&lt;br /&gt;
|-&lt;br /&gt;
| ERR_FIXED_MEMORY_FAILED           || Fixed area memory write fail&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DYNAMIC_MEMORY_FAILED         || Dynamic area memory write fail&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TIMER_ADDR_INVALID            || Timer address not provided by user (null). SPARC only&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_TIMER_INDEX_INVALID       || System timer index of subtimer invalid; SPARC only; Subtimers start from index 1; Need index of subtimer plus one in front&lt;br /&gt;
|-&lt;br /&gt;
| ERR_PERIPHERAL_CLOCK_INVALID      || System peripheral code invalid&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
    /*&lt;br /&gt;
     * Create the application configuration structure&lt;br /&gt;
     */&lt;br /&gt;
    struct application_configuration           app_config = {0};&lt;br /&gt;
&lt;br /&gt;
    /*&lt;br /&gt;
     * Fill in the application parameters&lt;br /&gt;
     */&lt;br /&gt;
    app_config.log_address                   = (log_t)log_data;              // required&lt;br /&gt;
    app_config.fixed_data_address            = (adrs_t)fixed_data;            // required&lt;br /&gt;
    app_config.dynamic_data_address          = (adrs_t)dynamic_data;          // required&lt;br /&gt;
&lt;br /&gt;
    app_config.stack_start_address           = start_stack_array[OCEOS_START_CPU_INDEX];// OCEOSMP_STACK_START_ADDRESS;&lt;br /&gt;
    app_config.stack_size_per_cpu            = (U32_t)&amp;amp;__oceos_stack_size_per_cpu;  // OCEOSMP_STACK_LOW_BOUND_ADDRESS;&lt;br /&gt;
&lt;br /&gt;
    app_config.system_error_function         = oceosmp_on_error;               // NULL =&amp;gt; ignore&lt;br /&gt;
    app_config.log_full_function             = oceosmp_on_full_log;            // NULL =&amp;gt; ignore&lt;br /&gt;
&lt;br /&gt;
    // used in setting up system log and fixed data array&lt;br /&gt;
    app_config.log_number_of_entries         = NUMBER_OF_LOG_ENTRIES;          // 0 =&amp;gt; use default&lt;br /&gt;
&lt;br /&gt;
    app_config.number_of_tasks               = NUMBER_OF_TASKS;                // &amp;gt;= 1&lt;br /&gt;
&lt;br /&gt;
    app_config.number_of_mutexes             = NUMBER_OF_MUTEXES;&lt;br /&gt;
	app_config.number_of_rwmutexes			 = NUMBER_OF_RWMUTEXES;&lt;br /&gt;
    app_config.number_of_counting_semaphores = NUMBER_OF_SEMAPHORES;&lt;br /&gt;
    app_config.number_of_data_queues         = NUMBER_OF_DATAQS;&lt;br /&gt;
&lt;br /&gt;
    /**&lt;br /&gt;
     * FOR SPARC TARGET ONLY.&lt;br /&gt;
     */&lt;br /&gt;
    app_config.sys_time_timer_index          = SYS_TIME_TIMER_INDEX;           // 0 =&amp;gt; invalid index&lt;br /&gt;
    /**&lt;br /&gt;
     * FOR SPARC TARGET ONLY.&lt;br /&gt;
     * Not Used for ARM. Always Nested&lt;br /&gt;
     */&lt;br /&gt;
    app_config.interrupt_nesting_enabled     = TRUE;                           // TRUE =&amp;gt; single vector&lt;br /&gt;
    app_config.oceos_cpu_switch_int_number   = OCEOS_CPU_INTER_COM_INT_NUMBER; // User should provide SGI ID (0-15)&lt;br /&gt;
&lt;br /&gt;
    app_config.timed_actions_queue_size      = NUMBER_OF_ACTION_ENTRIES;&lt;br /&gt;
    app_config.CS_log_entries_base2          = CS_LOG_DEF_ENTRIES_BASE2;&lt;br /&gt;
    /**&lt;br /&gt;
     * Set starting index of CPU that will be used by OCEOSMP&lt;br /&gt;
     */&lt;br /&gt;
    app_config.oceos_cpu_start_index         = OCEOS_START_CPU_INDEX;&lt;br /&gt;
    /**&lt;br /&gt;
     * Set last index of CPU that will be used by OCEOSMP&lt;br /&gt;
     */&lt;br /&gt;
    app_config.oceos_cpu_last_index          = OCEOS_LAST_CPU_INDEX;&lt;br /&gt;
    /*&lt;br /&gt;
     * Set system/peripheral clock used to initialise system timer&lt;br /&gt;
     */&lt;br /&gt;
    app_config.soc_peripheral_clck           = BSP_SYSFREQ * 1000 * 1000;&lt;br /&gt;
&lt;br /&gt;
    // initialise OCEOSMP&lt;br /&gt;
    S32_t status;&lt;br /&gt;
    status = oceos_init(app_config);&lt;br /&gt;
    if (OCEOS_SUCCESS &amp;gt; status) {&lt;br /&gt;
      oceosmp_print(&amp;quot;\n oceos_init failure\n\r&amp;quot;);&lt;br /&gt;
      return 0;&lt;br /&gt;
    } else {&lt;br /&gt;
      return 1;&lt;br /&gt;
    }   // else&lt;br /&gt;
 &amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_init_finish()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''initialisation.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Finalizes the fixed data array after all tasks etc. have been created&lt;br /&gt;
&lt;br /&gt;
All information needed to start OCEOS can be found in the fixed data area&lt;br /&gt;
when oceos_init_finish() has completed.&lt;br /&gt;
&lt;br /&gt;
Once all tasks etc. have been created oceos_init_finish() checks the&lt;br /&gt;
accumulated information against the application configuration data&lt;br /&gt;
stored in the fixed meta structure.&lt;br /&gt;
&lt;br /&gt;
oceos_init_finish also calculates the size of the dynamic data area and&lt;br /&gt;
checks it does not overlap with the system stack, the system log, or the&lt;br /&gt;
fixed data, and if all ok sets up pointers to the various dynamic area&lt;br /&gt;
components in the fixed data.&lt;br /&gt;
&lt;br /&gt;
It then adds an XOR checksum to the fixed data area, and checks that this&lt;br /&gt;
is followed by FILLER, which it replaces with the end sentinel.&lt;br /&gt;
&lt;br /&gt;
On successful completion it restores the interrupt level to its value&lt;br /&gt;
before oceos_init() was called, otherwise interrupts remain disabled.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Finalizes the fixed data array after all tasks etc. have been created&lt;br /&gt;
 *&lt;br /&gt;
 * All information needed to start OCEOS can be found in the fixed data area&lt;br /&gt;
 * when oceos_init_finish() has completed.&lt;br /&gt;
 *&lt;br /&gt;
 * Once all tasks etc. have been created oceos_init_finish() checks the&lt;br /&gt;
 * accumulated information against the application configuration data&lt;br /&gt;
 * stored in the fixed meta structure.&lt;br /&gt;
 *&lt;br /&gt;
 * oceos_init_finish also calculates the size of the dynamic data area and&lt;br /&gt;
 * checks it does not overlap with the system stack, the system log, or the&lt;br /&gt;
 * fixed data, and if all ok sets up pointers to the various dynamic area&lt;br /&gt;
 * components in the fixed data.&lt;br /&gt;
 *&lt;br /&gt;
 * It then adds an XOR checksum to the fixed data area, and checks that this&lt;br /&gt;
 * is followed by FILLER, which it replaces with the end sentinel.&lt;br /&gt;
 *&lt;br /&gt;
 * On successful completion it restores the interrupt level to its value&lt;br /&gt;
 * before oceos_init() was called, otherwise interrupts remain disabled.&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS                             All OK&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT               System Meta data is NULL or corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT                 System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_CPU_CORE                  Executing directive on wrong CPU&lt;br /&gt;
 *          ERR_WRONG_PHASE                     Called before oceos_init()&lt;br /&gt;
 *          ERR_TASKS_INCOMPLETE                Created wrong number of tasks&lt;br /&gt;
 *          ERR_MUTEX_INCOMPLETE                Created wrong number of mutexes&lt;br /&gt;
 *          ERR_RWMUTEX_INCOMPLETE              Created wrong number of rwmutexes&lt;br /&gt;
 *          ERR_SEM_INCOMPLETE                  Created wrong number of semaphores&lt;br /&gt;
 *          ERR_DATAQ_INCOMPLETE                Created wrong number of dataqs&lt;br /&gt;
 *          ERR_TASK_MAX_ID_INVALID             Task's max id invalid&lt;br /&gt;
 *          ERR_MUTEX_MAX_ID_INVALID            Mutexe's max id invalid&lt;br /&gt;
 *          ERR_RWMUTEX_MAX_ID_INVALID          Rwmutexe's max id invalid&lt;br /&gt;
 *          ERR_SEM_MAX_ID_INVALID              Semaphore's max id invalid&lt;br /&gt;
 *          ERR_DATAQ_MAX_ID_INVALID            Dataq's max id invalid&lt;br /&gt;
 *          ERR_TOTAL_JOBS_NUMBER_WRONG         Wrong number of total jobs created&lt;br /&gt;
 *          ERR_ORDER_ARRAY_PTR_INVALID         Order array pointer is NULL or mis-aligned&lt;br /&gt;
 *          ERR_FIXED_AREA_TOO_SMALL            Not enough space for fixed data area&lt;br /&gt;
 */&lt;br /&gt;
S32_t   oceos_init_finish(void);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
There are no input parameters to this function.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit  || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT               || System Meta data is NULL or corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT                 || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_CPU_CORE                  || Executing directive on wrong CPU&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE                     || Called before oceos_init()&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TASKS_INCOMPLETE                || Created wrong number of tasks&lt;br /&gt;
|-&lt;br /&gt;
| ERR_MUTEX_INCOMPLETE                || Created wrong number of mutexes&lt;br /&gt;
|-&lt;br /&gt;
| ERR_RWMUTEX_INCOMPLETE              || Created wrong number of rwmutexes&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SEM_INCOMPLETE                  || Created wrong number of semaphores&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DATAQ_INCOMPLETE                || Created wrong number of dataqs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TASK_MAX_ID_INVALID             || Task's max id invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_MUTEX_MAX_ID_INVALID            || Mutexe's max id invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_RWMUTEX_MAX_ID_INVALID          || Rwmutexe's max id invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SEM_MAX_ID_INVALID              || Semaphore's max id invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DATAQ_MAX_ID_INVALID            || Dataq's max id invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TOTAL_JOBS_NUMBER_WRONG         || Wrong number of total jobs created&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ORDER_ARRAY_PTR_INVALID         || Order array pointer is NULL or mis-aligned&lt;br /&gt;
|-&lt;br /&gt;
| ERR_FIXED_AREA_TOO_SMALL            || Not enough space for fixed data area&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
    /*&lt;br /&gt;
     * Finish initialising OCEOS and setting up the fixed data&lt;br /&gt;
     */&lt;br /&gt;
    status = oceos_init_finish();&lt;br /&gt;
    if(OCEOS_SUCCESS &amp;gt; status){&lt;br /&gt;
        // LOG&lt;br /&gt;
      oceosmp_print(&amp;quot;\nAbandoning, problem ending OCEOS initialisation\n\r&amp;quot;);&lt;br /&gt;
        return -1;&lt;br /&gt;
    }   // if&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_start()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''initialisation.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Starts OCEOS scheduling.&amp;lt;br&amp;gt;&lt;br /&gt;
Create dynamic OCEOS structures and start scheduling.&amp;lt;br&amp;gt;&lt;br /&gt;
This function should only be called once and only after [[OCEOSmp/directive_reference#oceos_init()|oceos_init()]] and [[OCEOSmp/directive_reference#oceos_init_finish()|oceos_init_finish()]] have been called successfully.&amp;lt;br&amp;gt;&lt;br /&gt;
Normally this function does not return. &amp;lt;br&amp;gt;&lt;br /&gt;
If a problem is detected the function terminates and returns an appropriate DIRECTIVE_STATUS code, with interrupts disabled.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Starts OCEOS scheduling&lt;br /&gt;
 *&lt;br /&gt;
 * Create dynamic OCEOS structures and start scheduling&lt;br /&gt;
 *&lt;br /&gt;
 * This function should only be called once&lt;br /&gt;
 * and only after oceos_init()&lt;br /&gt;
 * and oceos_init_finish() have&lt;br /&gt;
 *  been called successfully.&lt;br /&gt;
 * Normally this function does not return.&lt;br /&gt;
 * If a problem is detected the function&lt;br /&gt;
 * terminates and returns an appropriate&lt;br /&gt;
 * DIRECTIVE_STATUS code, with interrupts disabled.&lt;br /&gt;
 *&lt;br /&gt;
 * @param fixed_array_ptr   Pointer to fixed data array&lt;br /&gt;
 * @param start_task        Task ID&lt;br /&gt;
 * @param data_ptr          Pointer to data to be passed to the task&lt;br /&gt;
 * @return  OCEOSMP_EXIT                        OCEOSMP return from scheduling and exit&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT               Fixed area pointer is null or bad sentinel&lt;br /&gt;
 *          ERR_FIXED_AREA_SIZE_WRONG           Fixed area size is zero&lt;br /&gt;
 *          ERR_FIXED_AREA_END_SENTINEL_BAD     Fixed data end sentinel corrupt&lt;br /&gt;
 *          ERR_FIXED_AREA_BAD_XOR              Fixed area bad checksum or checksum mis-match&lt;br /&gt;
 *          ERR_INIT_NOT_DONE                   oceos_start() called without initialisation&lt;br /&gt;
 *          ERR_DYN_AREA_PTR_BAD                Dynamic area pointer invalid in sysMetaPtr&lt;br /&gt;
 *          ERR_INT_HANDLER_BAD                 IRQ controller pointer provided by BCC is NULL;or OCEOS handler is not set&lt;br /&gt;
 *          ERR_DYN_JOB_PTR_BAD                 Job array pointer is NULL&lt;br /&gt;
 *          ERR_FIXED_TASK_PTR_BAD              Tasks array pointer is NULL&lt;br /&gt;
 *          ERR_JOB_COUNT_WRONG                 Total job count inconsistent&lt;br /&gt;
 *          ERR_DYN_MUTEX_PTR_BAD               Mutex dynamic pointer is NULL&lt;br /&gt;
 *          ERR_DYN_LOCK_PTR_BAD                Mutex lock array pointer is NULL&lt;br /&gt;
 *          ERR_DYN_RWMUTEX_PTR_BAD             Rwmutex dynamic pointer is NULL&lt;br /&gt;
 *          ERR_DYN_RWLOCK_PTR_BAD              Rwmutex lock array pointer is NULL&lt;br /&gt;
 *          ERR_FIXED_SEM_PTR_BAD               Semaphore fixed pointer is NULL&lt;br /&gt;
 *          ERR_DYN_SEM_PTR_BAD                 Semaphore dynamic pointer is NULL&lt;br /&gt;
 *          ERR_SEM_PEND_PTR_BAD                Semaphore pending queue pointer is NULL&lt;br /&gt;
 *          ERR_FIXED_DATAQ_PTR_BAD             Dataq fixed pointer is NULL&lt;br /&gt;
 *          ERR_DYN_DATAQ_PTR_BAD               Dataq dynamic pointer is NULL&lt;br /&gt;
 *          ERR_DATAQ_PEND_PTR_BAD              Dataq pending queue pointer is NULL&lt;br /&gt;
 *          ERR_DATAQ_DATA_PTR_BAD              Dataq data pointer is NULL&lt;br /&gt;
 *          ERR_CPU_INT_NUMBER_INVALID          SPARC only.IRQ number for CPU inter-comunication invalid(zero or used by timer)&lt;br /&gt;
 *          ERR_REGISTER_CPU_IRQ_FAILED         SPARC only. Failed to set CPU IRQ handler in BCC&lt;br /&gt;
 *          ERR_CPU_STACK_INVALID               Current CPU stack not within specified range&lt;br /&gt;
 *          ERR_CPU_PRIORITY_STACK_INVALID      Per CPU priority stack invalid&lt;br /&gt;
 *          ERR_LOG_AREA_END_SENTINEL_BAD       Log area end sentinel override&lt;br /&gt;
 *          ERR_TA_CONFIG_PTR_BAD               SPARC only; Timed action configuration data pointer is NULL&lt;br /&gt;
 *          ERR_TA_TIMER_INDEX_INVALID          SPARC only; Timed action sub-timer index in timer unit is invalid&lt;br /&gt;
 *          ERR_TA_IRQ_NUMBER_INVALID           SPARC only; Timer action timer IRQ number is invalid&lt;br /&gt;
 *          ERR_TA_BCC_IRQ_REGISTER_FAILED      SPARC only; Timed action timer IRQ handler failed to register&lt;br /&gt;
 */&lt;br /&gt;
S32_t   oceos_start(&lt;br /&gt;
    const U32_t * const fixed_array_ptr,// pointer to fixed data array&lt;br /&gt;
    const U32_t start_task,             // taskID&lt;br /&gt;
    void * const data_ptr               // pointer to data to be passed to task&lt;br /&gt;
);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| fixed_array_ptr || Pointer to fixed data array&lt;br /&gt;
|-&lt;br /&gt;
| start_task      || Task ID&lt;br /&gt;
|-&lt;br /&gt;
| data_ptr        || Pointer to data to be passed to the task&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit  || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT               || Fixed area pointer is null or bad sentinel&lt;br /&gt;
|-&lt;br /&gt;
| ERR_FIXED_AREA_SIZE_WRONG           || Fixed area size is zero&lt;br /&gt;
|-&lt;br /&gt;
| ERR_FIXED_AREA_END_SENTINEL_BAD     || Fixed data end sentinel corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_FIXED_AREA_BAD_XOR              || Fixed area bad checksum or checksum mis-match&lt;br /&gt;
|-&lt;br /&gt;
| ERR_INIT_NOT_DONE                   || oceos_start() called without initialisation&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DYN_AREA_PTR_BAD                || Dynamic area pointer invalid in sysMetaPtr&lt;br /&gt;
|-&lt;br /&gt;
| ERR_INT_HANDLER_BAD                 || IRQ controller pointer provided by BCC is NULL;or OCEOS handler is not set&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DYN_JOB_PTR_BAD                 || Job array pointer is NULL&lt;br /&gt;
|-&lt;br /&gt;
| ERR_FIXED_TASK_PTR_BAD              || Tasks array pointer is NULL&lt;br /&gt;
|-&lt;br /&gt;
| ERR_JOB_COUNT_WRONG                 || Total job count inconsistent&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DYN_MUTEX_PTR_BAD               || Mutex dynamic pointer is NULL&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DYN_LOCK_PTR_BAD                || Mutex lock array pointer is NULL&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DYN_RWMUTEX_PTR_BAD             || Rwmutex dynamic pointer is NULL&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DYN_RWLOCK_PTR_BAD              || Rwmutex lock array pointer is NULL&lt;br /&gt;
|-&lt;br /&gt;
| ERR_FIXED_SEM_PTR_BAD               || Semaphore fixed pointer is NULL&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DYN_SEM_PTR_BAD                 || Semaphore dynamic pointer is NULL&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SEM_PEND_PTR_BAD                || Semaphore pending queue pointer is NULL&lt;br /&gt;
|-&lt;br /&gt;
| ERR_FIXED_DATAQ_PTR_BAD             || Dataq fixed pointer is NULL&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DYN_DATAQ_PTR_BAD               || Dataq dynamic pointer is NULL&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DATAQ_PEND_PTR_BAD              || Dataq pending queue pointer is NULL&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DATAQ_DATA_PTR_BAD              || Dataq data pointer is NULL&lt;br /&gt;
|-&lt;br /&gt;
| ERR_CPU_INT_NUMBER_INVALID          || SPARC only.IRQ number for CPU inter-comunication invalid(zero or used by timer)&lt;br /&gt;
|-&lt;br /&gt;
| ERR_REGISTER_CPU_IRQ_FAILED         || SPARC only. Failed to set CPU IRQ handler in BCC&lt;br /&gt;
|-&lt;br /&gt;
| ERR_CPU_STACK_INVALID               || Current CPU stack not within specified range&lt;br /&gt;
|-&lt;br /&gt;
| ERR_CPU_PRIORITY_STACK_INVALID      || Per CPU priority stack invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_LOG_AREA_END_SENTINEL_BAD       || Log area end sentinel override&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_CONFIG_PTR_BAD               || SPARC only; Timed action configuration data pointer is NULL&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_TIMER_INDEX_INVALID          || SPARC only; Timed action sub-timer index in timer unit is invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_IRQ_NUMBER_INVALID           || SPARC only; Timer action timer IRQ number is invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_BCC_IRQ_REGISTER_FAILED      || SPARC only; Timed action timer IRQ handler failed to register&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/* Sample Task names - all here start with t_ to help avoid name confusion */&lt;br /&gt;
enum TASK_NAME{&lt;br /&gt;
    t_tom,                      // will have task ID 0&lt;br /&gt;
    t_dick,                     // will have task ID 1&lt;br /&gt;
};&lt;br /&gt;
extern U32_t fixed_data[];&lt;br /&gt;
...&lt;br /&gt;
S32_t status;&lt;br /&gt;
&lt;br /&gt;
status = oceos_start(fixed_data, t_tom, NULL);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_exit()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''initialisation.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Ends scheduling and exit from [[OCEOSmp/directive_reference#oceos_start()|oceos_start()]].&lt;br /&gt;
No task can be started after this.&amp;lt;br&amp;gt;&lt;br /&gt;
OCEOS will exit when the current job ends.&amp;lt;br&amp;gt;&lt;br /&gt;
An idle task in an endless loop should check that scheduling is enabled.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Ends scheduling and exit from oceos_start.&lt;br /&gt;
 * No task can be started after this.&lt;br /&gt;
 * OCEOS will exit when the current job ends.&lt;br /&gt;
 * An idle task in an endless loop should check that scheduling is enabled.&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Called before scheduling started&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_exit(void);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
There are no input parameters to this function.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit  || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Called before scheduling started&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
// Exit OCEOS&lt;br /&gt;
oceos_exit();&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_CPU_sleep()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''initialisation.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
 Puts CPU in sleep mode.&amp;lt;br&amp;gt;&lt;br /&gt;
 User must to be sure that interrupts are enabled.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Puts CPU in sleep mode.&lt;br /&gt;
 * User must to be sure that interrupts are enabled.&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_CPU_sleep(void);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
There are no input parameters to this function.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
// Put CPU to sleep&lt;br /&gt;
oceos_CPU_sleep();&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceosmp_cpu_disable()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''initialisation.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function ends execution of all tasks running on particular CPU and removes the CPU from scheduling.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Ends execution of all tasks running on particular CPU and removes this CPU from scheduling.&lt;br /&gt;
 * @param cpu_id&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              CPU ID outside allowed range 0 to 254&lt;br /&gt;
 *          ERR_ID_WRONG                CPU ID &amp;gt;= number of available CPUs&lt;br /&gt;
 *          ERR_CPU_ALREADY_DISABLED    CPU already disabled&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceosmp_cpu_disable(&lt;br /&gt;
    U32_t cpu_id&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| cpu_id || ID of CPU core to be disabled.&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit  || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || CPU ID outside allowed range 0 to 254&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || CPU ID &amp;gt;= number of available CPUs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_CPU_ALREADY_DISABLED    || CPU already disabled&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, faulty_cpu;&lt;br /&gt;
...&lt;br /&gt;
// Disable faulty CPU core&lt;br /&gt;
status = oceosmp_cpu_disable(faulty_cpu));&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceosmp_cpu_enable()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''initialisation.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function adds a disabled CPU core to the OCEOSmp scheduler. It should only be called after scheduling has started&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 *  Adds disabled CPU to OCEOSmp scheduler&lt;br /&gt;
 *&lt;br /&gt;
 *  N.B. This function should only be called after scheduling has started&lt;br /&gt;
 *&lt;br /&gt;
 * @param cpu_id&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              CPU ID outside allowed range 0 to 254&lt;br /&gt;
 *          ERR_ID_WRONG                CPU ID &amp;gt;= number of available CPUs; or the same as currently running&lt;br /&gt;
 *          ERR_CPU_ALREADY_ENABLED     CPU already enabled&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceosmp_cpu_enable(&lt;br /&gt;
    U32_t cpu_id&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| cpu_id || ID of CPU core to be enabled.&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit  || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || CPU ID outside allowed range 0 to 254&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || CPU ID &amp;gt;= number of available CPUs; or the same as currently running&lt;br /&gt;
|-&lt;br /&gt;
| ERR_CPU_ALREADY_ENABLED     || CPU already enabled&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, good_cpu;&lt;br /&gt;
...&lt;br /&gt;
// Enable CPU core&lt;br /&gt;
status = oceosmp_cpu_enable(good_cpu));&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceosmp_cpu_terminate()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''initialisation.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function removes a CPU core from the OCEOSmp scheduler and marks it so it cannot be restarted. It puts CPU to sleep with interrupts disabled. It should only be called after scheduling has started.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 *  Removes CPU from OCEOSMP scheduler and terminates, cannot be restarted.&lt;br /&gt;
 *  Puts CPU to sleep with interrupts disabled&lt;br /&gt;
 *&lt;br /&gt;
 *  N.B. This function should only be called after scheduling has started&lt;br /&gt;
 *  Steps:&lt;br /&gt;
 *     1. Set terminate flag on this CPU;&lt;br /&gt;
 *     2. Trigger software interrupt to transfer execution to IRQ handler;&lt;br /&gt;
 *     3. Check flag and if set =&amp;gt; put CPU to sleep in while loop with interrupts disabled;&lt;br /&gt;
 *     4. Set MAX priority on this CPU priority stack;&lt;br /&gt;
 *     5. Remove CPU from scheduling;&lt;br /&gt;
 *     6. Clean up all the tasks by calling task terminate function and free up all the&lt;br /&gt;
 *        preempted jobs by this CPU;&lt;br /&gt;
 *&lt;br /&gt;
 * @param cpu_id&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              CPU ID outside allowed range 0 to 254&lt;br /&gt;
 *          ERR_ID_WRONG                CPU ID &amp;gt;= number of available CPUs; or the same as currently running&lt;br /&gt;
 *          ERR_CPU_ALREADY_TERMINATED  CPU already terminated&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceosmp_cpu_terminate(&lt;br /&gt;
    U32_t cpu_id&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| cpu_id || ID of CPU core to be terminated.&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit  || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || CPU ID outside allowed range 0 to 254&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || CPU ID &amp;gt;= number of available CPUs; or the same as currently running&lt;br /&gt;
|-&lt;br /&gt;
| ERR_CPU_ALREADY_TERMINATED  || CPU already terminated&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, faulty_cpu;&lt;br /&gt;
...&lt;br /&gt;
// Terminate CPU core&lt;br /&gt;
status = oceosmp_cpu_terminate(faulty_cpu));&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;Task directives&amp;lt;/span&amp;gt;==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ API Functions&lt;br /&gt;
|-&lt;br /&gt;
| Directive                                                                     || Description                          || main || task || IRQ handler&lt;br /&gt;
|-&lt;br /&gt;
| [[OCEOSmp/directive reference#oceos_task_create()| oceos_task_create()]]             || Create Task                        || *    ||      || &lt;br /&gt;
|-&lt;br /&gt;
| [[OCEOSmp/directive reference#oceos_task_start()| oceos_task_start()]]               || Start Task                         ||      ||  *   || *&lt;br /&gt;
|-&lt;br /&gt;
| [[OCEOSmp/directive reference#oceos_task_timed_start()| oceos_task_timed_start()]]   || Schedule a task to start execution at a given system time||      ||  *   || *&lt;br /&gt;
|-&lt;br /&gt;
| [[OCEOSmp/directive reference#oceos_task_disable()| oceos_task_disable()]]           || Disable Task                       ||      ||  *   || *&lt;br /&gt;
|-&lt;br /&gt;
| [[OCEOSmp/directive reference#oceos_task_enable()| oceos_task_enable()]]             || Enable Task                        ||      ||  *   || *&lt;br /&gt;
|-&lt;br /&gt;
| [[OCEOSmp/directive reference#oceos_task_self()| oceos_task_self()]]                 || Returns the task ID of the currently executing task ||    ||  *   || *&lt;br /&gt;
|-&lt;br /&gt;
| [[OCEOSmp/directive reference#oceos_task_get_priority()| oceos_task_get_priority()]] || Get priority of a task             ||      ||  *   || *&lt;br /&gt;
|-&lt;br /&gt;
| [[OCEOSmp/directive reference#oceos_task_get_status()| oceos_task_get_status()]]     || Get status of a task               ||      ||  *   || *&lt;br /&gt;
|-&lt;br /&gt;
| [[OCEOSmp/directive reference#oceos_task_kill()| oceos_task_kill()]]                 || Directive to terminate current task||      ||  *   || *&lt;br /&gt;
|-&lt;br /&gt;
| [[OCEOSmp/directive reference#oceos_task_get_info()| oceos_task_get_info()]]         || Get task information               ||      ||  *   || *&lt;br /&gt;
|-&lt;br /&gt;
| [[OCEOSmp/directive reference#oceosmp_task_kill()| oceosmp_task_kill()]]                 || Directive to terminate current task||      ||  *   || *&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;Task data structures&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''tasks.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The following data structures are used by some of the task directives.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Data structures'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * A pointer to this structure is passed to oceos_task_create().&lt;br /&gt;
 * The structure is first initialised according to a tasks's parameters,&lt;br /&gt;
 * and is not used again after the task is created and may then be discarded.&lt;br /&gt;
 */&lt;br /&gt;
struct task_descriptor {&lt;br /&gt;
&lt;br /&gt;
	void (*function_start)(void*);	// name of task start function&lt;br /&gt;
	void (*function_end)(void*);	// optional, NULL or task end function&lt;br /&gt;
&lt;br /&gt;
	U32_t task_id;					// 0 to 254, usually an enum&lt;br /&gt;
	U32_t task_jobs_max;			// 1 to 15, max concurrent 'jobs'&lt;br /&gt;
	U32_t task_priority;			// 1 (highest) to 254 (lowest)&lt;br /&gt;
	U32_t task_threshold;			// &amp;gt;=1, &amp;lt;= task_priority (higher or same priority)&lt;br /&gt;
	U32_t task_turned_on_initially;	// 0: disabled initially, else enabled&lt;br /&gt;
&lt;br /&gt;
	U32_t time_deadline_microsecs;	// start request to finish, 0 to ignore&lt;br /&gt;
	U32_t time_min_interval_microsecs;	// between start requests, 0 to ignore&lt;br /&gt;
&lt;br /&gt;
	U32_t uses_cpu_affinity;		// 0: not restricted, else core restricted&lt;br /&gt;
	U32_t uses_cpu_affinity_core_id;// core ID to which restricted if affinity used&lt;br /&gt;
}__attribute__ ((aligned (8)));&lt;br /&gt;
&lt;br /&gt;
/**&lt;br /&gt;
 * Task info used with oceos_task_get_info&lt;br /&gt;
 */&lt;br /&gt;
struct task_info {&lt;br /&gt;
  U64_t           time_max_delay;               // maximum time job is waiting on ready queue before becoming active&lt;br /&gt;
  U64_t           time_max_finish;              // maximum time to finish job execution after starting&lt;br /&gt;
  U64_t           time_max_exec;                // maximum time spent executing&lt;br /&gt;
  U64_t           time_total_exec;              // total CPU time used by this task&lt;br /&gt;
  U64_t           time_min_gap_starts;          // minimum time between job creations, can be reset&lt;br /&gt;
  U64_t           time_min_gap_finish_start;    // minimum time between job ending and new job creation, can be reset&lt;br /&gt;
&lt;br /&gt;
  U64_t           time_last_start;              // time of most recent job creation&lt;br /&gt;
  U64_t           time_last_finish;             // time of most recent job finish&lt;br /&gt;
&lt;br /&gt;
  unsigned int    jobs_current_max  :16;        // maximum number of current jobs for this task, no roll over, can be reset&lt;br /&gt;
  unsigned int    jobs_total        :16;        // number of times this task was started, no roll-over, can be reset&lt;br /&gt;
  U32_t           jobs_current;                 // Number of task instances currently in use by oceos&lt;br /&gt;
&lt;br /&gt;
  U32_t           preempt_max;                  // maximum times any job was pre-empted, no roll-over, can be reset&lt;br /&gt;
}__attribute__ ((aligned (8)));&lt;br /&gt;
&lt;br /&gt;
/* A task's status is returned as below if queried */&lt;br /&gt;
enum TASK_STATUS {&lt;br /&gt;
    TASK_DISABLED,      // cannot be scheduled, and no current jobs&lt;br /&gt;
    TASK_ENABLED,       // can be scheduled, but no current jobs&lt;br /&gt;
    TASK_INVALID,       // task does not exist&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_task_create()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''tasks.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Create a task.&lt;br /&gt;
Can only be use before OCEOS starts. Stores the task information in the OCEOS fixed data area.&lt;br /&gt;
This directive populates the data structures for a task. It should be called after [[OCEOSmp/directive_reference#oceos_init()|oceos_init()]] and before [[OCEOSmp/directive_reference#oceos_init_finish()|oceos_init_finish()]].&amp;lt;br&amp;gt;&lt;br /&gt;
It must be called for each task otherwise [[OCEOSmp/directive_reference#oceos_start()|oceos_start()]] will return an error.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Create a task using a task descriptor structure&lt;br /&gt;
 *&lt;br /&gt;
 * Can only be used in Initialisation Phase.&lt;br /&gt;
 *&lt;br /&gt;
 * A task has twelve constant parameters set when the task is created.&lt;br /&gt;
 * Rather than setting a list of these parameters the named fields of a&lt;br /&gt;
 * task_descriptor structure are set and a pointer to it passed here.&lt;br /&gt;
 *&lt;br /&gt;
 * The task_descriptor structure fields are described above.&lt;br /&gt;
 * Once the task has been created the structure can be discarded.&lt;br /&gt;
 *&lt;br /&gt;
 * To create a task:&lt;br /&gt;
 *		set up a task_descriptor structure,&lt;br /&gt;
 *		set its fields to the parameter values for the task,&lt;br /&gt;
 *		pass a pointer to the structure to this directive.&lt;br /&gt;
 *&lt;br /&gt;
 * The structure is checked for validity by oceos_task_create and its&lt;br /&gt;
 * information used to set the task details in the OCEOS fixed data area.&lt;br /&gt;
 *&lt;br /&gt;
 * @param  struct task_descriptor *	fields give task characteristics&lt;br /&gt;
 *&lt;br /&gt;
 * @return OCEOS_SUCCESS            No errors or warnings&lt;br /&gt;
 *         WARN_NO_END_FUNCTION     Warning, no end task function specified&lt;br /&gt;
 *&lt;br /&gt;
 *         ERR_SYS_FIXED_CORRUPT    System Fixed area corrupt&lt;br /&gt;
 *         ERR_WRONG_CPU_CORE       Executing directive on wrong CPU&lt;br /&gt;
 *         ERR_WRONG_PHASE          Called before oceos_init() is done&lt;br /&gt;
 *         ERR_TOO_MANY             MAX number of tasks already created&lt;br /&gt;
 *         ERR_ID_INVALID           Task ID outside allowed range 0 to 254&lt;br /&gt;
 *         ERR_ID_WRONG             Task ID outside &amp;gt;= number of tasks&lt;br /&gt;
 *         ERR_T_ALREADY_ALLOCATED  Task ID already in use&lt;br /&gt;
 *         ERR_T_PRIORITY_INVALID   Task priority outside allowed range 1 to 254&lt;br /&gt;
 *         ERR_THRESHOLD_INVALID    Task threshold outside range 1 to 254&lt;br /&gt;
 *         ERR_THRESHOLD_WRONG      Task threshold  higher priority than task priority&lt;br /&gt;
 *         ERR_JOBS_MAX_INVALID     Job number outside range 1 to 15&lt;br /&gt;
 *         ERR_JOBS_TOO_MANY        System capacity exceeded&lt;br /&gt;
 *         ERR_AFFINITY_WRONG       CPU core specified is outside chosen range&lt;br /&gt;
 *         ERR_START_FUNCTION_BAD   Task start function address either NULL or misaligned&lt;br /&gt;
 */&lt;br /&gt;
S32_t   oceos_task_create(&lt;br /&gt;
    const struct task_descriptor * const task_description_ptr&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter           || Description&lt;br /&gt;
|-&lt;br /&gt;
|struct task_descriptor * || Pointer to task descriptor which contains task attributes&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit     || Description&lt;br /&gt;
|-&lt;br /&gt;
|WARN_NO_END_FUNCTION     || Warning, no end task function specified&lt;br /&gt;
|-&lt;br /&gt;
|ERR_SYS_FIXED_CORRUPT    || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
|ERR_WRONG_CPU_CORE       || Executing directive on wrong CPU&lt;br /&gt;
|-&lt;br /&gt;
|ERR_WRONG_PHASE          || Called before oceos_init() is done&lt;br /&gt;
|-&lt;br /&gt;
|ERR_TOO_MANY             || MAX number of tasks already created&lt;br /&gt;
|-&lt;br /&gt;
|ERR_ID_INVALID           || Task ID outside allowed range 0 to 254&lt;br /&gt;
|-&lt;br /&gt;
|ERR_ID_WRONG             || Task ID outside &amp;gt;= number of tasks&lt;br /&gt;
|-&lt;br /&gt;
|ERR_T_ALREADY_ALLOCATED  || Task ID already in use&lt;br /&gt;
|-&lt;br /&gt;
|ERR_T_PRIORITY_INVALID   || Task priority outside allowed range 1 to 254&lt;br /&gt;
|-&lt;br /&gt;
|ERR_THRESHOLD_INVALID    || Task threshold outside range 1 to 254&lt;br /&gt;
|-&lt;br /&gt;
|ERR_THRESHOLD_WRONG      || Task threshold  higher priority than task priority&lt;br /&gt;
|-&lt;br /&gt;
|ERR_JOBS_MAX_INVALID     || Job number outside range 1 to 15&lt;br /&gt;
|-&lt;br /&gt;
|ERR_JOBS_TOO_MANY        || System capacity exceeded&lt;br /&gt;
|-&lt;br /&gt;
|ERR_AFFINITY_WRONG       || CPU core specified is outside chosen range&lt;br /&gt;
|-&lt;br /&gt;
|ERR_START_FUNCTION_BAD   || Task start function address either NULL or misaligned&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
/* Sample Task names - all here start with t_ to help avoid name confusion */&lt;br /&gt;
enum TASK_NAME{&lt;br /&gt;
      t_0,&lt;br /&gt;
      t_1,&lt;br /&gt;
      t_2&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
/*&lt;br /&gt;
 * APPLICATION FUNCTION DECLARATIONS&lt;br /&gt;
 */&lt;br /&gt;
void fun0(void *);&lt;br /&gt;
void fun1(void *);&lt;br /&gt;
void fun2(void *);&lt;br /&gt;
void end_function(void *);&lt;br /&gt;
&lt;br /&gt;
const struct task_descriptor tasks_data[NUMBER_OF_TASKS] = {&lt;br /&gt;
    {fun0, end_function, t_0, 2, 10, 8, TASK_ENABLED, 0, 0, 0, 0},&lt;br /&gt;
    {fun1, end_function, t_1, 2, 10, 8, TASK_ENABLED, 0, 0, 0, 0},&lt;br /&gt;
    {fun2, end_function, t_2, 2, 10, 8, TASK_ENABLED, 0, 0, 0, 0}&lt;br /&gt;
}; &lt;br /&gt;
&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
    // create tasks (names are defined in the application header)&lt;br /&gt;
    for (i=0; i&amp;lt;NUMBER_OF_TASKS; i++){&lt;br /&gt;
        if ( oceos_task_create(&amp;amp;tasks_data[i]) != OCEOS_SUCCESS ){&lt;br /&gt;
        	oceosmp_print(&amp;quot;\nFailed to create task\n\r&amp;quot;);&lt;br /&gt;
        	return -i;&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_task_start()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''tasks.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function starts an instance of a task. An instance of a task is called a job in OCEOS terminology.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 *  Starting a task involves three main stages&lt;br /&gt;
 *      1 setting up a job&lt;br /&gt;
 *          finding a free job entry if available&lt;br /&gt;
 *          setting up this entry including passing it the data void *&lt;br /&gt;
 *&lt;br /&gt;
 *      2 placing the job on readyQ&lt;br /&gt;
 *&lt;br /&gt;
 *      3 doing a context switch&lt;br /&gt;
 * This function should only be called after OCEOS is initialised&lt;br /&gt;
 *       and the dynamic task and job structures set up&lt;br /&gt;
 *&lt;br /&gt;
 *  When used from an interrupt handler,&lt;br /&gt;
 *  the context switch is only done&lt;br /&gt;
 *  after all nested interrupts have unwound&lt;br /&gt;
 *&lt;br /&gt;
 * @param task_id Task ID must be in range 0 to 254&lt;br /&gt;
 * @param ptr     Pointer to task data&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT    System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT      System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE          Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID           Task ID is invalid&lt;br /&gt;
 *          ERR_ID_WRONG             Task ID is wrong&lt;br /&gt;
 *          ERR_START_TASK_DISABLED  Starting task is disabled&lt;br /&gt;
 *          ERR_TOO_MANY             There is no free job&lt;br /&gt;
 *          ERR_SYS_BUSY             Failed to grab the lock&lt;br /&gt;
 */&lt;br /&gt;
S32_t   oceos_task_start(&lt;br /&gt;
    const U32_t task_id, // task ID, must be in range 0 to 254&lt;br /&gt;
    void * const ptr    // pointer to data&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| task_id || U32_t with Task ID in range 0 to 254.&lt;br /&gt;
|-&lt;br /&gt;
| ptr    || void * pointer to task data&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit  || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT    || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT      || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE          || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID           || Task ID is invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG             || Task ID is wrong&lt;br /&gt;
|-&lt;br /&gt;
| ERR_START_TASK_DISABLED  || Starting task is disabled&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TOO_MANY             || There is no free job&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY             || Failed to grab the lock&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
void *ptr;&lt;br /&gt;
...&lt;br /&gt;
// Start instance of task T_1 passing pointer ptr&lt;br /&gt;
status = oceos_task_start(t_1,ptr);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_task_timed_start()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''tasks.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function schedules a task to start execution at a given system time.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 *  Schedule a task to start execution at a given system time&lt;br /&gt;
 *&lt;br /&gt;
 *  The before and after offsets define a window around the selected time&lt;br /&gt;
 *  in which the task may be started.&lt;br /&gt;
 *&lt;br /&gt;
 *  If the current system time is before the start window a job is created&lt;br /&gt;
 *  and a corresponding action put on the timed action queue.&lt;br /&gt;
 *&lt;br /&gt;
 *  If the current system time is within the time window for starting the task,&lt;br /&gt;
 *  it is started immediately.&lt;br /&gt;
 *&lt;br /&gt;
 *  If the current system time is after the window, an error is reported.&lt;br /&gt;
 *&lt;br /&gt;
 *  Times are in microseconds.&lt;br /&gt;
 *&lt;br /&gt;
 *  This function should only be called after OCEOS is initialised&lt;br /&gt;
 *  and the dynamic task and job structures set up&lt;br /&gt;
 *&lt;br /&gt;
 * @param taskID        Task ID must be in range 0 to 254&lt;br /&gt;
 * @param ptr           Pointer to data&lt;br /&gt;
 * @param start_time    System time at which job should start&lt;br /&gt;
 * @param before        Forward tolerance for time&lt;br /&gt;
 * @param after         Backward tolerance for time&lt;br /&gt;
 * @param return_job_id Return job_id to the user, to remove this job from timed action if needed&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              Task ID invalid&lt;br /&gt;
 *          ERR_ID_WRONG                Task ID is wrong&lt;br /&gt;
 *          ERR_TA_NOT_INIT             Timed action inialisation is not done and tried to be used&lt;br /&gt;
 *          ERR_START_TASK_DISABLED     Starting task is disabled&lt;br /&gt;
 *          ERR_TOO_MANY                There is no free job&lt;br /&gt;
 *          ERR_TOO_LATE                Starting task is too late(out of time frame)&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to grab the lock&lt;br /&gt;
 *          ERR_TA_Q_FULL               Timed action queue is full&lt;br /&gt;
 *          ERR_TA_START_FAILED         Timed action execute failed; See log&lt;br /&gt;
 */&lt;br /&gt;
S32_t   oceos_task_timed_start(&lt;br /&gt;
    const U32_t task_id,     // task ID, must be in range 0 to 254&lt;br /&gt;
    void * const ptr,        // pointer to data&lt;br /&gt;
    const U64_t start_time,  // system time at which job should start&lt;br /&gt;
    const U32_t before,      // forward tolerance for time&lt;br /&gt;
    const U32_t after,       // backward tolerance for time&lt;br /&gt;
    U32_t * return_job_id    // return job_id to the user, to remove this job from timed action if needed&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| taskID        || U32_t task ID must be in range 0 to 254&lt;br /&gt;
|-&lt;br /&gt;
| ptr           || void * pointer to data&lt;br /&gt;
|-&lt;br /&gt;
| start_time    || U64_t system time at which job should start&lt;br /&gt;
|-&lt;br /&gt;
| before        || U32_t forward tolerance for time&lt;br /&gt;
|-&lt;br /&gt;
| after         || U32_t backward tolerance for time&lt;br /&gt;
|-&lt;br /&gt;
| return_job_id || U32_t return job_id to the user, to remove this job from timed action if needed&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit  || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || Task ID invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || Task ID is wrong&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_NOT_INIT             || Timed action inialisation is not done and tried to be used&lt;br /&gt;
|-&lt;br /&gt;
| ERR_START_TASK_DISABLED     || Starting task is disabled&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TOO_MANY                || There is no free job&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TOO_LATE                || Starting task is too late(out of time frame)&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to grab the lock&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_Q_FULL               || Timed action queue is full&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_START_FAILED         || Timed action execute failed; See log&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
U32_t job_id;&lt;br /&gt;
U64_t cur_sys_time;&lt;br /&gt;
...&lt;br /&gt;
  cur_sys_time = oceos_time_sys_get64();&lt;br /&gt;
&lt;br /&gt;
  // Start task 10,000 microseconds (us) from now and advise if started more than 1,000 us before or 2,000 us after.&lt;br /&gt;
  status = oceos_task_timed_start(t_2, ptr, cur_sys_time + 10000, 1000, 2000, &amp;amp;job_id);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_task_disable()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''initialisation.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function disables a task and removes any current pending jobs from the readyQ.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 *  Disable a task and remove any current pending jobs on readyQ.&lt;br /&gt;
 *&lt;br /&gt;
 *  A disabled task's jobs  will not be put into execution nor put on readyQ.&lt;br /&gt;
 *&lt;br /&gt;
 *  Note that where execution of a task has already commenced,&lt;br /&gt;
 *  disabling the task will not prevent it from completing.&lt;br /&gt;
 *&lt;br /&gt;
 *  This function should only be called after OCEOS is initialised&lt;br /&gt;
 *  and the dynamic task and job structures set up&lt;br /&gt;
 *&lt;br /&gt;
 * @param taskID  Task ID must be in range 0 to 254&lt;br /&gt;
 * @return: OCEOS_SUCCESS&lt;br /&gt;
 *          WARN_ALREADY_DISABLED        Task already disabled&lt;br /&gt;
 *          WARN_SEM_PEND_REMOVE_FAILED  Failed to remove job from semaphore pending queue&lt;br /&gt;
 *          WARN_DQ_PEND_REMOVE_FAILED   Failed to remove job from dataq pending queue&lt;br /&gt;
 *&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT        System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT          System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE              Directive was called before OCEOS init is finished&lt;br /&gt;
 *          ERR_ID_INVALID               Task ID is invalid&lt;br /&gt;
 *          ERR_ID_WRONG                 Task ID is wrong&lt;br /&gt;
 *          ERR_SYS_BUSY                 Failed to grab the lock&lt;br /&gt;
 */&lt;br /&gt;
S32_t   oceos_task_disable(&lt;br /&gt;
    const U32_t task_id // task ID, must be in range 0 to 254&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| taskID || U32_t task ID must be in range 0 to 254&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit  || Description&lt;br /&gt;
|-&lt;br /&gt;
| WARN_ALREADY_DISABLED        || Task already disabled&lt;br /&gt;
|-&lt;br /&gt;
| WARN_SEM_PEND_REMOVE_FAILED  || Failed to remove job from semaphore pending queue&lt;br /&gt;
|-&lt;br /&gt;
| WARN_DQ_PEND_REMOVE_FAILED   || Failed to remove job from dataq pending queue&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT        || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT          || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE              || Directive was called before OCEOS init is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID               || Task ID is invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                 || Task ID is wrong&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                 || Failed to grab the lock&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Disable task t_1&lt;br /&gt;
status = oceos_task_disable(t_1);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_task_enable()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''tasks.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function enables a task. Only enabled tasks may be started.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 *  Enable a task - only enabled tasks are placed on readyQ or started.&lt;br /&gt;
 *&lt;br /&gt;
 *  This function should only be called after OCEOS is initialised&lt;br /&gt;
 *  and the dynamic task and job structures set up&lt;br /&gt;
 *&lt;br /&gt;
 * @param taskID   Task ID must be in range 0 to 254&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          WARN_ALREADY_ENABLED     Task already enabled&lt;br /&gt;
 *&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT    System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT      System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE          Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID           Task ID is invalid&lt;br /&gt;
 *          ERR_ID_WRONG             Task ID is wrong&lt;br /&gt;
 *          ERR_SYS_BUSY             Failed to grab the lock&lt;br /&gt;
 */&lt;br /&gt;
S32_t   oceos_task_enable(&lt;br /&gt;
    const U32_t task_id // task ID, must be in range 0 to 254&lt;br /&gt;
);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| taskID  || U32_t task ID must be in range 0 to 254&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit  || Description&lt;br /&gt;
|-&lt;br /&gt;
| WARN_ALREADY_ENABLED     || Task already enabled&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT    || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT      || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE          || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID           || Task ID is invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG             || Task ID is wrong&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY             || Failed to grab the lock&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Enable task t_2&lt;br /&gt;
status = oceos_task_enable(t_2);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_task_self()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''tasks.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the task number of the currently running task on the calling CPU.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Get currently running task on calling CPU&lt;br /&gt;
 *&lt;br /&gt;
 * @param t_id  Task ID holder&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT        System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT          System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE              Directive was called before OCEOS init is finished&lt;br /&gt;
 *          ERR_CPU_DYN_PTR_BAD          CPU dynamic area pointer corrupt&lt;br /&gt;
 */&lt;br /&gt;
S32_t  oceos_task_self(&lt;br /&gt;
    U32_t *t_id&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| t_id || S32_t * pointer to variable where task ID will be written.&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit  || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT        || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT          || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE              || Directive was called before OCEOS init is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_CPU_DYN_PTR_BAD          || CPU dynamic area pointer corrupt&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, task_running;&lt;br /&gt;
...&lt;br /&gt;
// Return task ID that's running on this core&lt;br /&gt;
status = oceos_task_self(&amp;amp;task_running);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_task_get_priority()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''tasks.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the priority of the task ID passed to it.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Get priority of the task&lt;br /&gt;
 *&lt;br /&gt;
 * @param taskID        ID of task, must be in range 0 to 254&lt;br /&gt;
 * @param t_priority    Pointer to task priority holder&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT        System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT          System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE              Directive was called before OCEOS init is finished&lt;br /&gt;
 *          ERR_ID_INVALID               Task ID is invalid&lt;br /&gt;
 *          ERR_ID_WRONG                 Task ID is wrong&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_task_get_priority(&lt;br /&gt;
    const U32_t task_id, // task ID, must be in range 0 to 254&lt;br /&gt;
    U32_t *t_priority   // Pointer to task priority holder&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| task_id || S32_t task ID of task whose priority is required&lt;br /&gt;
|-&lt;br /&gt;
| t_priority || S32_t * pointer to variable where priority will be written&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit  || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT        || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT          || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE              || Directive was called before OCEOS init is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID               || Task ID is invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                 || Task ID is wrong&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
U32_t t_priority;&lt;br /&gt;
...&lt;br /&gt;
// Return the priority of task ID t_4 &lt;br /&gt;
status = oceos_task_get_priority(t_4, &amp;amp;t_priority);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_task_get_status()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''tasks.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the status of the task ID passed to it.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Get status of the task;&lt;br /&gt;
 * if OK t_status holds enum TASK_STATUS&lt;br /&gt;
 *&lt;br /&gt;
 * @param taskID    ID of task, must be in range 0 to 254&lt;br /&gt;
 * @param t_status  enum TASK_STATUS holder&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT        System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT          System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE              Directive was called before OCEOS init is finished&lt;br /&gt;
 *          ERR_ID_INVALID               Task ID is invalid&lt;br /&gt;
 *          ERR_ID_WRONG                 Task ID is wrong&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_task_get_status(&lt;br /&gt;
    const U32_t task_id,&lt;br /&gt;
    U32_t *t_status&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| task_id || S32_t task ID of task whose priority is required&lt;br /&gt;
|-&lt;br /&gt;
| t_status || S32_t * pointer to variable where status will be written&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit  || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT        || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT          || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE              || Directive was called before OCEOS init is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID               || Task ID is invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                 || Task ID is wrong&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
U32_t t_status;&lt;br /&gt;
...&lt;br /&gt;
// Return the status of task ID t_4 &lt;br /&gt;
status = oceos_task_get_status(t_4, &amp;amp;t_status);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_task_get_info()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''tasks.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the task information for the specified task.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Get task information for task with ID.&lt;br /&gt;
 *&lt;br /&gt;
 * User must pass pointer to struct task_info in order to retrieve data.&lt;br /&gt;
 *&lt;br /&gt;
 * @param task_id  Task ID&lt;br /&gt;
 * @param info     Pointer to struct task_info&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT    System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT      System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE          Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID           Task ID invalid&lt;br /&gt;
 *          ERR_ID_WRONG             Task ID wrong&lt;br /&gt;
 *          ERR_TASK_INFO_PTR_BAD    Task info pointer provided by user is NULL&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_task_get_info (&lt;br /&gt;
    const U32_t task_id,   // Task ID&lt;br /&gt;
    struct task_info *info // Pointer to struct task_info&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| task_id || ID of task for which information is required&lt;br /&gt;
|-&lt;br /&gt;
| task_info || struct task_info * pointer to the structure where task information is to be written&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit  || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT    || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT      || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE          || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID           || Task ID invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG             || Task ID wrong&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TASK_INFO_PTR_BAD    || Task info pointer provided by user is NULL&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
struct task_info info;&lt;br /&gt;
...&lt;br /&gt;
// Get information for task T3&lt;br /&gt;
status = oceos_task_get_info(t_3, &amp;amp;info);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceosmp_task_kill()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''tasks.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function kills the specified task running on the specified CPU.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 *  Function to kill currently running task on CPU;&lt;br /&gt;
 *  Can be used:&lt;br /&gt;
 *      From Mode_SVC  =&amp;gt; normal running mode for application&lt;br /&gt;
 *          If nesting level is zero and Mode_SVC&lt;br /&gt;
 *      From Mode_IRQ  =&amp;gt; from IRQ handler&lt;br /&gt;
 *          If nesting level is not zero, set flag to call this function within IRQ handler&lt;br /&gt;
 *      From Exception =&amp;gt; Mode_ABT and Mode_UND&lt;br /&gt;
 *          If nesting level is zero and NOT Mode_SVC, it is exception;&lt;br /&gt;
 *              Disable IRQs on current CPU;&lt;br /&gt;
 *              Set kill current task flag to TRUE;&lt;br /&gt;
 *              Issue SGI on current CPU, will be interrupted on return from Exception and&lt;br /&gt;
 *              this function will be called within IRQ handler&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT    System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT      System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE          Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_CPU_DYN_PTR_BAD      CPU dynamic area pointer corrupt&lt;br /&gt;
 *          ERR_ID_INVALID           Task ID invalid&lt;br /&gt;
 *          ERR_ID_WRONG             Task ID wrong&lt;br /&gt;
 *          ERR_CPU_ID_WRONG         CPU ID wrong&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceosmp_task_kill(&lt;br /&gt;
    U32_t task_id,&lt;br /&gt;
    U32_t cpu_id&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| task_id  || U32_t task ID to be killed (must be in range 0 to 254)&lt;br /&gt;
|-&lt;br /&gt;
| cpu_id  || U32_t CPU ID where task_id is to be killed&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT    || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT      || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE          || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_CPU_DYN_PTR_BAD      || CPU dynamic area pointer corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID           || Task ID invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG             || Task ID wrong&lt;br /&gt;
|-&lt;br /&gt;
| ERR_CPU_ID_WRONG         || CPU ID wrong&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Kill task t_2 on CPU cpu_1&lt;br /&gt;
status = oceosmp_task_kill(t_2, cpu_1);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;Mutex directives&amp;lt;/span&amp;gt;==&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_mutex_create()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''mutex.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function creates a mutex of specified ID with a specified priority ceiling.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Creates a mutex with priority ceiling&lt;br /&gt;
 *&lt;br /&gt;
 * NOTE: This function should only be called after OCEOSmp is initialised with&lt;br /&gt;
 *  oceos_init() and before initialisation ends with oceos_init_finish()&lt;br /&gt;
 *  and scheduling starts with oceos_start()&lt;br /&gt;
 *&lt;br /&gt;
 * @param mutex_id  mutex ID value 0 to 62&lt;br /&gt;
 * @param priority  mutex priority ceiling 1 to 254 (high to low task priority)&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_WRONG_CPU_CORE          Executing directive on wrong CPU&lt;br /&gt;
 *          ERR_WRONG_PHASE             Called before oceos_init() is done&lt;br /&gt;
 *          ERR_TOO_MANY                MAX number of MUTEXs already created&lt;br /&gt;
 *          ERR_ID_INVALID              MUTEX ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                MUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
 *          ERR_MX_ALREADY_ALLOCATED    MUTEX ID already used&lt;br /&gt;
 *          ERR_MX_PRIORITY_WRONG       MUTEX priority ceiling outside allowed range 1 to 254&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_mutex_create(&lt;br /&gt;
    const U32_t mutex_id,  // mutex ID, must be in range 0 to 62&lt;br /&gt;
    const U8_t  priority  // mutex priority ceiling&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| mutex_id  || u32_t mutex ID to be created (value 0 to 62).&lt;br /&gt;
|-&lt;br /&gt;
| priority_ceiling ||  U32_t mutex priority ceiling 1 to 254 (high to low task priority)&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_CPU_CORE          || Executing directive on wrong CPU&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Called before oceos_init() is done&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TOO_MANY                || MAX number of MUTEXs already created&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || MUTEX ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || MUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_MX_ALREADY_ALLOCATED    || MUTEX ID already used&lt;br /&gt;
|-&lt;br /&gt;
| ERR_MX_PRIORITY_WRONG       || MUTEX priority ceiling outside allowed range 1 to 254&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Create mutex with ID print_mutex and priority ceiling of 5&lt;br /&gt;
status = oceos_mutex_create(print_mutex, 5);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_mutex_wait()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''mutex.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function makes the task wait until the specified mutex is available.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
 /*&lt;br /&gt;
  * Wait on mutex with ID.&lt;br /&gt;
  * If task succeeds in grabbing mutex, system level priority rises to&lt;br /&gt;
  * priority of this mutex, so tasks with lower or equal priority will&lt;br /&gt;
  * not be able to start till mutex is released.&lt;br /&gt;
  *&lt;br /&gt;
  * This should only be called after OCEOSmp scheduling has started.&lt;br /&gt;
  *&lt;br /&gt;
  * @param mutex_id     const U32_t  : value 0 to 62&lt;br /&gt;
  *&lt;br /&gt;
  * @return  OCEOS_SUCCESS&lt;br /&gt;
  *          WARN_MX_INCORRECT_ORDER     MUTEX acquired in incorrect order&lt;br /&gt;
  *&lt;br /&gt;
  *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
  *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
  *          ERR_WRONG_PHASE             Directive was called before OCEOSmp initialisation is finished&lt;br /&gt;
  *          ERR_ID_INVALID              MUTEX ID outside allowed range 0 to 62&lt;br /&gt;
  *           ERR_ID_WRONG                MUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
  *          ERR_MX_CEILING_BAD          MUTEX ceiling not lower priority than job priority&lt;br /&gt;
  *          ERR_MX_ALREADY_HELD         MUTEX already held by this job&lt;br /&gt;
  *          ERR_SYS_BUSY                Failed to grab context switch guard&lt;br /&gt;
  */&lt;br /&gt;
S32_t oceos_mutex_wait(&lt;br /&gt;
    const U32_t  mutex_id      // mutex ID, must be in range 0 to 62&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| mutex_id  || u32_t mutex ID to be waited on (value 0 to 62).&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| WARN_MX_INCORRECT_ORDER     || MUTEX acquired in incorrect order&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOSmp initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || MUTEX ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || MUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_MX_CEILING_BAD          || MUTEX ceiling not lower priority than job priority&lt;br /&gt;
|-&lt;br /&gt;
| ERR_MX_ALREADY_HELD         || MUTEX already held by this job&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to grab context switch guard&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Wait on mutex m_2&lt;br /&gt;
status = oceos_mutex_wait(m_2);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_mutex_signal()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''mutex.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function signals the specified mutex.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Signal a mutex with ID&lt;br /&gt;
 *&lt;br /&gt;
 * N.B. :&lt;br /&gt;
 *      This function should not be called from an interrupt handler&lt;br /&gt;
 *      This should only be called after OCEOSmp scheduling has started.&lt;br /&gt;
 *&lt;br /&gt;
 * @param mutex_id     const U32_t  : value 0 to 62&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          WARN_MX_ALREADY_FREE        MUTEX is free already&lt;br /&gt;
 *          WARN_MX_NESTING_BAD         MUTEX nesting incorrect&lt;br /&gt;
 *&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOSmp initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              MUTEX ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                MUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
 *          ERR_MX_WRONG_JOB            MUTEX not held by this job&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to grab context switch guard&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_mutex_signal(&lt;br /&gt;
    const U32_t  mutex_id     // mutex ID, must be in range 0 to 62&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| mutex_id  || u32_t mutex ID to be signalled (value 0 to 62).&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| WARN_MX_ALREADY_FREE        || MUTEX is free already&lt;br /&gt;
|-&lt;br /&gt;
| WARN_MX_NESTING_BAD         || MUTEX nesting incorrect&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOSmp initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || MUTEX ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || MUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_MX_WRONG_JOB            || MUTEX not held by this job&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to grab context switch guard&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Signal mutex m_2&lt;br /&gt;
status = oceos_mutex_signal(m_2);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_mutex_get_value()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''mutex.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the value of the specified mutex.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Get current value of mutex with ID&lt;br /&gt;
 *&lt;br /&gt;
 * @param mutex_id      const U32_t  : value 0 to 62&lt;br /&gt;
 * @param m_value       pointer to MUTEX value holder&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOSmp initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              MUTEX ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                MUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
 *          ERR_MX_DATA_PTR_BAD         Pointer to MUTEX value return holder is null&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_mutex_get_value(&lt;br /&gt;
    const U32_t  mutex_id,      // mutex ID, must be in range 0 to 62&lt;br /&gt;
    U32_t *m_value              // Pointer to MUTEX value holder&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| mutex_id  || u32_t mutex ID to be signalled (value 0 to 62)&lt;br /&gt;
|-&lt;br /&gt;
| m_value  || u32_t * pointer where mutex value is to be written&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOSmp initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || MUTEX ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || MUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_MX_DATA_PTR_BAD         || Pointer to MUTEX value return holder is null&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
U32_t value;&lt;br /&gt;
...&lt;br /&gt;
// Get value of mutex m_2&lt;br /&gt;
status = oceos_mutex_get_value(m_2, &amp;amp;value);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;Read/write mutex directives&amp;lt;/span&amp;gt;==&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;Read/write mutex overview&amp;lt;/span&amp;gt;===&lt;br /&gt;
&lt;br /&gt;
Contents:&lt;br /&gt;
&lt;br /&gt;
 1.  Read/Write Mutex features&lt;br /&gt;
 2.  Read/Write Mutex data structures&lt;br /&gt;
 3.  Read/Write Mutex constants&lt;br /&gt;
 4.  Read/Write Mutex manager Directives&lt;br /&gt;
&lt;br /&gt;
==== Read/Write Mutex Features ====&lt;br /&gt;
&lt;br /&gt;
Read/Write Mutexes (rwmutexes) can be held for 'read' at the same time&lt;br /&gt;
by multiple jobs on different CPUs, but once held for 'write' by any job&lt;br /&gt;
cannot be obtained for 'read' or for 'write' by another job until released.&lt;br /&gt;
&lt;br /&gt;
They can be used to allow data be read simultaneously by multiple jobs when&lt;br /&gt;
the data is not being updated while ensuring that no updating can take&lt;br /&gt;
place while any job is reading the data.&lt;br /&gt;
&lt;br /&gt;
Pending write requests take precedence over pending read requests and are&lt;br /&gt;
done on a first come, first served basis. Once any job on a CPU has a&lt;br /&gt;
rwmutex for 'read' no other job on that CPU can acquire it so as to avoid&lt;br /&gt;
potential problems and minimise delays in servicing write requests by other&lt;br /&gt;
CPUs.&lt;br /&gt;
&lt;br /&gt;
While any job holds a rwmutex for reading any job on another CPU can also&lt;br /&gt;
acquire it for reading. Other jobs on the same CPU that may attempt to&lt;br /&gt;
acquire the rwmutex are delayed in starting until return of the rwmutex.&lt;br /&gt;
No job can acquire the rwmutex for writing until all read acquisitions&lt;br /&gt;
have been returned.&lt;br /&gt;
&lt;br /&gt;
No job will acquire a rwmutex for reading if any job is trying to acquire&lt;br /&gt;
it for writing, giving write precedence over read. Multiple write requests&lt;br /&gt;
waiting for existing read acquisitions to complete are serviced in the&lt;br /&gt;
order in which they were made when the current read acquisitions complete.&lt;br /&gt;
&lt;br /&gt;
If a task waits on a rwmutex that it already holds a system log entry is&lt;br /&gt;
made (LOG_RWMUTEX_ALREADY_HELD) and an INTERNAL_ERROR status code returned.&lt;br /&gt;
&lt;br /&gt;
If a task attempts to release a rwmutex it does not hold a system log entry&lt;br /&gt;
is made (LOG_RWMUTEX_ALREADY_FREE) and an INTERNAL_ERROR status code returned.&lt;br /&gt;
&lt;br /&gt;
If a job holds more than one rwmutex at the same time these must be&lt;br /&gt;
acquired and released in a nested manner&lt;br /&gt;
(e.g. wait 1, wait 2, wait 3, signal 3, signal 2, signal 1).&lt;br /&gt;
&lt;br /&gt;
If a task exits while holding one or more rwmutexes these are returned and&lt;br /&gt;
a system log entry made (LOG_RWMUTEX_NOT_RETURNED).&lt;br /&gt;
&lt;br /&gt;
==== Read/Write Mutex data structures ====&lt;br /&gt;
&lt;br /&gt;
In OCEOSmp each rwmutex has a priority ceiling, the priority of the highest&lt;br /&gt;
priority task that acquires the rwmutex for read or for write.&lt;br /&gt;
OCEOSmp uses this to ensure that once a job on a particular CPU has the&lt;br /&gt;
rwmutex for reading or for writing no other job on that CPU can be started&lt;br /&gt;
that might try to obtain that rwmutex.&lt;br /&gt;
&lt;br /&gt;
The priority ceiling of a rwmutex is specified when the rwmutex is created&lt;br /&gt;
and does not change subsequently. Priority ceilings are stored in the&lt;br /&gt;
fixed data area as an array U8_t rwmutexCeilings[] indexed by mutex ID.&lt;br /&gt;
This array is extended to be a whole number of 32-bit words.&lt;br /&gt;
&lt;br /&gt;
A rwmutex has a unique rwmutex ID, an unsigned integer usually defined in&lt;br /&gt;
the application header file as an enum RWMUTEX_NAME{} thus allowing a&lt;br /&gt;
user-friendly name be associated with each rwmutex ID.&lt;br /&gt;
&lt;br /&gt;
Using an enum is strongly recommended as it allows a user-friendly name be&lt;br /&gt;
associated with each ID, and helps ensure IDs are contiguous from 0.&lt;br /&gt;
&lt;br /&gt;
These rwmutex IDs are used as indices into both fixed and dynamic data&lt;br /&gt;
arrays and must cover the range 0 to ((number of rwmutexes) -1). Using&lt;br /&gt;
enum RWMUTEX_NAME{} automatically assigns names to IDs 0, 1, 2...&lt;br /&gt;
&lt;br /&gt;
Read write mutex dynamic data such as the current write requests and&lt;br /&gt;
current read count are stored in the dynamic data area in an array of&lt;br /&gt;
struct rwmutex_dyn_block also indexed by the rwmutex ID.&lt;br /&gt;
&lt;br /&gt;
A further dynamic area array of guard_t is used in providing mutual&lt;br /&gt;
exclusion when updating the rwmutex dynamic data.&lt;br /&gt;
&lt;br /&gt;
==== Read/Write Mutex constants ====&lt;br /&gt;
&lt;br /&gt;
In OCEOSmp there can be a maximum of 63 rwmutexes,&lt;br /&gt;
with IDs from 0 to 62 (the value 63 is used as an invalid ID).&lt;br /&gt;
&lt;br /&gt;
The rwmutexes can be created in any order, but OCEOSmp will return an error&lt;br /&gt;
and fail to start if the resulting IDs fail to be contiguous from 0 as IDs&lt;br /&gt;
are used by OCEOS as indices into arrays.&lt;br /&gt;
&lt;br /&gt;
Each rwmutex has a priority ceiling, the priority of the highest priority&lt;br /&gt;
task that uses the rwmutex for reading or for writing. This is specified&lt;br /&gt;
when the rwmutex is created, does not change subsequently, and must be in&lt;br /&gt;
the range 1 (TASK_MAX_PRIORITY) to 254 (TASK_MIN_PRIORITY).&lt;br /&gt;
The application developer must ensure that the correct rwmutex ceiling&lt;br /&gt;
is used. OCEOSmp will detect an attempt to acquire a rwmutex by a task&lt;br /&gt;
with higher priority than that rwmutex's priority ceiling, make a&lt;br /&gt;
system log entry (LOG_RWMUTEX_BAD_CEILING) and return an INTERNAL_ERROR&lt;br /&gt;
status code.&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_rwmutex_create()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''rwmutex.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function ees a read/write mutex.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Creates a Read/Write Mutex (RWMUTEX)&lt;br /&gt;
 *&lt;br /&gt;
 * This function should only be called after OCEOSmp is initialised with&lt;br /&gt;
 * oceos_init() and before initialisation ends with oceos_init_finish()&lt;br /&gt;
 * and scheduling starts with oceos_start()&lt;br /&gt;
 *&lt;br /&gt;
 * @param rwm_id    Read/Write RWMUTEX ID, must be in range 0 to 62&lt;br /&gt;
 * @param priority  Priority ceiling of highest priority task that uses the RWMUTEX&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_WRONG_CPU_CORE          Executing directive on wrong CPU&lt;br /&gt;
 *          ERR_WRONG_PHASE             Called before oceos_init() is done&lt;br /&gt;
 *          ERR_TOO_MANY                MAX number of RWMUTEXs already created&lt;br /&gt;
 *          ERR_ID_INVALID              RWMUTEX ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                RWMUTEX ID &amp;gt;= number of RWMUTEXs&lt;br /&gt;
 *          ERR_RWMX_ALREADY_ALLOCATED  RWMUTEX ID already used&lt;br /&gt;
 *          ERR_RWMX_PRIORITY_WRONG     RWMUTEX priority ceiling outside allowed range 1 to 254&lt;br /&gt;
 */&lt;br /&gt;
S32_t   oceos_rwmutex_create(&lt;br /&gt;
    const U32_t rwm_id,   // RWMUTEX ID, must be in range 0 to max rwm&lt;br /&gt;
    const U8_t priority   // RWMUTEX priority ceiling&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| rwm_id || Read/Write RWMUTEX ID, must be in range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| priority || Priority ceiling of highest priority task that uses the RWMUTEX&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_CPU_CORE          || Executing directive on wrong CPU&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Called before oceos_init() is done&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TOO_MANY                || MAX number of RWMUTEXs already created&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || RWMUTEX ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || RWMUTEX ID &amp;gt;= number of RWMUTEXs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_RWMX_ALREADY_ALLOCATED  || RWMUTEX ID already used&lt;br /&gt;
|-&lt;br /&gt;
| ERR_RWMX_PRIORITY_WRONG     || RWMUTEX priority ceiling outside allowed range 1 to 254&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Create read/write mutex with ID rwm_2 and priority ceiling of 100 &lt;br /&gt;
status = oceos_rwmutex_create(rwm_1, 100);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_rwmutex_read_wait()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''rwmutex.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function acquires a read/write mutex for read. If successful, jobs on other CPUs can also acquire it for read, but no job will be able to acquire it for write while any read is under way. If job already holds RWMUTEX for read or for write the appropriate status code is returned, a system log entry made, and the job continues. It will not succeed while any job is waiting to obtain RWMUTEX for write, and will loop waiting for all pending writes on this RWMUTEX to complete.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Read wait on RWMUTEX.&lt;br /&gt;
 *&lt;br /&gt;
 * If successful jobs on other CPUs can also acquire it for read, but no job&lt;br /&gt;
 * will be able to acquire it for write while any read is under way.&lt;br /&gt;
 * If job already holds RWMUTEX for read or for write appropriate status code&lt;br /&gt;
 * is returned, a system log entry made, and the job continues.&lt;br /&gt;
 * Will not succeed while any job is waiting to obtain RWMUTEX for write,&lt;br /&gt;
 * will loop waiting for all pending writes on this RWMUTEX to complete.&lt;br /&gt;
 *&lt;br /&gt;
 * This should only be called after OCEOS scheduling has started.&lt;br /&gt;
 *&lt;br /&gt;
 * N.B.	The returned status code must be checked and appropriate action&lt;br /&gt;
 * 		taken.&lt;br /&gt;
 *&lt;br /&gt;
 * @param rwm_id    const U32_t  : value 0 to 62&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          WARN_RWMX_NOT_HIGHEST       Already holds a RWMUTEX higher in the RWMUTEX order&lt;br /&gt;
 *                                      (there then may be a risk of deadlock)&lt;br /&gt;
 *&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              RWMUTEX ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                RWMUTEX ID &amp;gt;= number of RWMUTEXs&lt;br /&gt;
 *          ERR_RWMX_CEILING_BAD        RWMUTEX ceiling not lower priority than job priority&lt;br /&gt;
 *          ERR_RWMX_ALREADY_HELD       RWMUTEX already held by this job&lt;br /&gt;
 *          ERR_RWMX_CPU_STACK_FULL     CPU priority ceiling stack full&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_rwmutex_read_wait(&lt;br /&gt;
    const U32_t rwm_id  // RWMUTEX ID, must be in range 0 to 62&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| rwm_id || U32_t rwmutex to be acquired for read (value 0 to 62)&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| WARN_RWMX_NOT_HIGHEST       || Already holds a RWMUTEX higher in the RWMUTEX order (deadlock risk)&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || RWMUTEX ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || RWMUTEX ID &amp;gt;= number of RWMUTEXs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_RWMX_CEILING_BAD        || RWMUTEX ceiling not lower priority than job priority&lt;br /&gt;
|-&lt;br /&gt;
| ERR_RWMX_ALREADY_HELD       || RWMUTEX already held by this job&lt;br /&gt;
|-&lt;br /&gt;
| ERR_RWMX_CPU_STACK_FULL     || CPU priority ceiling stack full&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Acquire read/write mutex rwm_1 for read&lt;br /&gt;
status = oceos_rwmutex_read_wait(rwm_1);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_rwmutex_write_wait()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''rwmutex.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function acquires the specified read/write mutex for write.&lt;br /&gt;
If successful, no other job can also obtain it for reading or for writing. Will not succeed while any other job has acquired RWMUTEX for write,&lt;br /&gt;
or any jobs have obtained RWMUTEX for read. Will then loop until the RWMUTEX is released and for its turn in the sequence of jobs that have tried to acquire the RWMUTEX for writing. If already holds the RWMUTEX for writing or reading an appropriate status code is returned, a system log entry made, and the job continues. While there are any outstanding attempts to obtain the RWMUTEX for write no job will be able to acquire it for reading.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Write wait on RWMUTEX.&lt;br /&gt;
 *&lt;br /&gt;
 * If successful no other job can also obtain it for reading or for writing.&lt;br /&gt;
 * Will not succeed while any other job has acquired RWMUTEX for write,&lt;br /&gt;
 * or any jobs have obtained RWMUTEX for read. Will then loop until the&lt;br /&gt;
 * RWMUTEX is released and for its turn in the sequence of jobs that have&lt;br /&gt;
 * tried to acquire the RWMUTEX for writing.&lt;br /&gt;
 * If already holds the RWMUTEX for writing or reading an appropriate status&lt;br /&gt;
 * code is returned, a system log entry made, and the job continues.&lt;br /&gt;
 * While there are any outstanding attempts to obtain the RWMUTEX for write&lt;br /&gt;
 * no job will be able to acquire it for reading.&lt;br /&gt;
 *&lt;br /&gt;
 * This should only be called after OCEOS scheduling has started.&lt;br /&gt;
 *&lt;br /&gt;
 * N.B.	The returned status code must be checked and appropriate action&lt;br /&gt;
 * 		taken.&lt;br /&gt;
 *&lt;br /&gt;
 * @param rwm_id     const U32_t  : value 0 to 62&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          WARN_RWMX_NOT_HIGHEST       Already holds a RWMUTEX higher in the RWMUTEX order&lt;br /&gt;
 *                                      (there then may be a risk of deadlock)&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              RWMUTEX ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                RWMUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
 *          ERR_RWMX_CEILING_BAD        RWMUTEX ceiling not lower priority than job priority&lt;br /&gt;
 *          ERR_RWMX_ALREADY_HELD       RWMUTEX already held by this job&lt;br /&gt;
 *          ERR_RWMX_CPU_STACK_FULL     CPU priority ceiling stack full&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_rwmutex_write_wait(&lt;br /&gt;
    const U32_t rwm_id  // RWMUTEX ID, must be in range 0 to 62&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| rwm_id || U32_t rwmutex to be acquired for write(value 0 to 62)&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| WARN_RWMX_NOT_HIGHEST       || Already holds a RWMUTEX higher in the RWMUTEX order (deadlock risk)&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || RWMUTEX ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || RWMUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_RWMX_CEILING_BAD        || RWMUTEX ceiling not lower priority than job priority&lt;br /&gt;
|-&lt;br /&gt;
| ERR_RWMX_ALREADY_HELD       || RWMUTEX already held by this job&lt;br /&gt;
|-&lt;br /&gt;
| ERR_RWMX_CPU_STACK_FULL     || CPU priority ceiling stack full&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Acquire read/write mutex rwm_1 for write&lt;br /&gt;
status = oceos_rwmutex_read_wait(rwm_1);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_rwmutex_signal()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''rwmutex.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function signals the specified read/write mutex.&lt;br /&gt;
It frees the RWMUTEX for use by other jobs, irrespective of whether the RWMUTEX is held for reading or for writing. If the RWMUTEX is not held by the job then it returns an appropriate status code. It does not take into account how many times a job has obtained the RWMUTEX for read or for write.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Signal a RWMUTEX&lt;br /&gt;
 *&lt;br /&gt;
 * Frees the RWMUTEX for use by other jobs, irrespective of whether&lt;br /&gt;
 * RWMUTEX is held for reading or for writing.&lt;br /&gt;
 * if the RWMUTEX is not held by the job returns an appropriate status code.&lt;br /&gt;
 * Does not take into account how many times a job has obtained the RWMUTEX&lt;br /&gt;
 * for read or for write.&lt;br /&gt;
 *&lt;br /&gt;
 * This should only be called after OCEOS scheduling has started.&lt;br /&gt;
 *&lt;br /&gt;
 * N.B. The returned status code must be checked and appropriate action taken.&lt;br /&gt;
 *&lt;br /&gt;
 * @param rwm_id    const U32_t  : value 0 to 62&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          WARN_RWMX_ALREADY_FREE      RWMUTEX is free already&lt;br /&gt;
 *&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              RWMUTEX ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                RWMUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
 *          ERR_RWMX_CEILING_BAD        RWMUTEX ceiling not lower priority than job priority&lt;br /&gt;
 *          ERR_RWMX_CPU_STACK_EMPTY    CPU priority ceiling stack empty&lt;br /&gt;
 *          ERR_RWMX_CEILING_INVALID    CPU current priority ceiling on the priority stack is invalid&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_rwmutex_signal(&lt;br /&gt;
    const U32_t rwm_id // RWMUTEX ID, must be in range 0 to 62&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| rwm_id || U32_t rwmutex to be signaled(value 0 to 62)&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| WARN_RWMX_ALREADY_FREE      || RWMUTEX is free already&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || RWMUTEX ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || RWMUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_RWMX_CEILING_BAD        || RWMUTEX ceiling not lower priority than job priority&lt;br /&gt;
|-&lt;br /&gt;
| ERR_RWMX_CPU_STACK_EMPTY    || CPU priority ceiling stack empty&lt;br /&gt;
|-&lt;br /&gt;
| ERR_RWMX_CEILING_INVALID    || CPU current priority ceiling on the priority stack is invalid&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Signal read/write mutex number rwm_4&lt;br /&gt;
status = oceos_rwmutex_signal(rwm_4);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_rwmutex_check_status()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''rwmutex.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function checks the status of a read/write mutex. The possible states are free, in-use for read, and in-use for write.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Check whether RWMUTEX is free&lt;br /&gt;
 *&lt;br /&gt;
 * @param rwm_id        must be in range 0 to 62&lt;br /&gt;
 * @param m_status      pointer to RWMUTEX status holder;&lt;br /&gt;
 *                      if return code OCEOS_SUCCESS RWMUTEX status:&lt;br /&gt;
 *                          0 =&amp;gt; Free for use&lt;br /&gt;
 *                          1 =&amp;gt; In use for read&lt;br /&gt;
 *                          2 =&amp;gt; In use for write&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              RWMUTEX ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                RWMUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
 *          ERR_RWMX_DATA_PTR_BAD       Pointer to RWMUTEX status return holder is null&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_rwmutex_check_status(&lt;br /&gt;
    const U32_t rwm_id, // RWMUTEX ID, must be in range 0 to 62&lt;br /&gt;
    U32_t *m_status&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| rwm_id || read/write mutex number in range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| m_status || U32_t pointer to RWMUTEX status holder (0 = free, 1 = in-use for read, 2 = in-use for write &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || RWMUTEX ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || RWMUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_RWMX_DATA_PTR_BAD       || Pointer to RWMUTEX status return holder is null&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, rwm_status;&lt;br /&gt;
...&lt;br /&gt;
// Check the status of read/write mutex rwm_2&lt;br /&gt;
status = oceos_rwmutex_check_status(rwm_2, &amp;amp;rwm_status);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_rwmutex_reading_count()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''rwmutex.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the current number of jobs holding a specified read/write mutex for read.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 *&lt;br /&gt;
 * Get current number of jobs holding RWMUTEX for read&lt;br /&gt;
 *&lt;br /&gt;
 * @param rwm_id    must be in range 0 to 62&lt;br /&gt;
 * @param m_count   pointer to RWMUTEX count holder&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              RWMUTEX ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                RWMUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
 *          ERR_RWMX_DATA_PTR_BAD       Pointer to RWMUTEX count return holder is null&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_rwmutex_reading_count(&lt;br /&gt;
    const U32_t rwm_id, // RWMUTEX ID, must be in range 0 to 62&lt;br /&gt;
    U32_t *m_count&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| rwm_id || U32 value of read/write mutex (in range 0 to 62)&lt;br /&gt;
|-&lt;br /&gt;
| m_count || U32_t pointer to read/write mutex count holder&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || RWMUTEX ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || RWMUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_RWMX_DATA_PTR_BAD       || Pointer to RWMUTEX count return holder is null&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, rwm_count;&lt;br /&gt;
...&lt;br /&gt;
// Get the number of jobs holding the read/write mutex rwm_2 for read&lt;br /&gt;
status = oceos_rwmutex_reading_count(rwm_2, &amp;amp;rwm_count);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_rwmutex_write_reqs_count()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''header.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the current number of write requests for the specified read/write mutex .&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Get current RWMUTEX write requests count&lt;br /&gt;
 *&lt;br /&gt;
 * @param rwm_id    must be in range 0 to 62&lt;br /&gt;
 * @param m_count   pointer to RWMUTEX count holder&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              RWMUTEX ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                RWMUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
 *          ERR_RWMX_DATA_PTR_BAD       Pointer to RWMUTEX count return holder is null&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_rwmutex_write_reqs_count(&lt;br /&gt;
    const U32_t rwm_id, // RWMUTEX ID, must be in range 0 to 62&lt;br /&gt;
    U32_t *m_count&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| rwm_id || U32_t value of read/write mutex (must be in range 0 to 62)&lt;br /&gt;
|-&lt;br /&gt;
| m_count || U32_t pointer to read/write mutex count holder&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || RWMUTEX ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || RWMUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_RWMX_DATA_PTR_BAD       || Pointer to RWMUTEX count return holder is null&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, rwm_count;&lt;br /&gt;
...&lt;br /&gt;
// Get the count of cuurent write requests for read/write mutex rwm_1&lt;br /&gt;
status = oceos_rwmutex_write_reqs_count(rwm_1, &amp;amp;rwm_count);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_rwmutex_writes_pending_count()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''rwmutex.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the current number of pending writes for the specified read/write mutex.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Get current RWMUTEX writes pending count&lt;br /&gt;
 *&lt;br /&gt;
 * @param rwm_id    must be in range 0 to 62&lt;br /&gt;
 * @param m_count   pointer to RWMUTEX count holder&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              RWMUTEX ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                RWMUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
 *          ERR_RWMX_DATA_PTR_BAD       Pointer to RWMUTEX pending count return holder is null&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_rwmutex_writes_pending_count(&lt;br /&gt;
    const U32_t rwm_id, // RWMUTEX ID, must be in range 0 to 62&lt;br /&gt;
    U32_t *m_count&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| rwm_id || U32_t value of read/write mutex (must be in range 0 to 62)&lt;br /&gt;
|-&lt;br /&gt;
| m_count || U32_t pointer to read/write mutex count holder&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || RWMUTEX ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || RWMUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_RWMX_DATA_PTR_BAD       || Pointer to RWMUTEX count return holder is null&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, rwm_count;&lt;br /&gt;
...&lt;br /&gt;
// Get the count of cuurent write requests for read/write mutex rwm_1&lt;br /&gt;
status = oceos_rwmutex_writes_pending_count(rwm_1, &amp;amp;rwm_count);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_rwmutex_holding()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''header.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the read/write mutexes currently held by this instance of this task (job).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Get RWMUTEXs currently held by this instance of the task (job)&lt;br /&gt;
 *&lt;br /&gt;
 * @param m_data    U64_t pointer, each bit indicating RWMUTEX held by current task&lt;br /&gt;
 *                          0 =&amp;gt; Not held by job&lt;br /&gt;
 *                          1 =&amp;gt; Held by job&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_RWMX_DATA_PTR_BAD       Pointer to RWMUTEX status return holder is null&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_rwmutex_holding(&lt;br /&gt;
    U64_t *m_data&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| m_data || U64_t pointer, each bit indicating RWMUTEX held by current task, 0 =&amp;gt; not held, 1 =&amp;gt; held &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_RWMX_DATA_PTR_BAD       || Pointer to RWMUTEX status return holder is null&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
U64_t rwm_held;&lt;br /&gt;
...&lt;br /&gt;
// Which read/write mutexes does this job hold&lt;br /&gt;
status = oceos_rwmutex_holding(&amp;amp;rwm_held);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Semaphores directives ==&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_sem_create()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''semaphore.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function creates a semaphore.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Create a counting semaphore&lt;br /&gt;
 *&lt;br /&gt;
 * @param sem_id            SEMAPHORE ID (from 0 to 62)&lt;br /&gt;
 * @param max_permits       number of max permits allowed for this SEMAPHORE, 1 to 4095&lt;br /&gt;
 * @param count_permits     starting number of permits available 0 to 4095&lt;br /&gt;
 * @param pending_q_size    MAX Number of tasks on SEMAPHORE pending queue 1 to 253&lt;br /&gt;
 * @param use_timeout       if TRUE, directive oceos_sem_wait_restart_timeout can be used&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_WRONG_CPU_CORE          Executing directive on wrong CPU&lt;br /&gt;
 *          ERR_WRONG_PHASE             Called before oceos_init() is done&lt;br /&gt;
 *          ERR_TOO_MANY                MAX number of SEMAPHOREs already created&lt;br /&gt;
 *          ERR_ID_INVALID              SEMAPHORE ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                SEMAPHORE ID &amp;gt;= number of SEMAPHOREs&lt;br /&gt;
 *          ERR_SM_ALREADY_ALLOCATED    SEMAPHORE ID already used&lt;br /&gt;
 *          ERR_SM_MAX_PERMIT_WRONG     MAX permits outside allowed range 1 to 4095&lt;br /&gt;
 *          ERR_SM_COUNT_PERMIT_WRONG   Count permits outside allowed range 0 to 4095&lt;br /&gt;
 *          ERR_SM_COUNT_PERMIT_INVALID Count permits is greater than MAX permits for this SEMAPHORE&lt;br /&gt;
 *          ERR_SM_PENQ_SIZE_WRONG      SEMAPHORE pending queue size outside allowed range 1 to 253&lt;br /&gt;
 *          ERR_SM_TA_MAX_NUM_REACHED   Number of timed actions exceeds MAX allowed 255,&lt;br /&gt;
 *                                      each task on SEMAPHORE pending queue is timed action&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_sem_create(&lt;br /&gt;
    sem_t sem_id,         // counting semaphore ID (MAX 63)&lt;br /&gt;
    U16_t max_permits,    // max number of permits (MAX 4095)&lt;br /&gt;
    U16_t count_permits,  // initial number of permits (MAX 4095)&lt;br /&gt;
    U8_t  pending_q_size, // max number of pending queue jobs (MAX 253)&lt;br /&gt;
    BOOLE_t use_timeout   // whether timeout is used in oceos_sem_wait_restart_timeout&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| sem_id || Semaphore ID to be created (from 0 to 62)&lt;br /&gt;
|-&lt;br /&gt;
| max_permits || number of max permits allowed for this semaphore, 1 to 4095&lt;br /&gt;
|-&lt;br /&gt;
| count_permits || starting number of permits available 0 to 4095&lt;br /&gt;
|-&lt;br /&gt;
| pending_q_size || Maximum Number of tasks on SEMAPHORE pending queue 1 to 253&lt;br /&gt;
|-&lt;br /&gt;
| use_timeout || if TRUE, directive oceos_sem_wait_restart_timeout can be used&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_CPU_CORE          || Executing directive on wrong CPU&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Called before oceos_init() is done&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TOO_MANY                || MAX number of SEMAPHOREs already created&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || SEMAPHORE ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || SEMAPHORE ID &amp;gt;= number of SEMAPHOREs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SM_ALREADY_ALLOCATED    || SEMAPHORE ID already used&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SM_MAX_PERMIT_WRONG     || MAX permits outside allowed range 1 to 4095&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SM_COUNT_PERMIT_WRONG   || Count permits outside allowed range 0 to 4095&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SM_COUNT_PERMIT_INVALID || Count permits is greater than MAX permits for this SEMAPHORE&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SM_PENQ_SIZE_WRONG      || SEMAPHORE pending queue size outside allowed range 1 to 253&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SM_TA_MAX_NUM_REACHED   || Number of timed actions exceeds MAX allowed 255&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, param;&lt;br /&gt;
...&lt;br /&gt;
// Create semaphore called s_audi with max permits of 1000, starting permits of zero, max of 10 tasks on pending queue, and no timeouts &lt;br /&gt;
status = oceos_sem_create(s_audi, 1000, 0, 10, FALSE);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_sem_signal()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''semaphore.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function signals a semaphore, increments its count and transfers pending jobs to the ready queue.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Signals a semaphore, increments and transfers pending jobs to ready queue&lt;br /&gt;
 *&lt;br /&gt;
 * @param sem_id counting SEM ID&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          WARN_JOB_NOT_GUARDED&lt;br /&gt;
 *&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              SEM ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                SEM ID &amp;gt;= number of SEMs&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to grab SEM guard&lt;br /&gt;
 *          ERR_TOO_MANY                SEM max permits count already reached&lt;br /&gt;
 *          ERR_SM_JOB_ID_WRONG         Job ID of the task on SEM pending queue is wrong&lt;br /&gt;
 *          ERR_TA_NOT_FOUND            Timed action index to be removed for job not found&lt;br /&gt;
 *          ERR_TA_START_FAILED         Timed action re-start failed after job remove from timed action queue&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_sem_signal(&lt;br /&gt;
    sem_t sem_id // counting SEM ID&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| sem_id || U32_t value of semaphore to be signalled (incremented)&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| WARN_JOB_NOT_GUARDED        || job not guarded, application should check system log&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || SEM ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || SEM ID &amp;gt;= number of SEMs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to grab SEM guard&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TOO_MANY                || SEM max permits count already reached&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SM_JOB_ID_WRONG         || Job ID of the task on SEM pending queue is wrong&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_NOT_FOUND            || Timed action index to be removed for job not found&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_START_FAILED         || Timed action re-start failed after job remove from timed action queue&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Signal s_audi semaphore (increment its count)&lt;br /&gt;
status = oceos_sem_signal(s_audi);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_sem_wait_continue()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''semaphore.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function decrements the available permits of a sempahore otherwise returns an unsuccessful status code.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Wait on semaphore,&lt;br /&gt;
 * decrement the number of available permits for semaphore,&lt;br /&gt;
 * if no permits continue and task should handle unsuccessful result&lt;br /&gt;
 *&lt;br /&gt;
 * @param sem_id SEM ID&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              SEM ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                SEM ID &amp;gt;= number of SEMs&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to grab SEM guard&lt;br /&gt;
 *          ERR_SM_NOT_AVAILABLE        No more permits available for this SEM&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_sem_wait_continue(&lt;br /&gt;
    sem_t sem_id // counting SEM ID&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| sem_id || U32_t value of semaphore to be decremented&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || SEM ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || SEM ID &amp;gt;= number of SEMs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to grab SEM guard&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SM_NOT_AVAILABLE        || No more permits available for this SEM&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Decrement available permits on semaphore s_1&lt;br /&gt;
status = oceos_sem_wait_continue(s_1);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_sem_wait_restart()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''semaphore.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function decrements the available permits of a sempahore and if none available, the job is put on the pending queue.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Waits on semaphore,&lt;br /&gt;
 * if fail, put job on pending queue and exit task&lt;br /&gt;
 *&lt;br /&gt;
 * @param sem_id SEM ID&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              SEM ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                SEM ID &amp;gt;= number of SEMs&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to grab SEM guard&lt;br /&gt;
 *          ERR_SM_J_START_FROM_TIMOUT  Task started from timeout already, SEM no permits available second time&lt;br /&gt;
 *          ERR_FAILED                  Should never return this&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_sem_wait_restart(&lt;br /&gt;
    sem_t sem_id  // counting SEM ID&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| sem_id || U32_t value of semaphore to be decremented&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || SEM ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || SEM ID &amp;gt;= number of SEMs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to grab SEM guard&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SM_J_START_FROM_TIMOUT  || Task started from timeout already, SEM no permits available second time&lt;br /&gt;
|-&lt;br /&gt;
| ERR_FAILED                  || Should never return this&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Decrement available permits on semaphore s_1 otherwise job is put on pending queue&lt;br /&gt;
status = oceos_sem_wait_restart(s_1);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_sem_wait_restart_timeout()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''semaphore.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function decrements the available permits of a sempahore and if none available, the job is put on the pending queue with a timeout enabled. The job is restarted either when a permit is available to be decremented or when the timeout has expired. In order to use this directive, semaphore must be created with flag use_timeout is set to TRUE.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Waits on semaphore,&lt;br /&gt;
 * if fail, put job on pending queue with optional timeout.&lt;br /&gt;
 * In order to use this directive, semaphore must be created with&lt;br /&gt;
 * flag use_timeout is set to TRUE&lt;br /&gt;
 *&lt;br /&gt;
 * @param sem_id         SEM ID&lt;br /&gt;
 * @param U64_t timeout  Restart time if no permits, 0 =&amp;gt; ignore&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_TA_NOT_INIT             Timed action intialisation is not done and tried to be used; or SEM created without timeouts&lt;br /&gt;
 *          ERR_ID_INVALID              SEM ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                SEM ID &amp;gt;= number of SEMs&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to grab SEM guard&lt;br /&gt;
 *          ERR_SM_J_START_FROM_TIMOUT  Task started from timeout already, SEM no permits available second time&lt;br /&gt;
 *          ERR_TOO_MANY                SEM pending queue is full&lt;br /&gt;
 *          ERR_FAILED                  Should never return this&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_sem_wait_restart_timeout(&lt;br /&gt;
    sem_t sem_id, // counting SEM ID&lt;br /&gt;
    U64_t timeout // timeout, restart time if no permits, 0 =&amp;gt; ignore&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| sem_id || U32_t value of semaphore to be decremented&lt;br /&gt;
|-&lt;br /&gt;
| timeout | U64_t timeout in time units. A value of 0 causes timeout to be ignored.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_NOT_INIT             || Timed action intialisation is not done and tried to be used; or SEM created without&lt;br /&gt;
timeouts&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || SEM ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || SEM ID &amp;gt;= number of SEMs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to grab SEM guard&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SM_J_START_FROM_TIMOUT  || Task started from timeout already, SEM no permits available second time&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TOO_MANY                || SEM pending queue is full&lt;br /&gt;
|-&lt;br /&gt;
| ERR_FAILED                  || Should never return this&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Decrement available permits on semaphore s_1 otherwise job is put on pending queue with timeout of 10,000 time units (usually usecs)&lt;br /&gt;
status = oceos_sem_wait_restart_timeout(s_1);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_sem_get_value()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''semaphore.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the number of available permits for the specified semaphore.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Returns number of available permits&lt;br /&gt;
 * for SEM ID&lt;br /&gt;
 *&lt;br /&gt;
 * @param sem_id        SEM id&lt;br /&gt;
 * @param s_permits     pointer to permits count holder&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              SEM ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                SEM ID &amp;gt;= number of SEMs&lt;br /&gt;
 *          ERR_SM_DATA_BAD             Data holder pointer is null&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_sem_get_value(&lt;br /&gt;
    sem_t sem_id,    // counting SEM ID&lt;br /&gt;
    U32_t *s_permits // pointer to permits count holder&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| sem_id || U32_t value of semaphore whose permit count is required&lt;br /&gt;
|-&lt;br /&gt;
| s_permits || U32_t pointer to permits count holder&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || SEM ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || SEM ID &amp;gt;= number of SEMs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SM_DATA_BAD             || Data holder pointer is null&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, permit_count;&lt;br /&gt;
...&lt;br /&gt;
// Get the available permits for semaphore s_1&lt;br /&gt;
status = oceos_sem_get_value(s_1, &amp;amp;permit_count);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_sem_penq_get_size()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''semaphore.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the number of jobs on the specified semaphore pending queue.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Returns number of jobs on semaphore pending queue&lt;br /&gt;
 * for semaphore ID&lt;br /&gt;
 *&lt;br /&gt;
 * @param sem_id    SEM id&lt;br /&gt;
 * @param s_size    pointer to pending queue size holder&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              SEM ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                SEM ID &amp;gt;= number of SEMs&lt;br /&gt;
 *          ERR_SM_DATA_BAD             Data holder pointer is null&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_sem_penq_get_size(&lt;br /&gt;
    sem_t sem_id,   // counting SEM ID&lt;br /&gt;
    U32_t *s_size   // pointer to pending queue size holder&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| sem_id || U32_t value of semaphore whose permit count is required&lt;br /&gt;
|-&lt;br /&gt;
| s_size || U32_t pointer to pending queue jobs count holder&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || SEM ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || SEM ID &amp;gt;= number of SEMs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SM_DATA_BAD             || Data holder pointer is null&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, job_count;&lt;br /&gt;
...&lt;br /&gt;
// Get the available permits for semaphore s_1&lt;br /&gt;
status = oceos_sem_penq_get_size(s_1, &amp;amp;job_count);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_sem_reset()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''semaphore.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function restores the permits to the original semaphore initial value and removes any jobs from the pending queue.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Restore permits to original value and&lt;br /&gt;
 * remove jobs from pending queue&lt;br /&gt;
 *&lt;br /&gt;
 * @param sem_id    SEM ID&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              SEM ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                SEM ID &amp;gt;= number of SEMs&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to grab SEM guard&lt;br /&gt;
 *          ERR_SM_JOB_ID_WRONG         Job ID of the task on SEM pending queue is wrong&lt;br /&gt;
 *          ERR_TA_NOT_FOUND            Timed action index to be removed for job not found&lt;br /&gt;
 *          ERR_TA_START_FAILED         Timed action re-start failed after job remove from timed action queue&lt;br /&gt;
 */&lt;br /&gt;
S32_t   oceos_sem_reset(&lt;br /&gt;
    sem_t sem_id   // counting SEM ID&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| sem_id || U32_t value of semaphore to be reset&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || SEM ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || SEM ID &amp;gt;= number of SEMs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to grab SEM guard&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SM_JOB_ID_WRONG         || Job ID of the task on SEM pending queue is wrong&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_NOT_FOUND            || Timed action index to be removed for job not found&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_START_FAILED         || Timed action re-start failed after job remove from timed action queue&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Reset semaphore s_1&lt;br /&gt;
status = oceos_sem_reset(s_1);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Data Queues ==&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_dataq_create()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''dataq.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function creates a data queue with the specified characteristics.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Create data queue&lt;br /&gt;
 * If use_timeout = TRUE, timed actions must be initialised&lt;br /&gt;
 *&lt;br /&gt;
 * @param dataq_id      data queue ID&lt;br /&gt;
 * @param dataq_size    data queue size&lt;br /&gt;
 * @param pen_q_size    pending jobs queue size&lt;br /&gt;
 * @param roll_over     whether to roll over when full&lt;br /&gt;
 * @param use_timeout   if TRUE, directive oceos_dataq_read_restart_timeout can be used&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_WRONG_CPU_CORE          Executing directive on wrong CPU&lt;br /&gt;
 *          ERR_WRONG_PHASE             Called before oceos_init() is done&lt;br /&gt;
 *          ERR_TOO_MANY                MAX number of DATAQs already created&lt;br /&gt;
 *          ERR_ID_INVALID              DATAQ ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                DATAQ ID &amp;gt;= number of DATAQs&lt;br /&gt;
 *          ERR_DQ_ALREADY_ALLOCATED    DATAQ ID already used&lt;br /&gt;
 *          ERR_DQ_SIZE_WRONG           DATAQ size outside allowed range 1 to 255&lt;br /&gt;
 *          ERR_DQ_PENQ_SIZE_WRONG      DATAQ pending queue size outside allowed range 1 to 253&lt;br /&gt;
 *          ERR_DQ_TA_MAX_NUM_REACHED   Number of timed actions exceeds MAX allowed 255,&lt;br /&gt;
 *                                      each task on DATAQ pending queue is timed action&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_dataq_create(&lt;br /&gt;
                         dataq_t dataq_id,    // data queue ID&lt;br /&gt;
                         U16_t dataq_size,    // data queue size&lt;br /&gt;
                         U16_t pen_q_size,    // pending jobs queue size&lt;br /&gt;
                         BOOLE_t roll_over,   // whether to roll over when full&lt;br /&gt;
                         BOOLE_t use_timeout  // whether timeout is used oceos_dataq_read_restart_timeout&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| dataq_id ||   dataq_t data queue ID (number between 0 and 62)&lt;br /&gt;
|-&lt;br /&gt;
| dataq_size ||   data queue size (max number of pointers than can be added to the queue)&lt;br /&gt;
|-&lt;br /&gt;
| pen_q_size ||   pending jobs queue size&lt;br /&gt;
|-&lt;br /&gt;
| roll_over ||    whether to roll over when full (0 =&amp;gt; disabled, 1 =&amp;gt; enabled)&lt;br /&gt;
|-&lt;br /&gt;
| use_timeout ||  if TRUE, directive oceos_dataq_read_restart_timeout can be used&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_CPU_CORE          || Executing directive on wrong CPU&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Called before oceos_init() is done&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TOO_MANY                || MAX number of DATAQs already created&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || DATAQ ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || DATAQ ID &amp;gt;= number of DATAQs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DQ_ALREADY_ALLOCATED    || DATAQ ID already used&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DQ_SIZE_WRONG           || DATAQ size outside allowed range 1 to 255&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DQ_PENQ_SIZE_WRONG      || DATAQ pending queue size outside allowed range 1 to 253&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DQ_TA_MAX_NUM_REACHED   || Number of timed actions exceeds MAX allowed 255, each task on DATAQ pending queue is timed action&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Create data queue d_3 with size 20, max pending jobs of 10, rollover enabled, timeouts disabled &lt;br /&gt;
status = oceos_dataq_create(d_3, 20, 10, 1, 0));&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_dataq_write()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''dataq.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function puts a non-null pointer on the specified data queue.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Puts pointer to the data on data queue.&lt;br /&gt;
 * Pointer to the data must not be NULL&lt;br /&gt;
 *&lt;br /&gt;
 * @param dataq_t dataq_id Data queue ID&lt;br /&gt;
 * @param void* data       Non-null pointer to data&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          WARN_DQ_NOW_FULL            Warning, DATAQ is full now&lt;br /&gt;
 *          WARN_JOB_NOT_GUARDED&lt;br /&gt;
 *&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              DATAQ ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                DATAQ ID &amp;gt;= number of DATAQs&lt;br /&gt;
 *          ERR_DQ_DATA_BAD             Data pointer is null&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to acquire guard&lt;br /&gt;
 *          ERR_TOO_MANY                DATAQ is full&lt;br /&gt;
 *          ERR_DQ_JOB_ID_WRONG         Job ID of the task on pending queue is wrong&lt;br /&gt;
 *          ERR_TA_NOT_FOUND            Timed action index to be removed for job not found&lt;br /&gt;
 *          ERR_TA_START_FAILED         Timed action re-start failed after job remove from timed action queue&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_dataq_write(&lt;br /&gt;
    dataq_t dataq_id, // data queue ID&lt;br /&gt;
    void *data        // non-null pointer to data&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| dataq_id || dataq_t with value of Data queue ID&lt;br /&gt;
|-&lt;br /&gt;
| ptr || void* pointer to application data (non-null pointer)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| WARN_DQ_NOW_FULL            || Warning, DATAQ is full now&lt;br /&gt;
|-&lt;br /&gt;
| WARN_JOB_NOT_GUARDED        || &lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || DATAQ ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || DATAQ ID &amp;gt;= number of DATAQs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DQ_DATA_BAD             || Data pointer is null&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to acquire guard&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TOO_MANY                || DATAQ is full&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DQ_JOB_ID_WRONG         || Job ID of the task on pending queue is wrong&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_NOT_FOUND            || Timed action index to be removed for job not found&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_START_FAILED         || Timed action re-start failed after job remove from timed action queue&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
char[100] message_in;&lt;br /&gt;
...&lt;br /&gt;
// Put pointer to message_in on data queue s_2 &lt;br /&gt;
status = oceos_dataq_write(s_2, (void *)message_in);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_dataq_read_continue()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''dataq.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns a pointer from the specified data queue.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Read data queue&lt;br /&gt;
 *&lt;br /&gt;
 * @param dataq_t dataq_id  Data queue ID&lt;br /&gt;
 * @param void*   data      Pointer to data&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              DATAQ ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                DATAQ ID &amp;gt;= number of DATAQs&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to acquire guard&lt;br /&gt;
 *          ERR_DQ_EMPTY                DATAQ empty(count zero)&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_dataq_read_continue(&lt;br /&gt;
    dataq_t dataq_id, // data queue ID&lt;br /&gt;
    void* *data        // return data&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Descriptionn&lt;br /&gt;
|-&lt;br /&gt;
| dataq_id || dataq_t with value of Data queue ID&lt;br /&gt;
|-&lt;br /&gt;
| ptr || void* pointer to store returned data queue pointer removed from the queue&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || DATAQ ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || DATAQ ID &amp;gt;= number of DATAQs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to acquire guard&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DQ_EMPTY                || DATAQ empty(count zero)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
char *data_ptr;&lt;br /&gt;
...&lt;br /&gt;
// Read pointer from data queue s_2 &lt;br /&gt;
status = oceos_dataq_read_continue(s_2, (void *)data_ptr);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_dataq_read_restart()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''dataq.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns a pointer from the specified data queue. If the queue is empty, the job is added top the dataq pending queue. The job will be restarted when data is available. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Read data queue next item.&lt;br /&gt;
 * If dataq is empty, task is put on pending Q for dataq and&lt;br /&gt;
 * restarted by oceos_dataq_write&lt;br /&gt;
 *&lt;br /&gt;
 * @param dataq_id Data queue ID&lt;br /&gt;
 * @param data     Pointer to return data&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              DATAQ ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                DATAQ ID &amp;gt;= number of DATAQs&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to acquire guard&lt;br /&gt;
 *          ERR_DQ_J_START_FROM_TIMOUT  Job started from timeout already, DATAQ empty second time&lt;br /&gt;
 *          ERR_FAILED                  Should never return this&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_dataq_read_restart(&lt;br /&gt;
    dataq_t dataq_id,    // data queue ID&lt;br /&gt;
    void* *data           // pointer to return data&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| dataq_id || dataq_t with value of Data queue ID&lt;br /&gt;
|-&lt;br /&gt;
| ptr || void* pointer to store returned data queue pointer removed from the queue&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || DATAQ ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || DATAQ ID &amp;gt;= number of DATAQs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to acquire guard&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DQ_J_START_FROM_TIMOUT  || Job started from timeout already, DATAQ empty second time&lt;br /&gt;
|-&lt;br /&gt;
| ERR_FAILED                  || Should never return this&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
char *data_ptr;&lt;br /&gt;
...&lt;br /&gt;
// Read pointer from data queue s_2 with restart when data is available&lt;br /&gt;
status = oceos_dataq_read_restart(s_2, (void *)data_ptr);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_dataq_read_restart_timeout()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''dataq.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns a pointer from the specified data queue. If the queue is empty, the job is added top the dataq pending queue. The job will be restarted either when data is available or the timeout has expired. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Read data queue next item.&lt;br /&gt;
 * If dataq is empty, task is put on pending Q for dataq and&lt;br /&gt;
 * restarted by oceos_dataq_write or by timeout if timeout != 0&lt;br /&gt;
 * In order to use this feature timed actions must be configured and&lt;br /&gt;
 * dataq created with use timeout set to true&lt;br /&gt;
 *&lt;br /&gt;
 * @param dataq_id          Data queue ID&lt;br /&gt;
 * @param data              Pointer to return data&lt;br /&gt;
 * @param timeout           Timeout, restart time if no entry, 0 =&amp;gt; ignore&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_TA_NOT_INIT             Timed action intialisation is not done and tried to be used; or DATAQ created without timeouts&lt;br /&gt;
 *          ERR_ID_INVALID              DATAQ ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                DATAQ ID &amp;gt;= number of DATAQs&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to acquire guard&lt;br /&gt;
 *          ERR_DQ_EMPTY                DATAQ empty(count zero)&lt;br /&gt;
 *          ERR_DQ_J_START_FROM_TIMOUT  Job started from timeout already, DATAQ empty second time&lt;br /&gt;
 *          ERR_TOO_MANY                DATAQ pending queue is full&lt;br /&gt;
 *          ERR_FAILED                  Should never return this&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_dataq_read_restart_timeout(&lt;br /&gt;
    dataq_t dataq_id,   // data queue ID&lt;br /&gt;
    void* *data,         // Pointer to return data&lt;br /&gt;
    U64_t timeout       // timeout, restart time if no entry, 0 =&amp;gt; ignore&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| dataq_id || dataq_t with value of Data queue ID&lt;br /&gt;
|-&lt;br /&gt;
| ptr || void* pointer to store returned data queue pointer removed from the queue&lt;br /&gt;
|-&lt;br /&gt;
| timeout || U64_t containing timeout value, restart time if no entry, 0 =&amp;gt; ignore&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_NOT_INIT             || Timed action intialisation is not done and tried to be used; or DATAQ created without timeouts&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || DATAQ ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || DATAQ ID &amp;gt;= number of DATAQs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to acquire guard&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DQ_EMPTY                || DATAQ empty(count zero)&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DQ_J_START_FROM_TIMOUT  || Job started from timeout already, DATAQ empty second time&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TOO_MANY                || DATAQ pending queue is full&lt;br /&gt;
|-&lt;br /&gt;
| ERR_FAILED                  || Should never return this&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
char *data_ptr;&lt;br /&gt;
...&lt;br /&gt;
// Read pointer from data queue s_2 with timeout after 10,000 time units if no data is available&lt;br /&gt;
status = oceos_dataq_read_restart_timeout(s_2, (void *)data_ptr, 10000ull);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_dataq_get_size()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''dataq.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the number of items on the specified data queue.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Returns number of items on the data queue with ID&lt;br /&gt;
 *&lt;br /&gt;
 * @param dataq_id   DATAQ Id&lt;br /&gt;
 * @param d_size     Pointer to size holder&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              DATAQ ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                DATAQ ID &amp;gt;= number of DATAQs&lt;br /&gt;
 *          ERR_DQ_DATA_BAD             DATAQ size holder pointer is null&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_dataq_get_size(&lt;br /&gt;
    dataq_t dataq_id,   // data queue ID&lt;br /&gt;
    U32_t *d_size&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| dataq_id ||  dataq_t with the ID of the data queue (value between 0 and 62)&lt;br /&gt;
|-&lt;br /&gt;
| d_size || U32_t *d_size pointer to the variable to store the size&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || DATAQ ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || DATAQ ID &amp;gt;= number of DATAQs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DQ_DATA_BAD             || DATAQ size holder pointer is null&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, d_size;&lt;br /&gt;
...&lt;br /&gt;
// Get the number of entries on data queue d_0&lt;br /&gt;
status = oceos_dataq_get_size(d_0, &amp;amp;d_size);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_dataq_penq_get_size()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''dataq.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns number of jobs on the specified data queue pending job's queue.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Returns number of jobs on the dataq pending job's queue&lt;br /&gt;
 *&lt;br /&gt;
 * @param dataq_id  DATAQ Id&lt;br /&gt;
 * @param d_size    Pointer to pending queue size holder&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              DATAQ ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                DATAQ ID &amp;gt;= number of DATAQs&lt;br /&gt;
 *          ERR_DQ_DATA_BAD             DATAQ pending size holder pointer is null&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_dataq_penq_get_size(&lt;br /&gt;
    dataq_t dataq_id,&lt;br /&gt;
    U32_t *d_size&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| dataq_id ||  dataq_t with the ID of the data queue (value between 0 and 62)&lt;br /&gt;
|-&lt;br /&gt;
| d_jobs || U32_t *d_jobs pointer to the variable to store the number of jobs on the pending queue&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || DATAQ ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || DATAQ ID &amp;gt;= number of DATAQs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DQ_DATA_BAD             || DATAQ pending size holder pointer is null&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, d_jobs;&lt;br /&gt;
...&lt;br /&gt;
// Get the number of jobs the the pending jubs queue for data queue d_1&lt;br /&gt;
status = oceos_dataq_penq_get_size(d_1, &amp;amp;d_jobs);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_dataq_clear()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''dataq.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function clears the specified data queue including pending jobs for that queue.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Clears data queue and&lt;br /&gt;
 * frees tasks on pending queue&lt;br /&gt;
 *&lt;br /&gt;
 * @param dataq_t dataq_id Data queue ID&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              DATAQ ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                DATAQ ID &amp;gt;= number of DATAQs&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to acquire guard&lt;br /&gt;
 *          ERR_DQ_JOB_ID_WRONG         Job ID of the task on DATAQ pending queue is wrong&lt;br /&gt;
 *          ERR_TA_NOT_FOUND            Timed action index to be removed for job not found&lt;br /&gt;
 *          ERR_TA_START_FAILED         Timed action re-start failed after job remove from timed action queue&lt;br /&gt;
 */&lt;br /&gt;
S32_t  oceos_dataq_clear(&lt;br /&gt;
    dataq_t dataq_id    // data queue ID&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| dataq_id ||  dataq_t with the ID of the data queue to be cleared (value between 0 and 62)&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || DATAQ ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || DATAQ ID &amp;gt;= number of DATAQs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to acquire guard&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DQ_JOB_ID_WRONG         || Job ID of the task on DATAQ pending queue is wrong&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_NOT_FOUND            || Timed action index to be removed for job not found&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_START_FAILED         || Timed action re-start failed after job remove from timed action queue&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Clear data queue d_1&lt;br /&gt;
status = oceos_dataq_penq_get_size(d_1);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Timed Actions ==&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_timed_output_add()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''timed_action.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function adds a timed action to the timed action queue. It writes a value to an address at a specified system time. An optional mask can be applied so that only those bits are changed.&lt;br /&gt;
The action types are WRITE_ACTION, RMW_ACTION. WRITE_ACTION writes the value to the address. RMW_ACTION reads the values at the address and modifies the bits specified by the mask and value.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Add output action to timed actions queue :&lt;br /&gt;
 *  1. Create timed output action&lt;br /&gt;
 *  2. Stop timer&lt;br /&gt;
 *  3. Add action to action_array&lt;br /&gt;
 *  4. Start timer or execute if time is right&lt;br /&gt;
 *&lt;br /&gt;
 * Returns timed action ID that can be used later to remove&lt;br /&gt;
 * if need by oceos_timed_output_remove&lt;br /&gt;
 *&lt;br /&gt;
 * @param enum ACTION_TYPE action_type  Action type&lt;br /&gt;
 * @param U64_t act_time                System time at which action should be done&lt;br /&gt;
 * @param U32_t before_time             Forward tolerance for time&lt;br /&gt;
 * @param U32_t after_time              Backward tolerance for time&lt;br /&gt;
 * @param adrs_t address                Output address&lt;br /&gt;
 * @param U32_t value                   Output value&lt;br /&gt;
 * @param U32_t mask                    Output mask&lt;br /&gt;
 * @param U32_ *ta_index                Pointer to store timed action index&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_TA_NOT_INIT             Timed action inialisation is not done and tried to be used&lt;br /&gt;
 *          ERR_TA_PTR_BAD              Timed action pointer is null&lt;br /&gt;
 *          ERR_TA_TYPE_WRONG           Timed action type is wrong&lt;br /&gt;
 *          ERR_TOO_LATE                Timed action time is too late&lt;br /&gt;
 *          ERR_SYS_BUSY                Timed action guard failed to acquire&lt;br /&gt;
 *          ERR_TA_Q_FULL               Timed action queue is full&lt;br /&gt;
 *          ERR_TA_START_FAILED         Timed action execute failed; See log&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_timed_output_add(&lt;br /&gt;
    const enum ACTION_TYPE action_type,// Action type&lt;br /&gt;
    U64_t act_time,                    // system time at which action should be done&lt;br /&gt;
    U32_t before_time,                 // forward tolerance for time&lt;br /&gt;
    U32_t after_time,                  // backward tolerance for time&lt;br /&gt;
    const adrs_t address,              // output address&lt;br /&gt;
    const U32_t value,                 // output value&lt;br /&gt;
    const U32_t mask,                  // output mask&lt;br /&gt;
    U32_t *ta_index                    // Pointer to store timed action index&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| enum ACTION_TYPE action_type  || Action type&lt;br /&gt;
|-&lt;br /&gt;
| U64_t act_time                || System time at which action should be done&lt;br /&gt;
|-&lt;br /&gt;
| U32_t before_time             || Forward tolerance for time&lt;br /&gt;
|-&lt;br /&gt;
| U32_t after_time              || Backward tolerance for time&lt;br /&gt;
|-&lt;br /&gt;
| adrs_t address                || Output address&lt;br /&gt;
|-&lt;br /&gt;
| U32_t value                   || Output value&lt;br /&gt;
|-&lt;br /&gt;
| U32_t mask                    || Output mask&lt;br /&gt;
|-&lt;br /&gt;
| U32_ *ta_index                || Pointer to store timed action index&lt;br /&gt;
|-&lt;br /&gt;
| param || parameter to function&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_NOT_INIT             || Timed action inialisation is not done and tried to be used&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_PTR_BAD              || Timed action pointer is null&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_TYPE_WRONG           || Timed action type is wrong&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TOO_LATE                || Timed action time is too late&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Timed action guard failed to acquire&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_Q_FULL               || Timed action queue is full&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_START_FAILED         || Timed action execute failed; See log&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
#define OUTPUT_TIMED_VAL    0xDEADBEEF&lt;br /&gt;
#define OUTPUT_TIMED_MASK   0x1000001&lt;br /&gt;
#define OUTPUT_TIME         0xfffff&lt;br /&gt;
#define OUTPUT_TIME_FW      0x1000&lt;br /&gt;
#define OUTPUT_TIME_BW      0x1000&lt;br /&gt;
&lt;br /&gt;
static U32_t test_data[16] = { 0 };&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Write OUTPUT_TIMED_VAL to test_data[0] at 0xfffff time units from now with a tolerance of 0x1000 before and after the specified time   &lt;br /&gt;
status = oceos_timed_output_add(&lt;br /&gt;
                                       WRITE_ACTION,&lt;br /&gt;
                                       OUTPUT_TIME,&lt;br /&gt;
                                       OUTPUT_TIME_FW,&lt;br /&gt;
                                       OUTPUT_TIME_BW,&lt;br /&gt;
                                       (adrs_t) &amp;amp;test_data[0],&lt;br /&gt;
                                       OUTPUT_TIMED_VAL,&lt;br /&gt;
                                       0,&lt;br /&gt;
                                       &amp;amp;timed_action_index));&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_timed_jobs_number()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''timed_action.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the number of jobs on the timed actions queue.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Get number of Jobs (request to start the task) waiting on timed action queue.&lt;br /&gt;
 * These jobs are added by oceos_task_timed_start() or&lt;br /&gt;
 * oceos_dataq_read_restart_timeout when data is not available (NULL) or&lt;br /&gt;
 * oceos_sem_wait_restart_timeout when counting semaphore is 0&lt;br /&gt;
 *&lt;br /&gt;
 * @param total_jobs    Pointer to store total jobs number waiting on timed action Q&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_TA_NOT_INIT             Timed action inialisation is not done and tried to be used&lt;br /&gt;
 *          ERR_TA_PTR_BAD              Timed action pointer is null&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_timed_jobs_number(U32_t *total_jobs);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| total_jobs || s32_t pointer to store total jobs number waiting on timed action Q&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_NOT_INIT             || Timed action inialisation is not done and tried to be used&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_PTR_BAD              || Timed action pointer is null&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, no_of_jobs;&lt;br /&gt;
...&lt;br /&gt;
// Get the number of jobs on the timed actions queue&lt;br /&gt;
status = oceos_timed_jobs_number(&amp;amp;no_of_jobs);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_timed_jobs_remove()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''timed_action.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function removes the specified timed action from the queue.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Remove job from timed action queue&lt;br /&gt;
 * When task started using oceos_task_timed_start(),&lt;br /&gt;
 * this directive requires pointer to store ID&lt;br /&gt;
 * of job that put on the timed action queue.&lt;br /&gt;
 * This job can be removed later using this directive and stored job ID.&lt;br /&gt;
 *&lt;br /&gt;
 * @param U32_t job_id  Job ID&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_TA_NOT_INIT             Timed action intialisation is not done and tried to be used&lt;br /&gt;
 *          ERR_TA_PTR_BAD              Timed action pointer corrupt&lt;br /&gt;
 *          ERR_ID_WRONG                Job ID is wrong&lt;br /&gt;
 *          ERR_TA_NOT_FOUND            Timed action ID not found for action with job_id or removed already&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to acquire timed action guard&lt;br /&gt;
 *          WARN_TA_Q_EMPTY             Timed action queue is empty&lt;br /&gt;
 *          ERR_TA_START_FAILED         Timed action execute failed; See log&lt;br /&gt;
 */&lt;br /&gt;
S32_t   oceos_timed_jobs_remove(&lt;br /&gt;
    U32_t job_id                             // Job ID&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| job_id || U32_t Job ID to be removed from the timed actions queue&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_NOT_INIT             || Timed action intialisation is not done and tried to be used&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_PTR_BAD              || Timed action pointer corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || Job ID is wrong&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_NOT_FOUND            || Timed action ID not found for action with job_id or removed already&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to acquire timed action guard&lt;br /&gt;
|-&lt;br /&gt;
| WARN_TA_Q_EMPTY             || Timed action queue is empty&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_START_FAILED         || Timed action execute failed; See log&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, job_id;&lt;br /&gt;
...&lt;br /&gt;
// Remove job_id from the timed actions queue&lt;br /&gt;
status = oceos_timed_jobs_remove(job_id);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_timed_jobs_reset()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''timed_action.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function removes all jobs from timed actions queue.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Remove all jobs (requests to start a task) from timed actions queue&lt;br /&gt;
 * These jobs were added by oceos_task_timed_start() or&lt;br /&gt;
 * oceos_dataq_read_restart_timeout when data is not available (NULL) or&lt;br /&gt;
 * oceos_sem_wait_restart_timeout when counting semaphore is 0&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_TA_NOT_INIT             Timed action intialisation is not done and tried to be used&lt;br /&gt;
 *          ERR_TA_PTR_BAD              Timed action pointer is null&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to acquire timed action guard&lt;br /&gt;
 *          WARN_TA_Q_EMPTY             Timed action queue is empty&lt;br /&gt;
 *          ERR_TA_NOT_FOUND            Timed action index not found&lt;br /&gt;
 *          ERR_TA_START_FAILED         Timed action execute failed; See log&lt;br /&gt;
 */&lt;br /&gt;
S32_t   oceos_timed_jobs_reset(void);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
There are no input parameters to this function&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_NOT_INIT             || Timed action intialisation is not done and tried to be used&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_PTR_BAD              || Timed action pointer is null&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to acquire timed action guard&lt;br /&gt;
|-&lt;br /&gt;
| WARN_TA_Q_EMPTY             || Timed action queue is empty&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_NOT_FOUND            || Timed action index not found&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_START_FAILED         || Timed action execute failed; See log&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Remove all jobs from the timed actions queue&lt;br /&gt;
status = oceos_timed_jobs_reset(job_id);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_timed_output_remove()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''timed_action.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function removes the specified timed output action from timed actions queue.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Remove timed output action from timed actions queue.&lt;br /&gt;
 * When action is created, action index should be stored&lt;br /&gt;
 * to remove if need&lt;br /&gt;
 *&lt;br /&gt;
 * @param action_index&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_TA_NOT_INIT             Timed action intialisation is not done and tried to be used&lt;br /&gt;
 *          ERR_TA_PTR_BAD              Timed action pointer is null&lt;br /&gt;
 *          ERR_ID_WRONG                Timed action id is wrong&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to acquire timed action guard&lt;br /&gt;
 *          ERR_TA_NOT_FOUND            Timed action index not found&lt;br /&gt;
 *          ERR_TA_START_FAILED         Timed action execute failed&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_timed_output_remove(&lt;br /&gt;
    const U8_t  action_index    // Index in action array, returned when action was created&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| action_index|| S32_t specifying the timed output action index returned when the timed output was added.&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| Error bit  || Description&lt;br /&gt;
|&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_NOT_INIT             || Timed action intialisation is not done and tried to be used&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_PTR_BAD              || Timed action pointer is null&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || Timed action id is wrong&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to acquire timed action guard&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_NOT_FOUND            || Timed action index not found&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_START_FAILED         || Timed action execute failed&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
U8_t action_index;&lt;br /&gt;
...&lt;br /&gt;
// Remove timed output with specified action_index&lt;br /&gt;
status = oceos_timed_output_remove(action_index);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_timed_output_reset()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''timed_action.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function removes all timed output actions from timed actions queue.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Remove all timed output actions from timed actions queue&lt;br /&gt;
 * These timed output actions were created by oceos_timed_output_add&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_TA_NOT_INIT             Timed action intialisation is not done and tried to be used&lt;br /&gt;
 *          ERR_TA_PTR_BAD              Timed action pointer is null&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to acquire timed action guard&lt;br /&gt;
 *          WARN_TA_Q_EMPTY             Timed action queue is empty&lt;br /&gt;
 *          ERR_TA_NOT_FOUND            Timed action index not found&lt;br /&gt;
 *          ERR_TA_START_FAILED         Timed action execute failed; See log&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_timed_output_reset(void);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
There are no input parameters to this function. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| Error bit  || Description&lt;br /&gt;
|&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_NOT_INIT             || Timed action intialisation is not done and tried to be used&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_PTR_BAD              || Timed action pointer is null&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to acquire timed action guard&lt;br /&gt;
|-&lt;br /&gt;
| WARN_TA_Q_EMPTY             || Timed action queue is empty&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_NOT_FOUND            || Timed action index not found&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_START_FAILED         || Timed action execute failed; See log&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Remove all timed outputs from the timed actions queue&lt;br /&gt;
status = oceos_timed_output_reset();&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Logging directives ==&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;Introduction&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Log Area Features  (for details of other areas see oceos_areas.h)&lt;br /&gt;
&lt;br /&gt;
The system log area holds the system log and the records of the present and previous values of the system state variable.&lt;br /&gt;
&lt;br /&gt;
It is set up initially as an array of 32-bit words that starts at a 32-bit aligned address provided by the application developer.&lt;br /&gt;
&lt;br /&gt;
It is recommended that this address be in non-volatile RAM memory if this is available to allow information be preserved across power-up cycles.&lt;br /&gt;
&lt;br /&gt;
OCEOS preserves log area information across resets as far as possible.&lt;br /&gt;
&lt;br /&gt;
The system log itself is a circular buffer of struct log entry. Older entries are overwritten by new entries once all entries are in use.&lt;br /&gt;
&lt;br /&gt;
The application developer can specify a function to be called when 3/4 of log entries are in use. This function is called again only after 3/4 of log entries have been read and the log has again become 3/4 full.&lt;br /&gt;
&lt;br /&gt;
The read and write indices are stored in the log area and if equal indicate that the log is empty.&lt;br /&gt;
&lt;br /&gt;
As with other OCEOS data areas, the log area starts with a header&lt;br /&gt;
*a 32-bit word holding a constant OCEOS_VERSION&lt;br /&gt;
*a 32-bit word holding the log area size in 32-bit words&lt;br /&gt;
*a 32-bit word, the system status variable&lt;br /&gt;
*a 32-bit word, the system status mask&lt;br /&gt;
*a 32-bit word, the accumulated system status&lt;br /&gt;
*a 32-bit word, the previous system status mask&lt;br /&gt;
*a 32-bit word, the log control, that gives whether the log full function was called&lt;br /&gt;
*the read index&lt;br /&gt;
*the write index&lt;br /&gt;
*an array of struct log_entry making up the system log itself&lt;br /&gt;
*ending with a 32-bit constant END_SENTINEL&lt;br /&gt;
&lt;br /&gt;
The system fixed meta structure at sysMetaPtr provides&lt;br /&gt;
&lt;br /&gt;
*system_log_ptr      the start address of the log area&lt;br /&gt;
*logEntries          the number of log entries&lt;br /&gt;
*logCreated          flag indicating log was created successfully&lt;br /&gt;
*logFullFunction     user defined function, called when the log becomes 3/4 full (or NULL if not used)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Log Entry Types and Structure'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/*****************************************************************************&lt;br /&gt;
 * LOG ENTRY TYPES&lt;br /&gt;
 *&lt;br /&gt;
 * A log entry type is an 8-bit number.&lt;br /&gt;
 * Values from 0 to 127 can be defined by the application.&lt;br /&gt;
 * Values from 128 to 255 are used by OCEOS as below.&lt;br /&gt;
 *&lt;br /&gt;
 *&lt;br /&gt;
 * NOTE: Add new log types at the end for backward compatibility&lt;br /&gt;
 */&lt;br /&gt;
enum LOG_ENTRY_TYPE{&lt;br /&gt;
  LOG_SYS_OK = 0x80U,&lt;br /&gt;
  LOG_OCEOS_ABORT,				// when exiting from oceos_start&lt;br /&gt;
  LOG_LOG_NOT_VALID_ENTRY,		// used to initialise log and when log empty&lt;br /&gt;
  LOG_INIT_TASK_START_FAIL,		// initial task passed to oceos_start failed&lt;br /&gt;
  LOG_DEADLINE_MISSED,			// task deadline missed&lt;br /&gt;
  LOG_JOB_NOT_ACTIVE,			// cpu_terminate but job not active, absurd&lt;br /&gt;
  LOG_JOB_NOT_FREE,				// job guarded but not free&lt;br /&gt;
  LOG_JOBS_INC_FAILED, 			// pending jobs increment failed&lt;br /&gt;
  LOG_JOB_NOT_GUARDED,			// paranoia&lt;br /&gt;
  LOG_CS_LOG_SPIN_FAIL,			// oceos_CPU_sleep, trying to update CS log&lt;br /&gt;
  LOG_MUTEX_ALREADY_HELD,		// oceos_mutex_wait, code returned, not needed&lt;br /&gt;
  LOG_MUTEX_INCORRECT_ORDER,	// oceos_mutex_wait&lt;br /&gt;
  LOG_MUTEX_EXIT_HOLDING,		// task exits holding one or more mutexes&lt;br /&gt;
  LOG_MUTEX_EXIT_NONE,			// __oceos_tasks_remove_mutexes called but no mutex held&lt;br /&gt;
  LOG_SEMAPHORE_PENDING_REMOVE_FAIL,	// timed_action.c&lt;br /&gt;
  LOG_SEMAPHORE_PENDING_QUEUE_FULL,		// __oceos_semaphore_add_pend&lt;br /&gt;
  LOG_SEMAPHORE_SPIN_FAILED,			// trying to access semaphore&lt;br /&gt;
  LOG_DATAQ_PENDING_QUEUE_FULL,&lt;br /&gt;
  LOG_DATAQ_PENDING_REMOVE_FAIL,&lt;br /&gt;
  LOG_DATAQ_SPIN_FAILED,&lt;br /&gt;
  LOG_TIMED_ACTION_TIMER_NULL,&lt;br /&gt;
  LOG_TIMED_ACTION_INVALID,&lt;br /&gt;
  LOG_TIMED_ACTION_BAD_INDEX,&lt;br /&gt;
  LOG_TIMED_ACTION_MISSED,&lt;br /&gt;
  LOG_TIMED_ACTION_Q_EMPTY,&lt;br /&gt;
  LOG_TIMED_ACTION_REMOVE_FAIL,&lt;br /&gt;
  LOG_TIMED_ACTION_BAD_JOB_ID,&lt;br /&gt;
  LOG_TIMED_Q_SPIN_FAIL,&lt;br /&gt;
  LOG_SYSTEM_ERROR,&lt;br /&gt;
  LOG_ATOMICINC_FAILED,&lt;br /&gt;
  LOG_PENDING_PRI_UPDATE_FAILED,&lt;br /&gt;
  LOG_KILL_TASK_INVALID_ID,      // Tried to kill task with invalid ID&lt;br /&gt;
  LOG_OCEOS_EXIT_REQUEST,         // oceos_exit command was called&lt;br /&gt;
  LOG_RWMUTEX_NOT_RETURNED,&lt;br /&gt;
  LOG_RWMUTEX_NOT_HIGHEST&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
/*****************************************************************************&lt;br /&gt;
 * Structures&lt;br /&gt;
 */&lt;br /&gt;
/**&lt;br /&gt;
 * Log entry structure&lt;br /&gt;
 */&lt;br /&gt;
struct log_entry{&lt;br /&gt;
  U64_t             time64;&lt;br /&gt;
&lt;br /&gt;
  unsigned int      entry_cpu          :8;&lt;br /&gt;
  unsigned int      entry_type         :8;&lt;br /&gt;
  unsigned int      entry_note         :16;	// not used at present&lt;br /&gt;
&lt;br /&gt;
  U32_t             entry_comment;&lt;br /&gt;
}__attribute__ ((aligned (8)));&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_log_add_entry()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''system_log.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function adds an entry to the log. The entry overwrites the oldest unread entry if the log is full.&lt;br /&gt;
Custom log entries can be added to enum LOG_ENTRY from 0 to 128.&lt;br /&gt;
The indices are incremented in a circular fashion. If the write index reaches the read_index the read index is moved on, as read and write indices equal would indicate an empty log.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Add an entry to the log.&lt;br /&gt;
 * this overwrites the oldest unread entry if the log is full.&lt;br /&gt;
 * Custom log entries can be added to enum LOG_ENTRY from 0 to 128&lt;br /&gt;
 *&lt;br /&gt;
 * N.B. The indices are incremented in a circular fashion.&lt;br /&gt;
 *      If the write index reaches the read_index the read index is moved on,&lt;br /&gt;
 *      as read and write indices equal would indicate an empty log.&lt;br /&gt;
 *&lt;br /&gt;
 * @param type  enum LOG_ENTRY_TYPE&lt;br /&gt;
 * @param info  extra information to be logged&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_LOG_CORRUPT         System Log area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Log directive called in wrong phase; can be used after oceos_init() called&lt;br /&gt;
 *          ERR_ID_INVALID              Log type invalid&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to acquire log guard&lt;br /&gt;
 *          ERR_LOG_INDEX_WRONG         Read/write log index is wrong&lt;br /&gt;
 */&lt;br /&gt;
S32_t   oceos_log_add_entry(&lt;br /&gt;
    enum LOG_ENTRY_TYPE type,   // 8 bits enum LOG_ENTRY_TYPE&lt;br /&gt;
    const U32_t        info     // information&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| enum LOG_ENTRY_TYPE || Log entry type (see previous section for a list)&lt;br /&gt;
|-&lt;br /&gt;
| info | U32_t with the log information&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit  !! Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_LOG_CORRUPT         || System Log area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Log directive called in wrong phase; can be used after oceos_init() called&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || Log type invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to acquire log guard&lt;br /&gt;
|-&lt;br /&gt;
| ERR_LOG_INDEX_WRONG         || Read/write log index is wrong&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, info;&lt;br /&gt;
...&lt;br /&gt;
// Log LOG_APP_COMMS__ERROR (defined in enum LOG_ENTRY_TYPE) and info with more details&lt;br /&gt;
status = oceos_log_add_entry(LOG_APP_COMMS__ERROR, info);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_log_get_indexed_entry()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''system_log.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the entry at the specified position in the log. The entry is not removed and the log and log indices are not changed.&lt;br /&gt;
One use of this function is to allow the log be examined after a reset.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Returns the entry at the specified position in the log.&lt;br /&gt;
 * The entry is not removed and the log and log indices are not changed.&lt;br /&gt;
 * (intended to allow the log be examined for example after reset)&lt;br /&gt;
 *&lt;br /&gt;
 * @param index         position in the log&lt;br /&gt;
 * @param outputPtr     pointer to return log entry&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_LOG_CORRUPT         System Log area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Log directive called in wrong phase; can be used after oceos_init() called&lt;br /&gt;
 *          ERR_LOG_INDEX_WRONG         Read log index is wrong&lt;br /&gt;
 *          ERR_LOG_DATA_PTR_BAD        Data holder pointer is null&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_log_get_indexed_entry(&lt;br /&gt;
    const unsigned int index,&lt;br /&gt;
    struct log_entry * const outputPtr&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| index || U32_t with position in the log&lt;br /&gt;
|-&lt;br /&gt;
| outputPtr || pointer to struct log_entry to hold the returned entry&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit  !! Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_LOG_CORRUPT         || System Log area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Log directive called in wrong phase; can be used after oceos_init() called&lt;br /&gt;
|-&lt;br /&gt;
| ERR_LOG_INDEX_WRONG         || Read log index is wrong&lt;br /&gt;
|-&lt;br /&gt;
| ERR_LOG_DATA_PTR_BAD        || Data holder pointer is null&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, index;&lt;br /&gt;
struct log_entry store_entry;&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
// Read log_entry at specified index into outputPtr&lt;br /&gt;
status = oceos_log_get_indexed_entry(index, &amp;amp;store_entry);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_log_remove_entry()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''system_log.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function reads and removes the oldest unread log entry. &lt;br /&gt;
If the log is not empty use the entry at the read index to update the value at the output pointer, returning OCEOS_SUCCESS.&lt;br /&gt;
If outputPtr is NULL, entry is removed but no returned.&lt;br /&gt;
If the log is empty, set the value at the output pointer to LOG_LOG_NOT_VALID_ENTRY and return ERR_LOG_EMPTY.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Read and remove the oldest unread log entry&lt;br /&gt;
 *&lt;br /&gt;
 * If the log is not empty use the entry at the read index to update the value&lt;br /&gt;
 * at the output pointer, returning OCEOS_SUCCESS.&lt;br /&gt;
 *&lt;br /&gt;
 * If outputPtr is NULL, entry is removed but no returned&lt;br /&gt;
 *&lt;br /&gt;
 * If the log is empty, set the value at the output pointer to LOG_LOG_NOT_VALID_ENTRY&lt;br /&gt;
 * and return ERR_LOG_EMPTY&lt;br /&gt;
 *&lt;br /&gt;
 * @param outputPtr   pointer to struct log_entry&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_LOG_CORRUPT         System Log area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Log directive called in wrong phase; can be used after oceos_init() called&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to acquire log guard&lt;br /&gt;
 *          ERR_LOG_INDEX_WRONG         Read/write log index is wrong&lt;br /&gt;
 *          ERR_LOG_EMPTY               Log is empty&lt;br /&gt;
 */&lt;br /&gt;
S32_t   oceos_log_remove_entry(&lt;br /&gt;
    struct log_entry * const outputPtr&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| outputPtr || pointer to struct log_entry&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit  !! Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_LOG_CORRUPT         || System Log area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Log directive called in wrong phase; can be used after oceos_init() called&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to acquire log guard&lt;br /&gt;
|-&lt;br /&gt;
| ERR_LOG_INDEX_WRONG         || Read/write log index is wrong&lt;br /&gt;
|-&lt;br /&gt;
| ERR_LOG_EMPTY               || Log is empty&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
struct log_entry *outputPtr;&lt;br /&gt;
...&lt;br /&gt;
// Read log_entry into outputPtr and remove the oldest unread log entry&lt;br /&gt;
status = oceos_log_remove_entry(outputPtr);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_log_reset()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''system_log.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function sets all log entries to LOG_LOG_NOT_VALID_ENTRY and the log to empty, with the read and write indices set to 0.&lt;br /&gt;
The log is empty if the index of the next write is the same as the index of the next read. It does not affect the system status variable. It does not affect the context switch log.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * oceos_log_reset()&lt;br /&gt;
 *&lt;br /&gt;
 * Set all log entries to LOG_LOG_NOT_VALID_ENTRY and the log to empty, with the&lt;br /&gt;
 * read and write indices set to 0. and function called flag 0&lt;br /&gt;
 *&lt;br /&gt;
 * The log is empty if the index of the next write&lt;br /&gt;
 * is the same as the index of the next read.&lt;br /&gt;
 *&lt;br /&gt;
 * Does not affect the system status variable&lt;br /&gt;
 * Does not affect the context switch log&lt;br /&gt;
 *&lt;br /&gt;
 * N.B The fixed data area may no longer be writable&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_LOG_CORRUPT         System Log area corrupt; reset failed&lt;br /&gt;
 *          ERR_WRONG_PHASE             Log directive called in wrong phase; can be used after oceos_init() called&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to acquire log guard&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_log_reset(void);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
There are no input parameters to this function.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit  !! Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_LOG_CORRUPT         || System Log area corrupt; reset failed&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Log directive called in wrong phase; can be used after oceos_init() called&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to acquire log guard&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
// Clear down the system log&lt;br /&gt;
status = oceos_log_reset();&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_log_get_size()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''system_log.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the number of entries in the log according to the current values of the read and write indices.&lt;br /&gt;
The value will be zero if the current values of the read and write indices are the same. There may still be useful information in the log, e.g. after system reset, this can be accessed using oceos_log_get_indexed_entry().&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Return the number of entries in the log&lt;br /&gt;
 * according to the current values of the read and write indices.&lt;br /&gt;
 *&lt;br /&gt;
 * The value will be zero if the current values of the read and write indices&lt;br /&gt;
 * are the same.&lt;br /&gt;
 *&lt;br /&gt;
 * There may still be useful information in the log, e.g. after system reset,&lt;br /&gt;
 * this can be accessed using oceos_log_get_indexed_entry()&lt;br /&gt;
 *&lt;br /&gt;
 * @param l_size        pointer to log size holder&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_LOG_CORRUPT         System Log area corrupt;&lt;br /&gt;
 *          ERR_WRONG_PHASE             Log directive called in wrong phase; can be used after oceos_init() called&lt;br /&gt;
 *          ERR_LOG_DATA_PTR_BAD        Pointer to log size holder is NULL&lt;br /&gt;
 *          ERR_LOG_INDEX_WRONG         Read/write log index is wrong&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_log_get_size(&lt;br /&gt;
    U32_t *l_size&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| l_size|| U32_t pointer where size will be written.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit  !! Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_LOG_CORRUPT         || System Log area corrupt;&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Log directive called in wrong phase; can be used after oceos_init() called&lt;br /&gt;
|-&lt;br /&gt;
| ERR_LOG_DATA_PTR_BAD        || Pointer to log size holder is NULL&lt;br /&gt;
|-&lt;br /&gt;
| ERR_LOG_INDEX_WRONG         || Read/write log index is wrong&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, size;&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
// Clear down the system log&lt;br /&gt;
status = oceos_log_get_size(&amp;amp;size);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;System State Variable and System State Mask&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The System State variable provides a record of anomalies or problems detected by OCEOSmp's automatic consistency checks. An application handler for these can be set to be called automatically.&lt;br /&gt;
&lt;br /&gt;
An anomaly or problem results in a flag bit being set in the 32-bit word used to store the system state variable. The flags are identified below.&lt;br /&gt;
&lt;br /&gt;
All flags are reset to zero by oceos_init() when OCEOSmp is initialised, and may also be reset by the application using the directive provided.&lt;br /&gt;
&lt;br /&gt;
To provide a record across OCEOSmp restarts a copy is updated automatically whenever the state variable is updated. This is not cleared by oceos_init() but may be cleared by the application using a directive.&lt;br /&gt;
&lt;br /&gt;
Application software can define a problem handling function to be called automatically when specified system state flags are set. The flags are specified by setting the corresponding bits in the system state mask. The function and the state mask are defined in the system configuration.&lt;br /&gt;
&lt;br /&gt;
Changing a state flag from clear to set results in the function being called (if defined). Subsequent settings of that flag have no effect until after it has been cleared using the directive provided.&lt;br /&gt;
&lt;br /&gt;
N.B. In many cases when OCEOSmp sets a System State flag it also makes an entry in the system log that provides further information.&lt;br /&gt;
&lt;br /&gt;
SYSTEM STATE VARIABLE FLAGS&lt;br /&gt;
&lt;br /&gt;
These flags are updated by OCEOSmp using inclusive 'OR' when a consistency check detects a problem or anomaly. A copy of the system state variable is updated also and accumulates a record of flag settings that is preserved across restarts of OCEOSmp. OCEOSmp restarts reset the system state variable but not the copy.&lt;br /&gt;
&lt;br /&gt;
Resetting the state variables is the responsibility of the application (except for the state variable reset done when OCEOSmp is restarted).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''System Status Bits'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
#define  STATUS_NORMAL                    0u    // No flag set                              YES&lt;br /&gt;
#define  STATUS_INVALID          0xffffffffu    // System status is invalid                 YES BUT NO DETAIL!!!&lt;br /&gt;
&lt;br /&gt;
#define  STATUS_MASK_NORMAL      0xffffffffu    // Always call user def fn                  YES&lt;br /&gt;
&lt;br /&gt;
/* Task related problems */&lt;br /&gt;
#define  STATUS_DISABLED_TASK_START    0x1U    // An attempt to start a disabled task&lt;br /&gt;
#define  STATUS_TASK_JOB_LIMIT_OVER    0x2U    // An attempt to execute a task when its jobs limit is already reached.&lt;br /&gt;
#define  STATUS_JOB_OVER_TIME          0x4U    // Job time from creation to completion exceeds allowed maximum for task. YES&lt;br /&gt;
#define  STATUS_JOB_INTERVAL_SHORT     0x8U    // Minimum time between job creations is less than the allowed minimum for task&lt;br /&gt;
#define  STATUS_READYQ_FULL           0x10U    // Ready queue unable to accept job as result of being full&lt;br /&gt;
#define  STATUS_READYQ_NO_REMOVE      0x20U    // Remove job from ready queue failed&lt;br /&gt;
&lt;br /&gt;
/* Mutex related problems */&lt;br /&gt;
#define  STATUS_MUTEX_ALREADY_HELD    0x40U    // Mutex wait() when mutex already held&lt;br /&gt;
#define  STATUS_MUTEX_NOT_HELD        0x80U    // Mutex signal() when not already held&lt;br /&gt;
#define  STATUS_MUTEX_NOT_RETURNED   0x100U    // Mutex not returned before job terminates&lt;br /&gt;
#define  STATUS_MUTEX_NOT_NESTED     0x200U    // Use of multiple mutexes not nested&lt;br /&gt;
&lt;br /&gt;
/* Counting semaphore and data queue related problems */&lt;br /&gt;
#define  STATUS_SEMAPHORE_JOBS_FULL  0x400U    // Attempt to add job to semaphore pending list when list full&lt;br /&gt;
#define  STATUS_DATAQ_JOBS_FULL      0x800U    // Attempt to add job to data queue pending list when list full&lt;br /&gt;
#define  STATUS_DATAQ_FULL          0x1000U    // Data queue write when queue already full&lt;br /&gt;
&lt;br /&gt;
/* Timed actions related problems */&lt;br /&gt;
#define  STATUS_TIMED_JOBS_FULL     0x2000U    // Timed actions queue already full for timed task start&lt;br /&gt;
#define  STATUS_TIMED_OUTPUT_FULL   0x4000U    // Timed actions queue already full for timed output&lt;br /&gt;
#define  STATUS_TIMED_ACTION_LATE   0x8000U    // Timed action late                          YES&lt;br /&gt;
&lt;br /&gt;
/* Default trap handler should have been replaced&lt;br /&gt;
 * NOT USED AT THE MOMENT*/&lt;br /&gt;
#define  STATUS_SYSTEM_ERROR       0x10000U    // ERROR was handled by default trap handler  YES&lt;br /&gt;
&lt;br /&gt;
/* Flag to indicate problem with Stack Pointer&lt;br /&gt;
 * NOT USED AT THE MOMENT*/&lt;br /&gt;
#define  STATUS_SP_WARNING         0x20000U    // SP not in expected range&lt;br /&gt;
/* Log system error */&lt;br /&gt;
#define  STATUS_BAD_LOG            0x40000U    // System log problem&lt;br /&gt;
#define  STATUS_SPIN_FAILED        0x80000U    // Get SPIN lock failed&lt;br /&gt;
/* Not using next few bits */&lt;br /&gt;
&lt;br /&gt;
/* Will have to exit */&lt;br /&gt;
#define  STATUS_BAD_SENTINEL     0x40000000U    // Area sentinel corrupt&lt;br /&gt;
#define  STATUS_BAD_META_PTR     0x80000000U    // Null meta pointer&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_system_state_get()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''system_log.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns of the system state variable.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Returns the value of the system state variable&lt;br /&gt;
 *&lt;br /&gt;
 * @param state  pointer to state holder&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_LOG_DATA_PTR_BAD        Data holder pointer is null&lt;br /&gt;
 *          ERR_SYS_LOG_CORRUPT         LOG dynamic pointer is null&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_system_state_get(&lt;br /&gt;
    U32_t *state // pointer to state holder&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| state || U32_t pointer to state holder&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit  !! Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_LOG_DATA_PTR_BAD        || Data holder pointer is null&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_LOG_CORRUPT         || LOG dynamic pointer is null&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, state;&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
// Get the system state&lt;br /&gt;
status = oceos_system_state_get(&amp;amp;state);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_system_state_set()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''system_log.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function sets system state variable.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Sets system state variable&lt;br /&gt;
 *&lt;br /&gt;
 * @param new_state&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_LOG_CORRUPT         LOG dynamic pointer is null&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_system_state_set(&lt;br /&gt;
    U32_t new_state   // new value of system state variable&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| new_state || U32_t containing new system state&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit  !! Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_LOG_CORRUPT         || LOG dynamic pointer is null&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, new_state;&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
// Set new system state&lt;br /&gt;
status = oceos_system_state_set(new_state);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_system_state_copy_get()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''system_log.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the value of the system state copy variable.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Returns the value of the copy of system state variable&lt;br /&gt;
 *&lt;br /&gt;
 * @param state  pointer to state holder&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_LOG_DATA_PTR_BAD        Data holder pointer is null&lt;br /&gt;
 *          ERR_SYS_LOG_CORRUPT         LOG dynamic pointer is null&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_system_state_copy_get(&lt;br /&gt;
    U32_t *state // pointer to state copy holder&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| state || U32_t pointer to state copy holder&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit  !! Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_LOG_DATA_PTR_BAD        || Data holder pointer is null&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_LOG_CORRUPT         || LOG dynamic pointer is null&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, copy_state;&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
// Get the system state copy&lt;br /&gt;
status = oceos_system_state_copy_get(&amp;amp;copy_state);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_system_state_copy_set()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''system_log.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function loads a value to tha system state copy variable.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Sets system state copy variable&lt;br /&gt;
 *&lt;br /&gt;
 * @param new_state&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_LOG_CORRUPT         LOG dynamic pointer is null&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_system_state_copy_set(&lt;br /&gt;
    U32_t new_state   // new value of system state variable&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| new_state || U32_t containing new system state copy&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit  !! Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_LOG_CORRUPT         || LOG dynamic pointer is null&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, new_state;&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
// Set new system state copy&lt;br /&gt;
status = oceos_system_state_copy_set(new_state);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Timing directives ==&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;Introduction&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''SPARC'''&lt;br /&gt;
&lt;br /&gt;
In OCEOS system time is based on two chained 32-bit timers.&lt;br /&gt;
&lt;br /&gt;
No interrupts are involved, the current system time is obtained by reading the two timer counter registers (in an atomic way) and then inverting the&lt;br /&gt;
values since the timers count down.&lt;br /&gt;
&lt;br /&gt;
The scaler associated with the timers is configured based on the system clock frequency to decrement the low order timer every microsecond. This&lt;br /&gt;
decrements the high order timer when it rolls over, every 71.6 minutes approximately. The 64-bit time range is very long, over 584,000 years.&lt;br /&gt;
&lt;br /&gt;
'''ARM Cortex-M'''&lt;br /&gt;
&lt;br /&gt;
In OCEOS for ARM Cortex-M, system time is based on SysTick. The processor has a 24-bit system timer, SysTick, that counts down from the reload value to zero, reloads (wraps to) the value in the LOAD register on the next clock edge, then counts down on subsequent clocks.&lt;br /&gt;
&lt;br /&gt;
Note: When the processor is halted for debugging the counter does not decrement.&lt;br /&gt;
&lt;br /&gt;
OCEOS initializes the timer to be driven from MCK and counting down to zero asserts SysTick exception request.&lt;br /&gt;
OCEOS has 64 bit counter which is increased by 0xFFFFFF value every time timer reloads.&lt;br /&gt;
&lt;br /&gt;
'''RISC-V'''&lt;br /&gt;
&lt;br /&gt;
In OCEOS for RISC-V systems time is based internally on clock cycles.&lt;br /&gt;
The RISC-V processor typically has a 64 bit counter (typically mtime) that  updates automatically on each clock cycle. Each hart typically has its own comparison register (typically mtimecmp) that can be used to interrupt that hart when a certain cycle count has been exceeded.&lt;br /&gt;
If a particular RISC-V implementation provides a more restricted clock cycle count this will be used with appropriate modifications as clock cycles give the best timing precision available.&lt;br /&gt;
&lt;br /&gt;
Note: The application configuration provides the constant needed to allow microseconds (as used in OCEOS directives) be converted to clock cycles. Time is reported by OCEOSmp as the number of microseconds since OCEOS was initialized.&lt;br /&gt;
&lt;br /&gt;
A potential difficulty arises if the main system clock rate can change for power saving or other reasons, each system is probably different with regard to this. OCEOSmp can handle this, if needed.&lt;br /&gt;
&lt;br /&gt;
The units of OCEOS system time are microseconds on SPARC and ARM and on RISC-V the period of the clock cycle.&lt;br /&gt;
&lt;br /&gt;
The system time is reset to 0 by oceos_init()&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_time_sys_get64()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''oceos_timer.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the current system time as a 64-bit number.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
**&lt;br /&gt;
 * Get the current system time (64-bit)&lt;br /&gt;
 *&lt;br /&gt;
 * @return U64_t&lt;br /&gt;
 */&lt;br /&gt;
U64_t oceos_time_sys_get64(void);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There are no parameters to this function.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S64_t with the current system time.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S64_t now;&lt;br /&gt;
...&lt;br /&gt;
// Get the time&lt;br /&gt;
now = oceos_time_sys_get64();&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_time_sys_get32()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''oceos_timer.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the low 32 bits of the system time.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Get the current system time (low 32 bits of 64 bit value)&lt;br /&gt;
 *&lt;br /&gt;
 * @return U32_t&lt;br /&gt;
 */&lt;br /&gt;
U32_t oceos_time_sys_get32(void);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
There are no parameters to this function.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with the current system time.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t now;&lt;br /&gt;
...&lt;br /&gt;
// Get the time&lt;br /&gt;
now = oceos_time_sys_get32();&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:backup]]&lt;/div&gt;</summary>
		<author><name>Bkavanagh</name></author>
	</entry>
	<entry>
		<id>https://wiki.ocetechnology.com/mediawiki/index.php?title=MediaWiki:Sidebar&amp;diff=1713</id>
		<title>MediaWiki:Sidebar</title>
		<link rel="alternate" type="text/html" href="https://wiki.ocetechnology.com/mediawiki/index.php?title=MediaWiki:Sidebar&amp;diff=1713"/>
		<updated>2024-06-17T11:52:43Z</updated>

		<summary type="html">&lt;p&gt;Bkavanagh: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
* navigation&lt;br /&gt;
** Main Page|OCE wiki&lt;br /&gt;
*  DMON&lt;br /&gt;
** DMON install &amp;amp; use|DMON install &amp;amp; use&lt;br /&gt;
** DMON facilities|DMON facilities&lt;br /&gt;
** DMON commands|DMON commands&lt;br /&gt;
** DMON SOC support|DMON SOC support&lt;br /&gt;
** DMON Eclipse debug|DMON Eclipse debug&lt;br /&gt;
** DMON OCEOS Support|DMON OCEOS Support&lt;br /&gt;
** DMON Troubleshooting|DMON Troubleshooting&lt;br /&gt;
* OCEOS&lt;br /&gt;
** OCEOS/oceos_introduction|Introduction&lt;br /&gt;
** OCEOS/oceos_kernel|Kernel&lt;br /&gt;
** OCEOS/oceos_inter-task_communication|Inter-task Communication&lt;br /&gt;
** OCEOS/oceos_timed_actions|Timed Actions&lt;br /&gt;
** OCEOS/oceos_logging|Logging&lt;br /&gt;
** OCEOS/oceos_fdir|FDIR&lt;br /&gt;
** OCEOS/oceos_protection|Protection (GR716)&lt;br /&gt;
** OCEOS/oceos_debugging|Debugging&lt;br /&gt;
** OCEOS/oceos_profiling|Profiling&lt;br /&gt;
** OCEOS/oceos_use|Installation&lt;br /&gt;
* OCEOSmp&lt;br /&gt;
**OCEOSmp/introduction|Introduction&lt;br /&gt;
**OCEOSmp/notes|Application Notes&lt;br /&gt;
**OCEOSmp/directive_reference|Directive Reference&lt;br /&gt;
**OCEOSmp/polarfire|BSP PolarFire® SoC FPGA &lt;br /&gt;
**OCEOSmp/blank|Blank Section&lt;/div&gt;</summary>
		<author><name>Bkavanagh</name></author>
	</entry>
	<entry>
		<id>https://wiki.ocetechnology.com/mediawiki/index.php?title=OCEOSmp/polarfire&amp;diff=1712</id>
		<title>OCEOSmp/polarfire</title>
		<link rel="alternate" type="text/html" href="https://wiki.ocetechnology.com/mediawiki/index.php?title=OCEOSmp/polarfire&amp;diff=1712"/>
		<updated>2024-06-17T11:51:02Z</updated>

		<summary type="html">&lt;p&gt;Bkavanagh: /* OCEOSmp BSP for PolarFire */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= OCEOSmp BSP for PolarFire® SoC FPGA =&lt;br /&gt;
&lt;br /&gt;
OCEOSmp is a real-time operating system compliant with European Space Agency standards (ECSS Category B). It occupies a small memory footprint and provides a unique set of functions to help police the application tasks. It supports RISC-V, ARM, and SPARC processor architectures and has been designed to provide deterministic task scheduling.&lt;br /&gt;
The installation package contains documentation, header files, static link libraries, and code examples.&lt;br /&gt;
&lt;br /&gt;
== Using OCEOSmp with Soft Console ==&lt;br /&gt;
&lt;br /&gt;
The steps to use OCEOSmp with Soft Console are as follows:&lt;br /&gt;
#Add OCEOSmp header files folder to application project&lt;br /&gt;
#Add OCEOSmp directory search path option to the linker -LPathToOCEOSmpDirectory&lt;br /&gt;
#Add OCEOSmp library name to the linker options -loceosmp&lt;br /&gt;
#Copy oceosmp_config.h to project include folder&lt;br /&gt;
#Update oceosmp_config.h according to project requirements (number of tasks, mutexes, semaphores, data Qs, timed actions)&lt;br /&gt;
#Set size of log area, fixed area and dynamic areas&lt;br /&gt;
#Copy oceosmp_config.c to project source directory and modify configuration struct as required&lt;br /&gt;
#Copy oceosmp_config_riscv64.h to project include folder  &lt;br /&gt;
#Modify oceosmp_config_riscv64.h to select CPUs to be used with OCEOSmp&lt;br /&gt;
#Starting CPU must call main() at the end of initialisation&lt;br /&gt;
#Other CPUs must call oceos_start(NULL, 0, NULL) function&lt;br /&gt;
#Mss_entry.S must be updated to include a call to oceosmp_trap_from_machine_mode from trap_handler&lt;br /&gt;
#User trap handlers are called from oceosmp_trap_from_machine_mode&lt;br /&gt;
#Update linker script symbols for per CPU stack size&lt;br /&gt;
#Write the application code referring to examples provided, where necessary.&lt;br /&gt;
#The bare metal device drivers provided with Soft Console can generally be used with OCEOSmp. The weak references in the OCEOSmp interrupt vectors module will resolve to the device drivers to be used. &lt;br /&gt;
#Build the application as normal.&lt;br /&gt;
&lt;br /&gt;
The OCEOSmp documentation includes a user manual, wiki, and header files. &lt;br /&gt;
&lt;br /&gt;
== Licensing &amp;amp; services ==&lt;br /&gt;
&lt;br /&gt;
Licensing plans for OCEOSmp are as follows:&lt;br /&gt;
&lt;br /&gt;
#Development Kit (software, documentation, and unlimited runtime licences[note 1])&lt;br /&gt;
#Annual support fee (upgrades, unlimited runtime licences, access to support resources)&lt;br /&gt;
#Customer board OCEOSmp functional certification service&lt;br /&gt;
#A Safety Assurance Pack is available to provide an easy route to achieving safety certification&lt;br /&gt;
#Source code is available under special licence conditions&lt;br /&gt;
&lt;br /&gt;
Note 1: Unlimited runtime licences require annual support fee after first year&lt;br /&gt;
&lt;br /&gt;
== Contact information ==&lt;br /&gt;
&lt;br /&gt;
For sales contact sales@ocetechnology.com or call +353 1 716 3530.&lt;br /&gt;
&lt;br /&gt;
For support contact support@ocetechnology.com&lt;/div&gt;</summary>
		<author><name>Bkavanagh</name></author>
	</entry>
	<entry>
		<id>https://wiki.ocetechnology.com/mediawiki/index.php?title=OCEOSmp/polarfire&amp;diff=1711</id>
		<title>OCEOSmp/polarfire</title>
		<link rel="alternate" type="text/html" href="https://wiki.ocetechnology.com/mediawiki/index.php?title=OCEOSmp/polarfire&amp;diff=1711"/>
		<updated>2024-06-17T11:50:04Z</updated>

		<summary type="html">&lt;p&gt;Bkavanagh: /* OCEOSmp BSP for Polarfire */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= OCEOSmp BSP for PolarFire =&lt;br /&gt;
&lt;br /&gt;
OCEOSmp is a real-time operating system compliant with European Space Agency standards (ECSS Category B). It occupies a small memory footprint and provides a unique set of functions to help police the application tasks. It supports RISC-V, ARM, and SPARC processor architectures and has been designed to provide deterministic task scheduling.&lt;br /&gt;
The installation package contains documentation, header files, static link libraries, and code examples.&lt;br /&gt;
&lt;br /&gt;
== Using OCEOSmp with Soft Console ==&lt;br /&gt;
&lt;br /&gt;
The steps to use OCEOSmp with Soft Console are as follows:&lt;br /&gt;
#Add OCEOSmp header files folder to application project&lt;br /&gt;
#Add OCEOSmp directory search path option to the linker -LPathToOCEOSmpDirectory&lt;br /&gt;
#Add OCEOSmp library name to the linker options -loceosmp&lt;br /&gt;
#Copy oceosmp_config.h to project include folder&lt;br /&gt;
#Update oceosmp_config.h according to project requirements (number of tasks, mutexes, semaphores, data Qs, timed actions)&lt;br /&gt;
#Set size of log area, fixed area and dynamic areas&lt;br /&gt;
#Copy oceosmp_config.c to project source directory and modify configuration struct as required&lt;br /&gt;
#Copy oceosmp_config_riscv64.h to project include folder  &lt;br /&gt;
#Modify oceosmp_config_riscv64.h to select CPUs to be used with OCEOSmp&lt;br /&gt;
#Starting CPU must call main() at the end of initialisation&lt;br /&gt;
#Other CPUs must call oceos_start(NULL, 0, NULL) function&lt;br /&gt;
#Mss_entry.S must be updated to include a call to oceosmp_trap_from_machine_mode from trap_handler&lt;br /&gt;
#User trap handlers are called from oceosmp_trap_from_machine_mode&lt;br /&gt;
#Update linker script symbols for per CPU stack size&lt;br /&gt;
#Write the application code referring to examples provided, where necessary.&lt;br /&gt;
#The bare metal device drivers provided with Soft Console can generally be used with OCEOSmp. The weak references in the OCEOSmp interrupt vectors module will resolve to the device drivers to be used. &lt;br /&gt;
#Build the application as normal.&lt;br /&gt;
&lt;br /&gt;
The OCEOSmp documentation includes a user manual, wiki, and header files. &lt;br /&gt;
&lt;br /&gt;
== Licensing &amp;amp; services ==&lt;br /&gt;
&lt;br /&gt;
Licensing plans for OCEOSmp are as follows:&lt;br /&gt;
&lt;br /&gt;
#Development Kit (software, documentation, and unlimited runtime licences[note 1])&lt;br /&gt;
#Annual support fee (upgrades, unlimited runtime licences, access to support resources)&lt;br /&gt;
#Customer board OCEOSmp functional certification service&lt;br /&gt;
#A Safety Assurance Pack is available to provide an easy route to achieving safety certification&lt;br /&gt;
#Source code is available under special licence conditions&lt;br /&gt;
&lt;br /&gt;
Note 1: Unlimited runtime licences require annual support fee after first year&lt;br /&gt;
&lt;br /&gt;
== Contact information ==&lt;br /&gt;
&lt;br /&gt;
For sales contact sales@ocetechnology.com or call +353 1 716 3530.&lt;br /&gt;
&lt;br /&gt;
For support contact support@ocetechnology.com&lt;/div&gt;</summary>
		<author><name>Bkavanagh</name></author>
	</entry>
	<entry>
		<id>https://wiki.ocetechnology.com/mediawiki/index.php?title=OCEOSmp/polarfire&amp;diff=1710</id>
		<title>OCEOSmp/polarfire</title>
		<link rel="alternate" type="text/html" href="https://wiki.ocetechnology.com/mediawiki/index.php?title=OCEOSmp/polarfire&amp;diff=1710"/>
		<updated>2024-06-14T10:54:40Z</updated>

		<summary type="html">&lt;p&gt;Bkavanagh: /* Contact information */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= OCEOSmp BSP for Polarfire =&lt;br /&gt;
&lt;br /&gt;
OCEOSmp is a real-time operating system compliant with European Space Agency standards (ECSS Category B). It occupies a small memory footprint and provides a unique set of functions to help police the application tasks. It supports RISC-V, ARM, and SPARC processor architectures and has been designed to provide deterministic task scheduling.&lt;br /&gt;
The installation package contains documentation, header files, static link libraries, and code examples.&lt;br /&gt;
&lt;br /&gt;
== Using OCEOSmp with Soft Console ==&lt;br /&gt;
&lt;br /&gt;
The steps to use OCEOSmp with Soft Console are as follows:&lt;br /&gt;
#Add OCEOSmp header files folder to application project&lt;br /&gt;
#Add OCEOSmp directory search path option to the linker -LPathToOCEOSmpDirectory&lt;br /&gt;
#Add OCEOSmp library name to the linker options -loceosmp&lt;br /&gt;
#Copy oceosmp_config.h to project include folder&lt;br /&gt;
#Update oceosmp_config.h according to project requirements (number of tasks, mutexes, semaphores, data Qs, timed actions)&lt;br /&gt;
#Set size of log area, fixed area and dynamic areas&lt;br /&gt;
#Copy oceosmp_config.c to project source directory and modify configuration struct as required&lt;br /&gt;
#Copy oceosmp_config_riscv64.h to project include folder  &lt;br /&gt;
#Modify oceosmp_config_riscv64.h to select CPUs to be used with OCEOSmp&lt;br /&gt;
#Starting CPU must call main() at the end of initialisation&lt;br /&gt;
#Other CPUs must call oceos_start(NULL, 0, NULL) function&lt;br /&gt;
#Mss_entry.S must be updated to include a call to oceosmp_trap_from_machine_mode from trap_handler&lt;br /&gt;
#User trap handlers are called from oceosmp_trap_from_machine_mode&lt;br /&gt;
#Update linker script symbols for per CPU stack size&lt;br /&gt;
#Write the application code referring to examples provided, where necessary.&lt;br /&gt;
#The bare metal device drivers provided with Soft Console can generally be used with OCEOSmp. The weak references in the OCEOSmp interrupt vectors module will resolve to the device drivers to be used. &lt;br /&gt;
#Build the application as normal.&lt;br /&gt;
&lt;br /&gt;
The OCEOSmp documentation includes a user manual, wiki, and header files. &lt;br /&gt;
&lt;br /&gt;
== Licensing &amp;amp; services ==&lt;br /&gt;
&lt;br /&gt;
Licensing plans for OCEOSmp are as follows:&lt;br /&gt;
&lt;br /&gt;
#Development Kit (software, documentation, and unlimited runtime licences[note 1])&lt;br /&gt;
#Annual support fee (upgrades, unlimited runtime licences, access to support resources)&lt;br /&gt;
#Customer board OCEOSmp functional certification service&lt;br /&gt;
#A Safety Assurance Pack is available to provide an easy route to achieving safety certification&lt;br /&gt;
#Source code is available under special licence conditions&lt;br /&gt;
&lt;br /&gt;
Note 1: Unlimited runtime licences require annual support fee after first year&lt;br /&gt;
&lt;br /&gt;
== Contact information ==&lt;br /&gt;
&lt;br /&gt;
For sales contact sales@ocetechnology.com or call +353 1 716 3530.&lt;br /&gt;
&lt;br /&gt;
For support contact support@ocetechnology.com&lt;/div&gt;</summary>
		<author><name>Bkavanagh</name></author>
	</entry>
	<entry>
		<id>https://wiki.ocetechnology.com/mediawiki/index.php?title=OCEOSmp/polarfire&amp;diff=1709</id>
		<title>OCEOSmp/polarfire</title>
		<link rel="alternate" type="text/html" href="https://wiki.ocetechnology.com/mediawiki/index.php?title=OCEOSmp/polarfire&amp;diff=1709"/>
		<updated>2024-06-14T10:53:48Z</updated>

		<summary type="html">&lt;p&gt;Bkavanagh: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= OCEOSmp BSP for Polarfire =&lt;br /&gt;
&lt;br /&gt;
OCEOSmp is a real-time operating system compliant with European Space Agency standards (ECSS Category B). It occupies a small memory footprint and provides a unique set of functions to help police the application tasks. It supports RISC-V, ARM, and SPARC processor architectures and has been designed to provide deterministic task scheduling.&lt;br /&gt;
The installation package contains documentation, header files, static link libraries, and code examples.&lt;br /&gt;
&lt;br /&gt;
== Using OCEOSmp with Soft Console ==&lt;br /&gt;
&lt;br /&gt;
The steps to use OCEOSmp with Soft Console are as follows:&lt;br /&gt;
#Add OCEOSmp header files folder to application project&lt;br /&gt;
#Add OCEOSmp directory search path option to the linker -LPathToOCEOSmpDirectory&lt;br /&gt;
#Add OCEOSmp library name to the linker options -loceosmp&lt;br /&gt;
#Copy oceosmp_config.h to project include folder&lt;br /&gt;
#Update oceosmp_config.h according to project requirements (number of tasks, mutexes, semaphores, data Qs, timed actions)&lt;br /&gt;
#Set size of log area, fixed area and dynamic areas&lt;br /&gt;
#Copy oceosmp_config.c to project source directory and modify configuration struct as required&lt;br /&gt;
#Copy oceosmp_config_riscv64.h to project include folder  &lt;br /&gt;
#Modify oceosmp_config_riscv64.h to select CPUs to be used with OCEOSmp&lt;br /&gt;
#Starting CPU must call main() at the end of initialisation&lt;br /&gt;
#Other CPUs must call oceos_start(NULL, 0, NULL) function&lt;br /&gt;
#Mss_entry.S must be updated to include a call to oceosmp_trap_from_machine_mode from trap_handler&lt;br /&gt;
#User trap handlers are called from oceosmp_trap_from_machine_mode&lt;br /&gt;
#Update linker script symbols for per CPU stack size&lt;br /&gt;
#Write the application code referring to examples provided, where necessary.&lt;br /&gt;
#The bare metal device drivers provided with Soft Console can generally be used with OCEOSmp. The weak references in the OCEOSmp interrupt vectors module will resolve to the device drivers to be used. &lt;br /&gt;
#Build the application as normal.&lt;br /&gt;
&lt;br /&gt;
The OCEOSmp documentation includes a user manual, wiki, and header files. &lt;br /&gt;
&lt;br /&gt;
== Licensing &amp;amp; services ==&lt;br /&gt;
&lt;br /&gt;
Licensing plans for OCEOSmp are as follows:&lt;br /&gt;
&lt;br /&gt;
#Development Kit (software, documentation, and unlimited runtime licences[note 1])&lt;br /&gt;
#Annual support fee (upgrades, unlimited runtime licences, access to support resources)&lt;br /&gt;
#Customer board OCEOSmp functional certification service&lt;br /&gt;
#A Safety Assurance Pack is available to provide an easy route to achieving safety certification&lt;br /&gt;
#Source code is available under special licence conditions&lt;br /&gt;
&lt;br /&gt;
Note 1: Unlimited runtime licences require annual support fee after first year&lt;br /&gt;
&lt;br /&gt;
== Contact information ==&lt;br /&gt;
&lt;br /&gt;
For sales contact sales@ocetechnology.com or call +353 1 716 3530.&lt;br /&gt;
For support contact support@ocetechnology.com&lt;/div&gt;</summary>
		<author><name>Bkavanagh</name></author>
	</entry>
	<entry>
		<id>https://wiki.ocetechnology.com/mediawiki/index.php?title=OCEOSmp/polarfire&amp;diff=1708</id>
		<title>OCEOSmp/polarfire</title>
		<link rel="alternate" type="text/html" href="https://wiki.ocetechnology.com/mediawiki/index.php?title=OCEOSmp/polarfire&amp;diff=1708"/>
		<updated>2024-06-14T10:52:26Z</updated>

		<summary type="html">&lt;p&gt;Bkavanagh: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= OCEOSmp BSP for Polarfire =&lt;br /&gt;
&lt;br /&gt;
OCEOSmp is a real-time operating system compliant with European Space Agency standards (ECSS Category B). It occupies a small memory footprint and provides a unique set of functions to help police the application tasks. It supports RISC-V, ARM, and SPARC processor architectures and has been designed to provide deterministic task scheduling.&lt;br /&gt;
The installation package contains documentation, header files, static link libraries, and code examples.&lt;br /&gt;
&lt;br /&gt;
== Using OCEOSmp with Soft Console ==&lt;br /&gt;
&lt;br /&gt;
The steps to use OCEOSmp with Soft Console are as follows:&lt;br /&gt;
#Add OCEOSmp header files folder to application project&lt;br /&gt;
#Add OCEOSmp directory search path option to the linker -LPathToOCEOSmpDirectory&lt;br /&gt;
#Add OCEOSmp library name to the linker options -loceosmp&lt;br /&gt;
#Copy oceosmp_config.h to project include folder&lt;br /&gt;
#Update oceosmp_config.h according to project requirements (number of tasks, mutexes, semaphores, data Qs, timed actions)&lt;br /&gt;
#Set size of log area, fixed area and dynamic areas&lt;br /&gt;
#Copy oceosmp_config.c to project source directory and modify configuration struct as required&lt;br /&gt;
#Copy oceosmp_config_riscv64.h to project include folder  &lt;br /&gt;
#Modify oceosmp_config_riscv64.h to select CPUs to be used with OCEOSmp&lt;br /&gt;
#Starting CPU must call main() at the end of initialisation&lt;br /&gt;
#Other CPUs must call oceos_start(NULL, 0, NULL) function&lt;br /&gt;
#Mss_entry.S must be updated to include a call to oceosmp_trap_from_machine_mode from trap_handler&lt;br /&gt;
#User trap handlers are called from oceosmp_trap_from_machine_mode&lt;br /&gt;
#Update linker script symbols for per CPU stack size&lt;br /&gt;
#Write the application code referring to examples provided, where necessary.&lt;br /&gt;
#The bare metal device drivers provided with Soft Console can generally be used with OCEOSmp. The weak references in the OCEOSmp interrupt vectors module will resolve to the device drivers to be used. &lt;br /&gt;
#Build the application as normal.&lt;br /&gt;
&lt;br /&gt;
The OCEOSmp documentation includes a user manual, wiki, and header files. &lt;br /&gt;
&lt;br /&gt;
== Licensing &amp;amp; services ==&lt;br /&gt;
&lt;br /&gt;
Licensing plans for OCEOSmp are as follows:&lt;br /&gt;
&lt;br /&gt;
#Development Kit (software, documentation, and unlimited runtime licences1)&lt;br /&gt;
#Annual support fee (upgrades, unlimited runtime licences, access to support resources)&lt;br /&gt;
#Customer board OCEOSmp functional certification service&lt;br /&gt;
#A Safety Assurance Pack is available to provide an easy route to achieving safety certification&lt;br /&gt;
#Source code is available under special licence conditions&lt;br /&gt;
#Unlimited runtime licences require annual support fee after first year&lt;br /&gt;
&lt;br /&gt;
== Contact information ==&lt;br /&gt;
&lt;br /&gt;
For sales contact sales@ocetechnology.com or call +353 1 716 3530.&lt;br /&gt;
For support contact support@ocetechnology.com&lt;/div&gt;</summary>
		<author><name>Bkavanagh</name></author>
	</entry>
	<entry>
		<id>https://wiki.ocetechnology.com/mediawiki/index.php?title=OCEOSmp/polarfire&amp;diff=1707</id>
		<title>OCEOSmp/polarfire</title>
		<link rel="alternate" type="text/html" href="https://wiki.ocetechnology.com/mediawiki/index.php?title=OCEOSmp/polarfire&amp;diff=1707"/>
		<updated>2024-06-14T09:41:43Z</updated>

		<summary type="html">&lt;p&gt;Bkavanagh: Created page with &amp;quot;OCEOSmp BSP for Polarfire  OCEOSmp is a real-time operating system compliant with European Space Agency standards (ECSS Category B). It occupies a small memory footprint and p...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;OCEOSmp BSP for Polarfire&lt;br /&gt;
&lt;br /&gt;
OCEOSmp is a real-time operating system compliant with European Space Agency standards (ECSS Category B). It occupies a small memory footprint and provides a unique set of functions to help police the application tasks. It supports RISC-V, ARM, and SPARC processor architectures and has been designed to provide deterministic task scheduling.&lt;br /&gt;
The installation package contains documentation, header files, static link libraries, and code examples.&lt;br /&gt;
&lt;br /&gt;
Using OCEOSmp with Soft Console&lt;br /&gt;
&lt;br /&gt;
The steps to use OCEOSmp with Soft Console are as follows:&lt;br /&gt;
#Add OCEOSmp header files folder to application project&lt;br /&gt;
#Add OCEOSmp directory search path option to the linker -LPathToOCEOSmpDirectory&lt;br /&gt;
#Add OCEOSmp library name to the linker options -loceosmp&lt;br /&gt;
#Copy oceosmp_config.h to project include folder&lt;br /&gt;
#Update oceosmp_config.h according to project requirements (number of tasks, mutexes, semaphores, data Qs, timed actions)&lt;br /&gt;
#Set size of log area, fixed area and dynamic areas&lt;br /&gt;
#Copy oceosmp_config.c to project source directory and modify configuration struct as required&lt;br /&gt;
#Copy oceosmp_config_riscv64.h to project include folder  &lt;br /&gt;
#Modify oceosmp_config_riscv64.h to select CPUs to be used with OCEOSmp&lt;br /&gt;
#Starting CPU must call main() at the end of initialisation&lt;br /&gt;
#Other CPUs must call oceos_start(NULL, 0, NULL) function&lt;br /&gt;
#Mss_entry.S must be updated to include a call to oceosmp_trap_from_machine_mode from trap_handler&lt;br /&gt;
#User trap handlers are called from oceosmp_trap_from_machine_mode&lt;br /&gt;
#Update linker script symbols for per CPU stack size&lt;br /&gt;
#Write the application code referring to examples provided, where necessary.&lt;br /&gt;
#The bare metal device drivers provided with Soft Console can generally be used with OCEOSmp. The weak references in the OCEOSmp interrupt vectors module will resolve to the device drivers to be used. &lt;br /&gt;
#Build the application as normal.&lt;br /&gt;
&lt;br /&gt;
The OCEOSmp documentation includes a user manual, wiki, and header files. &lt;br /&gt;
&lt;br /&gt;
Licensing &amp;amp; services&lt;br /&gt;
&lt;br /&gt;
Licensing plans for OCEOSmp are as follows:&lt;br /&gt;
&lt;br /&gt;
#Development Kit (software, documentation, and unlimited runtime licences1)&lt;br /&gt;
#Annual support fee (upgrades, unlimited runtime licences, access to support resources)&lt;br /&gt;
#Customer board OCEOSmp functional certification service&lt;br /&gt;
#A Safety Assurance Pack is available to provide an easy route to achieving safety certification&lt;br /&gt;
#Source code is available under special licence conditions&lt;br /&gt;
#Unlimited runtime licences require annual support fee after first year&lt;br /&gt;
&lt;br /&gt;
Contact information&lt;br /&gt;
&lt;br /&gt;
For sales contact sales@ocetechnology.com or call +353 1 716 3530.&lt;br /&gt;
For support contact support@ocetechnology.com&lt;/div&gt;</summary>
		<author><name>Bkavanagh</name></author>
	</entry>
	<entry>
		<id>https://wiki.ocetechnology.com/mediawiki/index.php?title=MediaWiki:Sidebar&amp;diff=1706</id>
		<title>MediaWiki:Sidebar</title>
		<link rel="alternate" type="text/html" href="https://wiki.ocetechnology.com/mediawiki/index.php?title=MediaWiki:Sidebar&amp;diff=1706"/>
		<updated>2024-06-14T09:37:57Z</updated>

		<summary type="html">&lt;p&gt;Bkavanagh: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
* navigation&lt;br /&gt;
** Main Page|OCE wiki&lt;br /&gt;
*  DMON&lt;br /&gt;
** DMON install &amp;amp; use|DMON install &amp;amp; use&lt;br /&gt;
** DMON facilities|DMON facilities&lt;br /&gt;
** DMON commands|DMON commands&lt;br /&gt;
** DMON SOC support|DMON SOC support&lt;br /&gt;
** DMON Eclipse debug|DMON Eclipse debug&lt;br /&gt;
** DMON OCEOS Support|DMON OCEOS Support&lt;br /&gt;
** DMON Troubleshooting|DMON Troubleshooting&lt;br /&gt;
* OCEOS&lt;br /&gt;
** OCEOS/oceos_introduction|Introduction&lt;br /&gt;
** OCEOS/oceos_kernel|Kernel&lt;br /&gt;
** OCEOS/oceos_inter-task_communication|Inter-task Communication&lt;br /&gt;
** OCEOS/oceos_timed_actions|Timed Actions&lt;br /&gt;
** OCEOS/oceos_logging|Logging&lt;br /&gt;
** OCEOS/oceos_fdir|FDIR&lt;br /&gt;
** OCEOS/oceos_protection|Protection (GR716)&lt;br /&gt;
** OCEOS/oceos_debugging|Debugging&lt;br /&gt;
** OCEOS/oceos_profiling|Profiling&lt;br /&gt;
** OCEOS/oceos_use|Installation&lt;br /&gt;
* OCEOSmp&lt;br /&gt;
**OCEOSmp/introduction|Introduction&lt;br /&gt;
**OCEOSmp/notes|Application Notes&lt;br /&gt;
**OCEOSmp/directive_reference|Directive Reference&lt;br /&gt;
**OCEOSmp/polarfire|BSP Polarfire® SoC FPGA &lt;br /&gt;
**OCEOSmp/blank|Blank Section&lt;/div&gt;</summary>
		<author><name>Bkavanagh</name></author>
	</entry>
	<entry>
		<id>https://wiki.ocetechnology.com/mediawiki/index.php?title=OCEOSmp/directive_reference&amp;diff=1705</id>
		<title>OCEOSmp/directive reference</title>
		<link rel="alternate" type="text/html" href="https://wiki.ocetechnology.com/mediawiki/index.php?title=OCEOSmp/directive_reference&amp;diff=1705"/>
		<updated>2024-05-03T17:04:26Z</updated>

		<summary type="html">&lt;p&gt;Bkavanagh: /* Task data structures */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Introduction =&lt;br /&gt;
&lt;br /&gt;
To be added&lt;br /&gt;
&lt;br /&gt;
= Directives =&lt;br /&gt;
&lt;br /&gt;
== Initialisation directives ==&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_init()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''initialisation.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Initialises OCEOS and  must be the first directive used.&lt;br /&gt;
&lt;br /&gt;
Initialises the OCEOS system meta data using the information supplied in the application configuration and prepares for creation of tasks etc.&lt;br /&gt;
&lt;br /&gt;
The values provided in the application configuration are checked as much as possible before being used.&lt;br /&gt;
&lt;br /&gt;
The system log also is created here.&lt;br /&gt;
&lt;br /&gt;
This function sets up sysMetaPtr and init_meta_ptr and must have completed successfully before tasks etc. can be created.&lt;br /&gt;
&lt;br /&gt;
It disables interrupts and leaves them disabled, they will be re-enabled to the previous level after all tasks etc. have been created and [[OCEOSmp/directive_reference#oceos_init_finish()|oceos_init_finish()]] has completed successfully.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Initialises OCEOS and  must be the first directive used.&lt;br /&gt;
 *&lt;br /&gt;
 * Initialises the OCEOS system meta data using the information supplied in&lt;br /&gt;
 * the application configuration and prepares for creation of tasks etc.&lt;br /&gt;
 *&lt;br /&gt;
 * The values provided in the application configuration are checked as much&lt;br /&gt;
 * as possible before being used.&lt;br /&gt;
 *&lt;br /&gt;
 * The system log also is created here.&lt;br /&gt;
 *&lt;br /&gt;
 * This function sets up sysMetaPtr and init_meta_ptr and must have completed&lt;br /&gt;
 * successfully before tasks etc. can be created.&lt;br /&gt;
 *&lt;br /&gt;
 * It disables interrupts and leaves them disabled, they will be re-enabled to&lt;br /&gt;
 * the previous level after all tasks etc. have been created and&lt;br /&gt;
 * oceos_init_finish() has completed successfully.&lt;br /&gt;
 *&lt;br /&gt;
 * @param app_config Pointer to configuration struct&lt;br /&gt;
 * @return SUCCESSFUL                        All OK&lt;br /&gt;
 *         WARN_LOG_SIZE_DEFAULT             Warning, log size is set to default value of 64 entries&lt;br /&gt;
 *         WARN_NO_ERROR_FUNCTION            Warning, user defined function for ERROR handling is not provided&lt;br /&gt;
 *         ERR_CPU_FIRST_CORE_INVALID        Start CPU not in a range of available cores for this target; or greater than end CPU&lt;br /&gt;
 *         ERR_CPU_LAST_CORE_INVALID         Last CPU not in a range of available cores for this target&lt;br /&gt;
 *         ERR_NOT_START_CPU_CORE            Executing oceos_init on wrong CPU&lt;br /&gt;
 *         ERR_STACK_START_MISALIGNED        Stack start address is not set by user misaligned&lt;br /&gt;
 *         ERR_STACK_PER_CORE_INVALID        Stack per CPU size is zero, or not 8byte aligned, or less then min require&lt;br /&gt;
 *         ERR_LOG_ADDR_MISALIGNED           Log start address is not 8 byte aligned&lt;br /&gt;
 *         ERR_FIX_ADDR_MISALIGNED           Fixed area start address is not 8 byte aligned&lt;br /&gt;
 *         ERR_DYN_ADDR_MISALIGNED           Dynamic area start address is not 8 byte aligned&lt;br /&gt;
 *         ERR_CPU_CORE_RANGE_WRONG          CPU cores in use exceed available CPUs on the SoC&lt;br /&gt;
 *         ERR_STACK_SPACE_WRONG             Current CPU SP is not within user provided stack range&lt;br /&gt;
 *         ERR_LOG_SIZE_INVALID              Log size outside expected range&lt;br /&gt;
 *         ERR_CS_LOG_SIZE_INVALID           Context switch log size invalid&lt;br /&gt;
 *         ERR_TASK_NUMBER_INVALID           Number of tasks invalid&lt;br /&gt;
 *         ERR_MUTEX_NUMBER_INVALID          Number of mutexes invalid&lt;br /&gt;
 *         ERR_RWMUTEX_NUMBER_INVALID        Number of rwmutexes invalid&lt;br /&gt;
 *         ERR_SEM_NUMBER_INVALID            Number of semaphores invalid&lt;br /&gt;
 *         ERR_DATAQ_NUMBER_INVALID          Number of datqs invalid&lt;br /&gt;
 *         ERR_TIMED_ACTIONS_NUMBER_INVALID  Number of timed actions invalid&lt;br /&gt;
 *         ERR_OVERLAP_STACK                 Overlap stack end address with (two overlap areas are set)&lt;br /&gt;
 *         ERR_OVERLAP_LOG                   Overlap log with (two overlap areas are set)&lt;br /&gt;
 *         ERR_OVERLAP_FIXED                 Overlap fixed area with (two overlap areas are set)&lt;br /&gt;
 *         ERR_OVERLAP_DYNAMIC               Overlap dynamic area with (two overlap areas are set)&lt;br /&gt;
 *         ERR_FIXED_MEMORY_FAILED           Fixed area memory write fail&lt;br /&gt;
 *         ERR_DYNAMIC_MEMORY_FAILED         Dynamic area memory write fail&lt;br /&gt;
 *         ERR_TIMER_ADDR_INVALID            Timer address not provided by user (null). SPARC only&lt;br /&gt;
 *         ERR_SYS_TIMER_INDEX_INVALID       System timer index of subtimer invalid; SPARC only; Subtimers start from index 1; Need index of subtimer plus one in front&lt;br /&gt;
 *         ERR_PERIPHERAL_CLOCK_INVALID      System peripheral code invalid&lt;br /&gt;
 *&lt;br /&gt;
 */&lt;br /&gt;
S32_t   oceos_init(&lt;br /&gt;
    const struct application_configuration app_config&lt;br /&gt;
);&lt;br /&gt;
 &amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| app_config || Pointer to configuration struct.  struct application_configuration defined in '''''basic_structs.h'''''&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| WARN_LOG_SIZE_DEFAULT             || Warning, log size is set to default value of 64 entries&lt;br /&gt;
|-&lt;br /&gt;
| WARN_NO_ERROR_FUNCTION            || Warning, user defined function for ERROR handling is not provided&lt;br /&gt;
|-&lt;br /&gt;
| ERR_CPU_FIRST_CORE_INVALID        || Start CPU not in a range of available cores for this target; or greater than end CPU&lt;br /&gt;
|-&lt;br /&gt;
| ERR_CPU_LAST_CORE_INVALID         || Last CPU not in a range of available cores for this target&lt;br /&gt;
|-&lt;br /&gt;
| ERR_NOT_START_CPU_CORE            || Executing oceos_init on wrong CPU&lt;br /&gt;
|-&lt;br /&gt;
| ERR_STACK_START_MISALIGNED        || Stack start address is not set by user misaligned&lt;br /&gt;
|-&lt;br /&gt;
| ERR_STACK_PER_CORE_INVALID        || Stack per CPU size is zero, or not 8byte aligned, or less then min require&lt;br /&gt;
|-&lt;br /&gt;
| ERR_LOG_ADDR_MISALIGNED           || Log start address is not 8 byte aligned&lt;br /&gt;
|-&lt;br /&gt;
| ERR_FIX_ADDR_MISALIGNED           || Fixed area start address is not 8 byte aligned&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DYN_ADDR_MISALIGNED           || Dynamic area start address is not 8 byte aligned&lt;br /&gt;
|-&lt;br /&gt;
| ERR_CPU_CORE_RANGE_WRONG          || CPU cores in use exceed available CPUs on the SoC&lt;br /&gt;
|-&lt;br /&gt;
| ERR_STACK_SPACE_WRONG             || Current CPU SP is not within user provided stack range&lt;br /&gt;
|-&lt;br /&gt;
| ERR_LOG_SIZE_INVALID              || Log size outside expected range&lt;br /&gt;
|-&lt;br /&gt;
| ERR_CS_LOG_SIZE_INVALID           || Context switch log size invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TASK_NUMBER_INVALID           || Number of tasks invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_MUTEX_NUMBER_INVALID          || Number of mutexes invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_RWMUTEX_NUMBER_INVALID        || Number of rwmutexes invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SEM_NUMBER_INVALID            || Number of semaphores invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DATAQ_NUMBER_INVALID          || Number of datqs invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TIMED_ACTIONS_NUMBER_INVALID  || Number of timed actions invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_OVERLAP_STACK                 || Overlap stack end address with (two overlap areas are set)&lt;br /&gt;
|-&lt;br /&gt;
| ERR_OVERLAP_LOG                   || Overlap log with (two overlap areas are set)&lt;br /&gt;
|-&lt;br /&gt;
| ERR_OVERLAP_FIXED                 || Overlap fixed area with (two overlap areas are set)&lt;br /&gt;
|-&lt;br /&gt;
| ERR_OVERLAP_DYNAMIC               || Overlap dynamic area with (two overlap areas are set)&lt;br /&gt;
|-&lt;br /&gt;
| ERR_FIXED_MEMORY_FAILED           || Fixed area memory write fail&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DYNAMIC_MEMORY_FAILED         || Dynamic area memory write fail&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TIMER_ADDR_INVALID            || Timer address not provided by user (null). SPARC only&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_TIMER_INDEX_INVALID       || System timer index of subtimer invalid; SPARC only; Subtimers start from index 1; Need index of subtimer plus one in front&lt;br /&gt;
|-&lt;br /&gt;
| ERR_PERIPHERAL_CLOCK_INVALID      || System peripheral code invalid&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
    /*&lt;br /&gt;
     * Create the application configuration structure&lt;br /&gt;
     */&lt;br /&gt;
    struct application_configuration           app_config = {0};&lt;br /&gt;
&lt;br /&gt;
    /*&lt;br /&gt;
     * Fill in the application parameters&lt;br /&gt;
     */&lt;br /&gt;
    app_config.log_address                   = (log_t)log_data;              // required&lt;br /&gt;
    app_config.fixed_data_address            = (adrs_t)fixed_data;            // required&lt;br /&gt;
    app_config.dynamic_data_address          = (adrs_t)dynamic_data;          // required&lt;br /&gt;
&lt;br /&gt;
    app_config.stack_start_address           = start_stack_array[OCEOS_START_CPU_INDEX];// OCEOSMP_STACK_START_ADDRESS;&lt;br /&gt;
    app_config.stack_size_per_cpu            = (U32_t)&amp;amp;__oceos_stack_size_per_cpu;  // OCEOSMP_STACK_LOW_BOUND_ADDRESS;&lt;br /&gt;
&lt;br /&gt;
    app_config.system_error_function         = oceosmp_on_error;               // NULL =&amp;gt; ignore&lt;br /&gt;
    app_config.log_full_function             = oceosmp_on_full_log;            // NULL =&amp;gt; ignore&lt;br /&gt;
&lt;br /&gt;
    // used in setting up system log and fixed data array&lt;br /&gt;
    app_config.log_number_of_entries         = NUMBER_OF_LOG_ENTRIES;          // 0 =&amp;gt; use default&lt;br /&gt;
&lt;br /&gt;
    app_config.number_of_tasks               = NUMBER_OF_TASKS;                // &amp;gt;= 1&lt;br /&gt;
&lt;br /&gt;
    app_config.number_of_mutexes             = NUMBER_OF_MUTEXES;&lt;br /&gt;
	app_config.number_of_rwmutexes			 = NUMBER_OF_RWMUTEXES;&lt;br /&gt;
    app_config.number_of_counting_semaphores = NUMBER_OF_SEMAPHORES;&lt;br /&gt;
    app_config.number_of_data_queues         = NUMBER_OF_DATAQS;&lt;br /&gt;
&lt;br /&gt;
    /**&lt;br /&gt;
     * FOR SPARC TARGET ONLY.&lt;br /&gt;
     */&lt;br /&gt;
    app_config.sys_time_timer_index          = SYS_TIME_TIMER_INDEX;           // 0 =&amp;gt; invalid index&lt;br /&gt;
    /**&lt;br /&gt;
     * FOR SPARC TARGET ONLY.&lt;br /&gt;
     * Not Used for ARM. Always Nested&lt;br /&gt;
     */&lt;br /&gt;
    app_config.interrupt_nesting_enabled     = TRUE;                           // TRUE =&amp;gt; single vector&lt;br /&gt;
    app_config.oceos_cpu_switch_int_number   = OCEOS_CPU_INTER_COM_INT_NUMBER; // User should provide SGI ID (0-15)&lt;br /&gt;
&lt;br /&gt;
    app_config.timed_actions_queue_size      = NUMBER_OF_ACTION_ENTRIES;&lt;br /&gt;
    app_config.CS_log_entries_base2          = CS_LOG_DEF_ENTRIES_BASE2;&lt;br /&gt;
    /**&lt;br /&gt;
     * Set starting index of CPU that will be used by OCEOSMP&lt;br /&gt;
     */&lt;br /&gt;
    app_config.oceos_cpu_start_index         = OCEOS_START_CPU_INDEX;&lt;br /&gt;
    /**&lt;br /&gt;
     * Set last index of CPU that will be used by OCEOSMP&lt;br /&gt;
     */&lt;br /&gt;
    app_config.oceos_cpu_last_index          = OCEOS_LAST_CPU_INDEX;&lt;br /&gt;
    /*&lt;br /&gt;
     * Set system/peripheral clock used to initialise system timer&lt;br /&gt;
     */&lt;br /&gt;
    app_config.soc_peripheral_clck           = BSP_SYSFREQ * 1000 * 1000;&lt;br /&gt;
&lt;br /&gt;
    // initialise OCEOSMP&lt;br /&gt;
    S32_t status;&lt;br /&gt;
    status = oceos_init(app_config);&lt;br /&gt;
    if (OCEOS_SUCCESS &amp;gt; status) {&lt;br /&gt;
      oceosmp_print(&amp;quot;\n oceos_init failure\n\r&amp;quot;);&lt;br /&gt;
      return 0;&lt;br /&gt;
    } else {&lt;br /&gt;
      return 1;&lt;br /&gt;
    }   // else&lt;br /&gt;
 &amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_init_finish()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''initialisation.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Finalizes the fixed data array after all tasks etc. have been created&lt;br /&gt;
&lt;br /&gt;
All information needed to start OCEOS can be found in the fixed data area&lt;br /&gt;
when oceos_init_finish() has completed.&lt;br /&gt;
&lt;br /&gt;
Once all tasks etc. have been created oceos_init_finish() checks the&lt;br /&gt;
accumulated information against the application configuration data&lt;br /&gt;
stored in the fixed meta structure.&lt;br /&gt;
&lt;br /&gt;
oceos_init_finish also calculates the size of the dynamic data area and&lt;br /&gt;
checks it does not overlap with the system stack, the system log, or the&lt;br /&gt;
fixed data, and if all ok sets up pointers to the various dynamic area&lt;br /&gt;
components in the fixed data.&lt;br /&gt;
&lt;br /&gt;
It then adds an XOR checksum to the fixed data area, and checks that this&lt;br /&gt;
is followed by FILLER, which it replaces with the end sentinel.&lt;br /&gt;
&lt;br /&gt;
On successful completion it restores the interrupt level to its value&lt;br /&gt;
before oceos_init() was called, otherwise interrupts remain disabled.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Finalizes the fixed data array after all tasks etc. have been created&lt;br /&gt;
 *&lt;br /&gt;
 * All information needed to start OCEOS can be found in the fixed data area&lt;br /&gt;
 * when oceos_init_finish() has completed.&lt;br /&gt;
 *&lt;br /&gt;
 * Once all tasks etc. have been created oceos_init_finish() checks the&lt;br /&gt;
 * accumulated information against the application configuration data&lt;br /&gt;
 * stored in the fixed meta structure.&lt;br /&gt;
 *&lt;br /&gt;
 * oceos_init_finish also calculates the size of the dynamic data area and&lt;br /&gt;
 * checks it does not overlap with the system stack, the system log, or the&lt;br /&gt;
 * fixed data, and if all ok sets up pointers to the various dynamic area&lt;br /&gt;
 * components in the fixed data.&lt;br /&gt;
 *&lt;br /&gt;
 * It then adds an XOR checksum to the fixed data area, and checks that this&lt;br /&gt;
 * is followed by FILLER, which it replaces with the end sentinel.&lt;br /&gt;
 *&lt;br /&gt;
 * On successful completion it restores the interrupt level to its value&lt;br /&gt;
 * before oceos_init() was called, otherwise interrupts remain disabled.&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS                             All OK&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT               System Meta data is NULL or corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT                 System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_CPU_CORE                  Executing directive on wrong CPU&lt;br /&gt;
 *          ERR_WRONG_PHASE                     Called before oceos_init()&lt;br /&gt;
 *          ERR_TASKS_INCOMPLETE                Created wrong number of tasks&lt;br /&gt;
 *          ERR_MUTEX_INCOMPLETE                Created wrong number of mutexes&lt;br /&gt;
 *          ERR_RWMUTEX_INCOMPLETE              Created wrong number of rwmutexes&lt;br /&gt;
 *          ERR_SEM_INCOMPLETE                  Created wrong number of semaphores&lt;br /&gt;
 *          ERR_DATAQ_INCOMPLETE                Created wrong number of dataqs&lt;br /&gt;
 *          ERR_TASK_MAX_ID_INVALID             Task's max id invalid&lt;br /&gt;
 *          ERR_MUTEX_MAX_ID_INVALID            Mutexe's max id invalid&lt;br /&gt;
 *          ERR_RWMUTEX_MAX_ID_INVALID          Rwmutexe's max id invalid&lt;br /&gt;
 *          ERR_SEM_MAX_ID_INVALID              Semaphore's max id invalid&lt;br /&gt;
 *          ERR_DATAQ_MAX_ID_INVALID            Dataq's max id invalid&lt;br /&gt;
 *          ERR_TOTAL_JOBS_NUMBER_WRONG         Wrong number of total jobs created&lt;br /&gt;
 *          ERR_ORDER_ARRAY_PTR_INVALID         Order array pointer is NULL or mis-aligned&lt;br /&gt;
 *          ERR_FIXED_AREA_TOO_SMALL            Not enough space for fixed data area&lt;br /&gt;
 */&lt;br /&gt;
S32_t   oceos_init_finish(void);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
There are no input parameters to this function.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit  || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT               || System Meta data is NULL or corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT                 || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_CPU_CORE                  || Executing directive on wrong CPU&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE                     || Called before oceos_init()&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TASKS_INCOMPLETE                || Created wrong number of tasks&lt;br /&gt;
|-&lt;br /&gt;
| ERR_MUTEX_INCOMPLETE                || Created wrong number of mutexes&lt;br /&gt;
|-&lt;br /&gt;
| ERR_RWMUTEX_INCOMPLETE              || Created wrong number of rwmutexes&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SEM_INCOMPLETE                  || Created wrong number of semaphores&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DATAQ_INCOMPLETE                || Created wrong number of dataqs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TASK_MAX_ID_INVALID             || Task's max id invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_MUTEX_MAX_ID_INVALID            || Mutexe's max id invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_RWMUTEX_MAX_ID_INVALID          || Rwmutexe's max id invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SEM_MAX_ID_INVALID              || Semaphore's max id invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DATAQ_MAX_ID_INVALID            || Dataq's max id invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TOTAL_JOBS_NUMBER_WRONG         || Wrong number of total jobs created&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ORDER_ARRAY_PTR_INVALID         || Order array pointer is NULL or mis-aligned&lt;br /&gt;
|-&lt;br /&gt;
| ERR_FIXED_AREA_TOO_SMALL            || Not enough space for fixed data area&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
    /*&lt;br /&gt;
     * Finish initialising OCEOS and setting up the fixed data&lt;br /&gt;
     */&lt;br /&gt;
    status = oceos_init_finish();&lt;br /&gt;
    if(OCEOS_SUCCESS &amp;gt; status){&lt;br /&gt;
        // LOG&lt;br /&gt;
      oceosmp_print(&amp;quot;\nAbandoning, problem ending OCEOS initialisation\n\r&amp;quot;);&lt;br /&gt;
        return -1;&lt;br /&gt;
    }   // if&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_start()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''initialisation.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Starts OCEOS scheduling.&amp;lt;br&amp;gt;&lt;br /&gt;
Create dynamic OCEOS structures and start scheduling.&amp;lt;br&amp;gt;&lt;br /&gt;
This function should only be called once and only after [[OCEOSmp/directive_reference#oceos_init()|oceos_init()]] and [[OCEOSmp/directive_reference#oceos_init_finish()|oceos_init_finish()]] have been called successfully.&amp;lt;br&amp;gt;&lt;br /&gt;
Normally this function does not return. &amp;lt;br&amp;gt;&lt;br /&gt;
If a problem is detected the function terminates and returns an appropriate DIRECTIVE_STATUS code, with interrupts disabled.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Starts OCEOS scheduling&lt;br /&gt;
 *&lt;br /&gt;
 * Create dynamic OCEOS structures and start scheduling&lt;br /&gt;
 *&lt;br /&gt;
 * This function should only be called once&lt;br /&gt;
 * and only after oceos_init()&lt;br /&gt;
 * and oceos_init_finish() have&lt;br /&gt;
 *  been called successfully.&lt;br /&gt;
 * Normally this function does not return.&lt;br /&gt;
 * If a problem is detected the function&lt;br /&gt;
 * terminates and returns an appropriate&lt;br /&gt;
 * DIRECTIVE_STATUS code, with interrupts disabled.&lt;br /&gt;
 *&lt;br /&gt;
 * @param fixed_array_ptr   Pointer to fixed data array&lt;br /&gt;
 * @param start_task        Task ID&lt;br /&gt;
 * @param data_ptr          Pointer to data to be passed to the task&lt;br /&gt;
 * @return  OCEOSMP_EXIT                        OCEOSMP return from scheduling and exit&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT               Fixed area pointer is null or bad sentinel&lt;br /&gt;
 *          ERR_FIXED_AREA_SIZE_WRONG           Fixed area size is zero&lt;br /&gt;
 *          ERR_FIXED_AREA_END_SENTINEL_BAD     Fixed data end sentinel corrupt&lt;br /&gt;
 *          ERR_FIXED_AREA_BAD_XOR              Fixed area bad checksum or checksum mis-match&lt;br /&gt;
 *          ERR_INIT_NOT_DONE                   oceos_start() called without initialisation&lt;br /&gt;
 *          ERR_DYN_AREA_PTR_BAD                Dynamic area pointer invalid in sysMetaPtr&lt;br /&gt;
 *          ERR_INT_HANDLER_BAD                 IRQ controller pointer provided by BCC is NULL;or OCEOS handler is not set&lt;br /&gt;
 *          ERR_DYN_JOB_PTR_BAD                 Job array pointer is NULL&lt;br /&gt;
 *          ERR_FIXED_TASK_PTR_BAD              Tasks array pointer is NULL&lt;br /&gt;
 *          ERR_JOB_COUNT_WRONG                 Total job count inconsistent&lt;br /&gt;
 *          ERR_DYN_MUTEX_PTR_BAD               Mutex dynamic pointer is NULL&lt;br /&gt;
 *          ERR_DYN_LOCK_PTR_BAD                Mutex lock array pointer is NULL&lt;br /&gt;
 *          ERR_DYN_RWMUTEX_PTR_BAD             Rwmutex dynamic pointer is NULL&lt;br /&gt;
 *          ERR_DYN_RWLOCK_PTR_BAD              Rwmutex lock array pointer is NULL&lt;br /&gt;
 *          ERR_FIXED_SEM_PTR_BAD               Semaphore fixed pointer is NULL&lt;br /&gt;
 *          ERR_DYN_SEM_PTR_BAD                 Semaphore dynamic pointer is NULL&lt;br /&gt;
 *          ERR_SEM_PEND_PTR_BAD                Semaphore pending queue pointer is NULL&lt;br /&gt;
 *          ERR_FIXED_DATAQ_PTR_BAD             Dataq fixed pointer is NULL&lt;br /&gt;
 *          ERR_DYN_DATAQ_PTR_BAD               Dataq dynamic pointer is NULL&lt;br /&gt;
 *          ERR_DATAQ_PEND_PTR_BAD              Dataq pending queue pointer is NULL&lt;br /&gt;
 *          ERR_DATAQ_DATA_PTR_BAD              Dataq data pointer is NULL&lt;br /&gt;
 *          ERR_CPU_INT_NUMBER_INVALID          SPARC only.IRQ number for CPU inter-comunication invalid(zero or used by timer)&lt;br /&gt;
 *          ERR_REGISTER_CPU_IRQ_FAILED         SPARC only. Failed to set CPU IRQ handler in BCC&lt;br /&gt;
 *          ERR_CPU_STACK_INVALID               Current CPU stack not within specified range&lt;br /&gt;
 *          ERR_CPU_PRIORITY_STACK_INVALID      Per CPU priority stack invalid&lt;br /&gt;
 *          ERR_LOG_AREA_END_SENTINEL_BAD       Log area end sentinel override&lt;br /&gt;
 *          ERR_TA_CONFIG_PTR_BAD               SPARC only; Timed action configuration data pointer is NULL&lt;br /&gt;
 *          ERR_TA_TIMER_INDEX_INVALID          SPARC only; Timed action sub-timer index in timer unit is invalid&lt;br /&gt;
 *          ERR_TA_IRQ_NUMBER_INVALID           SPARC only; Timer action timer IRQ number is invalid&lt;br /&gt;
 *          ERR_TA_BCC_IRQ_REGISTER_FAILED      SPARC only; Timed action timer IRQ handler failed to register&lt;br /&gt;
 */&lt;br /&gt;
S32_t   oceos_start(&lt;br /&gt;
    const U32_t * const fixed_array_ptr,// pointer to fixed data array&lt;br /&gt;
    const U32_t start_task,             // taskID&lt;br /&gt;
    void * const data_ptr               // pointer to data to be passed to task&lt;br /&gt;
);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| fixed_array_ptr || Pointer to fixed data array&lt;br /&gt;
|-&lt;br /&gt;
| start_task      || Task ID&lt;br /&gt;
|-&lt;br /&gt;
| data_ptr        || Pointer to data to be passed to the task&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit  || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT               || Fixed area pointer is null or bad sentinel&lt;br /&gt;
|-&lt;br /&gt;
| ERR_FIXED_AREA_SIZE_WRONG           || Fixed area size is zero&lt;br /&gt;
|-&lt;br /&gt;
| ERR_FIXED_AREA_END_SENTINEL_BAD     || Fixed data end sentinel corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_FIXED_AREA_BAD_XOR              || Fixed area bad checksum or checksum mis-match&lt;br /&gt;
|-&lt;br /&gt;
| ERR_INIT_NOT_DONE                   || oceos_start() called without initialisation&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DYN_AREA_PTR_BAD                || Dynamic area pointer invalid in sysMetaPtr&lt;br /&gt;
|-&lt;br /&gt;
| ERR_INT_HANDLER_BAD                 || IRQ controller pointer provided by BCC is NULL;or OCEOS handler is not set&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DYN_JOB_PTR_BAD                 || Job array pointer is NULL&lt;br /&gt;
|-&lt;br /&gt;
| ERR_FIXED_TASK_PTR_BAD              || Tasks array pointer is NULL&lt;br /&gt;
|-&lt;br /&gt;
| ERR_JOB_COUNT_WRONG                 || Total job count inconsistent&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DYN_MUTEX_PTR_BAD               || Mutex dynamic pointer is NULL&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DYN_LOCK_PTR_BAD                || Mutex lock array pointer is NULL&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DYN_RWMUTEX_PTR_BAD             || Rwmutex dynamic pointer is NULL&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DYN_RWLOCK_PTR_BAD              || Rwmutex lock array pointer is NULL&lt;br /&gt;
|-&lt;br /&gt;
| ERR_FIXED_SEM_PTR_BAD               || Semaphore fixed pointer is NULL&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DYN_SEM_PTR_BAD                 || Semaphore dynamic pointer is NULL&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SEM_PEND_PTR_BAD                || Semaphore pending queue pointer is NULL&lt;br /&gt;
|-&lt;br /&gt;
| ERR_FIXED_DATAQ_PTR_BAD             || Dataq fixed pointer is NULL&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DYN_DATAQ_PTR_BAD               || Dataq dynamic pointer is NULL&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DATAQ_PEND_PTR_BAD              || Dataq pending queue pointer is NULL&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DATAQ_DATA_PTR_BAD              || Dataq data pointer is NULL&lt;br /&gt;
|-&lt;br /&gt;
| ERR_CPU_INT_NUMBER_INVALID          || SPARC only.IRQ number for CPU inter-comunication invalid(zero or used by timer)&lt;br /&gt;
|-&lt;br /&gt;
| ERR_REGISTER_CPU_IRQ_FAILED         || SPARC only. Failed to set CPU IRQ handler in BCC&lt;br /&gt;
|-&lt;br /&gt;
| ERR_CPU_STACK_INVALID               || Current CPU stack not within specified range&lt;br /&gt;
|-&lt;br /&gt;
| ERR_CPU_PRIORITY_STACK_INVALID      || Per CPU priority stack invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_LOG_AREA_END_SENTINEL_BAD       || Log area end sentinel override&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_CONFIG_PTR_BAD               || SPARC only; Timed action configuration data pointer is NULL&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_TIMER_INDEX_INVALID          || SPARC only; Timed action sub-timer index in timer unit is invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_IRQ_NUMBER_INVALID           || SPARC only; Timer action timer IRQ number is invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_BCC_IRQ_REGISTER_FAILED      || SPARC only; Timed action timer IRQ handler failed to register&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/* Sample Task names - all here start with t_ to help avoid name confusion */&lt;br /&gt;
enum TASK_NAME{&lt;br /&gt;
    t_tom,                      // will have task ID 0&lt;br /&gt;
    t_dick,                     // will have task ID 1&lt;br /&gt;
};&lt;br /&gt;
extern U32_t fixed_data[];&lt;br /&gt;
...&lt;br /&gt;
S32_t status;&lt;br /&gt;
&lt;br /&gt;
status = oceos_start(fixed_data, t_tom, NULL);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_exit()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''initialisation.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Ends scheduling and exit from [[OCEOSmp/directive_reference#oceos_start()|oceos_start()]].&lt;br /&gt;
No task can be started after this.&amp;lt;br&amp;gt;&lt;br /&gt;
OCEOS will exit when the current job ends.&amp;lt;br&amp;gt;&lt;br /&gt;
An idle task in an endless loop should check that scheduling is enabled.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Ends scheduling and exit from oceos_start.&lt;br /&gt;
 * No task can be started after this.&lt;br /&gt;
 * OCEOS will exit when the current job ends.&lt;br /&gt;
 * An idle task in an endless loop should check that scheduling is enabled.&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Called before scheduling started&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_exit(void);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
There are no input parameters to this function.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit  || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Called before scheduling started&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
// Exit OCEOS&lt;br /&gt;
oceos_exit();&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_CPU_sleep()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''initialisation.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
 Puts CPU in sleep mode.&amp;lt;br&amp;gt;&lt;br /&gt;
 User must to be sure that interrupts are enabled.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Puts CPU in sleep mode.&lt;br /&gt;
 * User must to be sure that interrupts are enabled.&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_CPU_sleep(void);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
There are no input parameters to this function.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
// Put CPU to sleep&lt;br /&gt;
oceos_CPU_sleep();&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceosmp_cpu_disable()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''initialisation.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function ends execution of all tasks running on particular CPU and removes the CPU from scheduling.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Ends execution of all tasks running on particular CPU and removes this CPU from scheduling.&lt;br /&gt;
 * @param cpu_id&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              CPU ID outside allowed range 0 to 254&lt;br /&gt;
 *          ERR_ID_WRONG                CPU ID &amp;gt;= number of available CPUs&lt;br /&gt;
 *          ERR_CPU_ALREADY_DISABLED    CPU already disabled&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceosmp_cpu_disable(&lt;br /&gt;
    U32_t cpu_id&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| cpu_id || ID of CPU core to be disabled.&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit  || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || CPU ID outside allowed range 0 to 254&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || CPU ID &amp;gt;= number of available CPUs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_CPU_ALREADY_DISABLED    || CPU already disabled&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, faulty_cpu;&lt;br /&gt;
...&lt;br /&gt;
// Disable faulty CPU core&lt;br /&gt;
status = oceosmp_cpu_disable(faulty_cpu));&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceosmp_cpu_enable()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''initialisation.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function adds a disabled CPU core to the OCEOSmp scheduler. It should only be called after scheduling has started&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 *  Adds disabled CPU to OCEOSmp scheduler&lt;br /&gt;
 *&lt;br /&gt;
 *  N.B. This function should only be called after scheduling has started&lt;br /&gt;
 *&lt;br /&gt;
 * @param cpu_id&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              CPU ID outside allowed range 0 to 254&lt;br /&gt;
 *          ERR_ID_WRONG                CPU ID &amp;gt;= number of available CPUs; or the same as currently running&lt;br /&gt;
 *          ERR_CPU_ALREADY_ENABLED     CPU already enabled&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceosmp_cpu_enable(&lt;br /&gt;
    U32_t cpu_id&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| cpu_id || ID of CPU core to be enabled.&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit  || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || CPU ID outside allowed range 0 to 254&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || CPU ID &amp;gt;= number of available CPUs; or the same as currently running&lt;br /&gt;
|-&lt;br /&gt;
| ERR_CPU_ALREADY_ENABLED     || CPU already enabled&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, good_cpu;&lt;br /&gt;
...&lt;br /&gt;
// Enable CPU core&lt;br /&gt;
status = oceosmp_cpu_enable(good_cpu));&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceosmp_cpu_terminate()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''initialisation.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function removes a CPU core from the OCEOSmp scheduler and marks it so it cannot be restarted. It puts CPU to sleep with interrupts disabled. It should only be called after scheduling has started.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 *  Removes CPU from OCEOSMP scheduler and terminates, cannot be restarted.&lt;br /&gt;
 *  Puts CPU to sleep with interrupts disabled&lt;br /&gt;
 *&lt;br /&gt;
 *  N.B. This function should only be called after scheduling has started&lt;br /&gt;
 *  Steps:&lt;br /&gt;
 *     1. Set terminate flag on this CPU;&lt;br /&gt;
 *     2. Trigger software interrupt to transfer execution to IRQ handler;&lt;br /&gt;
 *     3. Check flag and if set =&amp;gt; put CPU to sleep in while loop with interrupts disabled;&lt;br /&gt;
 *     4. Set MAX priority on this CPU priority stack;&lt;br /&gt;
 *     5. Remove CPU from scheduling;&lt;br /&gt;
 *     6. Clean up all the tasks by calling task terminate function and free up all the&lt;br /&gt;
 *        preempted jobs by this CPU;&lt;br /&gt;
 *&lt;br /&gt;
 * @param cpu_id&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              CPU ID outside allowed range 0 to 254&lt;br /&gt;
 *          ERR_ID_WRONG                CPU ID &amp;gt;= number of available CPUs; or the same as currently running&lt;br /&gt;
 *          ERR_CPU_ALREADY_TERMINATED  CPU already terminated&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceosmp_cpu_terminate(&lt;br /&gt;
    U32_t cpu_id&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| cpu_id || ID of CPU core to be terminated.&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit  || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || CPU ID outside allowed range 0 to 254&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || CPU ID &amp;gt;= number of available CPUs; or the same as currently running&lt;br /&gt;
|-&lt;br /&gt;
| ERR_CPU_ALREADY_TERMINATED  || CPU already terminated&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, faulty_cpu;&lt;br /&gt;
...&lt;br /&gt;
// Terminate CPU core&lt;br /&gt;
status = oceosmp_cpu_terminate(faulty_cpu));&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;Task directives&amp;lt;/span&amp;gt;==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ API Functions&lt;br /&gt;
|-&lt;br /&gt;
| Directive                                                                     || Description                          || main || task || IRQ handler&lt;br /&gt;
|-&lt;br /&gt;
| [[OCEOSmp/directive reference#oceos_task_create()| oceos_task_create()]]             || Create Task                        || *    ||      || &lt;br /&gt;
|-&lt;br /&gt;
| [[OCEOSmp/directive reference#oceos_task_start()| oceos_task_start()]]               || Start Task                         ||      ||  *   || *&lt;br /&gt;
|-&lt;br /&gt;
| [[OCEOSmp/directive reference#oceos_task_timed_start()| oceos_task_timed_start()]]   || Schedule a task to start execution at a given system time||      ||  *   || *&lt;br /&gt;
|-&lt;br /&gt;
| [[OCEOSmp/directive reference#oceos_task_disable()| oceos_task_disable()]]           || Disable Task                       ||      ||  *   || *&lt;br /&gt;
|-&lt;br /&gt;
| [[OCEOSmp/directive reference#oceos_task_enable()| oceos_task_enable()]]             || Enable Task                        ||      ||  *   || *&lt;br /&gt;
|-&lt;br /&gt;
| [[OCEOSmp/directive reference#oceos_task_self()| oceos_task_self()]]                 || Returns the task ID of the currently executing task ||    ||  *   || *&lt;br /&gt;
|-&lt;br /&gt;
| [[OCEOSmp/directive reference#oceos_task_get_priority()| oceos_task_get_priority()]] || Get priority of a task             ||      ||  *   || *&lt;br /&gt;
|-&lt;br /&gt;
| [[OCEOSmp/directive reference#oceos_task_get_status()| oceos_task_get_status()]]     || Get status of a task               ||      ||  *   || *&lt;br /&gt;
|-&lt;br /&gt;
| [[OCEOSmp/directive reference#oceos_task_kill()| oceos_task_kill()]]                 || Directive to terminate current task||      ||  *   || *&lt;br /&gt;
|-&lt;br /&gt;
| [[OCEOSmp/directive reference#oceos_task_get_info()| oceos_task_get_info()]]         || Get task information               ||      ||  *   || *&lt;br /&gt;
|-&lt;br /&gt;
| [[OCEOSmp/directive reference#oceosmp_task_kill()| oceosmp_task_kill()]]                 || Directive to terminate current task||      ||  *   || *&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;Task data structures&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''tasks.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The following data structures are used by some of the task directives.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Data structures'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * A pointer to this structure is passed to oceos_task_create().&lt;br /&gt;
 * The structure is first initialised according to a tasks's parameters,&lt;br /&gt;
 * and is not used again after the task is created and may then be discarded.&lt;br /&gt;
 */&lt;br /&gt;
struct task_descriptor {&lt;br /&gt;
&lt;br /&gt;
	void (*function_start)(void*);	// name of task start function&lt;br /&gt;
	void (*function_end)(void*);	// optional, NULL or task end function&lt;br /&gt;
&lt;br /&gt;
	U32_t task_id;					// 0 to 254, usually an enum&lt;br /&gt;
	U32_t task_jobs_max;			// 1 to 15, max concurrent 'jobs'&lt;br /&gt;
	U32_t task_priority;			// 1 (highest) to 254 (lowest)&lt;br /&gt;
	U32_t task_threshold;			// &amp;gt;=1, &amp;lt;= task_priority (higher or same priority)&lt;br /&gt;
	U32_t task_turned_on_initially;	// 0: disabled initially, else enabled&lt;br /&gt;
&lt;br /&gt;
	U32_t time_deadline_microsecs;	// start request to finish, 0 to ignore&lt;br /&gt;
	U32_t time_min_interval_microsecs;	// between start requests, 0 to ignore&lt;br /&gt;
&lt;br /&gt;
	U32_t uses_cpu_affinity;		// 0: not restricted, else core restricted&lt;br /&gt;
	U32_t uses_cpu_affinity_core_id;// core ID to which restricted if affinity used&lt;br /&gt;
}__attribute__ ((aligned (8)));&lt;br /&gt;
&lt;br /&gt;
/**&lt;br /&gt;
 * Task info used with oceos_task_get_info&lt;br /&gt;
 */&lt;br /&gt;
struct task_info {&lt;br /&gt;
  U64_t           time_max_delay;               // maximum time job is waiting on ready queue before becoming active&lt;br /&gt;
  U64_t           time_max_finish;              // maximum time to finish job execution after starting&lt;br /&gt;
  U64_t           time_max_exec;                // maximum time spent executing&lt;br /&gt;
  U64_t           time_total_exec;              // total CPU time used by this task&lt;br /&gt;
  U64_t           time_min_gap_starts;          // minimum time between job creations, can be reset&lt;br /&gt;
  U64_t           time_min_gap_finish_start;    // minimum time between job ending and new job creation, can be reset&lt;br /&gt;
&lt;br /&gt;
  U64_t           time_last_start;              // time of most recent job creation&lt;br /&gt;
  U64_t           time_last_finish;             // time of most recent job finish&lt;br /&gt;
&lt;br /&gt;
  unsigned int    jobs_current_max  :16;        // maximum number of current jobs for this task, no roll over, can be reset&lt;br /&gt;
  unsigned int    jobs_total        :16;        // number of times this task was started, no roll-over, can be reset&lt;br /&gt;
  U32_t           jobs_current;                 // Number of task instances currently in use by oceos&lt;br /&gt;
&lt;br /&gt;
  U32_t           preempt_max;                  // maximum times any job was pre-empted, no roll-over, can be reset&lt;br /&gt;
}__attribute__ ((aligned (8)));&lt;br /&gt;
&lt;br /&gt;
/* A task's status is returned as below if queried */&lt;br /&gt;
enum TASK_STATUS {&lt;br /&gt;
    TASK_DISABLED,      // cannot be scheduled, and no current jobs&lt;br /&gt;
    TASK_ENABLED,       // can be scheduled, but no current jobs&lt;br /&gt;
    TASK_INVALID,       // task does not exist&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_task_create()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''tasks.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Create a task.&lt;br /&gt;
Can only be use before OCEOS starts. Stores the task information in the OCEOS fixed data area.&lt;br /&gt;
This directive populates the data structures for a task. It should be called after [[OCEOSmp/directive_reference#oceos_init()|oceos_init()]] and before [[OCEOSmp/directive_reference#oceos_init_finish()|oceos_init_finish()]].&amp;lt;br&amp;gt;&lt;br /&gt;
It must be called for each task otherwise [[OCEOSmp/directive_reference#oceos_start()|oceos_start()]] will return an error.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Create a task using a task descriptor structure&lt;br /&gt;
 *&lt;br /&gt;
 * Can only be used in Initialisation Phase.&lt;br /&gt;
 *&lt;br /&gt;
 * A task has twelve constant parameters set when the task is created.&lt;br /&gt;
 * Rather than setting a list of these parameters the named fields of a&lt;br /&gt;
 * task_descriptor structure are set and a pointer to it passed here.&lt;br /&gt;
 *&lt;br /&gt;
 * The task_descriptor structure fields are described above.&lt;br /&gt;
 * Once the task has been created the structure can be discarded.&lt;br /&gt;
 *&lt;br /&gt;
 * To create a task:&lt;br /&gt;
 *		set up a task_descriptor structure,&lt;br /&gt;
 *		set its fields to the parameter values for the task,&lt;br /&gt;
 *		pass a pointer to the structure to this directive.&lt;br /&gt;
 *&lt;br /&gt;
 * The structure is checked for validity by oceos_task_create and its&lt;br /&gt;
 * information used to set the task details in the OCEOS fixed data area.&lt;br /&gt;
 *&lt;br /&gt;
 * @param  struct task_descriptor *	fields give task characteristics&lt;br /&gt;
 *&lt;br /&gt;
 * @return OCEOS_SUCCESS            No errors or warnings&lt;br /&gt;
 *         WARN_NO_END_FUNCTION     Warning, no end task function specified&lt;br /&gt;
 *&lt;br /&gt;
 *         ERR_SYS_FIXED_CORRUPT    System Fixed area corrupt&lt;br /&gt;
 *         ERR_WRONG_CPU_CORE       Executing directive on wrong CPU&lt;br /&gt;
 *         ERR_WRONG_PHASE          Called before oceos_init() is done&lt;br /&gt;
 *         ERR_TOO_MANY             MAX number of tasks already created&lt;br /&gt;
 *         ERR_ID_INVALID           Task ID outside allowed range 0 to 254&lt;br /&gt;
 *         ERR_ID_WRONG             Task ID outside &amp;gt;= number of tasks&lt;br /&gt;
 *         ERR_T_ALREADY_ALLOCATED  Task ID already in use&lt;br /&gt;
 *         ERR_T_PRIORITY_INVALID   Task priority outside allowed range 1 to 254&lt;br /&gt;
 *         ERR_THRESHOLD_INVALID    Task threshold outside range 1 to 254&lt;br /&gt;
 *         ERR_THRESHOLD_WRONG      Task threshold  higher priority than task priority&lt;br /&gt;
 *         ERR_JOBS_MAX_INVALID     Job number outside range 1 to 15&lt;br /&gt;
 *         ERR_JOBS_TOO_MANY        System capacity exceeded&lt;br /&gt;
 *         ERR_AFFINITY_WRONG       CPU core specified is outside chosen range&lt;br /&gt;
 *         ERR_START_FUNCTION_BAD   Task start function address either NULL or misaligned&lt;br /&gt;
 */&lt;br /&gt;
S32_t   oceos_task_create(&lt;br /&gt;
    const struct task_descriptor * const task_description_ptr&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter           || Description&lt;br /&gt;
|-&lt;br /&gt;
|struct task_descriptor * || Pointer to task descriptor which contains task attributes&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit     || Description&lt;br /&gt;
|-&lt;br /&gt;
|WARN_NO_END_FUNCTION     || Warning, no end task function specified&lt;br /&gt;
|-&lt;br /&gt;
|ERR_SYS_FIXED_CORRUPT    || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
|ERR_WRONG_CPU_CORE       || Executing directive on wrong CPU&lt;br /&gt;
|-&lt;br /&gt;
|ERR_WRONG_PHASE          || Called before oceos_init() is done&lt;br /&gt;
|-&lt;br /&gt;
|ERR_TOO_MANY             || MAX number of tasks already created&lt;br /&gt;
|-&lt;br /&gt;
|ERR_ID_INVALID           || Task ID outside allowed range 0 to 254&lt;br /&gt;
|-&lt;br /&gt;
|ERR_ID_WRONG             || Task ID outside &amp;gt;= number of tasks&lt;br /&gt;
|-&lt;br /&gt;
|ERR_T_ALREADY_ALLOCATED  || Task ID already in use&lt;br /&gt;
|-&lt;br /&gt;
|ERR_T_PRIORITY_INVALID   || Task priority outside allowed range 1 to 254&lt;br /&gt;
|-&lt;br /&gt;
|ERR_THRESHOLD_INVALID    || Task threshold outside range 1 to 254&lt;br /&gt;
|-&lt;br /&gt;
|ERR_THRESHOLD_WRONG      || Task threshold  higher priority than task priority&lt;br /&gt;
|-&lt;br /&gt;
|ERR_JOBS_MAX_INVALID     || Job number outside range 1 to 15&lt;br /&gt;
|-&lt;br /&gt;
|ERR_JOBS_TOO_MANY        || System capacity exceeded&lt;br /&gt;
|-&lt;br /&gt;
|ERR_AFFINITY_WRONG       || CPU core specified is outside chosen range&lt;br /&gt;
|-&lt;br /&gt;
|ERR_START_FUNCTION_BAD   || Task start function address either NULL or misaligned&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
/* Sample Task names - all here start with t_ to help avoid name confusion */&lt;br /&gt;
enum TASK_NAME{&lt;br /&gt;
      t_0,&lt;br /&gt;
      t_1,&lt;br /&gt;
      t_2&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
/*&lt;br /&gt;
 * APPLICATION FUNCTION DECLARATIONS&lt;br /&gt;
 */&lt;br /&gt;
void fun0(void *);&lt;br /&gt;
void fun1(void *);&lt;br /&gt;
void fun2(void *);&lt;br /&gt;
void end_function(void *);&lt;br /&gt;
&lt;br /&gt;
const struct task_descriptor tasks_data[NUMBER_OF_TASKS] = {&lt;br /&gt;
    {fun0, end_function, t_0, 2, 10, 8, TASK_ENABLED, 0, 0, 0, 0},&lt;br /&gt;
    {fun1, end_function, t_1, 2, 10, 8, TASK_ENABLED, 0, 0, 0, 0},&lt;br /&gt;
    {fun2, end_function, t_2, 2, 10, 8, TASK_ENABLED, 0, 0, 0, 0}&lt;br /&gt;
}; &lt;br /&gt;
&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
    // create tasks (names are defined in the application header)&lt;br /&gt;
    for (i=0; i&amp;lt;NUMBER_OF_TASKS; i++){&lt;br /&gt;
        if ( oceos_task_create(&amp;amp;tasks_data[i]) != OCEOS_SUCCESS ){&lt;br /&gt;
        	oceosmp_print(&amp;quot;\nFailed to create task\n\r&amp;quot;);&lt;br /&gt;
        	return -i;&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_task_start()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''tasks.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function starts an instance of a task. An instance of a task is called a job in OCEOS terminology.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 *  Starting a task involves three main stages&lt;br /&gt;
 *      1 setting up a job&lt;br /&gt;
 *          finding a free job entry if available&lt;br /&gt;
 *          setting up this entry including passing it the data void *&lt;br /&gt;
 *&lt;br /&gt;
 *      2 placing the job on readyQ&lt;br /&gt;
 *&lt;br /&gt;
 *      3 doing a context switch&lt;br /&gt;
 * This function should only be called after OCEOS is initialised&lt;br /&gt;
 *       and the dynamic task and job structures set up&lt;br /&gt;
 *&lt;br /&gt;
 *  When used from an interrupt handler,&lt;br /&gt;
 *  the context switch is only done&lt;br /&gt;
 *  after all nested interrupts have unwound&lt;br /&gt;
 *&lt;br /&gt;
 * @param task_id Task ID must be in range 0 to 254&lt;br /&gt;
 * @param ptr     Pointer to task data&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT    System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT      System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE          Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID           Task ID is invalid&lt;br /&gt;
 *          ERR_ID_WRONG             Task ID is wrong&lt;br /&gt;
 *          ERR_START_TASK_DISABLED  Starting task is disabled&lt;br /&gt;
 *          ERR_TOO_MANY             There is no free job&lt;br /&gt;
 *          ERR_SYS_BUSY             Failed to grab the lock&lt;br /&gt;
 */&lt;br /&gt;
S32_t   oceos_task_start(&lt;br /&gt;
    const U32_t task_id, // task ID, must be in range 0 to 254&lt;br /&gt;
    void * const ptr    // pointer to data&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| task_id || U32_t with Task ID in range 0 to 254.&lt;br /&gt;
|-&lt;br /&gt;
| ptr    || void * pointer to task data&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit  || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT    || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT      || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE          || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID           || Task ID is invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG             || Task ID is wrong&lt;br /&gt;
|-&lt;br /&gt;
| ERR_START_TASK_DISABLED  || Starting task is disabled&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TOO_MANY             || There is no free job&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY             || Failed to grab the lock&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
void *ptr;&lt;br /&gt;
...&lt;br /&gt;
// Start instance of task T_1 passing pointer ptr&lt;br /&gt;
status = oceos_task_start(t_1,ptr);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_task_timed_start()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''tasks.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function schedules a task to start execution at a given system time.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 *  Schedule a task to start execution at a given system time&lt;br /&gt;
 *&lt;br /&gt;
 *  The before and after offsets define a window around the selected time&lt;br /&gt;
 *  in which the task may be started.&lt;br /&gt;
 *&lt;br /&gt;
 *  If the current system time is before the start window a job is created&lt;br /&gt;
 *  and a corresponding action put on the timed action queue.&lt;br /&gt;
 *&lt;br /&gt;
 *  If the current system time is within the time window for starting the task,&lt;br /&gt;
 *  it is started immediately.&lt;br /&gt;
 *&lt;br /&gt;
 *  If the current system time is after the window, an error is reported.&lt;br /&gt;
 *&lt;br /&gt;
 *  Times are in microseconds.&lt;br /&gt;
 *&lt;br /&gt;
 *  This function should only be called after OCEOS is initialised&lt;br /&gt;
 *  and the dynamic task and job structures set up&lt;br /&gt;
 *&lt;br /&gt;
 * @param taskID        Task ID must be in range 0 to 254&lt;br /&gt;
 * @param ptr           Pointer to data&lt;br /&gt;
 * @param start_time    System time at which job should start&lt;br /&gt;
 * @param before        Forward tolerance for time&lt;br /&gt;
 * @param after         Backward tolerance for time&lt;br /&gt;
 * @param return_job_id Return job_id to the user, to remove this job from timed action if needed&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              Task ID invalid&lt;br /&gt;
 *          ERR_ID_WRONG                Task ID is wrong&lt;br /&gt;
 *          ERR_TA_NOT_INIT             Timed action inialisation is not done and tried to be used&lt;br /&gt;
 *          ERR_START_TASK_DISABLED     Starting task is disabled&lt;br /&gt;
 *          ERR_TOO_MANY                There is no free job&lt;br /&gt;
 *          ERR_TOO_LATE                Starting task is too late(out of time frame)&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to grab the lock&lt;br /&gt;
 *          ERR_TA_Q_FULL               Timed action queue is full&lt;br /&gt;
 *          ERR_TA_START_FAILED         Timed action execute failed; See log&lt;br /&gt;
 */&lt;br /&gt;
S32_t   oceos_task_timed_start(&lt;br /&gt;
    const U32_t task_id,     // task ID, must be in range 0 to 254&lt;br /&gt;
    void * const ptr,        // pointer to data&lt;br /&gt;
    const U64_t start_time,  // system time at which job should start&lt;br /&gt;
    const U32_t before,      // forward tolerance for time&lt;br /&gt;
    const U32_t after,       // backward tolerance for time&lt;br /&gt;
    U32_t * return_job_id    // return job_id to the user, to remove this job from timed action if needed&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| taskID        || U32_t task ID must be in range 0 to 254&lt;br /&gt;
|-&lt;br /&gt;
| ptr           || void * pointer to data&lt;br /&gt;
|-&lt;br /&gt;
| start_time    || U64_t system time at which job should start&lt;br /&gt;
|-&lt;br /&gt;
| before        || U32_t forward tolerance for time&lt;br /&gt;
|-&lt;br /&gt;
| after         || U32_t backward tolerance for time&lt;br /&gt;
|-&lt;br /&gt;
| return_job_id || U32_t return job_id to the user, to remove this job from timed action if needed&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit  || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || Task ID invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || Task ID is wrong&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_NOT_INIT             || Timed action inialisation is not done and tried to be used&lt;br /&gt;
|-&lt;br /&gt;
| ERR_START_TASK_DISABLED     || Starting task is disabled&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TOO_MANY                || There is no free job&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TOO_LATE                || Starting task is too late(out of time frame)&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to grab the lock&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_Q_FULL               || Timed action queue is full&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_START_FAILED         || Timed action execute failed; See log&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
U32_t job_id;&lt;br /&gt;
U64_t cur_sys_time;&lt;br /&gt;
...&lt;br /&gt;
  cur_sys_time = oceos_time_sys_get64();&lt;br /&gt;
&lt;br /&gt;
  // Start task 10,000 microseconds (us) from now and advise if started more than 1,000 us before or 2,000 us after.&lt;br /&gt;
  status = oceos_task_timed_start(t_2, ptr, cur_sys_time + 10000, 1000, 2000, &amp;amp;job_id);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_task_disable()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''initialisation.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function disables a task and removes any current pending jobs from the readyQ.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 *  Disable a task and remove any current pending jobs on readyQ.&lt;br /&gt;
 *&lt;br /&gt;
 *  A disabled task's jobs  will not be put into execution nor put on readyQ.&lt;br /&gt;
 *&lt;br /&gt;
 *  Note that where execution of a task has already commenced,&lt;br /&gt;
 *  disabling the task will not prevent it from completing.&lt;br /&gt;
 *&lt;br /&gt;
 *  This function should only be called after OCEOS is initialised&lt;br /&gt;
 *  and the dynamic task and job structures set up&lt;br /&gt;
 *&lt;br /&gt;
 * @param taskID  Task ID must be in range 0 to 254&lt;br /&gt;
 * @return: OCEOS_SUCCESS&lt;br /&gt;
 *          WARN_ALREADY_DISABLED        Task already disabled&lt;br /&gt;
 *          WARN_SEM_PEND_REMOVE_FAILED  Failed to remove job from semaphore pending queue&lt;br /&gt;
 *          WARN_DQ_PEND_REMOVE_FAILED   Failed to remove job from dataq pending queue&lt;br /&gt;
 *&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT        System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT          System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE              Directive was called before OCEOS init is finished&lt;br /&gt;
 *          ERR_ID_INVALID               Task ID is invalid&lt;br /&gt;
 *          ERR_ID_WRONG                 Task ID is wrong&lt;br /&gt;
 *          ERR_SYS_BUSY                 Failed to grab the lock&lt;br /&gt;
 */&lt;br /&gt;
S32_t   oceos_task_disable(&lt;br /&gt;
    const U32_t task_id // task ID, must be in range 0 to 254&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| taskID || U32_t task ID must be in range 0 to 254&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit  || Description&lt;br /&gt;
|-&lt;br /&gt;
| WARN_ALREADY_DISABLED        || Task already disabled&lt;br /&gt;
|-&lt;br /&gt;
| WARN_SEM_PEND_REMOVE_FAILED  || Failed to remove job from semaphore pending queue&lt;br /&gt;
|-&lt;br /&gt;
| WARN_DQ_PEND_REMOVE_FAILED   || Failed to remove job from dataq pending queue&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT        || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT          || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE              || Directive was called before OCEOS init is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID               || Task ID is invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                 || Task ID is wrong&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                 || Failed to grab the lock&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Disable task t_1&lt;br /&gt;
status = oceos_task_disable(t_1);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_task_enable()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''tasks.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function enables a task. Only enabled tasks may be started.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 *  Enable a task - only enabled tasks are placed on readyQ or started.&lt;br /&gt;
 *&lt;br /&gt;
 *  This function should only be called after OCEOS is initialised&lt;br /&gt;
 *  and the dynamic task and job structures set up&lt;br /&gt;
 *&lt;br /&gt;
 * @param taskID   Task ID must be in range 0 to 254&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          WARN_ALREADY_ENABLED     Task already enabled&lt;br /&gt;
 *&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT    System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT      System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE          Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID           Task ID is invalid&lt;br /&gt;
 *          ERR_ID_WRONG             Task ID is wrong&lt;br /&gt;
 *          ERR_SYS_BUSY             Failed to grab the lock&lt;br /&gt;
 */&lt;br /&gt;
S32_t   oceos_task_enable(&lt;br /&gt;
    const U32_t task_id // task ID, must be in range 0 to 254&lt;br /&gt;
);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| taskID  || U32_t task ID must be in range 0 to 254&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit  || Description&lt;br /&gt;
|-&lt;br /&gt;
| WARN_ALREADY_ENABLED     || Task already enabled&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT    || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT      || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE          || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID           || Task ID is invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG             || Task ID is wrong&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY             || Failed to grab the lock&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Enable task t_2&lt;br /&gt;
status = oceos_task_enable(t_2);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_task_self()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''tasks.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the task number of the currently running task on the calling CPU.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Get currently running task on calling CPU&lt;br /&gt;
 *&lt;br /&gt;
 * @param t_id  Task ID holder&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT        System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT          System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE              Directive was called before OCEOS init is finished&lt;br /&gt;
 *          ERR_CPU_DYN_PTR_BAD          CPU dynamic area pointer corrupt&lt;br /&gt;
 */&lt;br /&gt;
S32_t  oceos_task_self(&lt;br /&gt;
    U32_t *t_id&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| t_id || S32_t * pointer to variable where task ID will be written.&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit  || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT        || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT          || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE              || Directive was called before OCEOS init is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_CPU_DYN_PTR_BAD          || CPU dynamic area pointer corrupt&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, task_running;&lt;br /&gt;
...&lt;br /&gt;
// Return task ID that's running on this core&lt;br /&gt;
status = oceos_task_self(&amp;amp;task_running);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_task_get_priority()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''tasks.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the priority of the task ID passed to it.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Get priority of the task&lt;br /&gt;
 *&lt;br /&gt;
 * @param taskID        ID of task, must be in range 0 to 254&lt;br /&gt;
 * @param t_priority    Pointer to task priority holder&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT        System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT          System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE              Directive was called before OCEOS init is finished&lt;br /&gt;
 *          ERR_ID_INVALID               Task ID is invalid&lt;br /&gt;
 *          ERR_ID_WRONG                 Task ID is wrong&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_task_get_priority(&lt;br /&gt;
    const U32_t task_id, // task ID, must be in range 0 to 254&lt;br /&gt;
    U32_t *t_priority   // Pointer to task priority holder&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| task_id || S32_t task ID of task whose priority is required&lt;br /&gt;
|-&lt;br /&gt;
| t_priority || S32_t * pointer to variable where priority will be written&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit  || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT        || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT          || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE              || Directive was called before OCEOS init is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID               || Task ID is invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                 || Task ID is wrong&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
U32_t t_priority;&lt;br /&gt;
...&lt;br /&gt;
// Return the priority of task ID t_4 &lt;br /&gt;
status = oceos_task_get_priority(t_4, &amp;amp;t_priority);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_task_get_status()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''tasks.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the status of the task ID passed to it.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Get status of the task;&lt;br /&gt;
 * if OK t_status holds enum TASK_STATUS&lt;br /&gt;
 *&lt;br /&gt;
 * @param taskID    ID of task, must be in range 0 to 254&lt;br /&gt;
 * @param t_status  enum TASK_STATUS holder&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT        System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT          System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE              Directive was called before OCEOS init is finished&lt;br /&gt;
 *          ERR_ID_INVALID               Task ID is invalid&lt;br /&gt;
 *          ERR_ID_WRONG                 Task ID is wrong&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_task_get_status(&lt;br /&gt;
    const U32_t task_id,&lt;br /&gt;
    U32_t *t_status&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| task_id || S32_t task ID of task whose priority is required&lt;br /&gt;
|-&lt;br /&gt;
| t_status || S32_t * pointer to variable where status will be written&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit  || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT        || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT          || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE              || Directive was called before OCEOS init is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID               || Task ID is invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                 || Task ID is wrong&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
U32_t t_status;&lt;br /&gt;
...&lt;br /&gt;
// Return the status of task ID t_4 &lt;br /&gt;
status = oceos_task_get_status(t_4, &amp;amp;t_status);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_task_get_info()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''tasks.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the task information for the specified task.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Get task information for task with ID.&lt;br /&gt;
 *&lt;br /&gt;
 * User must pass pointer to struct task_info in order to retrieve data.&lt;br /&gt;
 *&lt;br /&gt;
 * @param task_id  Task ID&lt;br /&gt;
 * @param info     Pointer to struct task_info&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT    System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT      System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE          Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID           Task ID invalid&lt;br /&gt;
 *          ERR_ID_WRONG             Task ID wrong&lt;br /&gt;
 *          ERR_TASK_INFO_PTR_BAD    Task info pointer provided by user is NULL&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_task_get_info (&lt;br /&gt;
    const U32_t task_id,   // Task ID&lt;br /&gt;
    struct task_info *info // Pointer to struct task_info&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| task_id || ID of task for which information is required&lt;br /&gt;
|-&lt;br /&gt;
| task_info || struct task_info * pointer to the structure where task information is to be written&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit  || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT    || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT      || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE          || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID           || Task ID invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG             || Task ID wrong&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TASK_INFO_PTR_BAD    || Task info pointer provided by user is NULL&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
struct task_info info;&lt;br /&gt;
...&lt;br /&gt;
// Get information for task T3&lt;br /&gt;
status = oceos_task_get_info(t_3, &amp;amp;info);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceosmp_task_kill()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''tasks.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function kills the specified task running on the specified CPU.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 *  Function to kill currently running task on CPU;&lt;br /&gt;
 *  Can be used:&lt;br /&gt;
 *      From Mode_SVC  =&amp;gt; normal running mode for application&lt;br /&gt;
 *          If nesting level is zero and Mode_SVC&lt;br /&gt;
 *      From Mode_IRQ  =&amp;gt; from IRQ handler&lt;br /&gt;
 *          If nesting level is not zero, set flag to call this function within IRQ handler&lt;br /&gt;
 *      From Exception =&amp;gt; Mode_ABT and Mode_UND&lt;br /&gt;
 *          If nesting level is zero and NOT Mode_SVC, it is exception;&lt;br /&gt;
 *              Disable IRQs on current CPU;&lt;br /&gt;
 *              Set kill current task flag to TRUE;&lt;br /&gt;
 *              Issue SGI on current CPU, will be interrupted on return from Exception and&lt;br /&gt;
 *              this function will be called within IRQ handler&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT    System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT      System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE          Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_CPU_DYN_PTR_BAD      CPU dynamic area pointer corrupt&lt;br /&gt;
 *          ERR_ID_INVALID           Task ID invalid&lt;br /&gt;
 *          ERR_ID_WRONG             Task ID wrong&lt;br /&gt;
 *          ERR_CPU_ID_WRONG         CPU ID wrong&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceosmp_task_kill(&lt;br /&gt;
    U32_t task_id,&lt;br /&gt;
    U32_t cpu_id&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| task_id  || U32_t task ID to be killed (must be in range 0 to 254)&lt;br /&gt;
|-&lt;br /&gt;
| cpu_id  || U32_t CPU ID where task_id is to be killed&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT    || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT      || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE          || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_CPU_DYN_PTR_BAD      || CPU dynamic area pointer corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID           || Task ID invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG             || Task ID wrong&lt;br /&gt;
|-&lt;br /&gt;
| ERR_CPU_ID_WRONG         || CPU ID wrong&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Kill task t_2 on CPU cpu_1&lt;br /&gt;
status = oceosmp_task_kill(t_2, cpu_1);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;Mutex directives&amp;lt;/span&amp;gt;==&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_mutex_create()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''mutex.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function creates a mutex of specified ID with a specified priority ceiling.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Creates a mutex with priority ceiling&lt;br /&gt;
 *&lt;br /&gt;
 * NOTE: This function should only be called after OCEOSmp is initialised with&lt;br /&gt;
 *  oceos_init() and before initialisation ends with oceos_init_finish()&lt;br /&gt;
 *  and scheduling starts with oceos_start()&lt;br /&gt;
 *&lt;br /&gt;
 * @param mutex_id  mutex ID value 0 to 62&lt;br /&gt;
 * @param priority  mutex priority ceiling 1 to 254 (high to low task priority)&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_WRONG_CPU_CORE          Executing directive on wrong CPU&lt;br /&gt;
 *          ERR_WRONG_PHASE             Called before oceos_init() is done&lt;br /&gt;
 *          ERR_TOO_MANY                MAX number of MUTEXs already created&lt;br /&gt;
 *          ERR_ID_INVALID              MUTEX ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                MUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
 *          ERR_MX_ALREADY_ALLOCATED    MUTEX ID already used&lt;br /&gt;
 *          ERR_MX_PRIORITY_WRONG       MUTEX priority ceiling outside allowed range 1 to 254&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_mutex_create(&lt;br /&gt;
    const U32_t mutex_id,  // mutex ID, must be in range 0 to 62&lt;br /&gt;
    const U8_t  priority  // mutex priority ceiling&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| mutex_id  || u32_t mutex ID to be created (value 0 to 62).&lt;br /&gt;
|-&lt;br /&gt;
| priority_ceiling ||  U32_t mutex priority ceiling 1 to 254 (high to low task priority)&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_CPU_CORE          || Executing directive on wrong CPU&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Called before oceos_init() is done&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TOO_MANY                || MAX number of MUTEXs already created&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || MUTEX ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || MUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_MX_ALREADY_ALLOCATED    || MUTEX ID already used&lt;br /&gt;
|-&lt;br /&gt;
| ERR_MX_PRIORITY_WRONG       || MUTEX priority ceiling outside allowed range 1 to 254&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Create mutex with ID print_mutex and priority ceiling of 5&lt;br /&gt;
status = oceos_mutex_create(print_mutex, 5);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_mutex_wait()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''mutex.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function makes the task wait until the specified mutex is available.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
 /*&lt;br /&gt;
  * Wait on mutex with ID.&lt;br /&gt;
  * If task succeeds in grabbing mutex, system level priority rises to&lt;br /&gt;
  * priority of this mutex, so tasks with lower or equal priority will&lt;br /&gt;
  * not be able to start till mutex is released.&lt;br /&gt;
  *&lt;br /&gt;
  * This should only be called after OCEOSmp scheduling has started.&lt;br /&gt;
  *&lt;br /&gt;
  * @param mutex_id     const U32_t  : value 0 to 62&lt;br /&gt;
  *&lt;br /&gt;
  * @return  OCEOS_SUCCESS&lt;br /&gt;
  *          WARN_MX_INCORRECT_ORDER     MUTEX acquired in incorrect order&lt;br /&gt;
  *&lt;br /&gt;
  *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
  *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
  *          ERR_WRONG_PHASE             Directive was called before OCEOSmp initialisation is finished&lt;br /&gt;
  *          ERR_ID_INVALID              MUTEX ID outside allowed range 0 to 62&lt;br /&gt;
  *           ERR_ID_WRONG                MUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
  *          ERR_MX_CEILING_BAD          MUTEX ceiling not lower priority than job priority&lt;br /&gt;
  *          ERR_MX_ALREADY_HELD         MUTEX already held by this job&lt;br /&gt;
  *          ERR_SYS_BUSY                Failed to grab context switch guard&lt;br /&gt;
  */&lt;br /&gt;
S32_t oceos_mutex_wait(&lt;br /&gt;
    const U32_t  mutex_id      // mutex ID, must be in range 0 to 62&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| mutex_id  || u32_t mutex ID to be waited on (value 0 to 62).&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| WARN_MX_INCORRECT_ORDER     || MUTEX acquired in incorrect order&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOSmp initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || MUTEX ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || MUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_MX_CEILING_BAD          || MUTEX ceiling not lower priority than job priority&lt;br /&gt;
|-&lt;br /&gt;
| ERR_MX_ALREADY_HELD         || MUTEX already held by this job&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to grab context switch guard&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Wait on mutex m_2&lt;br /&gt;
status = oceos_mutex_wait(m_2);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_mutex_signal()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''mutex.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function signals the specified mutex.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Signal a mutex with ID&lt;br /&gt;
 *&lt;br /&gt;
 * N.B. :&lt;br /&gt;
 *      This function should not be called from an interrupt handler&lt;br /&gt;
 *      This should only be called after OCEOSmp scheduling has started.&lt;br /&gt;
 *&lt;br /&gt;
 * @param mutex_id     const U32_t  : value 0 to 62&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          WARN_MX_ALREADY_FREE        MUTEX is free already&lt;br /&gt;
 *          WARN_MX_NESTING_BAD         MUTEX nesting incorrect&lt;br /&gt;
 *&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOSmp initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              MUTEX ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                MUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
 *          ERR_MX_WRONG_JOB            MUTEX not held by this job&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to grab context switch guard&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_mutex_signal(&lt;br /&gt;
    const U32_t  mutex_id     // mutex ID, must be in range 0 to 62&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| mutex_id  || u32_t mutex ID to be signalled (value 0 to 62).&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| WARN_MX_ALREADY_FREE        || MUTEX is free already&lt;br /&gt;
|-&lt;br /&gt;
| WARN_MX_NESTING_BAD         || MUTEX nesting incorrect&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOSmp initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || MUTEX ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || MUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_MX_WRONG_JOB            || MUTEX not held by this job&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to grab context switch guard&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Signal mutex m_2&lt;br /&gt;
status = oceos_mutex_signal(m_2);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_mutex_get_value()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''mutex.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the value of the specified mutex.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Get current value of mutex with ID&lt;br /&gt;
 *&lt;br /&gt;
 * @param mutex_id      const U32_t  : value 0 to 62&lt;br /&gt;
 * @param m_value       pointer to MUTEX value holder&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOSmp initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              MUTEX ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                MUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
 *          ERR_MX_DATA_PTR_BAD         Pointer to MUTEX value return holder is null&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_mutex_get_value(&lt;br /&gt;
    const U32_t  mutex_id,      // mutex ID, must be in range 0 to 62&lt;br /&gt;
    U32_t *m_value              // Pointer to MUTEX value holder&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| mutex_id  || u32_t mutex ID to be signalled (value 0 to 62)&lt;br /&gt;
|-&lt;br /&gt;
| m_value  || u32_t * pointer where mutex value is to be written&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOSmp initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || MUTEX ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || MUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_MX_DATA_PTR_BAD         || Pointer to MUTEX value return holder is null&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
U32_t value;&lt;br /&gt;
...&lt;br /&gt;
// Get value of mutex m_2&lt;br /&gt;
status = oceos_mutex_get_value(m_2, &amp;amp;value);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;Read/write mutex directives&amp;lt;/span&amp;gt;==&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;Read/write mutex overview&amp;lt;/span&amp;gt;===&lt;br /&gt;
&lt;br /&gt;
Contents:&lt;br /&gt;
&lt;br /&gt;
 1.  Read/Write Mutex features&lt;br /&gt;
 2.  Read/Write Mutex data structures&lt;br /&gt;
 3.  Read/Write Mutex constants&lt;br /&gt;
 4.  Read/Write Mutex manager Directives&lt;br /&gt;
&lt;br /&gt;
==== Read/Write Mutex Features ====&lt;br /&gt;
&lt;br /&gt;
Read/Write Mutexes (rwmutexes) can be held for 'read' at the same time&lt;br /&gt;
by multiple jobs on different CPUs, but once held for 'write' by any job&lt;br /&gt;
cannot be obtained for 'read' or for 'write' by another job until released.&lt;br /&gt;
&lt;br /&gt;
They can be used to allow data be read simultaneously by multiple jobs when&lt;br /&gt;
the data is not being updated while ensuring that no updating can take&lt;br /&gt;
place while any job is reading the data.&lt;br /&gt;
&lt;br /&gt;
Pending write requests take precedence over pending read requests and are&lt;br /&gt;
done on a first come, first served basis. Once any job on a CPU has a&lt;br /&gt;
rwmutex for 'read' no other job on that CPU can acquire it so as to avoid&lt;br /&gt;
potential problems and minimise delays in servicing write requests by other&lt;br /&gt;
CPUs.&lt;br /&gt;
&lt;br /&gt;
While any job holds a rwmutex for reading any job on another CPU can also&lt;br /&gt;
acquire it for reading. Other jobs on the same CPU that may attempt to&lt;br /&gt;
acquire the rwmutex are delayed in starting until return of the rwmutex.&lt;br /&gt;
No job can acquire the rwmutex for writing until all read acquisitions&lt;br /&gt;
have been returned.&lt;br /&gt;
&lt;br /&gt;
No job will acquire a rwmutex for reading if any job is trying to acquire&lt;br /&gt;
it for writing, giving write precedence over read. Multiple write requests&lt;br /&gt;
waiting for existing read acquisitions to complete are serviced in the&lt;br /&gt;
order in which they were made when the current read acquisitions complete.&lt;br /&gt;
&lt;br /&gt;
If a task waits on a rwmutex that it already holds a system log entry is&lt;br /&gt;
made (LOG_RWMUTEX_ALREADY_HELD) and an INTERNAL_ERROR status code returned.&lt;br /&gt;
&lt;br /&gt;
If a task attempts to release a rwmutex it does not hold a system log entry&lt;br /&gt;
is made (LOG_RWMUTEX_ALREADY_FREE) and an INTERNAL_ERROR status code returned.&lt;br /&gt;
&lt;br /&gt;
If a job holds more than one rwmutex at the same time these must be&lt;br /&gt;
acquired and released in a nested manner&lt;br /&gt;
(e.g. wait 1, wait 2, wait 3, signal 3, signal 2, signal 1).&lt;br /&gt;
&lt;br /&gt;
If a task exits while holding one or more rwmutexes these are returned and&lt;br /&gt;
a system log entry made (LOG_RWMUTEX_NOT_RETURNED).&lt;br /&gt;
&lt;br /&gt;
==== Read/Write Mutex data structures ====&lt;br /&gt;
&lt;br /&gt;
In OCEOSmp each rwmutex has a priority ceiling, the priority of the highest&lt;br /&gt;
priority task that acquires the rwmutex for read or for write.&lt;br /&gt;
OCEOSmp uses this to ensure that once a job on a particular CPU has the&lt;br /&gt;
rwmutex for reading or for writing no other job on that CPU can be started&lt;br /&gt;
that might try to obtain that rwmutex.&lt;br /&gt;
&lt;br /&gt;
The priority ceiling of a rwmutex is specified when the rwmutex is created&lt;br /&gt;
and does not change subsequently. Priority ceilings are stored in the&lt;br /&gt;
fixed data area as an array U8_t rwmutexCeilings[] indexed by mutex ID.&lt;br /&gt;
This array is extended to be a whole number of 32-bit words.&lt;br /&gt;
&lt;br /&gt;
A rwmutex has a unique rwmutex ID, an unsigned integer usually defined in&lt;br /&gt;
the application header file as an enum RWMUTEX_NAME{} thus allowing a&lt;br /&gt;
user-friendly name be associated with each rwmutex ID.&lt;br /&gt;
&lt;br /&gt;
Using an enum is strongly recommended as it allows a user-friendly name be&lt;br /&gt;
associated with each ID, and helps ensure IDs are contiguous from 0.&lt;br /&gt;
&lt;br /&gt;
These rwmutex IDs are used as indices into both fixed and dynamic data&lt;br /&gt;
arrays and must cover the range 0 to ((number of rwmutexes) -1). Using&lt;br /&gt;
enum RWMUTEX_NAME{} automatically assigns names to IDs 0, 1, 2...&lt;br /&gt;
&lt;br /&gt;
Read write mutex dynamic data such as the current write requests and&lt;br /&gt;
current read count are stored in the dynamic data area in an array of&lt;br /&gt;
struct rwmutex_dyn_block also indexed by the rwmutex ID.&lt;br /&gt;
&lt;br /&gt;
A further dynamic area array of guard_t is used in providing mutual&lt;br /&gt;
exclusion when updating the rwmutex dynamic data.&lt;br /&gt;
&lt;br /&gt;
==== Read/Write Mutex constants ====&lt;br /&gt;
&lt;br /&gt;
In OCEOSmp there can be a maximum of 63 rwmutexes,&lt;br /&gt;
with IDs from 0 to 62 (the value 63 is used as an invalid ID).&lt;br /&gt;
&lt;br /&gt;
The rwmutexes can be created in any order, but OCEOSmp will return an error&lt;br /&gt;
and fail to start if the resulting IDs fail to be contiguous from 0 as IDs&lt;br /&gt;
are used by OCEOS as indices into arrays.&lt;br /&gt;
&lt;br /&gt;
Each rwmutex has a priority ceiling, the priority of the highest priority&lt;br /&gt;
task that uses the rwmutex for reading or for writing. This is specified&lt;br /&gt;
when the rwmutex is created, does not change subsequently, and must be in&lt;br /&gt;
the range 1 (TASK_MAX_PRIORITY) to 254 (TASK_MIN_PRIORITY).&lt;br /&gt;
The application developer must ensure that the correct rwmutex ceiling&lt;br /&gt;
is used. OCEOSmp will detect an attempt to acquire a rwmutex by a task&lt;br /&gt;
with higher priority than that rwmutex's priority ceiling, make a&lt;br /&gt;
system log entry (LOG_RWMUTEX_BAD_CEILING) and return an INTERNAL_ERROR&lt;br /&gt;
status code.&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_rwmutex_create()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''rwmutex.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function ees a read/write mutex.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Creates a Read/Write Mutex (RWMUTEX)&lt;br /&gt;
 *&lt;br /&gt;
 * This function should only be called after OCEOSmp is initialised with&lt;br /&gt;
 * oceos_init() and before initialisation ends with oceos_init_finish()&lt;br /&gt;
 * and scheduling starts with oceos_start()&lt;br /&gt;
 *&lt;br /&gt;
 * @param rwm_id    Read/Write RWMUTEX ID, must be in range 0 to 62&lt;br /&gt;
 * @param priority  Priority ceiling of highest priority task that uses the RWMUTEX&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_WRONG_CPU_CORE          Executing directive on wrong CPU&lt;br /&gt;
 *          ERR_WRONG_PHASE             Called before oceos_init() is done&lt;br /&gt;
 *          ERR_TOO_MANY                MAX number of RWMUTEXs already created&lt;br /&gt;
 *          ERR_ID_INVALID              RWMUTEX ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                RWMUTEX ID &amp;gt;= number of RWMUTEXs&lt;br /&gt;
 *          ERR_RWMX_ALREADY_ALLOCATED  RWMUTEX ID already used&lt;br /&gt;
 *          ERR_RWMX_PRIORITY_WRONG     RWMUTEX priority ceiling outside allowed range 1 to 254&lt;br /&gt;
 */&lt;br /&gt;
S32_t   oceos_rwmutex_create(&lt;br /&gt;
    const U32_t rwm_id,   // RWMUTEX ID, must be in range 0 to max rwm&lt;br /&gt;
    const U8_t priority   // RWMUTEX priority ceiling&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| rwm_id || Read/Write RWMUTEX ID, must be in range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| priority || Priority ceiling of highest priority task that uses the RWMUTEX&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_CPU_CORE          || Executing directive on wrong CPU&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Called before oceos_init() is done&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TOO_MANY                || MAX number of RWMUTEXs already created&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || RWMUTEX ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || RWMUTEX ID &amp;gt;= number of RWMUTEXs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_RWMX_ALREADY_ALLOCATED  || RWMUTEX ID already used&lt;br /&gt;
|-&lt;br /&gt;
| ERR_RWMX_PRIORITY_WRONG     || RWMUTEX priority ceiling outside allowed range 1 to 254&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Create read/write mutex with ID rwm_2 and priority ceiling of 100 &lt;br /&gt;
status = oceos_rwmutex_create(rwm_1, 100);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_rwmutex_read_wait()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''rwmutex.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function acquires a read/write mutex for read. If successful, jobs on other CPUs can also acquire it for read, but no job will be able to acquire it for write while any read is under way. If job already holds RWMUTEX for read or for write the appropriate status code is returned, a system log entry made, and the job continues. It will not succeed while any job is waiting to obtain RWMUTEX for write, and will loop waiting for all pending writes on this RWMUTEX to complete.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Read wait on RWMUTEX.&lt;br /&gt;
 *&lt;br /&gt;
 * If successful jobs on other CPUs can also acquire it for read, but no job&lt;br /&gt;
 * will be able to acquire it for write while any read is under way.&lt;br /&gt;
 * If job already holds RWMUTEX for read or for write appropriate status code&lt;br /&gt;
 * is returned, a system log entry made, and the job continues.&lt;br /&gt;
 * Will not succeed while any job is waiting to obtain RWMUTEX for write,&lt;br /&gt;
 * will loop waiting for all pending writes on this RWMUTEX to complete.&lt;br /&gt;
 *&lt;br /&gt;
 * This should only be called after OCEOS scheduling has started.&lt;br /&gt;
 *&lt;br /&gt;
 * N.B.	The returned status code must be checked and appropriate action&lt;br /&gt;
 * 		taken.&lt;br /&gt;
 *&lt;br /&gt;
 * @param rwm_id    const U32_t  : value 0 to 62&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          WARN_RWMX_NOT_HIGHEST       Already holds a RWMUTEX higher in the RWMUTEX order&lt;br /&gt;
 *                                      (there then may be a risk of deadlock)&lt;br /&gt;
 *&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              RWMUTEX ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                RWMUTEX ID &amp;gt;= number of RWMUTEXs&lt;br /&gt;
 *          ERR_RWMX_CEILING_BAD        RWMUTEX ceiling not lower priority than job priority&lt;br /&gt;
 *          ERR_RWMX_ALREADY_HELD       RWMUTEX already held by this job&lt;br /&gt;
 *          ERR_RWMX_CPU_STACK_FULL     CPU priority ceiling stack full&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_rwmutex_read_wait(&lt;br /&gt;
    const U32_t rwm_id  // RWMUTEX ID, must be in range 0 to 62&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| rwm_id || U32_t rwmutex to be acquired for read (value 0 to 62)&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| WARN_RWMX_NOT_HIGHEST       || Already holds a RWMUTEX higher in the RWMUTEX order (deadlock risk)&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || RWMUTEX ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || RWMUTEX ID &amp;gt;= number of RWMUTEXs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_RWMX_CEILING_BAD        || RWMUTEX ceiling not lower priority than job priority&lt;br /&gt;
|-&lt;br /&gt;
| ERR_RWMX_ALREADY_HELD       || RWMUTEX already held by this job&lt;br /&gt;
|-&lt;br /&gt;
| ERR_RWMX_CPU_STACK_FULL     || CPU priority ceiling stack full&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Acquire read/write mutex rwm_1 for read&lt;br /&gt;
status = oceos_rwmutex_read_wait(rwm_1);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_rwmutex_write_wait()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''rwmutex.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function acquires the specified read/write mutex for write.&lt;br /&gt;
If successful, no other job can also obtain it for reading or for writing. Will not succeed while any other job has acquired RWMUTEX for write,&lt;br /&gt;
or any jobs have obtained RWMUTEX for read. Will then loop until the RWMUTEX is released and for its turn in the sequence of jobs that have tried to acquire the RWMUTEX for writing. If already holds the RWMUTEX for writing or reading an appropriate status code is returned, a system log entry made, and the job continues. While there are any outstanding attempts to obtain the RWMUTEX for write no job will be able to acquire it for reading.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Write wait on RWMUTEX.&lt;br /&gt;
 *&lt;br /&gt;
 * If successful no other job can also obtain it for reading or for writing.&lt;br /&gt;
 * Will not succeed while any other job has acquired RWMUTEX for write,&lt;br /&gt;
 * or any jobs have obtained RWMUTEX for read. Will then loop until the&lt;br /&gt;
 * RWMUTEX is released and for its turn in the sequence of jobs that have&lt;br /&gt;
 * tried to acquire the RWMUTEX for writing.&lt;br /&gt;
 * If already holds the RWMUTEX for writing or reading an appropriate status&lt;br /&gt;
 * code is returned, a system log entry made, and the job continues.&lt;br /&gt;
 * While there are any outstanding attempts to obtain the RWMUTEX for write&lt;br /&gt;
 * no job will be able to acquire it for reading.&lt;br /&gt;
 *&lt;br /&gt;
 * This should only be called after OCEOS scheduling has started.&lt;br /&gt;
 *&lt;br /&gt;
 * N.B.	The returned status code must be checked and appropriate action&lt;br /&gt;
 * 		taken.&lt;br /&gt;
 *&lt;br /&gt;
 * @param rwm_id     const U32_t  : value 0 to 62&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          WARN_RWMX_NOT_HIGHEST       Already holds a RWMUTEX higher in the RWMUTEX order&lt;br /&gt;
 *                                      (there then may be a risk of deadlock)&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              RWMUTEX ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                RWMUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
 *          ERR_RWMX_CEILING_BAD        RWMUTEX ceiling not lower priority than job priority&lt;br /&gt;
 *          ERR_RWMX_ALREADY_HELD       RWMUTEX already held by this job&lt;br /&gt;
 *          ERR_RWMX_CPU_STACK_FULL     CPU priority ceiling stack full&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_rwmutex_write_wait(&lt;br /&gt;
    const U32_t rwm_id  // RWMUTEX ID, must be in range 0 to 62&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| rwm_id || U32_t rwmutex to be acquired for write(value 0 to 62)&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| WARN_RWMX_NOT_HIGHEST       || Already holds a RWMUTEX higher in the RWMUTEX order (deadlock risk)&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || RWMUTEX ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || RWMUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_RWMX_CEILING_BAD        || RWMUTEX ceiling not lower priority than job priority&lt;br /&gt;
|-&lt;br /&gt;
| ERR_RWMX_ALREADY_HELD       || RWMUTEX already held by this job&lt;br /&gt;
|-&lt;br /&gt;
| ERR_RWMX_CPU_STACK_FULL     || CPU priority ceiling stack full&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Acquire read/write mutex rwm_1 for write&lt;br /&gt;
status = oceos_rwmutex_read_wait(rwm_1);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_rwmutex_signal()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''rwmutex.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function signals the specified read/write mutex.&lt;br /&gt;
It frees the RWMUTEX for use by other jobs, irrespective of whether the RWMUTEX is held for reading or for writing. If the RWMUTEX is not held by the job then it returns an appropriate status code. It does not take into account how many times a job has obtained the RWMUTEX for read or for write.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Signal a RWMUTEX&lt;br /&gt;
 *&lt;br /&gt;
 * Frees the RWMUTEX for use by other jobs, irrespective of whether&lt;br /&gt;
 * RWMUTEX is held for reading or for writing.&lt;br /&gt;
 * if the RWMUTEX is not held by the job returns an appropriate status code.&lt;br /&gt;
 * Does not take into account how many times a job has obtained the RWMUTEX&lt;br /&gt;
 * for read or for write.&lt;br /&gt;
 *&lt;br /&gt;
 * This should only be called after OCEOS scheduling has started.&lt;br /&gt;
 *&lt;br /&gt;
 * N.B. The returned status code must be checked and appropriate action taken.&lt;br /&gt;
 *&lt;br /&gt;
 * @param rwm_id    const U32_t  : value 0 to 62&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          WARN_RWMX_ALREADY_FREE      RWMUTEX is free already&lt;br /&gt;
 *&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              RWMUTEX ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                RWMUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
 *          ERR_RWMX_CEILING_BAD        RWMUTEX ceiling not lower priority than job priority&lt;br /&gt;
 *          ERR_RWMX_CPU_STACK_EMPTY    CPU priority ceiling stack empty&lt;br /&gt;
 *          ERR_RWMX_CEILING_INVALID    CPU current priority ceiling on the priority stack is invalid&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_rwmutex_signal(&lt;br /&gt;
    const U32_t rwm_id // RWMUTEX ID, must be in range 0 to 62&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| rwm_id || U32_t rwmutex to be signaled(value 0 to 62)&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| WARN_RWMX_ALREADY_FREE      || RWMUTEX is free already&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || RWMUTEX ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || RWMUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_RWMX_CEILING_BAD        || RWMUTEX ceiling not lower priority than job priority&lt;br /&gt;
|-&lt;br /&gt;
| ERR_RWMX_CPU_STACK_EMPTY    || CPU priority ceiling stack empty&lt;br /&gt;
|-&lt;br /&gt;
| ERR_RWMX_CEILING_INVALID    || CPU current priority ceiling on the priority stack is invalid&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Signal read/write mutex number rwm_4&lt;br /&gt;
status = oceos_rwmutex_signal(rwm_4);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_rwmutex_check_status()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''rwmutex.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function checks the status of a read/write mutex. The possible states are free, in-use for read, and in-use for write.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Check whether RWMUTEX is free&lt;br /&gt;
 *&lt;br /&gt;
 * @param rwm_id        must be in range 0 to 62&lt;br /&gt;
 * @param m_status      pointer to RWMUTEX status holder;&lt;br /&gt;
 *                      if return code OCEOS_SUCCESS RWMUTEX status:&lt;br /&gt;
 *                          0 =&amp;gt; Free for use&lt;br /&gt;
 *                          1 =&amp;gt; In use for read&lt;br /&gt;
 *                          2 =&amp;gt; In use for write&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              RWMUTEX ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                RWMUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
 *          ERR_RWMX_DATA_PTR_BAD       Pointer to RWMUTEX status return holder is null&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_rwmutex_check_status(&lt;br /&gt;
    const U32_t rwm_id, // RWMUTEX ID, must be in range 0 to 62&lt;br /&gt;
    U32_t *m_status&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| rwm_id || read/write mutex number in range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| m_status || U32_t pointer to RWMUTEX status holder (0 = free, 1 = in-use for read, 2 = in-use for write &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || RWMUTEX ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || RWMUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_RWMX_DATA_PTR_BAD       || Pointer to RWMUTEX status return holder is null&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, rwm_status;&lt;br /&gt;
...&lt;br /&gt;
// Check the status of read/write mutex rwm_2&lt;br /&gt;
status = oceos_rwmutex_check_status(rwm_2, &amp;amp;rwm_status);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_rwmutex_reading_count()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''rwmutex.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the current number of jobs holding a specified read/write mutex for read.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 *&lt;br /&gt;
 * Get current number of jobs holding RWMUTEX for read&lt;br /&gt;
 *&lt;br /&gt;
 * @param rwm_id    must be in range 0 to 62&lt;br /&gt;
 * @param m_count   pointer to RWMUTEX count holder&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              RWMUTEX ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                RWMUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
 *          ERR_RWMX_DATA_PTR_BAD       Pointer to RWMUTEX count return holder is null&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_rwmutex_reading_count(&lt;br /&gt;
    const U32_t rwm_id, // RWMUTEX ID, must be in range 0 to 62&lt;br /&gt;
    U32_t *m_count&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| rwm_id || U32 value of read/write mutex (in range 0 to 62)&lt;br /&gt;
|-&lt;br /&gt;
| m_count || U32_t pointer to read/write mutex count holder&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || RWMUTEX ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || RWMUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_RWMX_DATA_PTR_BAD       || Pointer to RWMUTEX count return holder is null&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, rwm_count;&lt;br /&gt;
...&lt;br /&gt;
// Get the number of jobs holding the read/write mutex rwm_2 for read&lt;br /&gt;
status = oceos_rwmutex_reading_count(rwm_2, &amp;amp;rwm_count);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_rwmutex_write_reqs_count()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''header.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the current number of write requests for the specified read/write mutex .&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Get current RWMUTEX write requests count&lt;br /&gt;
 *&lt;br /&gt;
 * @param rwm_id    must be in range 0 to 62&lt;br /&gt;
 * @param m_count   pointer to RWMUTEX count holder&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              RWMUTEX ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                RWMUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
 *          ERR_RWMX_DATA_PTR_BAD       Pointer to RWMUTEX count return holder is null&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_rwmutex_write_reqs_count(&lt;br /&gt;
    const U32_t rwm_id, // RWMUTEX ID, must be in range 0 to 62&lt;br /&gt;
    U32_t *m_count&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| rwm_id || U32_t value of read/write mutex (must be in range 0 to 62)&lt;br /&gt;
|-&lt;br /&gt;
| m_count || U32_t pointer to read/write mutex count holder&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || RWMUTEX ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || RWMUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_RWMX_DATA_PTR_BAD       || Pointer to RWMUTEX count return holder is null&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, rwm_count;&lt;br /&gt;
...&lt;br /&gt;
// Get the count of cuurent write requests for read/write mutex rwm_1&lt;br /&gt;
status = oceos_rwmutex_write_reqs_count(rwm_1, &amp;amp;rwm_count);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_rwmutex_writes_pending_count()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''rwmutex.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the current number of pending writes for the specified read/write mutex.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Get current RWMUTEX writes pending count&lt;br /&gt;
 *&lt;br /&gt;
 * @param rwm_id    must be in range 0 to 62&lt;br /&gt;
 * @param m_count   pointer to RWMUTEX count holder&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              RWMUTEX ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                RWMUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
 *          ERR_RWMX_DATA_PTR_BAD       Pointer to RWMUTEX pending count return holder is null&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_rwmutex_writes_pending_count(&lt;br /&gt;
    const U32_t rwm_id, // RWMUTEX ID, must be in range 0 to 62&lt;br /&gt;
    U32_t *m_count&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| rwm_id || U32_t value of read/write mutex (must be in range 0 to 62)&lt;br /&gt;
|-&lt;br /&gt;
| m_count || U32_t pointer to read/write mutex count holder&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || RWMUTEX ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || RWMUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_RWMX_DATA_PTR_BAD       || Pointer to RWMUTEX count return holder is null&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, rwm_count;&lt;br /&gt;
...&lt;br /&gt;
// Get the count of cuurent write requests for read/write mutex rwm_1&lt;br /&gt;
status = oceos_rwmutex_writes_pending_count(rwm_1, &amp;amp;rwm_count);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_rwmutex_holding()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''header.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the read/write mutexes currently held by this instance of this task (job).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Get RWMUTEXs currently held by this instance of the task (job)&lt;br /&gt;
 *&lt;br /&gt;
 * @param m_data    U64_t pointer, each bit indicating RWMUTEX held by current task&lt;br /&gt;
 *                          0 =&amp;gt; Not held by job&lt;br /&gt;
 *                          1 =&amp;gt; Held by job&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_RWMX_DATA_PTR_BAD       Pointer to RWMUTEX status return holder is null&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_rwmutex_holding(&lt;br /&gt;
    U64_t *m_data&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| m_data || U64_t pointer, each bit indicating RWMUTEX held by current task, 0 =&amp;gt; not held, 1 =&amp;gt; held &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_RWMX_DATA_PTR_BAD       || Pointer to RWMUTEX status return holder is null&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
U64_t rwm_held;&lt;br /&gt;
...&lt;br /&gt;
// Which read/write mutexes does this job hold&lt;br /&gt;
status = oceos_rwmutex_holding(&amp;amp;rwm_held);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Semaphores directives ==&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_sem_create()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''semaphore.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function creates a semaphore.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Create a counting semaphore&lt;br /&gt;
 *&lt;br /&gt;
 * @param sem_id            SEMAPHORE ID (from 0 to 62)&lt;br /&gt;
 * @param max_permits       number of max permits allowed for this SEMAPHORE, 1 to 4095&lt;br /&gt;
 * @param count_permits     starting number of permits available 0 to 4095&lt;br /&gt;
 * @param pending_q_size    MAX Number of tasks on SEMAPHORE pending queue 1 to 253&lt;br /&gt;
 * @param use_timeout       if TRUE, directive oceos_sem_wait_restart_timeout can be used&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_WRONG_CPU_CORE          Executing directive on wrong CPU&lt;br /&gt;
 *          ERR_WRONG_PHASE             Called before oceos_init() is done&lt;br /&gt;
 *          ERR_TOO_MANY                MAX number of SEMAPHOREs already created&lt;br /&gt;
 *          ERR_ID_INVALID              SEMAPHORE ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                SEMAPHORE ID &amp;gt;= number of SEMAPHOREs&lt;br /&gt;
 *          ERR_SM_ALREADY_ALLOCATED    SEMAPHORE ID already used&lt;br /&gt;
 *          ERR_SM_MAX_PERMIT_WRONG     MAX permits outside allowed range 1 to 4095&lt;br /&gt;
 *          ERR_SM_COUNT_PERMIT_WRONG   Count permits outside allowed range 0 to 4095&lt;br /&gt;
 *          ERR_SM_COUNT_PERMIT_INVALID Count permits is greater than MAX permits for this SEMAPHORE&lt;br /&gt;
 *          ERR_SM_PENQ_SIZE_WRONG      SEMAPHORE pending queue size outside allowed range 1 to 253&lt;br /&gt;
 *          ERR_SM_TA_MAX_NUM_REACHED   Number of timed actions exceeds MAX allowed 255,&lt;br /&gt;
 *                                      each task on SEMAPHORE pending queue is timed action&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_sem_create(&lt;br /&gt;
    sem_t sem_id,         // counting semaphore ID (MAX 63)&lt;br /&gt;
    U16_t max_permits,    // max number of permits (MAX 4095)&lt;br /&gt;
    U16_t count_permits,  // initial number of permits (MAX 4095)&lt;br /&gt;
    U8_t  pending_q_size, // max number of pending queue jobs (MAX 253)&lt;br /&gt;
    BOOLE_t use_timeout   // whether timeout is used in oceos_sem_wait_restart_timeout&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| sem_id || Semaphore ID to be created (from 0 to 62)&lt;br /&gt;
|-&lt;br /&gt;
| max_permits || number of max permits allowed for this semaphore, 1 to 4095&lt;br /&gt;
|-&lt;br /&gt;
| count_permits || starting number of permits available 0 to 4095&lt;br /&gt;
|-&lt;br /&gt;
| pending_q_size || Maximum Number of tasks on SEMAPHORE pending queue 1 to 253&lt;br /&gt;
|-&lt;br /&gt;
| use_timeout || if TRUE, directive oceos_sem_wait_restart_timeout can be used&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_CPU_CORE          || Executing directive on wrong CPU&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Called before oceos_init() is done&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TOO_MANY                || MAX number of SEMAPHOREs already created&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || SEMAPHORE ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || SEMAPHORE ID &amp;gt;= number of SEMAPHOREs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SM_ALREADY_ALLOCATED    || SEMAPHORE ID already used&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SM_MAX_PERMIT_WRONG     || MAX permits outside allowed range 1 to 4095&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SM_COUNT_PERMIT_WRONG   || Count permits outside allowed range 0 to 4095&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SM_COUNT_PERMIT_INVALID || Count permits is greater than MAX permits for this SEMAPHORE&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SM_PENQ_SIZE_WRONG      || SEMAPHORE pending queue size outside allowed range 1 to 253&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SM_TA_MAX_NUM_REACHED   || Number of timed actions exceeds MAX allowed 255&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, param;&lt;br /&gt;
...&lt;br /&gt;
// Create semaphore called s_audi with max permits of 1000, starting permits of zero, max of 10 tasks on pending queue, and no timeouts &lt;br /&gt;
status = oceos_sem_create(s_audi, 1000, 0, 10, FALSE);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_sem_signal()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''semaphore.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function signals a semaphore, increments its count and transfers pending jobs to the ready queue.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Signals a semaphore, increments and transfers pending jobs to ready queue&lt;br /&gt;
 *&lt;br /&gt;
 * @param sem_id counting SEM ID&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          WARN_JOB_NOT_GUARDED&lt;br /&gt;
 *&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              SEM ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                SEM ID &amp;gt;= number of SEMs&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to grab SEM guard&lt;br /&gt;
 *          ERR_TOO_MANY                SEM max permits count already reached&lt;br /&gt;
 *          ERR_SM_JOB_ID_WRONG         Job ID of the task on SEM pending queue is wrong&lt;br /&gt;
 *          ERR_TA_NOT_FOUND            Timed action index to be removed for job not found&lt;br /&gt;
 *          ERR_TA_START_FAILED         Timed action re-start failed after job remove from timed action queue&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_sem_signal(&lt;br /&gt;
    sem_t sem_id // counting SEM ID&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| sem_id || U32_t value of semaphore to be signalled (incremented)&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| WARN_JOB_NOT_GUARDED        || job not guarded, application should check system log&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || SEM ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || SEM ID &amp;gt;= number of SEMs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to grab SEM guard&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TOO_MANY                || SEM max permits count already reached&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SM_JOB_ID_WRONG         || Job ID of the task on SEM pending queue is wrong&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_NOT_FOUND            || Timed action index to be removed for job not found&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_START_FAILED         || Timed action re-start failed after job remove from timed action queue&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Signal s_audi semaphore (increment its count)&lt;br /&gt;
status = oceos_sem_signal(s_audi);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_sem_wait_continue()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''semaphore.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function decrements the available permits of a sempahore otherwise returns an unsuccessful status code.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Wait on semaphore,&lt;br /&gt;
 * decrement the number of available permits for semaphore,&lt;br /&gt;
 * if no permits continue and task should handle unsuccessful result&lt;br /&gt;
 *&lt;br /&gt;
 * @param sem_id SEM ID&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              SEM ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                SEM ID &amp;gt;= number of SEMs&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to grab SEM guard&lt;br /&gt;
 *          ERR_SM_NOT_AVAILABLE        No more permits available for this SEM&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_sem_wait_continue(&lt;br /&gt;
    sem_t sem_id // counting SEM ID&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| sem_id || U32_t value of semaphore to be decremented&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || SEM ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || SEM ID &amp;gt;= number of SEMs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to grab SEM guard&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SM_NOT_AVAILABLE        || No more permits available for this SEM&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Decrement available permits on semaphore s_1&lt;br /&gt;
status = oceos_sem_wait_continue(s_1);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_sem_wait_restart()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''semaphore.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function decrements the available permits of a sempahore and if none available, the job is put on the pending queue.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Waits on semaphore,&lt;br /&gt;
 * if fail, put job on pending queue and exit task&lt;br /&gt;
 *&lt;br /&gt;
 * @param sem_id SEM ID&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              SEM ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                SEM ID &amp;gt;= number of SEMs&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to grab SEM guard&lt;br /&gt;
 *          ERR_SM_J_START_FROM_TIMOUT  Task started from timeout already, SEM no permits available second time&lt;br /&gt;
 *          ERR_FAILED                  Should never return this&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_sem_wait_restart(&lt;br /&gt;
    sem_t sem_id  // counting SEM ID&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| sem_id || U32_t value of semaphore to be decremented&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || SEM ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || SEM ID &amp;gt;= number of SEMs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to grab SEM guard&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SM_J_START_FROM_TIMOUT  || Task started from timeout already, SEM no permits available second time&lt;br /&gt;
|-&lt;br /&gt;
| ERR_FAILED                  || Should never return this&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Decrement available permits on semaphore s_1 otherwise job is put on pending queue&lt;br /&gt;
status = oceos_sem_wait_restart(s_1);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_sem_wait_restart_timeout()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''semaphore.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function decrements the available permits of a sempahore and if none available, the job is put on the pending queue with a timeout enabled. The job is restarted either when a permit is available to be decremented or when the timeout has expired. In order to use this directive, semaphore must be created with flag use_timeout is set to TRUE.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Waits on semaphore,&lt;br /&gt;
 * if fail, put job on pending queue with optional timeout.&lt;br /&gt;
 * In order to use this directive, semaphore must be created with&lt;br /&gt;
 * flag use_timeout is set to TRUE&lt;br /&gt;
 *&lt;br /&gt;
 * @param sem_id         SEM ID&lt;br /&gt;
 * @param U64_t timeout  Restart time if no permits, 0 =&amp;gt; ignore&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_TA_NOT_INIT             Timed action intialisation is not done and tried to be used; or SEM created without timeouts&lt;br /&gt;
 *          ERR_ID_INVALID              SEM ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                SEM ID &amp;gt;= number of SEMs&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to grab SEM guard&lt;br /&gt;
 *          ERR_SM_J_START_FROM_TIMOUT  Task started from timeout already, SEM no permits available second time&lt;br /&gt;
 *          ERR_TOO_MANY                SEM pending queue is full&lt;br /&gt;
 *          ERR_FAILED                  Should never return this&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_sem_wait_restart_timeout(&lt;br /&gt;
    sem_t sem_id, // counting SEM ID&lt;br /&gt;
    U64_t timeout // timeout, restart time if no permits, 0 =&amp;gt; ignore&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| sem_id || U32_t value of semaphore to be decremented&lt;br /&gt;
|-&lt;br /&gt;
| timeout | U64_t timeout in time units. A value of 0 causes timeout to be ignored.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_NOT_INIT             || Timed action intialisation is not done and tried to be used; or SEM created without&lt;br /&gt;
timeouts&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || SEM ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || SEM ID &amp;gt;= number of SEMs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to grab SEM guard&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SM_J_START_FROM_TIMOUT  || Task started from timeout already, SEM no permits available second time&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TOO_MANY                || SEM pending queue is full&lt;br /&gt;
|-&lt;br /&gt;
| ERR_FAILED                  || Should never return this&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Decrement available permits on semaphore s_1 otherwise job is put on pending queue with timeout of 10,000 time units (usually usecs)&lt;br /&gt;
status = oceos_sem_wait_restart_timeout(s_1);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_sem_get_value()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''semaphore.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the number of available permits for the specified semaphore.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Returns number of available permits&lt;br /&gt;
 * for SEM ID&lt;br /&gt;
 *&lt;br /&gt;
 * @param sem_id        SEM id&lt;br /&gt;
 * @param s_permits     pointer to permits count holder&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              SEM ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                SEM ID &amp;gt;= number of SEMs&lt;br /&gt;
 *          ERR_SM_DATA_BAD             Data holder pointer is null&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_sem_get_value(&lt;br /&gt;
    sem_t sem_id,    // counting SEM ID&lt;br /&gt;
    U32_t *s_permits // pointer to permits count holder&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| sem_id || U32_t value of semaphore whose permit count is required&lt;br /&gt;
|-&lt;br /&gt;
| s_permits || U32_t pointer to permits count holder&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || SEM ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || SEM ID &amp;gt;= number of SEMs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SM_DATA_BAD             || Data holder pointer is null&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, permit_count;&lt;br /&gt;
...&lt;br /&gt;
// Get the available permits for semaphore s_1&lt;br /&gt;
status = oceos_sem_get_value(s_1, &amp;amp;permit_count);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_sem_penq_get_size()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''semaphore.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the number of jobs on the specified semaphore pending queue.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Returns number of jobs on semaphore pending queue&lt;br /&gt;
 * for semaphore ID&lt;br /&gt;
 *&lt;br /&gt;
 * @param sem_id    SEM id&lt;br /&gt;
 * @param s_size    pointer to pending queue size holder&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              SEM ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                SEM ID &amp;gt;= number of SEMs&lt;br /&gt;
 *          ERR_SM_DATA_BAD             Data holder pointer is null&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_sem_penq_get_size(&lt;br /&gt;
    sem_t sem_id,   // counting SEM ID&lt;br /&gt;
    U32_t *s_size   // pointer to pending queue size holder&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| sem_id || U32_t value of semaphore whose permit count is required&lt;br /&gt;
|-&lt;br /&gt;
| s_size || U32_t pointer to pending queue jobs count holder&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || SEM ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || SEM ID &amp;gt;= number of SEMs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SM_DATA_BAD             || Data holder pointer is null&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, job_count;&lt;br /&gt;
...&lt;br /&gt;
// Get the available permits for semaphore s_1&lt;br /&gt;
status = oceos_sem_penq_get_size(s_1, &amp;amp;job_count);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_sem_reset()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''semaphore.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function restores the permits to the original semaphore initial value and removes any jobs from the pending queue.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Restore permits to original value and&lt;br /&gt;
 * remove jobs from pending queue&lt;br /&gt;
 *&lt;br /&gt;
 * @param sem_id    SEM ID&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              SEM ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                SEM ID &amp;gt;= number of SEMs&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to grab SEM guard&lt;br /&gt;
 *          ERR_SM_JOB_ID_WRONG         Job ID of the task on SEM pending queue is wrong&lt;br /&gt;
 *          ERR_TA_NOT_FOUND            Timed action index to be removed for job not found&lt;br /&gt;
 *          ERR_TA_START_FAILED         Timed action re-start failed after job remove from timed action queue&lt;br /&gt;
 */&lt;br /&gt;
S32_t   oceos_sem_reset(&lt;br /&gt;
    sem_t sem_id   // counting SEM ID&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| sem_id || U32_t value of semaphore to be reset&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || SEM ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || SEM ID &amp;gt;= number of SEMs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to grab SEM guard&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SM_JOB_ID_WRONG         || Job ID of the task on SEM pending queue is wrong&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_NOT_FOUND            || Timed action index to be removed for job not found&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_START_FAILED         || Timed action re-start failed after job remove from timed action queue&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Reset semaphore s_1&lt;br /&gt;
status = oceos_sem_reset(s_1);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Data Queues ==&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_dataq_create()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''dataq.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function creates a data queue with the specified characteristics.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Create data queue&lt;br /&gt;
 * If use_timeout = TRUE, timed actions must be initialised&lt;br /&gt;
 *&lt;br /&gt;
 * @param dataq_id      data queue ID&lt;br /&gt;
 * @param dataq_size    data queue size&lt;br /&gt;
 * @param pen_q_size    pending jobs queue size&lt;br /&gt;
 * @param roll_over     whether to roll over when full&lt;br /&gt;
 * @param use_timeout   if TRUE, directive oceos_dataq_read_restart_timeout can be used&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_WRONG_CPU_CORE          Executing directive on wrong CPU&lt;br /&gt;
 *          ERR_WRONG_PHASE             Called before oceos_init() is done&lt;br /&gt;
 *          ERR_TOO_MANY                MAX number of DATAQs already created&lt;br /&gt;
 *          ERR_ID_INVALID              DATAQ ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                DATAQ ID &amp;gt;= number of DATAQs&lt;br /&gt;
 *          ERR_DQ_ALREADY_ALLOCATED    DATAQ ID already used&lt;br /&gt;
 *          ERR_DQ_SIZE_WRONG           DATAQ size outside allowed range 1 to 255&lt;br /&gt;
 *          ERR_DQ_PENQ_SIZE_WRONG      DATAQ pending queue size outside allowed range 1 to 253&lt;br /&gt;
 *          ERR_DQ_TA_MAX_NUM_REACHED   Number of timed actions exceeds MAX allowed 255,&lt;br /&gt;
 *                                      each task on DATAQ pending queue is timed action&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_dataq_create(&lt;br /&gt;
                         dataq_t dataq_id,    // data queue ID&lt;br /&gt;
                         U16_t dataq_size,    // data queue size&lt;br /&gt;
                         U16_t pen_q_size,    // pending jobs queue size&lt;br /&gt;
                         BOOLE_t roll_over,   // whether to roll over when full&lt;br /&gt;
                         BOOLE_t use_timeout  // whether timeout is used oceos_dataq_read_restart_timeout&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| dataq_id ||   dataq_t data queue ID (number between 0 and 62)&lt;br /&gt;
|-&lt;br /&gt;
| dataq_size ||   data queue size (max number of pointers than can be added to the queue)&lt;br /&gt;
|-&lt;br /&gt;
| pen_q_size ||   pending jobs queue size&lt;br /&gt;
|-&lt;br /&gt;
| roll_over ||    whether to roll over when full (0 =&amp;gt; disabled, 1 =&amp;gt; enabled)&lt;br /&gt;
|-&lt;br /&gt;
| use_timeout ||  if TRUE, directive oceos_dataq_read_restart_timeout can be used&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_CPU_CORE          || Executing directive on wrong CPU&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Called before oceos_init() is done&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TOO_MANY                || MAX number of DATAQs already created&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || DATAQ ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || DATAQ ID &amp;gt;= number of DATAQs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DQ_ALREADY_ALLOCATED    || DATAQ ID already used&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DQ_SIZE_WRONG           || DATAQ size outside allowed range 1 to 255&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DQ_PENQ_SIZE_WRONG      || DATAQ pending queue size outside allowed range 1 to 253&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DQ_TA_MAX_NUM_REACHED   || Number of timed actions exceeds MAX allowed 255, each task on DATAQ pending queue is timed action&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Create data queue d_3 with size 20, max pending jobs of 10, rollover enabled, timeouts disabled &lt;br /&gt;
status = oceos_dataq_create(d_3, 20, 10, 1, 0));&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_dataq_write()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''dataq.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function puts a non-null pointer on the specified data queue.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Puts pointer to the data on data queue.&lt;br /&gt;
 * Pointer to the data must not be NULL&lt;br /&gt;
 *&lt;br /&gt;
 * @param dataq_t dataq_id Data queue ID&lt;br /&gt;
 * @param void* data       Non-null pointer to data&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          WARN_DQ_NOW_FULL            Warning, DATAQ is full now&lt;br /&gt;
 *          WARN_JOB_NOT_GUARDED&lt;br /&gt;
 *&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              DATAQ ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                DATAQ ID &amp;gt;= number of DATAQs&lt;br /&gt;
 *          ERR_DQ_DATA_BAD             Data pointer is null&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to acquire guard&lt;br /&gt;
 *          ERR_TOO_MANY                DATAQ is full&lt;br /&gt;
 *          ERR_DQ_JOB_ID_WRONG         Job ID of the task on pending queue is wrong&lt;br /&gt;
 *          ERR_TA_NOT_FOUND            Timed action index to be removed for job not found&lt;br /&gt;
 *          ERR_TA_START_FAILED         Timed action re-start failed after job remove from timed action queue&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_dataq_write(&lt;br /&gt;
    dataq_t dataq_id, // data queue ID&lt;br /&gt;
    void *data        // non-null pointer to data&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| dataq_id || dataq_t with value of Data queue ID&lt;br /&gt;
|-&lt;br /&gt;
| ptr || void* pointer to application data (non-null pointer)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| WARN_DQ_NOW_FULL            || Warning, DATAQ is full now&lt;br /&gt;
|-&lt;br /&gt;
| WARN_JOB_NOT_GUARDED        || &lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || DATAQ ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || DATAQ ID &amp;gt;= number of DATAQs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DQ_DATA_BAD             || Data pointer is null&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to acquire guard&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TOO_MANY                || DATAQ is full&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DQ_JOB_ID_WRONG         || Job ID of the task on pending queue is wrong&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_NOT_FOUND            || Timed action index to be removed for job not found&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_START_FAILED         || Timed action re-start failed after job remove from timed action queue&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
char[100] message_in;&lt;br /&gt;
...&lt;br /&gt;
// Put pointer to message_in on data queue s_2 &lt;br /&gt;
status = oceos_dataq_write(s_2, (void *)message_in);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_dataq_read_continue()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''dataq.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns a pointer from the specified data queue.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Read data queue&lt;br /&gt;
 *&lt;br /&gt;
 * @param dataq_t dataq_id  Data queue ID&lt;br /&gt;
 * @param void*   data      Pointer to data&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              DATAQ ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                DATAQ ID &amp;gt;= number of DATAQs&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to acquire guard&lt;br /&gt;
 *          ERR_DQ_EMPTY                DATAQ empty(count zero)&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_dataq_read_continue(&lt;br /&gt;
    dataq_t dataq_id, // data queue ID&lt;br /&gt;
    void* *data        // return data&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Descriptionn&lt;br /&gt;
|-&lt;br /&gt;
| dataq_id || dataq_t with value of Data queue ID&lt;br /&gt;
|-&lt;br /&gt;
| ptr || void* pointer to store returned data queue pointer removed from the queue&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || DATAQ ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || DATAQ ID &amp;gt;= number of DATAQs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to acquire guard&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DQ_EMPTY                || DATAQ empty(count zero)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
char *data_ptr;&lt;br /&gt;
...&lt;br /&gt;
// Read pointer from data queue s_2 &lt;br /&gt;
status = oceos_dataq_read_continue(s_2, (void *)data_ptr);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_dataq_read_restart()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''dataq.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns a pointer from the specified data queue. If the queue is empty, the job is added top the dataq pending queue. The job will be restarted when data is available. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Read data queue next item.&lt;br /&gt;
 * If dataq is empty, task is put on pending Q for dataq and&lt;br /&gt;
 * restarted by oceos_dataq_write&lt;br /&gt;
 *&lt;br /&gt;
 * @param dataq_id Data queue ID&lt;br /&gt;
 * @param data     Pointer to return data&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              DATAQ ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                DATAQ ID &amp;gt;= number of DATAQs&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to acquire guard&lt;br /&gt;
 *          ERR_DQ_J_START_FROM_TIMOUT  Job started from timeout already, DATAQ empty second time&lt;br /&gt;
 *          ERR_FAILED                  Should never return this&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_dataq_read_restart(&lt;br /&gt;
    dataq_t dataq_id,    // data queue ID&lt;br /&gt;
    void* *data           // pointer to return data&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| dataq_id || dataq_t with value of Data queue ID&lt;br /&gt;
|-&lt;br /&gt;
| ptr || void* pointer to store returned data queue pointer removed from the queue&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || DATAQ ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || DATAQ ID &amp;gt;= number of DATAQs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to acquire guard&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DQ_J_START_FROM_TIMOUT  || Job started from timeout already, DATAQ empty second time&lt;br /&gt;
|-&lt;br /&gt;
| ERR_FAILED                  || Should never return this&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
char *data_ptr;&lt;br /&gt;
...&lt;br /&gt;
// Read pointer from data queue s_2 with restart when data is available&lt;br /&gt;
status = oceos_dataq_read_restart(s_2, (void *)data_ptr);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_dataq_read_restart_timeout()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''dataq.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns a pointer from the specified data queue. If the queue is empty, the job is added top the dataq pending queue. The job will be restarted either when data is available or the timeout has expired. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Read data queue next item.&lt;br /&gt;
 * If dataq is empty, task is put on pending Q for dataq and&lt;br /&gt;
 * restarted by oceos_dataq_write or by timeout if timeout != 0&lt;br /&gt;
 * In order to use this feature timed actions must be configured and&lt;br /&gt;
 * dataq created with use timeout set to true&lt;br /&gt;
 *&lt;br /&gt;
 * @param dataq_id          Data queue ID&lt;br /&gt;
 * @param data              Pointer to return data&lt;br /&gt;
 * @param timeout           Timeout, restart time if no entry, 0 =&amp;gt; ignore&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_TA_NOT_INIT             Timed action intialisation is not done and tried to be used; or DATAQ created without timeouts&lt;br /&gt;
 *          ERR_ID_INVALID              DATAQ ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                DATAQ ID &amp;gt;= number of DATAQs&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to acquire guard&lt;br /&gt;
 *          ERR_DQ_EMPTY                DATAQ empty(count zero)&lt;br /&gt;
 *          ERR_DQ_J_START_FROM_TIMOUT  Job started from timeout already, DATAQ empty second time&lt;br /&gt;
 *          ERR_TOO_MANY                DATAQ pending queue is full&lt;br /&gt;
 *          ERR_FAILED                  Should never return this&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_dataq_read_restart_timeout(&lt;br /&gt;
    dataq_t dataq_id,   // data queue ID&lt;br /&gt;
    void* *data,         // Pointer to return data&lt;br /&gt;
    U64_t timeout       // timeout, restart time if no entry, 0 =&amp;gt; ignore&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| dataq_id || dataq_t with value of Data queue ID&lt;br /&gt;
|-&lt;br /&gt;
| ptr || void* pointer to store returned data queue pointer removed from the queue&lt;br /&gt;
|-&lt;br /&gt;
| timeout || U64_t containing timeout value, restart time if no entry, 0 =&amp;gt; ignore&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_NOT_INIT             || Timed action intialisation is not done and tried to be used; or DATAQ created without timeouts&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || DATAQ ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || DATAQ ID &amp;gt;= number of DATAQs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to acquire guard&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DQ_EMPTY                || DATAQ empty(count zero)&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DQ_J_START_FROM_TIMOUT  || Job started from timeout already, DATAQ empty second time&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TOO_MANY                || DATAQ pending queue is full&lt;br /&gt;
|-&lt;br /&gt;
| ERR_FAILED                  || Should never return this&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
char *data_ptr;&lt;br /&gt;
...&lt;br /&gt;
// Read pointer from data queue s_2 with timeout after 10,000 time units if no data is available&lt;br /&gt;
status = oceos_dataq_read_restart_timeout(s_2, (void *)data_ptr, 10000ull);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_dataq_get_size()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''dataq.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the number of items on the specified data queue.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Returns number of items on the data queue with ID&lt;br /&gt;
 *&lt;br /&gt;
 * @param dataq_id   DATAQ Id&lt;br /&gt;
 * @param d_size     Pointer to size holder&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              DATAQ ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                DATAQ ID &amp;gt;= number of DATAQs&lt;br /&gt;
 *          ERR_DQ_DATA_BAD             DATAQ size holder pointer is null&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_dataq_get_size(&lt;br /&gt;
    dataq_t dataq_id,   // data queue ID&lt;br /&gt;
    U32_t *d_size&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| dataq_id ||  dataq_t with the ID of the data queue (value between 0 and 62)&lt;br /&gt;
|-&lt;br /&gt;
| d_size || U32_t *d_size pointer to the variable to store the size&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || DATAQ ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || DATAQ ID &amp;gt;= number of DATAQs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DQ_DATA_BAD             || DATAQ size holder pointer is null&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, d_size;&lt;br /&gt;
...&lt;br /&gt;
// Get the number of entries on data queue d_0&lt;br /&gt;
status = oceos_dataq_get_size(d_0, &amp;amp;d_size);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_dataq_penq_get_size()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''dataq.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns number of jobs on the specified data queue pending job's queue.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Returns number of jobs on the dataq pending job's queue&lt;br /&gt;
 *&lt;br /&gt;
 * @param dataq_id  DATAQ Id&lt;br /&gt;
 * @param d_size    Pointer to pending queue size holder&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              DATAQ ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                DATAQ ID &amp;gt;= number of DATAQs&lt;br /&gt;
 *          ERR_DQ_DATA_BAD             DATAQ pending size holder pointer is null&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_dataq_penq_get_size(&lt;br /&gt;
    dataq_t dataq_id,&lt;br /&gt;
    U32_t *d_size&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| dataq_id ||  dataq_t with the ID of the data queue (value between 0 and 62)&lt;br /&gt;
|-&lt;br /&gt;
| d_jobs || U32_t *d_jobs pointer to the variable to store the number of jobs on the pending queue&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || DATAQ ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || DATAQ ID &amp;gt;= number of DATAQs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DQ_DATA_BAD             || DATAQ pending size holder pointer is null&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, d_jobs;&lt;br /&gt;
...&lt;br /&gt;
// Get the number of jobs the the pending jubs queue for data queue d_1&lt;br /&gt;
status = oceos_dataq_penq_get_size(d_1, &amp;amp;d_jobs);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_dataq_clear()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''dataq.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function clears the specified data queue including pending jobs for that queue.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Clears data queue and&lt;br /&gt;
 * frees tasks on pending queue&lt;br /&gt;
 *&lt;br /&gt;
 * @param dataq_t dataq_id Data queue ID&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              DATAQ ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                DATAQ ID &amp;gt;= number of DATAQs&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to acquire guard&lt;br /&gt;
 *          ERR_DQ_JOB_ID_WRONG         Job ID of the task on DATAQ pending queue is wrong&lt;br /&gt;
 *          ERR_TA_NOT_FOUND            Timed action index to be removed for job not found&lt;br /&gt;
 *          ERR_TA_START_FAILED         Timed action re-start failed after job remove from timed action queue&lt;br /&gt;
 */&lt;br /&gt;
S32_t  oceos_dataq_clear(&lt;br /&gt;
    dataq_t dataq_id    // data queue ID&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| dataq_id ||  dataq_t with the ID of the data queue to be cleared (value between 0 and 62)&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || DATAQ ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || DATAQ ID &amp;gt;= number of DATAQs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to acquire guard&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DQ_JOB_ID_WRONG         || Job ID of the task on DATAQ pending queue is wrong&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_NOT_FOUND            || Timed action index to be removed for job not found&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_START_FAILED         || Timed action re-start failed after job remove from timed action queue&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Clear data queue d_1&lt;br /&gt;
status = oceos_dataq_penq_get_size(d_1);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Timed Actions ==&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_timed_output_add()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''timed_action.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function adds a timed action to the timed action queue. It writes a value to an address at a specified system time. An optional mask can be applied so that only those bits are changed.&lt;br /&gt;
The action types are WRITE_ACTION, RMW_ACTION. WRITE_ACTION writes the value to the address. RMW_ACTION reads the values at the address and modifies the bits specified by the mask and value.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Add output action to timed actions queue :&lt;br /&gt;
 *  1. Create timed output action&lt;br /&gt;
 *  2. Stop timer&lt;br /&gt;
 *  3. Add action to action_array&lt;br /&gt;
 *  4. Start timer or execute if time is right&lt;br /&gt;
 *&lt;br /&gt;
 * Returns timed action ID that can be used later to remove&lt;br /&gt;
 * if need by oceos_timed_output_remove&lt;br /&gt;
 *&lt;br /&gt;
 * @param enum ACTION_TYPE action_type  Action type&lt;br /&gt;
 * @param U64_t act_time                System time at which action should be done&lt;br /&gt;
 * @param U32_t before_time             Forward tolerance for time&lt;br /&gt;
 * @param U32_t after_time              Backward tolerance for time&lt;br /&gt;
 * @param adrs_t address                Output address&lt;br /&gt;
 * @param U32_t value                   Output value&lt;br /&gt;
 * @param U32_t mask                    Output mask&lt;br /&gt;
 * @param U32_ *ta_index                Pointer to store timed action index&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_TA_NOT_INIT             Timed action inialisation is not done and tried to be used&lt;br /&gt;
 *          ERR_TA_PTR_BAD              Timed action pointer is null&lt;br /&gt;
 *          ERR_TA_TYPE_WRONG           Timed action type is wrong&lt;br /&gt;
 *          ERR_TOO_LATE                Timed action time is too late&lt;br /&gt;
 *          ERR_SYS_BUSY                Timed action guard failed to acquire&lt;br /&gt;
 *          ERR_TA_Q_FULL               Timed action queue is full&lt;br /&gt;
 *          ERR_TA_START_FAILED         Timed action execute failed; See log&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_timed_output_add(&lt;br /&gt;
    const enum ACTION_TYPE action_type,// Action type&lt;br /&gt;
    U64_t act_time,                    // system time at which action should be done&lt;br /&gt;
    U32_t before_time,                 // forward tolerance for time&lt;br /&gt;
    U32_t after_time,                  // backward tolerance for time&lt;br /&gt;
    const adrs_t address,              // output address&lt;br /&gt;
    const U32_t value,                 // output value&lt;br /&gt;
    const U32_t mask,                  // output mask&lt;br /&gt;
    U32_t *ta_index                    // Pointer to store timed action index&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| enum ACTION_TYPE action_type  || Action type&lt;br /&gt;
|-&lt;br /&gt;
| U64_t act_time                || System time at which action should be done&lt;br /&gt;
|-&lt;br /&gt;
| U32_t before_time             || Forward tolerance for time&lt;br /&gt;
|-&lt;br /&gt;
| U32_t after_time              || Backward tolerance for time&lt;br /&gt;
|-&lt;br /&gt;
| adrs_t address                || Output address&lt;br /&gt;
|-&lt;br /&gt;
| U32_t value                   || Output value&lt;br /&gt;
|-&lt;br /&gt;
| U32_t mask                    || Output mask&lt;br /&gt;
|-&lt;br /&gt;
| U32_ *ta_index                || Pointer to store timed action index&lt;br /&gt;
|-&lt;br /&gt;
| param || parameter to function&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_NOT_INIT             || Timed action inialisation is not done and tried to be used&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_PTR_BAD              || Timed action pointer is null&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_TYPE_WRONG           || Timed action type is wrong&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TOO_LATE                || Timed action time is too late&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Timed action guard failed to acquire&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_Q_FULL               || Timed action queue is full&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_START_FAILED         || Timed action execute failed; See log&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
#define OUTPUT_TIMED_VAL    0xDEADBEEF&lt;br /&gt;
#define OUTPUT_TIMED_MASK   0x1000001&lt;br /&gt;
#define OUTPUT_TIME         0xfffff&lt;br /&gt;
#define OUTPUT_TIME_FW      0x1000&lt;br /&gt;
#define OUTPUT_TIME_BW      0x1000&lt;br /&gt;
&lt;br /&gt;
static U32_t test_data[16] = { 0 };&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Write OUTPUT_TIMED_VAL to test_data[0] at 0xfffff time units from now with a tolerance of 0x1000 before and after the specified time   &lt;br /&gt;
status = oceos_timed_output_add(&lt;br /&gt;
                                       WRITE_ACTION,&lt;br /&gt;
                                       OUTPUT_TIME,&lt;br /&gt;
                                       OUTPUT_TIME_FW,&lt;br /&gt;
                                       OUTPUT_TIME_BW,&lt;br /&gt;
                                       (adrs_t) &amp;amp;test_data[0],&lt;br /&gt;
                                       OUTPUT_TIMED_VAL,&lt;br /&gt;
                                       0,&lt;br /&gt;
                                       &amp;amp;timed_action_index));&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_timed_jobs_number()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''timed_action.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the number of jobs on the timed actions queue.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Get number of Jobs (request to start the task) waiting on timed action queue.&lt;br /&gt;
 * These jobs are added by oceos_task_timed_start() or&lt;br /&gt;
 * oceos_dataq_read_restart_timeout when data is not available (NULL) or&lt;br /&gt;
 * oceos_sem_wait_restart_timeout when counting semaphore is 0&lt;br /&gt;
 *&lt;br /&gt;
 * @param total_jobs    Pointer to store total jobs number waiting on timed action Q&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_TA_NOT_INIT             Timed action inialisation is not done and tried to be used&lt;br /&gt;
 *          ERR_TA_PTR_BAD              Timed action pointer is null&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_timed_jobs_number(U32_t *total_jobs);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| total_jobs || s32_t pointer to store total jobs number waiting on timed action Q&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_NOT_INIT             || Timed action inialisation is not done and tried to be used&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_PTR_BAD              || Timed action pointer is null&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, no_of_jobs;&lt;br /&gt;
...&lt;br /&gt;
// Get the number of jobs on the timed actions queue&lt;br /&gt;
status = oceos_timed_jobs_number(&amp;amp;no_of_jobs);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_timed_jobs_remove()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''timed_action.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function removes the specified timed action from the queue.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Remove job from timed action queue&lt;br /&gt;
 * When task started using oceos_task_timed_start(),&lt;br /&gt;
 * this directive requires pointer to store ID&lt;br /&gt;
 * of job that put on the timed action queue.&lt;br /&gt;
 * This job can be removed later using this directive and stored job ID.&lt;br /&gt;
 *&lt;br /&gt;
 * @param U32_t job_id  Job ID&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_TA_NOT_INIT             Timed action intialisation is not done and tried to be used&lt;br /&gt;
 *          ERR_TA_PTR_BAD              Timed action pointer corrupt&lt;br /&gt;
 *          ERR_ID_WRONG                Job ID is wrong&lt;br /&gt;
 *          ERR_TA_NOT_FOUND            Timed action ID not found for action with job_id or removed already&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to acquire timed action guard&lt;br /&gt;
 *          WARN_TA_Q_EMPTY             Timed action queue is empty&lt;br /&gt;
 *          ERR_TA_START_FAILED         Timed action execute failed; See log&lt;br /&gt;
 */&lt;br /&gt;
S32_t   oceos_timed_jobs_remove(&lt;br /&gt;
    U32_t job_id                             // Job ID&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| job_id || U32_t Job ID to be removed from the timed actions queue&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_NOT_INIT             || Timed action intialisation is not done and tried to be used&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_PTR_BAD              || Timed action pointer corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || Job ID is wrong&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_NOT_FOUND            || Timed action ID not found for action with job_id or removed already&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to acquire timed action guard&lt;br /&gt;
|-&lt;br /&gt;
| WARN_TA_Q_EMPTY             || Timed action queue is empty&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_START_FAILED         || Timed action execute failed; See log&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, job_id;&lt;br /&gt;
...&lt;br /&gt;
// Remove job_id from the timed actions queue&lt;br /&gt;
status = oceos_timed_jobs_remove(job_id);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_timed_jobs_reset()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''timed_action.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function removes all jobs from timed actions queue.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Remove all jobs (requests to start a task) from timed actions queue&lt;br /&gt;
 * These jobs were added by oceos_task_timed_start() or&lt;br /&gt;
 * oceos_dataq_read_restart_timeout when data is not available (NULL) or&lt;br /&gt;
 * oceos_sem_wait_restart_timeout when counting semaphore is 0&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_TA_NOT_INIT             Timed action intialisation is not done and tried to be used&lt;br /&gt;
 *          ERR_TA_PTR_BAD              Timed action pointer is null&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to acquire timed action guard&lt;br /&gt;
 *          WARN_TA_Q_EMPTY             Timed action queue is empty&lt;br /&gt;
 *          ERR_TA_NOT_FOUND            Timed action index not found&lt;br /&gt;
 *          ERR_TA_START_FAILED         Timed action execute failed; See log&lt;br /&gt;
 */&lt;br /&gt;
S32_t   oceos_timed_jobs_reset(void);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
There are no input parameters to this function&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_NOT_INIT             || Timed action intialisation is not done and tried to be used&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_PTR_BAD              || Timed action pointer is null&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to acquire timed action guard&lt;br /&gt;
|-&lt;br /&gt;
| WARN_TA_Q_EMPTY             || Timed action queue is empty&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_NOT_FOUND            || Timed action index not found&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_START_FAILED         || Timed action execute failed; See log&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Remove all jobs from the timed actions queue&lt;br /&gt;
status = oceos_timed_jobs_reset(job_id);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_timed_output_remove()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''timed_action.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function removes the specified timed output action from timed actions queue.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Remove timed output action from timed actions queue.&lt;br /&gt;
 * When action is created, action index should be stored&lt;br /&gt;
 * to remove if need&lt;br /&gt;
 *&lt;br /&gt;
 * @param action_index&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_TA_NOT_INIT             Timed action intialisation is not done and tried to be used&lt;br /&gt;
 *          ERR_TA_PTR_BAD              Timed action pointer is null&lt;br /&gt;
 *          ERR_ID_WRONG                Timed action id is wrong&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to acquire timed action guard&lt;br /&gt;
 *          ERR_TA_NOT_FOUND            Timed action index not found&lt;br /&gt;
 *          ERR_TA_START_FAILED         Timed action execute failed&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_timed_output_remove(&lt;br /&gt;
    const U8_t  action_index    // Index in action array, returned when action was created&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| action_index|| S32_t specifying the timed output action index returned when the timed output was added.&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| Error bit  || Description&lt;br /&gt;
|&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_NOT_INIT             || Timed action intialisation is not done and tried to be used&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_PTR_BAD              || Timed action pointer is null&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || Timed action id is wrong&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to acquire timed action guard&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_NOT_FOUND            || Timed action index not found&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_START_FAILED         || Timed action execute failed&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
U8_t action_index;&lt;br /&gt;
...&lt;br /&gt;
// Remove timed output with specified action_index&lt;br /&gt;
status = oceos_timed_output_remove(action_index);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_timed_output_reset()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''timed_action.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function removes all timed output actions from timed actions queue.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Remove all timed output actions from timed actions queue&lt;br /&gt;
 * These timed output actions were created by oceos_timed_output_add&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_TA_NOT_INIT             Timed action intialisation is not done and tried to be used&lt;br /&gt;
 *          ERR_TA_PTR_BAD              Timed action pointer is null&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to acquire timed action guard&lt;br /&gt;
 *          WARN_TA_Q_EMPTY             Timed action queue is empty&lt;br /&gt;
 *          ERR_TA_NOT_FOUND            Timed action index not found&lt;br /&gt;
 *          ERR_TA_START_FAILED         Timed action execute failed; See log&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_timed_output_reset(void);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
There are no input parameters to this function. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| Error bit  || Description&lt;br /&gt;
|&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_NOT_INIT             || Timed action intialisation is not done and tried to be used&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_PTR_BAD              || Timed action pointer is null&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to acquire timed action guard&lt;br /&gt;
|-&lt;br /&gt;
| WARN_TA_Q_EMPTY             || Timed action queue is empty&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_NOT_FOUND            || Timed action index not found&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_START_FAILED         || Timed action execute failed; See log&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Remove all timed outputs from the timed actions queue&lt;br /&gt;
status = oceos_timed_output_reset();&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Logging directives ==&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;Introduction&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Log Area Features  (for details of other areas see oceos_areas.h)&lt;br /&gt;
&lt;br /&gt;
The system log area holds the system log and the records of the present and previous values of the system state variable.&lt;br /&gt;
&lt;br /&gt;
It is set up initially as an array of 32-bit words that starts at a 32-bit aligned address provided by the application developer.&lt;br /&gt;
&lt;br /&gt;
It is recommended that this address be in non-volatile RAM memory if this is available to allow information be preserved across power-up cycles.&lt;br /&gt;
&lt;br /&gt;
OCEOS preserves log area information across resets as far as possible.&lt;br /&gt;
&lt;br /&gt;
The system log itself is a circular buffer of struct log entry. Older entries are overwritten by new entries once all entries are in use.&lt;br /&gt;
&lt;br /&gt;
The application developer can specify a function to be called when 3/4 of log entries are in use. This function is called again only after 3/4 of log entries have been read and the log has again become 3/4 full.&lt;br /&gt;
&lt;br /&gt;
The read and write indices are stored in the log area and if equal indicate that the log is empty.&lt;br /&gt;
&lt;br /&gt;
As with other OCEOS data areas, the log area starts with a header&lt;br /&gt;
*a 32-bit word holding a constant OCEOS_VERSION&lt;br /&gt;
*a 32-bit word holding the log area size in 32-bit words&lt;br /&gt;
*a 32-bit word, the system status variable&lt;br /&gt;
*a 32-bit word, the system status mask&lt;br /&gt;
*a 32-bit word, the accumulated system status&lt;br /&gt;
*a 32-bit word, the previous system status mask&lt;br /&gt;
*a 32-bit word, the log control, that gives whether the log full function was called&lt;br /&gt;
*the read index&lt;br /&gt;
*the write index&lt;br /&gt;
*an array of struct log_entry making up the system log itself&lt;br /&gt;
*ending with a 32-bit constant END_SENTINEL&lt;br /&gt;
&lt;br /&gt;
The system fixed meta structure at sysMetaPtr provides&lt;br /&gt;
&lt;br /&gt;
*system_log_ptr      the start address of the log area&lt;br /&gt;
*logEntries          the number of log entries&lt;br /&gt;
*logCreated          flag indicating log was created successfully&lt;br /&gt;
*logFullFunction     user defined function, called when the log becomes 3/4 full (or NULL if not used)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Log Entry Types and Structure'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/*****************************************************************************&lt;br /&gt;
 * LOG ENTRY TYPES&lt;br /&gt;
 *&lt;br /&gt;
 * A log entry type is an 8-bit number.&lt;br /&gt;
 * Values from 0 to 127 can be defined by the application.&lt;br /&gt;
 * Values from 128 to 255 are used by OCEOS as below.&lt;br /&gt;
 *&lt;br /&gt;
 *&lt;br /&gt;
 * NOTE: Add new log types at the end for backward compatibility&lt;br /&gt;
 */&lt;br /&gt;
enum LOG_ENTRY_TYPE{&lt;br /&gt;
  LOG_SYS_OK = 0x80U,&lt;br /&gt;
  LOG_OCEOS_ABORT,				// when exiting from oceos_start&lt;br /&gt;
  LOG_LOG_NOT_VALID_ENTRY,		// used to initialise log and when log empty&lt;br /&gt;
  LOG_INIT_TASK_START_FAIL,		// initial task passed to oceos_start failed&lt;br /&gt;
  LOG_DEADLINE_MISSED,			// task deadline missed&lt;br /&gt;
  LOG_JOB_NOT_ACTIVE,			// cpu_terminate but job not active, absurd&lt;br /&gt;
  LOG_JOB_NOT_FREE,				// job guarded but not free&lt;br /&gt;
  LOG_JOBS_INC_FAILED, 			// pending jobs increment failed&lt;br /&gt;
  LOG_JOB_NOT_GUARDED,			// paranoia&lt;br /&gt;
  LOG_CS_LOG_SPIN_FAIL,			// oceos_CPU_sleep, trying to update CS log&lt;br /&gt;
  LOG_MUTEX_ALREADY_HELD,		// oceos_mutex_wait, code returned, not needed&lt;br /&gt;
  LOG_MUTEX_INCORRECT_ORDER,	// oceos_mutex_wait&lt;br /&gt;
  LOG_MUTEX_EXIT_HOLDING,		// task exits holding one or more mutexes&lt;br /&gt;
  LOG_MUTEX_EXIT_NONE,			// __oceos_tasks_remove_mutexes called but no mutex held&lt;br /&gt;
  LOG_SEMAPHORE_PENDING_REMOVE_FAIL,	// timed_action.c&lt;br /&gt;
  LOG_SEMAPHORE_PENDING_QUEUE_FULL,		// __oceos_semaphore_add_pend&lt;br /&gt;
  LOG_SEMAPHORE_SPIN_FAILED,			// trying to access semaphore&lt;br /&gt;
  LOG_DATAQ_PENDING_QUEUE_FULL,&lt;br /&gt;
  LOG_DATAQ_PENDING_REMOVE_FAIL,&lt;br /&gt;
  LOG_DATAQ_SPIN_FAILED,&lt;br /&gt;
  LOG_TIMED_ACTION_TIMER_NULL,&lt;br /&gt;
  LOG_TIMED_ACTION_INVALID,&lt;br /&gt;
  LOG_TIMED_ACTION_BAD_INDEX,&lt;br /&gt;
  LOG_TIMED_ACTION_MISSED,&lt;br /&gt;
  LOG_TIMED_ACTION_Q_EMPTY,&lt;br /&gt;
  LOG_TIMED_ACTION_REMOVE_FAIL,&lt;br /&gt;
  LOG_TIMED_ACTION_BAD_JOB_ID,&lt;br /&gt;
  LOG_TIMED_Q_SPIN_FAIL,&lt;br /&gt;
  LOG_SYSTEM_ERROR,&lt;br /&gt;
  LOG_ATOMICINC_FAILED,&lt;br /&gt;
  LOG_PENDING_PRI_UPDATE_FAILED,&lt;br /&gt;
  LOG_KILL_TASK_INVALID_ID,      // Tried to kill task with invalid ID&lt;br /&gt;
  LOG_OCEOS_EXIT_REQUEST,         // oceos_exit command was called&lt;br /&gt;
  LOG_RWMUTEX_NOT_RETURNED,&lt;br /&gt;
  LOG_RWMUTEX_NOT_HIGHEST&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
/*****************************************************************************&lt;br /&gt;
 * Structures&lt;br /&gt;
 */&lt;br /&gt;
/**&lt;br /&gt;
 * Log entry structure&lt;br /&gt;
 */&lt;br /&gt;
struct log_entry{&lt;br /&gt;
  U64_t             time64;&lt;br /&gt;
&lt;br /&gt;
  unsigned int      entry_cpu          :8;&lt;br /&gt;
  unsigned int      entry_type         :8;&lt;br /&gt;
  unsigned int      entry_note         :16;	// not used at present&lt;br /&gt;
&lt;br /&gt;
  U32_t             entry_comment;&lt;br /&gt;
}__attribute__ ((aligned (8)));&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_log_add_entry()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''system_log.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function adds an entry to the log. The entry overwrites the oldest unread entry if the log is full.&lt;br /&gt;
Custom log entries can be added to enum LOG_ENTRY from 0 to 128.&lt;br /&gt;
The indices are incremented in a circular fashion. If the write index reaches the read_index the read index is moved on, as read and write indices equal would indicate an empty log.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Add an entry to the log.&lt;br /&gt;
 * this overwrites the oldest unread entry if the log is full.&lt;br /&gt;
 * Custom log entries can be added to enum LOG_ENTRY from 0 to 128&lt;br /&gt;
 *&lt;br /&gt;
 * N.B. The indices are incremented in a circular fashion.&lt;br /&gt;
 *      If the write index reaches the read_index the read index is moved on,&lt;br /&gt;
 *      as read and write indices equal would indicate an empty log.&lt;br /&gt;
 *&lt;br /&gt;
 * @param type  enum LOG_ENTRY_TYPE&lt;br /&gt;
 * @param info  extra information to be logged&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_LOG_CORRUPT         System Log area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Log directive called in wrong phase; can be used after oceos_init() called&lt;br /&gt;
 *          ERR_ID_INVALID              Log type invalid&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to acquire log guard&lt;br /&gt;
 *          ERR_LOG_INDEX_WRONG         Read/write log index is wrong&lt;br /&gt;
 */&lt;br /&gt;
S32_t   oceos_log_add_entry(&lt;br /&gt;
    enum LOG_ENTRY_TYPE type,   // 8 bits enum LOG_ENTRY_TYPE&lt;br /&gt;
    const U32_t        info     // information&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| enum LOG_ENTRY_TYPE || Log entry type (see previous section for a list)&lt;br /&gt;
|-&lt;br /&gt;
| info | U32_t with the log information&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit  !! Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_LOG_CORRUPT         || System Log area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Log directive called in wrong phase; can be used after oceos_init() called&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || Log type invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to acquire log guard&lt;br /&gt;
|-&lt;br /&gt;
| ERR_LOG_INDEX_WRONG         || Read/write log index is wrong&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, info;&lt;br /&gt;
...&lt;br /&gt;
// Log LOG_APP_COMMS__ERROR (defined in enum LOG_ENTRY_TYPE) and info with more details&lt;br /&gt;
status = oceos_log_add_entry(LOG_APP_COMMS__ERROR, info);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_log_get_indexed_entry()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''system_log.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the entry at the specified position in the log. The entry is not removed and the log and log indices are not changed.&lt;br /&gt;
One use of this function is to allow the log be examined after a reset.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Returns the entry at the specified position in the log.&lt;br /&gt;
 * The entry is not removed and the log and log indices are not changed.&lt;br /&gt;
 * (intended to allow the log be examined for example after reset)&lt;br /&gt;
 *&lt;br /&gt;
 * @param index         position in the log&lt;br /&gt;
 * @param outputPtr     pointer to return log entry&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_LOG_CORRUPT         System Log area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Log directive called in wrong phase; can be used after oceos_init() called&lt;br /&gt;
 *          ERR_LOG_INDEX_WRONG         Read log index is wrong&lt;br /&gt;
 *          ERR_LOG_DATA_PTR_BAD        Data holder pointer is null&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_log_get_indexed_entry(&lt;br /&gt;
    const unsigned int index,&lt;br /&gt;
    struct log_entry * const outputPtr&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| index || U32_t with position in the log&lt;br /&gt;
|-&lt;br /&gt;
| outputPtr || pointer to struct log_entry to hold the returned entry&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit  !! Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_LOG_CORRUPT         || System Log area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Log directive called in wrong phase; can be used after oceos_init() called&lt;br /&gt;
|-&lt;br /&gt;
| ERR_LOG_INDEX_WRONG         || Read log index is wrong&lt;br /&gt;
|-&lt;br /&gt;
| ERR_LOG_DATA_PTR_BAD        || Data holder pointer is null&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, index;&lt;br /&gt;
struct log_entry store_entry;&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
// Read log_entry at specified index into outputPtr&lt;br /&gt;
status = oceos_log_get_indexed_entry(index, &amp;amp;store_entry);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_log_remove_entry()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''system_log.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function reads and removes the oldest unread log entry. &lt;br /&gt;
If the log is not empty use the entry at the read index to update the value at the output pointer, returning OCEOS_SUCCESS.&lt;br /&gt;
If outputPtr is NULL, entry is removed but no returned.&lt;br /&gt;
If the log is empty, set the value at the output pointer to LOG_LOG_NOT_VALID_ENTRY and return ERR_LOG_EMPTY.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Read and remove the oldest unread log entry&lt;br /&gt;
 *&lt;br /&gt;
 * If the log is not empty use the entry at the read index to update the value&lt;br /&gt;
 * at the output pointer, returning OCEOS_SUCCESS.&lt;br /&gt;
 *&lt;br /&gt;
 * If outputPtr is NULL, entry is removed but no returned&lt;br /&gt;
 *&lt;br /&gt;
 * If the log is empty, set the value at the output pointer to LOG_LOG_NOT_VALID_ENTRY&lt;br /&gt;
 * and return ERR_LOG_EMPTY&lt;br /&gt;
 *&lt;br /&gt;
 * @param outputPtr   pointer to struct log_entry&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_LOG_CORRUPT         System Log area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Log directive called in wrong phase; can be used after oceos_init() called&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to acquire log guard&lt;br /&gt;
 *          ERR_LOG_INDEX_WRONG         Read/write log index is wrong&lt;br /&gt;
 *          ERR_LOG_EMPTY               Log is empty&lt;br /&gt;
 */&lt;br /&gt;
S32_t   oceos_log_remove_entry(&lt;br /&gt;
    struct log_entry * const outputPtr&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| outputPtr || pointer to struct log_entry&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit  !! Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_LOG_CORRUPT         || System Log area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Log directive called in wrong phase; can be used after oceos_init() called&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to acquire log guard&lt;br /&gt;
|-&lt;br /&gt;
| ERR_LOG_INDEX_WRONG         || Read/write log index is wrong&lt;br /&gt;
|-&lt;br /&gt;
| ERR_LOG_EMPTY               || Log is empty&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
struct log_entry *outputPtr;&lt;br /&gt;
...&lt;br /&gt;
// Read log_entry into outputPtr and remove the oldest unread log entry&lt;br /&gt;
status = oceos_log_remove_entry(outputPtr);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_log_reset()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''system_log.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function sets all log entries to LOG_LOG_NOT_VALID_ENTRY and the log to empty, with the read and write indices set to 0.&lt;br /&gt;
The log is empty if the index of the next write is the same as the index of the next read. It does not affect the system status variable. It does not affect the context switch log.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * oceos_log_reset()&lt;br /&gt;
 *&lt;br /&gt;
 * Set all log entries to LOG_LOG_NOT_VALID_ENTRY and the log to empty, with the&lt;br /&gt;
 * read and write indices set to 0. and function called flag 0&lt;br /&gt;
 *&lt;br /&gt;
 * The log is empty if the index of the next write&lt;br /&gt;
 * is the same as the index of the next read.&lt;br /&gt;
 *&lt;br /&gt;
 * Does not affect the system status variable&lt;br /&gt;
 * Does not affect the context switch log&lt;br /&gt;
 *&lt;br /&gt;
 * N.B The fixed data area may no longer be writable&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_LOG_CORRUPT         System Log area corrupt; reset failed&lt;br /&gt;
 *          ERR_WRONG_PHASE             Log directive called in wrong phase; can be used after oceos_init() called&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to acquire log guard&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_log_reset(void);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
There are no input parameters to this function.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit  !! Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_LOG_CORRUPT         || System Log area corrupt; reset failed&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Log directive called in wrong phase; can be used after oceos_init() called&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to acquire log guard&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
// Clear down the system log&lt;br /&gt;
status = oceos_log_reset();&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_log_get_size()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''system_log.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the number of entries in the log according to the current values of the read and write indices.&lt;br /&gt;
The value will be zero if the current values of the read and write indices are the same. There may still be useful information in the log, e.g. after system reset, this can be accessed using oceos_log_get_indexed_entry().&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Return the number of entries in the log&lt;br /&gt;
 * according to the current values of the read and write indices.&lt;br /&gt;
 *&lt;br /&gt;
 * The value will be zero if the current values of the read and write indices&lt;br /&gt;
 * are the same.&lt;br /&gt;
 *&lt;br /&gt;
 * There may still be useful information in the log, e.g. after system reset,&lt;br /&gt;
 * this can be accessed using oceos_log_get_indexed_entry()&lt;br /&gt;
 *&lt;br /&gt;
 * @param l_size        pointer to log size holder&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_LOG_CORRUPT         System Log area corrupt;&lt;br /&gt;
 *          ERR_WRONG_PHASE             Log directive called in wrong phase; can be used after oceos_init() called&lt;br /&gt;
 *          ERR_LOG_DATA_PTR_BAD        Pointer to log size holder is NULL&lt;br /&gt;
 *          ERR_LOG_INDEX_WRONG         Read/write log index is wrong&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_log_get_size(&lt;br /&gt;
    U32_t *l_size&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| l_size|| U32_t pointer where size will be written.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit  !! Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_LOG_CORRUPT         || System Log area corrupt;&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Log directive called in wrong phase; can be used after oceos_init() called&lt;br /&gt;
|-&lt;br /&gt;
| ERR_LOG_DATA_PTR_BAD        || Pointer to log size holder is NULL&lt;br /&gt;
|-&lt;br /&gt;
| ERR_LOG_INDEX_WRONG         || Read/write log index is wrong&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, size;&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
// Clear down the system log&lt;br /&gt;
status = oceos_log_get_size(&amp;amp;size);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;System State Variable and System State Mask&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The System State variable provides a record of anomalies or problems detected by OCEOSmp's automatic consistency checks. An application handler for these can be set to be called automatically.&lt;br /&gt;
&lt;br /&gt;
An anomaly or problem results in a flag bit being set in the 32-bit word used to store the system state variable. The flags are identified below.&lt;br /&gt;
&lt;br /&gt;
All flags are reset to zero by oceos_init() when OCEOSmp is initialised, and may also be reset by the application using the directive provided.&lt;br /&gt;
&lt;br /&gt;
To provide a record across OCEOSmp restarts a copy is updated automatically whenever the state variable is updated. This is not cleared by oceos_init() but may be cleared by the application using a directive.&lt;br /&gt;
&lt;br /&gt;
Application software can define a problem handling function to be called automatically when specified system state flags are set. The flags are specified by setting the corresponding bits in the system state mask. The function and the state mask are defined in the system configuration.&lt;br /&gt;
&lt;br /&gt;
Changing a state flag from clear to set results in the function being called (if defined). Subsequent settings of that flag have no effect until after it has been cleared using the directive provided.&lt;br /&gt;
&lt;br /&gt;
N.B. In many cases when OCEOSmp sets a System State flag it also makes an entry in the system log that provides further information.&lt;br /&gt;
&lt;br /&gt;
SYSTEM STATE VARIABLE FLAGS&lt;br /&gt;
&lt;br /&gt;
These flags are updated by OCEOSmp using inclusive 'OR' when a consistency check detects a problem or anomaly. A copy of the system state variable is updated also and accumulates a record of flag settings that is preserved across restarts of OCEOSmp. OCEOSmp restarts reset the system state variable but not the copy.&lt;br /&gt;
&lt;br /&gt;
Resetting the state variables is the responsibility of the application (except for the state variable reset done when OCEOSmp is restarted).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''System Status Bits'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
#define  STATUS_NORMAL                    0u    // No flag set                              YES&lt;br /&gt;
#define  STATUS_INVALID          0xffffffffu    // System status is invalid                 YES BUT NO DETAIL!!!&lt;br /&gt;
&lt;br /&gt;
#define  STATUS_MASK_NORMAL      0xffffffffu    // Always call user def fn                  YES&lt;br /&gt;
&lt;br /&gt;
/* Task related problems */&lt;br /&gt;
#define  STATUS_DISABLED_TASK_START    0x1U    // An attempt to start a disabled task&lt;br /&gt;
#define  STATUS_TASK_JOB_LIMIT_OVER    0x2U    // An attempt to execute a task when its jobs limit is already reached.&lt;br /&gt;
#define  STATUS_JOB_OVER_TIME          0x4U    // Job time from creation to completion exceeds allowed maximum for task. YES&lt;br /&gt;
#define  STATUS_JOB_INTERVAL_SHORT     0x8U    // Minimum time between job creations is less than the allowed minimum for task&lt;br /&gt;
#define  STATUS_READYQ_FULL           0x10U    // Ready queue unable to accept job as result of being full&lt;br /&gt;
#define  STATUS_READYQ_NO_REMOVE      0x20U    // Remove job from ready queue failed&lt;br /&gt;
&lt;br /&gt;
/* Mutex related problems */&lt;br /&gt;
#define  STATUS_MUTEX_ALREADY_HELD    0x40U    // Mutex wait() when mutex already held&lt;br /&gt;
#define  STATUS_MUTEX_NOT_HELD        0x80U    // Mutex signal() when not already held&lt;br /&gt;
#define  STATUS_MUTEX_NOT_RETURNED   0x100U    // Mutex not returned before job terminates&lt;br /&gt;
#define  STATUS_MUTEX_NOT_NESTED     0x200U    // Use of multiple mutexes not nested&lt;br /&gt;
&lt;br /&gt;
/* Counting semaphore and data queue related problems */&lt;br /&gt;
#define  STATUS_SEMAPHORE_JOBS_FULL  0x400U    // Attempt to add job to semaphore pending list when list full&lt;br /&gt;
#define  STATUS_DATAQ_JOBS_FULL      0x800U    // Attempt to add job to data queue pending list when list full&lt;br /&gt;
#define  STATUS_DATAQ_FULL          0x1000U    // Data queue write when queue already full&lt;br /&gt;
&lt;br /&gt;
/* Timed actions related problems */&lt;br /&gt;
#define  STATUS_TIMED_JOBS_FULL     0x2000U    // Timed actions queue already full for timed task start&lt;br /&gt;
#define  STATUS_TIMED_OUTPUT_FULL   0x4000U    // Timed actions queue already full for timed output&lt;br /&gt;
#define  STATUS_TIMED_ACTION_LATE   0x8000U    // Timed action late                          YES&lt;br /&gt;
&lt;br /&gt;
/* Default trap handler should have been replaced&lt;br /&gt;
 * NOT USED AT THE MOMENT*/&lt;br /&gt;
#define  STATUS_SYSTEM_ERROR       0x10000U    // ERROR was handled by default trap handler  YES&lt;br /&gt;
&lt;br /&gt;
/* Flag to indicate problem with Stack Pointer&lt;br /&gt;
 * NOT USED AT THE MOMENT*/&lt;br /&gt;
#define  STATUS_SP_WARNING         0x20000U    // SP not in expected range&lt;br /&gt;
/* Log system error */&lt;br /&gt;
#define  STATUS_BAD_LOG            0x40000U    // System log problem&lt;br /&gt;
#define  STATUS_SPIN_FAILED        0x80000U    // Get SPIN lock failed&lt;br /&gt;
/* Not using next few bits */&lt;br /&gt;
&lt;br /&gt;
/* Will have to exit */&lt;br /&gt;
#define  STATUS_BAD_SENTINEL     0x40000000U    // Area sentinel corrupt&lt;br /&gt;
#define  STATUS_BAD_META_PTR     0x80000000U    // Null meta pointer&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_system_state_get()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''system_log.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns of the system state variable.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Returns the value of the system state variable&lt;br /&gt;
 *&lt;br /&gt;
 * @param state  pointer to state holder&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_LOG_DATA_PTR_BAD        Data holder pointer is null&lt;br /&gt;
 *          ERR_SYS_LOG_CORRUPT         LOG dynamic pointer is null&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_system_state_get(&lt;br /&gt;
    U32_t *state // pointer to state holder&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| state || U32_t pointer to state holder&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit  !! Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_LOG_DATA_PTR_BAD        || Data holder pointer is null&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_LOG_CORRUPT         || LOG dynamic pointer is null&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, state;&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
// Get the system state&lt;br /&gt;
status = oceos_system_state_get(&amp;amp;state);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_system_state_set()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''system_log.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function sets system state variable.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Sets system state variable&lt;br /&gt;
 *&lt;br /&gt;
 * @param new_state&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_LOG_CORRUPT         LOG dynamic pointer is null&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_system_state_set(&lt;br /&gt;
    U32_t new_state   // new value of system state variable&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| new_state || U32_t containing new system state&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit  !! Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_LOG_CORRUPT         || LOG dynamic pointer is null&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, new_state;&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
// Set new system state&lt;br /&gt;
status = oceos_system_state_set(new_state);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_system_state_copy_get()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''system_log.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the value of the system state copy variable.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Returns the value of the copy of system state variable&lt;br /&gt;
 *&lt;br /&gt;
 * @param state  pointer to state holder&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_LOG_DATA_PTR_BAD        Data holder pointer is null&lt;br /&gt;
 *          ERR_SYS_LOG_CORRUPT         LOG dynamic pointer is null&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_system_state_copy_get(&lt;br /&gt;
    U32_t *state // pointer to state copy holder&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| state || U32_t pointer to state copy holder&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit  !! Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_LOG_DATA_PTR_BAD        || Data holder pointer is null&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_LOG_CORRUPT         || LOG dynamic pointer is null&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, copy_state;&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
// Get the system state copy&lt;br /&gt;
status = oceos_system_state_copy_get(&amp;amp;copy_state);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_system_state_copy_set()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''system_log.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function loads a value to tha system state copy variable.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Sets system state copy variable&lt;br /&gt;
 *&lt;br /&gt;
 * @param new_state&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_LOG_CORRUPT         LOG dynamic pointer is null&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_system_state_copy_set(&lt;br /&gt;
    U32_t new_state   // new value of system state variable&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| new_state || U32_t containing new system state copy&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit  !! Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_LOG_CORRUPT         || LOG dynamic pointer is null&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, new_state;&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
// Set new system state copy&lt;br /&gt;
status = oceos_system_state_copy_set(new_state);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Timing directives ==&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;Introduction&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''SPARC'''&lt;br /&gt;
&lt;br /&gt;
In OCEOS system time is based on two chained 32-bit timers.&lt;br /&gt;
&lt;br /&gt;
No interrupts are involved, the current system time is obtained by reading the two timer counter registers (in an atomic way) and then inverting the&lt;br /&gt;
values since the timers count down.&lt;br /&gt;
&lt;br /&gt;
The scaler associated with the timers is configured based on the system clock frequency to decrement the low order timer every microsecond. This&lt;br /&gt;
decrements the high order timer when it rolls over, every 71.6 minutes approximately. The 64-bit time range is very long, over 584,000 years.&lt;br /&gt;
&lt;br /&gt;
'''ARM Cortex-M'''&lt;br /&gt;
&lt;br /&gt;
In OCEOS for ARM Cortex-M, system time is based on SysTick. The processor has a 24-bit system timer, SysTick, that counts down from the reload value to zero, reloads (wraps to) the value in the LOAD register on the next clock edge, then counts down on subsequent clocks.&lt;br /&gt;
&lt;br /&gt;
Note: When the processor is halted for debugging the counter does not decrement.&lt;br /&gt;
&lt;br /&gt;
OCEOS initializes the timer to be driven from MCK and counting down to zero asserts SysTick exception request.&lt;br /&gt;
OCEOS has 64 bit counter which is increased by 0xFFFFFF value every time timer reloads.&lt;br /&gt;
&lt;br /&gt;
'''RISC-V'''&lt;br /&gt;
&lt;br /&gt;
In OCEOS for RISC-V systems time is based internally on clock cycles.&lt;br /&gt;
The RISC-V processor typically has a 64 bit counter (typically mtime) that  updates automatically on each clock cycle. Each hart typically has its own comparison register (typically mtimecmp) that can be used to interrupt that hart when a certain cycle count has been exceeded.&lt;br /&gt;
If a particular RISC-V implementation provides a more restricted clock cycle count this will be used with appropriate modifications as clock cycles give the best timing precision available.&lt;br /&gt;
&lt;br /&gt;
Note: The application configuration provides the constant needed to allow microseconds (as used in OCEOS directives) be converted to clock cycles. Time is reported by OCEOSmp as the number of microseconds since OCEOS was initialized.&lt;br /&gt;
&lt;br /&gt;
A potential difficulty arises if the main system clock rate can change for power saving or other reasons, each system is probably different with regard to this. OCEOSmp can handle this, if needed.&lt;br /&gt;
&lt;br /&gt;
The units of OCEOS system time are microseconds on SPARC and ARM and on RISC-V the period of the clock cycle.&lt;br /&gt;
&lt;br /&gt;
The system time is reset to 0 by oceos_init()&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_time_sys_get64()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''oceos_timer.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the current system time as a 64-bit number.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
**&lt;br /&gt;
 * Get the current system time (64-bit)&lt;br /&gt;
 *&lt;br /&gt;
 * @return U64_t&lt;br /&gt;
 */&lt;br /&gt;
U64_t oceos_time_sys_get64(void);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There are no parameters to this function.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S64_t with the current system time.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S64_t now;&lt;br /&gt;
...&lt;br /&gt;
// Get the time&lt;br /&gt;
now = oceos_time_sys_get64();&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_time_sys_get32()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''oceos_timer.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the low 32 bits of the system time.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Get the current system time (low 32 bits of 64 bit value)&lt;br /&gt;
 *&lt;br /&gt;
 * @return U32_t&lt;br /&gt;
 */&lt;br /&gt;
U32_t oceos_time_sys_get32(void);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
There are no parameters to this function.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with the current system time.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t now;&lt;br /&gt;
...&lt;br /&gt;
// Get the time&lt;br /&gt;
now = oceos_time_sys_get32();&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:backup]]&lt;/div&gt;</summary>
		<author><name>Bkavanagh</name></author>
	</entry>
	<entry>
		<id>https://wiki.ocetechnology.com/mediawiki/index.php?title=OCEOSmp/directive_reference&amp;diff=1704</id>
		<title>OCEOSmp/directive reference</title>
		<link rel="alternate" type="text/html" href="https://wiki.ocetechnology.com/mediawiki/index.php?title=OCEOSmp/directive_reference&amp;diff=1704"/>
		<updated>2024-05-03T17:03:02Z</updated>

		<summary type="html">&lt;p&gt;Bkavanagh: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Introduction =&lt;br /&gt;
&lt;br /&gt;
To be added&lt;br /&gt;
&lt;br /&gt;
= Directives =&lt;br /&gt;
&lt;br /&gt;
== Initialisation directives ==&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_init()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''initialisation.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Initialises OCEOS and  must be the first directive used.&lt;br /&gt;
&lt;br /&gt;
Initialises the OCEOS system meta data using the information supplied in the application configuration and prepares for creation of tasks etc.&lt;br /&gt;
&lt;br /&gt;
The values provided in the application configuration are checked as much as possible before being used.&lt;br /&gt;
&lt;br /&gt;
The system log also is created here.&lt;br /&gt;
&lt;br /&gt;
This function sets up sysMetaPtr and init_meta_ptr and must have completed successfully before tasks etc. can be created.&lt;br /&gt;
&lt;br /&gt;
It disables interrupts and leaves them disabled, they will be re-enabled to the previous level after all tasks etc. have been created and [[OCEOSmp/directive_reference#oceos_init_finish()|oceos_init_finish()]] has completed successfully.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Initialises OCEOS and  must be the first directive used.&lt;br /&gt;
 *&lt;br /&gt;
 * Initialises the OCEOS system meta data using the information supplied in&lt;br /&gt;
 * the application configuration and prepares for creation of tasks etc.&lt;br /&gt;
 *&lt;br /&gt;
 * The values provided in the application configuration are checked as much&lt;br /&gt;
 * as possible before being used.&lt;br /&gt;
 *&lt;br /&gt;
 * The system log also is created here.&lt;br /&gt;
 *&lt;br /&gt;
 * This function sets up sysMetaPtr and init_meta_ptr and must have completed&lt;br /&gt;
 * successfully before tasks etc. can be created.&lt;br /&gt;
 *&lt;br /&gt;
 * It disables interrupts and leaves them disabled, they will be re-enabled to&lt;br /&gt;
 * the previous level after all tasks etc. have been created and&lt;br /&gt;
 * oceos_init_finish() has completed successfully.&lt;br /&gt;
 *&lt;br /&gt;
 * @param app_config Pointer to configuration struct&lt;br /&gt;
 * @return SUCCESSFUL                        All OK&lt;br /&gt;
 *         WARN_LOG_SIZE_DEFAULT             Warning, log size is set to default value of 64 entries&lt;br /&gt;
 *         WARN_NO_ERROR_FUNCTION            Warning, user defined function for ERROR handling is not provided&lt;br /&gt;
 *         ERR_CPU_FIRST_CORE_INVALID        Start CPU not in a range of available cores for this target; or greater than end CPU&lt;br /&gt;
 *         ERR_CPU_LAST_CORE_INVALID         Last CPU not in a range of available cores for this target&lt;br /&gt;
 *         ERR_NOT_START_CPU_CORE            Executing oceos_init on wrong CPU&lt;br /&gt;
 *         ERR_STACK_START_MISALIGNED        Stack start address is not set by user misaligned&lt;br /&gt;
 *         ERR_STACK_PER_CORE_INVALID        Stack per CPU size is zero, or not 8byte aligned, or less then min require&lt;br /&gt;
 *         ERR_LOG_ADDR_MISALIGNED           Log start address is not 8 byte aligned&lt;br /&gt;
 *         ERR_FIX_ADDR_MISALIGNED           Fixed area start address is not 8 byte aligned&lt;br /&gt;
 *         ERR_DYN_ADDR_MISALIGNED           Dynamic area start address is not 8 byte aligned&lt;br /&gt;
 *         ERR_CPU_CORE_RANGE_WRONG          CPU cores in use exceed available CPUs on the SoC&lt;br /&gt;
 *         ERR_STACK_SPACE_WRONG             Current CPU SP is not within user provided stack range&lt;br /&gt;
 *         ERR_LOG_SIZE_INVALID              Log size outside expected range&lt;br /&gt;
 *         ERR_CS_LOG_SIZE_INVALID           Context switch log size invalid&lt;br /&gt;
 *         ERR_TASK_NUMBER_INVALID           Number of tasks invalid&lt;br /&gt;
 *         ERR_MUTEX_NUMBER_INVALID          Number of mutexes invalid&lt;br /&gt;
 *         ERR_RWMUTEX_NUMBER_INVALID        Number of rwmutexes invalid&lt;br /&gt;
 *         ERR_SEM_NUMBER_INVALID            Number of semaphores invalid&lt;br /&gt;
 *         ERR_DATAQ_NUMBER_INVALID          Number of datqs invalid&lt;br /&gt;
 *         ERR_TIMED_ACTIONS_NUMBER_INVALID  Number of timed actions invalid&lt;br /&gt;
 *         ERR_OVERLAP_STACK                 Overlap stack end address with (two overlap areas are set)&lt;br /&gt;
 *         ERR_OVERLAP_LOG                   Overlap log with (two overlap areas are set)&lt;br /&gt;
 *         ERR_OVERLAP_FIXED                 Overlap fixed area with (two overlap areas are set)&lt;br /&gt;
 *         ERR_OVERLAP_DYNAMIC               Overlap dynamic area with (two overlap areas are set)&lt;br /&gt;
 *         ERR_FIXED_MEMORY_FAILED           Fixed area memory write fail&lt;br /&gt;
 *         ERR_DYNAMIC_MEMORY_FAILED         Dynamic area memory write fail&lt;br /&gt;
 *         ERR_TIMER_ADDR_INVALID            Timer address not provided by user (null). SPARC only&lt;br /&gt;
 *         ERR_SYS_TIMER_INDEX_INVALID       System timer index of subtimer invalid; SPARC only; Subtimers start from index 1; Need index of subtimer plus one in front&lt;br /&gt;
 *         ERR_PERIPHERAL_CLOCK_INVALID      System peripheral code invalid&lt;br /&gt;
 *&lt;br /&gt;
 */&lt;br /&gt;
S32_t   oceos_init(&lt;br /&gt;
    const struct application_configuration app_config&lt;br /&gt;
);&lt;br /&gt;
 &amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| app_config || Pointer to configuration struct.  struct application_configuration defined in '''''basic_structs.h'''''&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| WARN_LOG_SIZE_DEFAULT             || Warning, log size is set to default value of 64 entries&lt;br /&gt;
|-&lt;br /&gt;
| WARN_NO_ERROR_FUNCTION            || Warning, user defined function for ERROR handling is not provided&lt;br /&gt;
|-&lt;br /&gt;
| ERR_CPU_FIRST_CORE_INVALID        || Start CPU not in a range of available cores for this target; or greater than end CPU&lt;br /&gt;
|-&lt;br /&gt;
| ERR_CPU_LAST_CORE_INVALID         || Last CPU not in a range of available cores for this target&lt;br /&gt;
|-&lt;br /&gt;
| ERR_NOT_START_CPU_CORE            || Executing oceos_init on wrong CPU&lt;br /&gt;
|-&lt;br /&gt;
| ERR_STACK_START_MISALIGNED        || Stack start address is not set by user misaligned&lt;br /&gt;
|-&lt;br /&gt;
| ERR_STACK_PER_CORE_INVALID        || Stack per CPU size is zero, or not 8byte aligned, or less then min require&lt;br /&gt;
|-&lt;br /&gt;
| ERR_LOG_ADDR_MISALIGNED           || Log start address is not 8 byte aligned&lt;br /&gt;
|-&lt;br /&gt;
| ERR_FIX_ADDR_MISALIGNED           || Fixed area start address is not 8 byte aligned&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DYN_ADDR_MISALIGNED           || Dynamic area start address is not 8 byte aligned&lt;br /&gt;
|-&lt;br /&gt;
| ERR_CPU_CORE_RANGE_WRONG          || CPU cores in use exceed available CPUs on the SoC&lt;br /&gt;
|-&lt;br /&gt;
| ERR_STACK_SPACE_WRONG             || Current CPU SP is not within user provided stack range&lt;br /&gt;
|-&lt;br /&gt;
| ERR_LOG_SIZE_INVALID              || Log size outside expected range&lt;br /&gt;
|-&lt;br /&gt;
| ERR_CS_LOG_SIZE_INVALID           || Context switch log size invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TASK_NUMBER_INVALID           || Number of tasks invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_MUTEX_NUMBER_INVALID          || Number of mutexes invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_RWMUTEX_NUMBER_INVALID        || Number of rwmutexes invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SEM_NUMBER_INVALID            || Number of semaphores invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DATAQ_NUMBER_INVALID          || Number of datqs invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TIMED_ACTIONS_NUMBER_INVALID  || Number of timed actions invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_OVERLAP_STACK                 || Overlap stack end address with (two overlap areas are set)&lt;br /&gt;
|-&lt;br /&gt;
| ERR_OVERLAP_LOG                   || Overlap log with (two overlap areas are set)&lt;br /&gt;
|-&lt;br /&gt;
| ERR_OVERLAP_FIXED                 || Overlap fixed area with (two overlap areas are set)&lt;br /&gt;
|-&lt;br /&gt;
| ERR_OVERLAP_DYNAMIC               || Overlap dynamic area with (two overlap areas are set)&lt;br /&gt;
|-&lt;br /&gt;
| ERR_FIXED_MEMORY_FAILED           || Fixed area memory write fail&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DYNAMIC_MEMORY_FAILED         || Dynamic area memory write fail&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TIMER_ADDR_INVALID            || Timer address not provided by user (null). SPARC only&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_TIMER_INDEX_INVALID       || System timer index of subtimer invalid; SPARC only; Subtimers start from index 1; Need index of subtimer plus one in front&lt;br /&gt;
|-&lt;br /&gt;
| ERR_PERIPHERAL_CLOCK_INVALID      || System peripheral code invalid&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
    /*&lt;br /&gt;
     * Create the application configuration structure&lt;br /&gt;
     */&lt;br /&gt;
    struct application_configuration           app_config = {0};&lt;br /&gt;
&lt;br /&gt;
    /*&lt;br /&gt;
     * Fill in the application parameters&lt;br /&gt;
     */&lt;br /&gt;
    app_config.log_address                   = (log_t)log_data;              // required&lt;br /&gt;
    app_config.fixed_data_address            = (adrs_t)fixed_data;            // required&lt;br /&gt;
    app_config.dynamic_data_address          = (adrs_t)dynamic_data;          // required&lt;br /&gt;
&lt;br /&gt;
    app_config.stack_start_address           = start_stack_array[OCEOS_START_CPU_INDEX];// OCEOSMP_STACK_START_ADDRESS;&lt;br /&gt;
    app_config.stack_size_per_cpu            = (U32_t)&amp;amp;__oceos_stack_size_per_cpu;  // OCEOSMP_STACK_LOW_BOUND_ADDRESS;&lt;br /&gt;
&lt;br /&gt;
    app_config.system_error_function         = oceosmp_on_error;               // NULL =&amp;gt; ignore&lt;br /&gt;
    app_config.log_full_function             = oceosmp_on_full_log;            // NULL =&amp;gt; ignore&lt;br /&gt;
&lt;br /&gt;
    // used in setting up system log and fixed data array&lt;br /&gt;
    app_config.log_number_of_entries         = NUMBER_OF_LOG_ENTRIES;          // 0 =&amp;gt; use default&lt;br /&gt;
&lt;br /&gt;
    app_config.number_of_tasks               = NUMBER_OF_TASKS;                // &amp;gt;= 1&lt;br /&gt;
&lt;br /&gt;
    app_config.number_of_mutexes             = NUMBER_OF_MUTEXES;&lt;br /&gt;
	app_config.number_of_rwmutexes			 = NUMBER_OF_RWMUTEXES;&lt;br /&gt;
    app_config.number_of_counting_semaphores = NUMBER_OF_SEMAPHORES;&lt;br /&gt;
    app_config.number_of_data_queues         = NUMBER_OF_DATAQS;&lt;br /&gt;
&lt;br /&gt;
    /**&lt;br /&gt;
     * FOR SPARC TARGET ONLY.&lt;br /&gt;
     */&lt;br /&gt;
    app_config.sys_time_timer_index          = SYS_TIME_TIMER_INDEX;           // 0 =&amp;gt; invalid index&lt;br /&gt;
    /**&lt;br /&gt;
     * FOR SPARC TARGET ONLY.&lt;br /&gt;
     * Not Used for ARM. Always Nested&lt;br /&gt;
     */&lt;br /&gt;
    app_config.interrupt_nesting_enabled     = TRUE;                           // TRUE =&amp;gt; single vector&lt;br /&gt;
    app_config.oceos_cpu_switch_int_number   = OCEOS_CPU_INTER_COM_INT_NUMBER; // User should provide SGI ID (0-15)&lt;br /&gt;
&lt;br /&gt;
    app_config.timed_actions_queue_size      = NUMBER_OF_ACTION_ENTRIES;&lt;br /&gt;
    app_config.CS_log_entries_base2          = CS_LOG_DEF_ENTRIES_BASE2;&lt;br /&gt;
    /**&lt;br /&gt;
     * Set starting index of CPU that will be used by OCEOSMP&lt;br /&gt;
     */&lt;br /&gt;
    app_config.oceos_cpu_start_index         = OCEOS_START_CPU_INDEX;&lt;br /&gt;
    /**&lt;br /&gt;
     * Set last index of CPU that will be used by OCEOSMP&lt;br /&gt;
     */&lt;br /&gt;
    app_config.oceos_cpu_last_index          = OCEOS_LAST_CPU_INDEX;&lt;br /&gt;
    /*&lt;br /&gt;
     * Set system/peripheral clock used to initialise system timer&lt;br /&gt;
     */&lt;br /&gt;
    app_config.soc_peripheral_clck           = BSP_SYSFREQ * 1000 * 1000;&lt;br /&gt;
&lt;br /&gt;
    // initialise OCEOSMP&lt;br /&gt;
    S32_t status;&lt;br /&gt;
    status = oceos_init(app_config);&lt;br /&gt;
    if (OCEOS_SUCCESS &amp;gt; status) {&lt;br /&gt;
      oceosmp_print(&amp;quot;\n oceos_init failure\n\r&amp;quot;);&lt;br /&gt;
      return 0;&lt;br /&gt;
    } else {&lt;br /&gt;
      return 1;&lt;br /&gt;
    }   // else&lt;br /&gt;
 &amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_init_finish()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''initialisation.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Finalizes the fixed data array after all tasks etc. have been created&lt;br /&gt;
&lt;br /&gt;
All information needed to start OCEOS can be found in the fixed data area&lt;br /&gt;
when oceos_init_finish() has completed.&lt;br /&gt;
&lt;br /&gt;
Once all tasks etc. have been created oceos_init_finish() checks the&lt;br /&gt;
accumulated information against the application configuration data&lt;br /&gt;
stored in the fixed meta structure.&lt;br /&gt;
&lt;br /&gt;
oceos_init_finish also calculates the size of the dynamic data area and&lt;br /&gt;
checks it does not overlap with the system stack, the system log, or the&lt;br /&gt;
fixed data, and if all ok sets up pointers to the various dynamic area&lt;br /&gt;
components in the fixed data.&lt;br /&gt;
&lt;br /&gt;
It then adds an XOR checksum to the fixed data area, and checks that this&lt;br /&gt;
is followed by FILLER, which it replaces with the end sentinel.&lt;br /&gt;
&lt;br /&gt;
On successful completion it restores the interrupt level to its value&lt;br /&gt;
before oceos_init() was called, otherwise interrupts remain disabled.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Finalizes the fixed data array after all tasks etc. have been created&lt;br /&gt;
 *&lt;br /&gt;
 * All information needed to start OCEOS can be found in the fixed data area&lt;br /&gt;
 * when oceos_init_finish() has completed.&lt;br /&gt;
 *&lt;br /&gt;
 * Once all tasks etc. have been created oceos_init_finish() checks the&lt;br /&gt;
 * accumulated information against the application configuration data&lt;br /&gt;
 * stored in the fixed meta structure.&lt;br /&gt;
 *&lt;br /&gt;
 * oceos_init_finish also calculates the size of the dynamic data area and&lt;br /&gt;
 * checks it does not overlap with the system stack, the system log, or the&lt;br /&gt;
 * fixed data, and if all ok sets up pointers to the various dynamic area&lt;br /&gt;
 * components in the fixed data.&lt;br /&gt;
 *&lt;br /&gt;
 * It then adds an XOR checksum to the fixed data area, and checks that this&lt;br /&gt;
 * is followed by FILLER, which it replaces with the end sentinel.&lt;br /&gt;
 *&lt;br /&gt;
 * On successful completion it restores the interrupt level to its value&lt;br /&gt;
 * before oceos_init() was called, otherwise interrupts remain disabled.&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS                             All OK&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT               System Meta data is NULL or corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT                 System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_CPU_CORE                  Executing directive on wrong CPU&lt;br /&gt;
 *          ERR_WRONG_PHASE                     Called before oceos_init()&lt;br /&gt;
 *          ERR_TASKS_INCOMPLETE                Created wrong number of tasks&lt;br /&gt;
 *          ERR_MUTEX_INCOMPLETE                Created wrong number of mutexes&lt;br /&gt;
 *          ERR_RWMUTEX_INCOMPLETE              Created wrong number of rwmutexes&lt;br /&gt;
 *          ERR_SEM_INCOMPLETE                  Created wrong number of semaphores&lt;br /&gt;
 *          ERR_DATAQ_INCOMPLETE                Created wrong number of dataqs&lt;br /&gt;
 *          ERR_TASK_MAX_ID_INVALID             Task's max id invalid&lt;br /&gt;
 *          ERR_MUTEX_MAX_ID_INVALID            Mutexe's max id invalid&lt;br /&gt;
 *          ERR_RWMUTEX_MAX_ID_INVALID          Rwmutexe's max id invalid&lt;br /&gt;
 *          ERR_SEM_MAX_ID_INVALID              Semaphore's max id invalid&lt;br /&gt;
 *          ERR_DATAQ_MAX_ID_INVALID            Dataq's max id invalid&lt;br /&gt;
 *          ERR_TOTAL_JOBS_NUMBER_WRONG         Wrong number of total jobs created&lt;br /&gt;
 *          ERR_ORDER_ARRAY_PTR_INVALID         Order array pointer is NULL or mis-aligned&lt;br /&gt;
 *          ERR_FIXED_AREA_TOO_SMALL            Not enough space for fixed data area&lt;br /&gt;
 */&lt;br /&gt;
S32_t   oceos_init_finish(void);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
There are no input parameters to this function.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit  || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT               || System Meta data is NULL or corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT                 || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_CPU_CORE                  || Executing directive on wrong CPU&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE                     || Called before oceos_init()&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TASKS_INCOMPLETE                || Created wrong number of tasks&lt;br /&gt;
|-&lt;br /&gt;
| ERR_MUTEX_INCOMPLETE                || Created wrong number of mutexes&lt;br /&gt;
|-&lt;br /&gt;
| ERR_RWMUTEX_INCOMPLETE              || Created wrong number of rwmutexes&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SEM_INCOMPLETE                  || Created wrong number of semaphores&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DATAQ_INCOMPLETE                || Created wrong number of dataqs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TASK_MAX_ID_INVALID             || Task's max id invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_MUTEX_MAX_ID_INVALID            || Mutexe's max id invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_RWMUTEX_MAX_ID_INVALID          || Rwmutexe's max id invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SEM_MAX_ID_INVALID              || Semaphore's max id invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DATAQ_MAX_ID_INVALID            || Dataq's max id invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TOTAL_JOBS_NUMBER_WRONG         || Wrong number of total jobs created&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ORDER_ARRAY_PTR_INVALID         || Order array pointer is NULL or mis-aligned&lt;br /&gt;
|-&lt;br /&gt;
| ERR_FIXED_AREA_TOO_SMALL            || Not enough space for fixed data area&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
    /*&lt;br /&gt;
     * Finish initialising OCEOS and setting up the fixed data&lt;br /&gt;
     */&lt;br /&gt;
    status = oceos_init_finish();&lt;br /&gt;
    if(OCEOS_SUCCESS &amp;gt; status){&lt;br /&gt;
        // LOG&lt;br /&gt;
      oceosmp_print(&amp;quot;\nAbandoning, problem ending OCEOS initialisation\n\r&amp;quot;);&lt;br /&gt;
        return -1;&lt;br /&gt;
    }   // if&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_start()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''initialisation.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Starts OCEOS scheduling.&amp;lt;br&amp;gt;&lt;br /&gt;
Create dynamic OCEOS structures and start scheduling.&amp;lt;br&amp;gt;&lt;br /&gt;
This function should only be called once and only after [[OCEOSmp/directive_reference#oceos_init()|oceos_init()]] and [[OCEOSmp/directive_reference#oceos_init_finish()|oceos_init_finish()]] have been called successfully.&amp;lt;br&amp;gt;&lt;br /&gt;
Normally this function does not return. &amp;lt;br&amp;gt;&lt;br /&gt;
If a problem is detected the function terminates and returns an appropriate DIRECTIVE_STATUS code, with interrupts disabled.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Starts OCEOS scheduling&lt;br /&gt;
 *&lt;br /&gt;
 * Create dynamic OCEOS structures and start scheduling&lt;br /&gt;
 *&lt;br /&gt;
 * This function should only be called once&lt;br /&gt;
 * and only after oceos_init()&lt;br /&gt;
 * and oceos_init_finish() have&lt;br /&gt;
 *  been called successfully.&lt;br /&gt;
 * Normally this function does not return.&lt;br /&gt;
 * If a problem is detected the function&lt;br /&gt;
 * terminates and returns an appropriate&lt;br /&gt;
 * DIRECTIVE_STATUS code, with interrupts disabled.&lt;br /&gt;
 *&lt;br /&gt;
 * @param fixed_array_ptr   Pointer to fixed data array&lt;br /&gt;
 * @param start_task        Task ID&lt;br /&gt;
 * @param data_ptr          Pointer to data to be passed to the task&lt;br /&gt;
 * @return  OCEOSMP_EXIT                        OCEOSMP return from scheduling and exit&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT               Fixed area pointer is null or bad sentinel&lt;br /&gt;
 *          ERR_FIXED_AREA_SIZE_WRONG           Fixed area size is zero&lt;br /&gt;
 *          ERR_FIXED_AREA_END_SENTINEL_BAD     Fixed data end sentinel corrupt&lt;br /&gt;
 *          ERR_FIXED_AREA_BAD_XOR              Fixed area bad checksum or checksum mis-match&lt;br /&gt;
 *          ERR_INIT_NOT_DONE                   oceos_start() called without initialisation&lt;br /&gt;
 *          ERR_DYN_AREA_PTR_BAD                Dynamic area pointer invalid in sysMetaPtr&lt;br /&gt;
 *          ERR_INT_HANDLER_BAD                 IRQ controller pointer provided by BCC is NULL;or OCEOS handler is not set&lt;br /&gt;
 *          ERR_DYN_JOB_PTR_BAD                 Job array pointer is NULL&lt;br /&gt;
 *          ERR_FIXED_TASK_PTR_BAD              Tasks array pointer is NULL&lt;br /&gt;
 *          ERR_JOB_COUNT_WRONG                 Total job count inconsistent&lt;br /&gt;
 *          ERR_DYN_MUTEX_PTR_BAD               Mutex dynamic pointer is NULL&lt;br /&gt;
 *          ERR_DYN_LOCK_PTR_BAD                Mutex lock array pointer is NULL&lt;br /&gt;
 *          ERR_DYN_RWMUTEX_PTR_BAD             Rwmutex dynamic pointer is NULL&lt;br /&gt;
 *          ERR_DYN_RWLOCK_PTR_BAD              Rwmutex lock array pointer is NULL&lt;br /&gt;
 *          ERR_FIXED_SEM_PTR_BAD               Semaphore fixed pointer is NULL&lt;br /&gt;
 *          ERR_DYN_SEM_PTR_BAD                 Semaphore dynamic pointer is NULL&lt;br /&gt;
 *          ERR_SEM_PEND_PTR_BAD                Semaphore pending queue pointer is NULL&lt;br /&gt;
 *          ERR_FIXED_DATAQ_PTR_BAD             Dataq fixed pointer is NULL&lt;br /&gt;
 *          ERR_DYN_DATAQ_PTR_BAD               Dataq dynamic pointer is NULL&lt;br /&gt;
 *          ERR_DATAQ_PEND_PTR_BAD              Dataq pending queue pointer is NULL&lt;br /&gt;
 *          ERR_DATAQ_DATA_PTR_BAD              Dataq data pointer is NULL&lt;br /&gt;
 *          ERR_CPU_INT_NUMBER_INVALID          SPARC only.IRQ number for CPU inter-comunication invalid(zero or used by timer)&lt;br /&gt;
 *          ERR_REGISTER_CPU_IRQ_FAILED         SPARC only. Failed to set CPU IRQ handler in BCC&lt;br /&gt;
 *          ERR_CPU_STACK_INVALID               Current CPU stack not within specified range&lt;br /&gt;
 *          ERR_CPU_PRIORITY_STACK_INVALID      Per CPU priority stack invalid&lt;br /&gt;
 *          ERR_LOG_AREA_END_SENTINEL_BAD       Log area end sentinel override&lt;br /&gt;
 *          ERR_TA_CONFIG_PTR_BAD               SPARC only; Timed action configuration data pointer is NULL&lt;br /&gt;
 *          ERR_TA_TIMER_INDEX_INVALID          SPARC only; Timed action sub-timer index in timer unit is invalid&lt;br /&gt;
 *          ERR_TA_IRQ_NUMBER_INVALID           SPARC only; Timer action timer IRQ number is invalid&lt;br /&gt;
 *          ERR_TA_BCC_IRQ_REGISTER_FAILED      SPARC only; Timed action timer IRQ handler failed to register&lt;br /&gt;
 */&lt;br /&gt;
S32_t   oceos_start(&lt;br /&gt;
    const U32_t * const fixed_array_ptr,// pointer to fixed data array&lt;br /&gt;
    const U32_t start_task,             // taskID&lt;br /&gt;
    void * const data_ptr               // pointer to data to be passed to task&lt;br /&gt;
);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| fixed_array_ptr || Pointer to fixed data array&lt;br /&gt;
|-&lt;br /&gt;
| start_task      || Task ID&lt;br /&gt;
|-&lt;br /&gt;
| data_ptr        || Pointer to data to be passed to the task&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit  || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT               || Fixed area pointer is null or bad sentinel&lt;br /&gt;
|-&lt;br /&gt;
| ERR_FIXED_AREA_SIZE_WRONG           || Fixed area size is zero&lt;br /&gt;
|-&lt;br /&gt;
| ERR_FIXED_AREA_END_SENTINEL_BAD     || Fixed data end sentinel corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_FIXED_AREA_BAD_XOR              || Fixed area bad checksum or checksum mis-match&lt;br /&gt;
|-&lt;br /&gt;
| ERR_INIT_NOT_DONE                   || oceos_start() called without initialisation&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DYN_AREA_PTR_BAD                || Dynamic area pointer invalid in sysMetaPtr&lt;br /&gt;
|-&lt;br /&gt;
| ERR_INT_HANDLER_BAD                 || IRQ controller pointer provided by BCC is NULL;or OCEOS handler is not set&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DYN_JOB_PTR_BAD                 || Job array pointer is NULL&lt;br /&gt;
|-&lt;br /&gt;
| ERR_FIXED_TASK_PTR_BAD              || Tasks array pointer is NULL&lt;br /&gt;
|-&lt;br /&gt;
| ERR_JOB_COUNT_WRONG                 || Total job count inconsistent&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DYN_MUTEX_PTR_BAD               || Mutex dynamic pointer is NULL&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DYN_LOCK_PTR_BAD                || Mutex lock array pointer is NULL&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DYN_RWMUTEX_PTR_BAD             || Rwmutex dynamic pointer is NULL&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DYN_RWLOCK_PTR_BAD              || Rwmutex lock array pointer is NULL&lt;br /&gt;
|-&lt;br /&gt;
| ERR_FIXED_SEM_PTR_BAD               || Semaphore fixed pointer is NULL&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DYN_SEM_PTR_BAD                 || Semaphore dynamic pointer is NULL&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SEM_PEND_PTR_BAD                || Semaphore pending queue pointer is NULL&lt;br /&gt;
|-&lt;br /&gt;
| ERR_FIXED_DATAQ_PTR_BAD             || Dataq fixed pointer is NULL&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DYN_DATAQ_PTR_BAD               || Dataq dynamic pointer is NULL&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DATAQ_PEND_PTR_BAD              || Dataq pending queue pointer is NULL&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DATAQ_DATA_PTR_BAD              || Dataq data pointer is NULL&lt;br /&gt;
|-&lt;br /&gt;
| ERR_CPU_INT_NUMBER_INVALID          || SPARC only.IRQ number for CPU inter-comunication invalid(zero or used by timer)&lt;br /&gt;
|-&lt;br /&gt;
| ERR_REGISTER_CPU_IRQ_FAILED         || SPARC only. Failed to set CPU IRQ handler in BCC&lt;br /&gt;
|-&lt;br /&gt;
| ERR_CPU_STACK_INVALID               || Current CPU stack not within specified range&lt;br /&gt;
|-&lt;br /&gt;
| ERR_CPU_PRIORITY_STACK_INVALID      || Per CPU priority stack invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_LOG_AREA_END_SENTINEL_BAD       || Log area end sentinel override&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_CONFIG_PTR_BAD               || SPARC only; Timed action configuration data pointer is NULL&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_TIMER_INDEX_INVALID          || SPARC only; Timed action sub-timer index in timer unit is invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_IRQ_NUMBER_INVALID           || SPARC only; Timer action timer IRQ number is invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_BCC_IRQ_REGISTER_FAILED      || SPARC only; Timed action timer IRQ handler failed to register&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/* Sample Task names - all here start with t_ to help avoid name confusion */&lt;br /&gt;
enum TASK_NAME{&lt;br /&gt;
    t_tom,                      // will have task ID 0&lt;br /&gt;
    t_dick,                     // will have task ID 1&lt;br /&gt;
};&lt;br /&gt;
extern U32_t fixed_data[];&lt;br /&gt;
...&lt;br /&gt;
S32_t status;&lt;br /&gt;
&lt;br /&gt;
status = oceos_start(fixed_data, t_tom, NULL);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_exit()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''initialisation.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Ends scheduling and exit from [[OCEOSmp/directive_reference#oceos_start()|oceos_start()]].&lt;br /&gt;
No task can be started after this.&amp;lt;br&amp;gt;&lt;br /&gt;
OCEOS will exit when the current job ends.&amp;lt;br&amp;gt;&lt;br /&gt;
An idle task in an endless loop should check that scheduling is enabled.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Ends scheduling and exit from oceos_start.&lt;br /&gt;
 * No task can be started after this.&lt;br /&gt;
 * OCEOS will exit when the current job ends.&lt;br /&gt;
 * An idle task in an endless loop should check that scheduling is enabled.&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Called before scheduling started&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_exit(void);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
There are no input parameters to this function.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit  || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Called before scheduling started&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
// Exit OCEOS&lt;br /&gt;
oceos_exit();&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_CPU_sleep()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''initialisation.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
 Puts CPU in sleep mode.&amp;lt;br&amp;gt;&lt;br /&gt;
 User must to be sure that interrupts are enabled.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Puts CPU in sleep mode.&lt;br /&gt;
 * User must to be sure that interrupts are enabled.&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_CPU_sleep(void);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
There are no input parameters to this function.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
// Put CPU to sleep&lt;br /&gt;
oceos_CPU_sleep();&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceosmp_cpu_disable()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''initialisation.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function ends execution of all tasks running on particular CPU and removes the CPU from scheduling.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Ends execution of all tasks running on particular CPU and removes this CPU from scheduling.&lt;br /&gt;
 * @param cpu_id&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              CPU ID outside allowed range 0 to 254&lt;br /&gt;
 *          ERR_ID_WRONG                CPU ID &amp;gt;= number of available CPUs&lt;br /&gt;
 *          ERR_CPU_ALREADY_DISABLED    CPU already disabled&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceosmp_cpu_disable(&lt;br /&gt;
    U32_t cpu_id&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| cpu_id || ID of CPU core to be disabled.&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit  || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || CPU ID outside allowed range 0 to 254&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || CPU ID &amp;gt;= number of available CPUs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_CPU_ALREADY_DISABLED    || CPU already disabled&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, faulty_cpu;&lt;br /&gt;
...&lt;br /&gt;
// Disable faulty CPU core&lt;br /&gt;
status = oceosmp_cpu_disable(faulty_cpu));&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceosmp_cpu_enable()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''initialisation.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function adds a disabled CPU core to the OCEOSmp scheduler. It should only be called after scheduling has started&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 *  Adds disabled CPU to OCEOSmp scheduler&lt;br /&gt;
 *&lt;br /&gt;
 *  N.B. This function should only be called after scheduling has started&lt;br /&gt;
 *&lt;br /&gt;
 * @param cpu_id&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              CPU ID outside allowed range 0 to 254&lt;br /&gt;
 *          ERR_ID_WRONG                CPU ID &amp;gt;= number of available CPUs; or the same as currently running&lt;br /&gt;
 *          ERR_CPU_ALREADY_ENABLED     CPU already enabled&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceosmp_cpu_enable(&lt;br /&gt;
    U32_t cpu_id&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| cpu_id || ID of CPU core to be enabled.&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit  || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || CPU ID outside allowed range 0 to 254&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || CPU ID &amp;gt;= number of available CPUs; or the same as currently running&lt;br /&gt;
|-&lt;br /&gt;
| ERR_CPU_ALREADY_ENABLED     || CPU already enabled&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, good_cpu;&lt;br /&gt;
...&lt;br /&gt;
// Enable CPU core&lt;br /&gt;
status = oceosmp_cpu_enable(good_cpu));&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceosmp_cpu_terminate()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''initialisation.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function removes a CPU core from the OCEOSmp scheduler and marks it so it cannot be restarted. It puts CPU to sleep with interrupts disabled. It should only be called after scheduling has started.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 *  Removes CPU from OCEOSMP scheduler and terminates, cannot be restarted.&lt;br /&gt;
 *  Puts CPU to sleep with interrupts disabled&lt;br /&gt;
 *&lt;br /&gt;
 *  N.B. This function should only be called after scheduling has started&lt;br /&gt;
 *  Steps:&lt;br /&gt;
 *     1. Set terminate flag on this CPU;&lt;br /&gt;
 *     2. Trigger software interrupt to transfer execution to IRQ handler;&lt;br /&gt;
 *     3. Check flag and if set =&amp;gt; put CPU to sleep in while loop with interrupts disabled;&lt;br /&gt;
 *     4. Set MAX priority on this CPU priority stack;&lt;br /&gt;
 *     5. Remove CPU from scheduling;&lt;br /&gt;
 *     6. Clean up all the tasks by calling task terminate function and free up all the&lt;br /&gt;
 *        preempted jobs by this CPU;&lt;br /&gt;
 *&lt;br /&gt;
 * @param cpu_id&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              CPU ID outside allowed range 0 to 254&lt;br /&gt;
 *          ERR_ID_WRONG                CPU ID &amp;gt;= number of available CPUs; or the same as currently running&lt;br /&gt;
 *          ERR_CPU_ALREADY_TERMINATED  CPU already terminated&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceosmp_cpu_terminate(&lt;br /&gt;
    U32_t cpu_id&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| cpu_id || ID of CPU core to be terminated.&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit  || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || CPU ID outside allowed range 0 to 254&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || CPU ID &amp;gt;= number of available CPUs; or the same as currently running&lt;br /&gt;
|-&lt;br /&gt;
| ERR_CPU_ALREADY_TERMINATED  || CPU already terminated&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, faulty_cpu;&lt;br /&gt;
...&lt;br /&gt;
// Terminate CPU core&lt;br /&gt;
status = oceosmp_cpu_terminate(faulty_cpu));&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;Task directives&amp;lt;/span&amp;gt;==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ API Functions&lt;br /&gt;
|-&lt;br /&gt;
| Directive                                                                     || Description                          || main || task || IRQ handler&lt;br /&gt;
|-&lt;br /&gt;
| [[OCEOSmp/directive reference#oceos_task_create()| oceos_task_create()]]             || Create Task                        || *    ||      || &lt;br /&gt;
|-&lt;br /&gt;
| [[OCEOSmp/directive reference#oceos_task_start()| oceos_task_start()]]               || Start Task                         ||      ||  *   || *&lt;br /&gt;
|-&lt;br /&gt;
| [[OCEOSmp/directive reference#oceos_task_timed_start()| oceos_task_timed_start()]]   || Schedule a task to start execution at a given system time||      ||  *   || *&lt;br /&gt;
|-&lt;br /&gt;
| [[OCEOSmp/directive reference#oceos_task_disable()| oceos_task_disable()]]           || Disable Task                       ||      ||  *   || *&lt;br /&gt;
|-&lt;br /&gt;
| [[OCEOSmp/directive reference#oceos_task_enable()| oceos_task_enable()]]             || Enable Task                        ||      ||  *   || *&lt;br /&gt;
|-&lt;br /&gt;
| [[OCEOSmp/directive reference#oceos_task_self()| oceos_task_self()]]                 || Returns the task ID of the currently executing task ||    ||  *   || *&lt;br /&gt;
|-&lt;br /&gt;
| [[OCEOSmp/directive reference#oceos_task_get_priority()| oceos_task_get_priority()]] || Get priority of a task             ||      ||  *   || *&lt;br /&gt;
|-&lt;br /&gt;
| [[OCEOSmp/directive reference#oceos_task_get_status()| oceos_task_get_status()]]     || Get status of a task               ||      ||  *   || *&lt;br /&gt;
|-&lt;br /&gt;
| [[OCEOSmp/directive reference#oceos_task_kill()| oceos_task_kill()]]                 || Directive to terminate current task||      ||  *   || *&lt;br /&gt;
|-&lt;br /&gt;
| [[OCEOSmp/directive reference#oceos_task_get_info()| oceos_task_get_info()]]         || Get task information               ||      ||  *   || *&lt;br /&gt;
|-&lt;br /&gt;
| [[OCEOSmp/directive reference#oceosmp_task_kill()| oceosmp_task_kill()]]                 || Directive to terminate current task||      ||  *   || *&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;Task data structures&amp;lt;/span&amp;gt;===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''tasks.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The following data structures are used by some of the task directives.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Data structures'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * A pointer to this structure is passed to oceos_task_create().&lt;br /&gt;
 * The structure is first initialised according to a tasks's parameters,&lt;br /&gt;
 * and is not used again after the task is created and may then be discarded.&lt;br /&gt;
 */&lt;br /&gt;
struct task_descriptor {&lt;br /&gt;
&lt;br /&gt;
	void (*function_start)(void*);	// name of task start function&lt;br /&gt;
	void (*function_end)(void*);	// optional, NULL or task end function&lt;br /&gt;
&lt;br /&gt;
	U32_t task_id;					// 0 to 254, usually an enum&lt;br /&gt;
	U32_t task_jobs_max;			// 1 to 15, max concurrent 'jobs'&lt;br /&gt;
	U32_t task_priority;			// 1 (highest) to 254 (lowest)&lt;br /&gt;
	U32_t task_threshold;			// &amp;gt;=1, &amp;lt;= task_priority (higher or same priority)&lt;br /&gt;
	U32_t task_turned_on_initially;	// 0: disabled initially, else enabled&lt;br /&gt;
&lt;br /&gt;
	U32_t time_deadline_microsecs;	// start request to finish, 0 to ignore&lt;br /&gt;
	U32_t time_min_interval_microsecs;	// between start requests, 0 to ignore&lt;br /&gt;
&lt;br /&gt;
	U32_t uses_cpu_affinity;		// 0: not restricted, else core restricted&lt;br /&gt;
	U32_t uses_cpu_affinity_core_id;// core ID to which restricted if affinity used&lt;br /&gt;
}__attribute__ ((aligned (8)));&lt;br /&gt;
&lt;br /&gt;
/**&lt;br /&gt;
 * Task info used with oceos_task_get_info&lt;br /&gt;
 */&lt;br /&gt;
struct task_info {&lt;br /&gt;
  U64_t           time_max_delay;               // maximum time job is waiting on ready queue before becoming active&lt;br /&gt;
  U64_t           time_max_finish;              // maximum time to finish job execution after starting&lt;br /&gt;
  U64_t           time_max_exec;                // maximum time spent executing&lt;br /&gt;
  U64_t           time_total_exec;              // total CPU time used by this task&lt;br /&gt;
  U64_t           time_min_gap_starts;          // minimum time between job creations, can be reset&lt;br /&gt;
  U64_t           time_min_gap_finish_start;    // minimum time between job ending and new job creation, can be reset&lt;br /&gt;
&lt;br /&gt;
  U64_t           time_last_start;              // time of most recent job creation&lt;br /&gt;
  U64_t           time_last_finish;             // time of most recent job finish&lt;br /&gt;
&lt;br /&gt;
  unsigned int    jobs_current_max  :16;        // maximum number of current jobs for this task, no roll over, can be reset&lt;br /&gt;
  unsigned int    jobs_total        :16;        // number of times this task was started, no roll-over, can be reset&lt;br /&gt;
  U32_t           jobs_current;                 // Number of task instances currently in use by oceos&lt;br /&gt;
&lt;br /&gt;
  U32_t           preempt_max;                  // maximum times any job was pre-empted, no roll-over, can be reset&lt;br /&gt;
}__attribute__ ((aligned (8)));&lt;br /&gt;
&lt;br /&gt;
/* A task's status is returned as below if queried */&lt;br /&gt;
enum TASK_STATUS {&lt;br /&gt;
    TASK_DISABLED,      // cannot be scheduled, and no current jobs&lt;br /&gt;
    TASK_ENABLED,       // can be scheduled, but no current jobs&lt;br /&gt;
    TASK_INVALID,       // task does not exist&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_task_create()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''tasks.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Create a task.&lt;br /&gt;
Can only be use before OCEOS starts. Stores the task information in the OCEOS fixed data area.&lt;br /&gt;
This directive populates the data structures for a task. It should be called after [[OCEOSmp/directive_reference#oceos_init()|oceos_init()]] and before [[OCEOSmp/directive_reference#oceos_init_finish()|oceos_init_finish()]].&amp;lt;br&amp;gt;&lt;br /&gt;
It must be called for each task otherwise [[OCEOSmp/directive_reference#oceos_start()|oceos_start()]] will return an error.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Create a task using a task descriptor structure&lt;br /&gt;
 *&lt;br /&gt;
 * Can only be used in Initialisation Phase.&lt;br /&gt;
 *&lt;br /&gt;
 * A task has twelve constant parameters set when the task is created.&lt;br /&gt;
 * Rather than setting a list of these parameters the named fields of a&lt;br /&gt;
 * task_descriptor structure are set and a pointer to it passed here.&lt;br /&gt;
 *&lt;br /&gt;
 * The task_descriptor structure fields are described above.&lt;br /&gt;
 * Once the task has been created the structure can be discarded.&lt;br /&gt;
 *&lt;br /&gt;
 * To create a task:&lt;br /&gt;
 *		set up a task_descriptor structure,&lt;br /&gt;
 *		set its fields to the parameter values for the task,&lt;br /&gt;
 *		pass a pointer to the structure to this directive.&lt;br /&gt;
 *&lt;br /&gt;
 * The structure is checked for validity by oceos_task_create and its&lt;br /&gt;
 * information used to set the task details in the OCEOS fixed data area.&lt;br /&gt;
 *&lt;br /&gt;
 * @param  struct task_descriptor *	fields give task characteristics&lt;br /&gt;
 *&lt;br /&gt;
 * @return OCEOS_SUCCESS            No errors or warnings&lt;br /&gt;
 *         WARN_NO_END_FUNCTION     Warning, no end task function specified&lt;br /&gt;
 *&lt;br /&gt;
 *         ERR_SYS_FIXED_CORRUPT    System Fixed area corrupt&lt;br /&gt;
 *         ERR_WRONG_CPU_CORE       Executing directive on wrong CPU&lt;br /&gt;
 *         ERR_WRONG_PHASE          Called before oceos_init() is done&lt;br /&gt;
 *         ERR_TOO_MANY             MAX number of tasks already created&lt;br /&gt;
 *         ERR_ID_INVALID           Task ID outside allowed range 0 to 254&lt;br /&gt;
 *         ERR_ID_WRONG             Task ID outside &amp;gt;= number of tasks&lt;br /&gt;
 *         ERR_T_ALREADY_ALLOCATED  Task ID already in use&lt;br /&gt;
 *         ERR_T_PRIORITY_INVALID   Task priority outside allowed range 1 to 254&lt;br /&gt;
 *         ERR_THRESHOLD_INVALID    Task threshold outside range 1 to 254&lt;br /&gt;
 *         ERR_THRESHOLD_WRONG      Task threshold  higher priority than task priority&lt;br /&gt;
 *         ERR_JOBS_MAX_INVALID     Job number outside range 1 to 15&lt;br /&gt;
 *         ERR_JOBS_TOO_MANY        System capacity exceeded&lt;br /&gt;
 *         ERR_AFFINITY_WRONG       CPU core specified is outside chosen range&lt;br /&gt;
 *         ERR_START_FUNCTION_BAD   Task start function address either NULL or misaligned&lt;br /&gt;
 */&lt;br /&gt;
S32_t   oceos_task_create(&lt;br /&gt;
    const struct task_descriptor * const task_description_ptr&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter           || Description&lt;br /&gt;
|-&lt;br /&gt;
|struct task_descriptor * || Pointer to task descriptor which contains task attributes&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit     || Description&lt;br /&gt;
|-&lt;br /&gt;
|WARN_NO_END_FUNCTION     || Warning, no end task function specified&lt;br /&gt;
|-&lt;br /&gt;
|ERR_SYS_FIXED_CORRUPT    || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
|ERR_WRONG_CPU_CORE       || Executing directive on wrong CPU&lt;br /&gt;
|-&lt;br /&gt;
|ERR_WRONG_PHASE          || Called before oceos_init() is done&lt;br /&gt;
|-&lt;br /&gt;
|ERR_TOO_MANY             || MAX number of tasks already created&lt;br /&gt;
|-&lt;br /&gt;
|ERR_ID_INVALID           || Task ID outside allowed range 0 to 254&lt;br /&gt;
|-&lt;br /&gt;
|ERR_ID_WRONG             || Task ID outside &amp;gt;= number of tasks&lt;br /&gt;
|-&lt;br /&gt;
|ERR_T_ALREADY_ALLOCATED  || Task ID already in use&lt;br /&gt;
|-&lt;br /&gt;
|ERR_T_PRIORITY_INVALID   || Task priority outside allowed range 1 to 254&lt;br /&gt;
|-&lt;br /&gt;
|ERR_THRESHOLD_INVALID    || Task threshold outside range 1 to 254&lt;br /&gt;
|-&lt;br /&gt;
|ERR_THRESHOLD_WRONG      || Task threshold  higher priority than task priority&lt;br /&gt;
|-&lt;br /&gt;
|ERR_JOBS_MAX_INVALID     || Job number outside range 1 to 15&lt;br /&gt;
|-&lt;br /&gt;
|ERR_JOBS_TOO_MANY        || System capacity exceeded&lt;br /&gt;
|-&lt;br /&gt;
|ERR_AFFINITY_WRONG       || CPU core specified is outside chosen range&lt;br /&gt;
|-&lt;br /&gt;
|ERR_START_FUNCTION_BAD   || Task start function address either NULL or misaligned&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
/* Sample Task names - all here start with t_ to help avoid name confusion */&lt;br /&gt;
enum TASK_NAME{&lt;br /&gt;
      t_0,&lt;br /&gt;
      t_1,&lt;br /&gt;
      t_2&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
/*&lt;br /&gt;
 * APPLICATION FUNCTION DECLARATIONS&lt;br /&gt;
 */&lt;br /&gt;
void fun0(void *);&lt;br /&gt;
void fun1(void *);&lt;br /&gt;
void fun2(void *);&lt;br /&gt;
void end_function(void *);&lt;br /&gt;
&lt;br /&gt;
const struct task_descriptor tasks_data[NUMBER_OF_TASKS] = {&lt;br /&gt;
    {fun0, end_function, t_0, 2, 10, 8, TASK_ENABLED, 0, 0, 0, 0},&lt;br /&gt;
    {fun1, end_function, t_1, 2, 10, 8, TASK_ENABLED, 0, 0, 0, 0},&lt;br /&gt;
    {fun2, end_function, t_2, 2, 10, 8, TASK_ENABLED, 0, 0, 0, 0}&lt;br /&gt;
}; &lt;br /&gt;
&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
    // create tasks (names are defined in the application header)&lt;br /&gt;
    for (i=0; i&amp;lt;NUMBER_OF_TASKS; i++){&lt;br /&gt;
        if ( oceos_task_create(&amp;amp;tasks_data[i]) != OCEOS_SUCCESS ){&lt;br /&gt;
        	oceosmp_print(&amp;quot;\nFailed to create task\n\r&amp;quot;);&lt;br /&gt;
        	return -i;&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_task_start()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''tasks.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function starts an instance of a task. An instance of a task is called a job in OCEOS terminology.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 *  Starting a task involves three main stages&lt;br /&gt;
 *      1 setting up a job&lt;br /&gt;
 *          finding a free job entry if available&lt;br /&gt;
 *          setting up this entry including passing it the data void *&lt;br /&gt;
 *&lt;br /&gt;
 *      2 placing the job on readyQ&lt;br /&gt;
 *&lt;br /&gt;
 *      3 doing a context switch&lt;br /&gt;
 * This function should only be called after OCEOS is initialised&lt;br /&gt;
 *       and the dynamic task and job structures set up&lt;br /&gt;
 *&lt;br /&gt;
 *  When used from an interrupt handler,&lt;br /&gt;
 *  the context switch is only done&lt;br /&gt;
 *  after all nested interrupts have unwound&lt;br /&gt;
 *&lt;br /&gt;
 * @param task_id Task ID must be in range 0 to 254&lt;br /&gt;
 * @param ptr     Pointer to task data&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT    System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT      System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE          Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID           Task ID is invalid&lt;br /&gt;
 *          ERR_ID_WRONG             Task ID is wrong&lt;br /&gt;
 *          ERR_START_TASK_DISABLED  Starting task is disabled&lt;br /&gt;
 *          ERR_TOO_MANY             There is no free job&lt;br /&gt;
 *          ERR_SYS_BUSY             Failed to grab the lock&lt;br /&gt;
 */&lt;br /&gt;
S32_t   oceos_task_start(&lt;br /&gt;
    const U32_t task_id, // task ID, must be in range 0 to 254&lt;br /&gt;
    void * const ptr    // pointer to data&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| task_id || U32_t with Task ID in range 0 to 254.&lt;br /&gt;
|-&lt;br /&gt;
| ptr    || void * pointer to task data&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit  || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT    || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT      || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE          || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID           || Task ID is invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG             || Task ID is wrong&lt;br /&gt;
|-&lt;br /&gt;
| ERR_START_TASK_DISABLED  || Starting task is disabled&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TOO_MANY             || There is no free job&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY             || Failed to grab the lock&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
void *ptr;&lt;br /&gt;
...&lt;br /&gt;
// Start instance of task T_1 passing pointer ptr&lt;br /&gt;
status = oceos_task_start(t_1,ptr);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_task_timed_start()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''tasks.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function schedules a task to start execution at a given system time.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 *  Schedule a task to start execution at a given system time&lt;br /&gt;
 *&lt;br /&gt;
 *  The before and after offsets define a window around the selected time&lt;br /&gt;
 *  in which the task may be started.&lt;br /&gt;
 *&lt;br /&gt;
 *  If the current system time is before the start window a job is created&lt;br /&gt;
 *  and a corresponding action put on the timed action queue.&lt;br /&gt;
 *&lt;br /&gt;
 *  If the current system time is within the time window for starting the task,&lt;br /&gt;
 *  it is started immediately.&lt;br /&gt;
 *&lt;br /&gt;
 *  If the current system time is after the window, an error is reported.&lt;br /&gt;
 *&lt;br /&gt;
 *  Times are in microseconds.&lt;br /&gt;
 *&lt;br /&gt;
 *  This function should only be called after OCEOS is initialised&lt;br /&gt;
 *  and the dynamic task and job structures set up&lt;br /&gt;
 *&lt;br /&gt;
 * @param taskID        Task ID must be in range 0 to 254&lt;br /&gt;
 * @param ptr           Pointer to data&lt;br /&gt;
 * @param start_time    System time at which job should start&lt;br /&gt;
 * @param before        Forward tolerance for time&lt;br /&gt;
 * @param after         Backward tolerance for time&lt;br /&gt;
 * @param return_job_id Return job_id to the user, to remove this job from timed action if needed&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              Task ID invalid&lt;br /&gt;
 *          ERR_ID_WRONG                Task ID is wrong&lt;br /&gt;
 *          ERR_TA_NOT_INIT             Timed action inialisation is not done and tried to be used&lt;br /&gt;
 *          ERR_START_TASK_DISABLED     Starting task is disabled&lt;br /&gt;
 *          ERR_TOO_MANY                There is no free job&lt;br /&gt;
 *          ERR_TOO_LATE                Starting task is too late(out of time frame)&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to grab the lock&lt;br /&gt;
 *          ERR_TA_Q_FULL               Timed action queue is full&lt;br /&gt;
 *          ERR_TA_START_FAILED         Timed action execute failed; See log&lt;br /&gt;
 */&lt;br /&gt;
S32_t   oceos_task_timed_start(&lt;br /&gt;
    const U32_t task_id,     // task ID, must be in range 0 to 254&lt;br /&gt;
    void * const ptr,        // pointer to data&lt;br /&gt;
    const U64_t start_time,  // system time at which job should start&lt;br /&gt;
    const U32_t before,      // forward tolerance for time&lt;br /&gt;
    const U32_t after,       // backward tolerance for time&lt;br /&gt;
    U32_t * return_job_id    // return job_id to the user, to remove this job from timed action if needed&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| taskID        || U32_t task ID must be in range 0 to 254&lt;br /&gt;
|-&lt;br /&gt;
| ptr           || void * pointer to data&lt;br /&gt;
|-&lt;br /&gt;
| start_time    || U64_t system time at which job should start&lt;br /&gt;
|-&lt;br /&gt;
| before        || U32_t forward tolerance for time&lt;br /&gt;
|-&lt;br /&gt;
| after         || U32_t backward tolerance for time&lt;br /&gt;
|-&lt;br /&gt;
| return_job_id || U32_t return job_id to the user, to remove this job from timed action if needed&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit  || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || Task ID invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || Task ID is wrong&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_NOT_INIT             || Timed action inialisation is not done and tried to be used&lt;br /&gt;
|-&lt;br /&gt;
| ERR_START_TASK_DISABLED     || Starting task is disabled&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TOO_MANY                || There is no free job&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TOO_LATE                || Starting task is too late(out of time frame)&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to grab the lock&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_Q_FULL               || Timed action queue is full&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_START_FAILED         || Timed action execute failed; See log&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
U32_t job_id;&lt;br /&gt;
U64_t cur_sys_time;&lt;br /&gt;
...&lt;br /&gt;
  cur_sys_time = oceos_time_sys_get64();&lt;br /&gt;
&lt;br /&gt;
  // Start task 10,000 microseconds (us) from now and advise if started more than 1,000 us before or 2,000 us after.&lt;br /&gt;
  status = oceos_task_timed_start(t_2, ptr, cur_sys_time + 10000, 1000, 2000, &amp;amp;job_id);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_task_disable()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''initialisation.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function disables a task and removes any current pending jobs from the readyQ.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 *  Disable a task and remove any current pending jobs on readyQ.&lt;br /&gt;
 *&lt;br /&gt;
 *  A disabled task's jobs  will not be put into execution nor put on readyQ.&lt;br /&gt;
 *&lt;br /&gt;
 *  Note that where execution of a task has already commenced,&lt;br /&gt;
 *  disabling the task will not prevent it from completing.&lt;br /&gt;
 *&lt;br /&gt;
 *  This function should only be called after OCEOS is initialised&lt;br /&gt;
 *  and the dynamic task and job structures set up&lt;br /&gt;
 *&lt;br /&gt;
 * @param taskID  Task ID must be in range 0 to 254&lt;br /&gt;
 * @return: OCEOS_SUCCESS&lt;br /&gt;
 *          WARN_ALREADY_DISABLED        Task already disabled&lt;br /&gt;
 *          WARN_SEM_PEND_REMOVE_FAILED  Failed to remove job from semaphore pending queue&lt;br /&gt;
 *          WARN_DQ_PEND_REMOVE_FAILED   Failed to remove job from dataq pending queue&lt;br /&gt;
 *&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT        System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT          System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE              Directive was called before OCEOS init is finished&lt;br /&gt;
 *          ERR_ID_INVALID               Task ID is invalid&lt;br /&gt;
 *          ERR_ID_WRONG                 Task ID is wrong&lt;br /&gt;
 *          ERR_SYS_BUSY                 Failed to grab the lock&lt;br /&gt;
 */&lt;br /&gt;
S32_t   oceos_task_disable(&lt;br /&gt;
    const U32_t task_id // task ID, must be in range 0 to 254&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| taskID || U32_t task ID must be in range 0 to 254&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit  || Description&lt;br /&gt;
|-&lt;br /&gt;
| WARN_ALREADY_DISABLED        || Task already disabled&lt;br /&gt;
|-&lt;br /&gt;
| WARN_SEM_PEND_REMOVE_FAILED  || Failed to remove job from semaphore pending queue&lt;br /&gt;
|-&lt;br /&gt;
| WARN_DQ_PEND_REMOVE_FAILED   || Failed to remove job from dataq pending queue&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT        || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT          || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE              || Directive was called before OCEOS init is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID               || Task ID is invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                 || Task ID is wrong&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                 || Failed to grab the lock&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Disable task t_1&lt;br /&gt;
status = oceos_task_disable(t_1);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_task_enable()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''tasks.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function enables a task. Only enabled tasks may be started.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 *  Enable a task - only enabled tasks are placed on readyQ or started.&lt;br /&gt;
 *&lt;br /&gt;
 *  This function should only be called after OCEOS is initialised&lt;br /&gt;
 *  and the dynamic task and job structures set up&lt;br /&gt;
 *&lt;br /&gt;
 * @param taskID   Task ID must be in range 0 to 254&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          WARN_ALREADY_ENABLED     Task already enabled&lt;br /&gt;
 *&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT    System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT      System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE          Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID           Task ID is invalid&lt;br /&gt;
 *          ERR_ID_WRONG             Task ID is wrong&lt;br /&gt;
 *          ERR_SYS_BUSY             Failed to grab the lock&lt;br /&gt;
 */&lt;br /&gt;
S32_t   oceos_task_enable(&lt;br /&gt;
    const U32_t task_id // task ID, must be in range 0 to 254&lt;br /&gt;
);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| taskID  || U32_t task ID must be in range 0 to 254&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit  || Description&lt;br /&gt;
|-&lt;br /&gt;
| WARN_ALREADY_ENABLED     || Task already enabled&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT    || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT      || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE          || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID           || Task ID is invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG             || Task ID is wrong&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY             || Failed to grab the lock&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Enable task t_2&lt;br /&gt;
status = oceos_task_enable(t_2);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_task_self()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''tasks.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the task number of the currently running task on the calling CPU.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Get currently running task on calling CPU&lt;br /&gt;
 *&lt;br /&gt;
 * @param t_id  Task ID holder&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT        System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT          System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE              Directive was called before OCEOS init is finished&lt;br /&gt;
 *          ERR_CPU_DYN_PTR_BAD          CPU dynamic area pointer corrupt&lt;br /&gt;
 */&lt;br /&gt;
S32_t  oceos_task_self(&lt;br /&gt;
    U32_t *t_id&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| t_id || S32_t * pointer to variable where task ID will be written.&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit  || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT        || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT          || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE              || Directive was called before OCEOS init is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_CPU_DYN_PTR_BAD          || CPU dynamic area pointer corrupt&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, task_running;&lt;br /&gt;
...&lt;br /&gt;
// Return task ID that's running on this core&lt;br /&gt;
status = oceos_task_self(&amp;amp;task_running);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_task_get_priority()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''tasks.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the priority of the task ID passed to it.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Get priority of the task&lt;br /&gt;
 *&lt;br /&gt;
 * @param taskID        ID of task, must be in range 0 to 254&lt;br /&gt;
 * @param t_priority    Pointer to task priority holder&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT        System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT          System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE              Directive was called before OCEOS init is finished&lt;br /&gt;
 *          ERR_ID_INVALID               Task ID is invalid&lt;br /&gt;
 *          ERR_ID_WRONG                 Task ID is wrong&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_task_get_priority(&lt;br /&gt;
    const U32_t task_id, // task ID, must be in range 0 to 254&lt;br /&gt;
    U32_t *t_priority   // Pointer to task priority holder&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| task_id || S32_t task ID of task whose priority is required&lt;br /&gt;
|-&lt;br /&gt;
| t_priority || S32_t * pointer to variable where priority will be written&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit  || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT        || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT          || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE              || Directive was called before OCEOS init is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID               || Task ID is invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                 || Task ID is wrong&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
U32_t t_priority;&lt;br /&gt;
...&lt;br /&gt;
// Return the priority of task ID t_4 &lt;br /&gt;
status = oceos_task_get_priority(t_4, &amp;amp;t_priority);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_task_get_status()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''tasks.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the status of the task ID passed to it.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Get status of the task;&lt;br /&gt;
 * if OK t_status holds enum TASK_STATUS&lt;br /&gt;
 *&lt;br /&gt;
 * @param taskID    ID of task, must be in range 0 to 254&lt;br /&gt;
 * @param t_status  enum TASK_STATUS holder&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT        System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT          System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE              Directive was called before OCEOS init is finished&lt;br /&gt;
 *          ERR_ID_INVALID               Task ID is invalid&lt;br /&gt;
 *          ERR_ID_WRONG                 Task ID is wrong&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_task_get_status(&lt;br /&gt;
    const U32_t task_id,&lt;br /&gt;
    U32_t *t_status&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| task_id || S32_t task ID of task whose priority is required&lt;br /&gt;
|-&lt;br /&gt;
| t_status || S32_t * pointer to variable where status will be written&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit  || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT        || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT          || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE              || Directive was called before OCEOS init is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID               || Task ID is invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                 || Task ID is wrong&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
U32_t t_status;&lt;br /&gt;
...&lt;br /&gt;
// Return the status of task ID t_4 &lt;br /&gt;
status = oceos_task_get_status(t_4, &amp;amp;t_status);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_task_get_info()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''tasks.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the task information for the specified task.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Get task information for task with ID.&lt;br /&gt;
 *&lt;br /&gt;
 * User must pass pointer to struct task_info in order to retrieve data.&lt;br /&gt;
 *&lt;br /&gt;
 * @param task_id  Task ID&lt;br /&gt;
 * @param info     Pointer to struct task_info&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT    System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT      System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE          Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID           Task ID invalid&lt;br /&gt;
 *          ERR_ID_WRONG             Task ID wrong&lt;br /&gt;
 *          ERR_TASK_INFO_PTR_BAD    Task info pointer provided by user is NULL&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_task_get_info (&lt;br /&gt;
    const U32_t task_id,   // Task ID&lt;br /&gt;
    struct task_info *info // Pointer to struct task_info&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| task_id || ID of task for which information is required&lt;br /&gt;
|-&lt;br /&gt;
| task_info || struct task_info * pointer to the structure where task information is to be written&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit  || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT    || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT      || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE          || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID           || Task ID invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG             || Task ID wrong&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TASK_INFO_PTR_BAD    || Task info pointer provided by user is NULL&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
struct task_info info;&lt;br /&gt;
...&lt;br /&gt;
// Get information for task T3&lt;br /&gt;
status = oceos_task_get_info(t_3, &amp;amp;info);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceosmp_task_kill()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''tasks.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function kills the specified task running on the specified CPU.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 *  Function to kill currently running task on CPU;&lt;br /&gt;
 *  Can be used:&lt;br /&gt;
 *      From Mode_SVC  =&amp;gt; normal running mode for application&lt;br /&gt;
 *          If nesting level is zero and Mode_SVC&lt;br /&gt;
 *      From Mode_IRQ  =&amp;gt; from IRQ handler&lt;br /&gt;
 *          If nesting level is not zero, set flag to call this function within IRQ handler&lt;br /&gt;
 *      From Exception =&amp;gt; Mode_ABT and Mode_UND&lt;br /&gt;
 *          If nesting level is zero and NOT Mode_SVC, it is exception;&lt;br /&gt;
 *              Disable IRQs on current CPU;&lt;br /&gt;
 *              Set kill current task flag to TRUE;&lt;br /&gt;
 *              Issue SGI on current CPU, will be interrupted on return from Exception and&lt;br /&gt;
 *              this function will be called within IRQ handler&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT    System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT      System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE          Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_CPU_DYN_PTR_BAD      CPU dynamic area pointer corrupt&lt;br /&gt;
 *          ERR_ID_INVALID           Task ID invalid&lt;br /&gt;
 *          ERR_ID_WRONG             Task ID wrong&lt;br /&gt;
 *          ERR_CPU_ID_WRONG         CPU ID wrong&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceosmp_task_kill(&lt;br /&gt;
    U32_t task_id,&lt;br /&gt;
    U32_t cpu_id&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| task_id  || U32_t task ID to be killed (must be in range 0 to 254)&lt;br /&gt;
|-&lt;br /&gt;
| cpu_id  || U32_t CPU ID where task_id is to be killed&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT    || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT      || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE          || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_CPU_DYN_PTR_BAD      || CPU dynamic area pointer corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID           || Task ID invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG             || Task ID wrong&lt;br /&gt;
|-&lt;br /&gt;
| ERR_CPU_ID_WRONG         || CPU ID wrong&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Kill task t_2 on CPU cpu_1&lt;br /&gt;
status = oceosmp_task_kill(t_2, cpu_1);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;Mutex directives&amp;lt;/span&amp;gt;==&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_mutex_create()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''mutex.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function creates a mutex of specified ID with a specified priority ceiling.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Creates a mutex with priority ceiling&lt;br /&gt;
 *&lt;br /&gt;
 * NOTE: This function should only be called after OCEOSmp is initialised with&lt;br /&gt;
 *  oceos_init() and before initialisation ends with oceos_init_finish()&lt;br /&gt;
 *  and scheduling starts with oceos_start()&lt;br /&gt;
 *&lt;br /&gt;
 * @param mutex_id  mutex ID value 0 to 62&lt;br /&gt;
 * @param priority  mutex priority ceiling 1 to 254 (high to low task priority)&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_WRONG_CPU_CORE          Executing directive on wrong CPU&lt;br /&gt;
 *          ERR_WRONG_PHASE             Called before oceos_init() is done&lt;br /&gt;
 *          ERR_TOO_MANY                MAX number of MUTEXs already created&lt;br /&gt;
 *          ERR_ID_INVALID              MUTEX ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                MUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
 *          ERR_MX_ALREADY_ALLOCATED    MUTEX ID already used&lt;br /&gt;
 *          ERR_MX_PRIORITY_WRONG       MUTEX priority ceiling outside allowed range 1 to 254&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_mutex_create(&lt;br /&gt;
    const U32_t mutex_id,  // mutex ID, must be in range 0 to 62&lt;br /&gt;
    const U8_t  priority  // mutex priority ceiling&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| mutex_id  || u32_t mutex ID to be created (value 0 to 62).&lt;br /&gt;
|-&lt;br /&gt;
| priority_ceiling ||  U32_t mutex priority ceiling 1 to 254 (high to low task priority)&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_CPU_CORE          || Executing directive on wrong CPU&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Called before oceos_init() is done&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TOO_MANY                || MAX number of MUTEXs already created&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || MUTEX ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || MUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_MX_ALREADY_ALLOCATED    || MUTEX ID already used&lt;br /&gt;
|-&lt;br /&gt;
| ERR_MX_PRIORITY_WRONG       || MUTEX priority ceiling outside allowed range 1 to 254&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Create mutex with ID print_mutex and priority ceiling of 5&lt;br /&gt;
status = oceos_mutex_create(print_mutex, 5);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_mutex_wait()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''mutex.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function makes the task wait until the specified mutex is available.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
 /*&lt;br /&gt;
  * Wait on mutex with ID.&lt;br /&gt;
  * If task succeeds in grabbing mutex, system level priority rises to&lt;br /&gt;
  * priority of this mutex, so tasks with lower or equal priority will&lt;br /&gt;
  * not be able to start till mutex is released.&lt;br /&gt;
  *&lt;br /&gt;
  * This should only be called after OCEOSmp scheduling has started.&lt;br /&gt;
  *&lt;br /&gt;
  * @param mutex_id     const U32_t  : value 0 to 62&lt;br /&gt;
  *&lt;br /&gt;
  * @return  OCEOS_SUCCESS&lt;br /&gt;
  *          WARN_MX_INCORRECT_ORDER     MUTEX acquired in incorrect order&lt;br /&gt;
  *&lt;br /&gt;
  *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
  *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
  *          ERR_WRONG_PHASE             Directive was called before OCEOSmp initialisation is finished&lt;br /&gt;
  *          ERR_ID_INVALID              MUTEX ID outside allowed range 0 to 62&lt;br /&gt;
  *           ERR_ID_WRONG                MUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
  *          ERR_MX_CEILING_BAD          MUTEX ceiling not lower priority than job priority&lt;br /&gt;
  *          ERR_MX_ALREADY_HELD         MUTEX already held by this job&lt;br /&gt;
  *          ERR_SYS_BUSY                Failed to grab context switch guard&lt;br /&gt;
  */&lt;br /&gt;
S32_t oceos_mutex_wait(&lt;br /&gt;
    const U32_t  mutex_id      // mutex ID, must be in range 0 to 62&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| mutex_id  || u32_t mutex ID to be waited on (value 0 to 62).&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| WARN_MX_INCORRECT_ORDER     || MUTEX acquired in incorrect order&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOSmp initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || MUTEX ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || MUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_MX_CEILING_BAD          || MUTEX ceiling not lower priority than job priority&lt;br /&gt;
|-&lt;br /&gt;
| ERR_MX_ALREADY_HELD         || MUTEX already held by this job&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to grab context switch guard&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Wait on mutex m_2&lt;br /&gt;
status = oceos_mutex_wait(m_2);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_mutex_signal()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''mutex.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function signals the specified mutex.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Signal a mutex with ID&lt;br /&gt;
 *&lt;br /&gt;
 * N.B. :&lt;br /&gt;
 *      This function should not be called from an interrupt handler&lt;br /&gt;
 *      This should only be called after OCEOSmp scheduling has started.&lt;br /&gt;
 *&lt;br /&gt;
 * @param mutex_id     const U32_t  : value 0 to 62&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          WARN_MX_ALREADY_FREE        MUTEX is free already&lt;br /&gt;
 *          WARN_MX_NESTING_BAD         MUTEX nesting incorrect&lt;br /&gt;
 *&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOSmp initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              MUTEX ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                MUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
 *          ERR_MX_WRONG_JOB            MUTEX not held by this job&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to grab context switch guard&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_mutex_signal(&lt;br /&gt;
    const U32_t  mutex_id     // mutex ID, must be in range 0 to 62&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| mutex_id  || u32_t mutex ID to be signalled (value 0 to 62).&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| WARN_MX_ALREADY_FREE        || MUTEX is free already&lt;br /&gt;
|-&lt;br /&gt;
| WARN_MX_NESTING_BAD         || MUTEX nesting incorrect&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOSmp initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || MUTEX ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || MUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_MX_WRONG_JOB            || MUTEX not held by this job&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to grab context switch guard&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Signal mutex m_2&lt;br /&gt;
status = oceos_mutex_signal(m_2);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_mutex_get_value()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''mutex.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the value of the specified mutex.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Get current value of mutex with ID&lt;br /&gt;
 *&lt;br /&gt;
 * @param mutex_id      const U32_t  : value 0 to 62&lt;br /&gt;
 * @param m_value       pointer to MUTEX value holder&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOSmp initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              MUTEX ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                MUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
 *          ERR_MX_DATA_PTR_BAD         Pointer to MUTEX value return holder is null&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_mutex_get_value(&lt;br /&gt;
    const U32_t  mutex_id,      // mutex ID, must be in range 0 to 62&lt;br /&gt;
    U32_t *m_value              // Pointer to MUTEX value holder&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| mutex_id  || u32_t mutex ID to be signalled (value 0 to 62)&lt;br /&gt;
|-&lt;br /&gt;
| m_value  || u32_t * pointer where mutex value is to be written&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOSmp initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || MUTEX ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || MUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_MX_DATA_PTR_BAD         || Pointer to MUTEX value return holder is null&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
U32_t value;&lt;br /&gt;
...&lt;br /&gt;
// Get value of mutex m_2&lt;br /&gt;
status = oceos_mutex_get_value(m_2, &amp;amp;value);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;Read/write mutex directives&amp;lt;/span&amp;gt;==&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;Read/write mutex overview&amp;lt;/span&amp;gt;===&lt;br /&gt;
&lt;br /&gt;
Contents:&lt;br /&gt;
&lt;br /&gt;
 1.  Read/Write Mutex features&lt;br /&gt;
 2.  Read/Write Mutex data structures&lt;br /&gt;
 3.  Read/Write Mutex constants&lt;br /&gt;
 4.  Read/Write Mutex manager Directives&lt;br /&gt;
&lt;br /&gt;
==== Read/Write Mutex Features ====&lt;br /&gt;
&lt;br /&gt;
Read/Write Mutexes (rwmutexes) can be held for 'read' at the same time&lt;br /&gt;
by multiple jobs on different CPUs, but once held for 'write' by any job&lt;br /&gt;
cannot be obtained for 'read' or for 'write' by another job until released.&lt;br /&gt;
&lt;br /&gt;
They can be used to allow data be read simultaneously by multiple jobs when&lt;br /&gt;
the data is not being updated while ensuring that no updating can take&lt;br /&gt;
place while any job is reading the data.&lt;br /&gt;
&lt;br /&gt;
Pending write requests take precedence over pending read requests and are&lt;br /&gt;
done on a first come, first served basis. Once any job on a CPU has a&lt;br /&gt;
rwmutex for 'read' no other job on that CPU can acquire it so as to avoid&lt;br /&gt;
potential problems and minimise delays in servicing write requests by other&lt;br /&gt;
CPUs.&lt;br /&gt;
&lt;br /&gt;
While any job holds a rwmutex for reading any job on another CPU can also&lt;br /&gt;
acquire it for reading. Other jobs on the same CPU that may attempt to&lt;br /&gt;
acquire the rwmutex are delayed in starting until return of the rwmutex.&lt;br /&gt;
No job can acquire the rwmutex for writing until all read acquisitions&lt;br /&gt;
have been returned.&lt;br /&gt;
&lt;br /&gt;
No job will acquire a rwmutex for reading if any job is trying to acquire&lt;br /&gt;
it for writing, giving write precedence over read. Multiple write requests&lt;br /&gt;
waiting for existing read acquisitions to complete are serviced in the&lt;br /&gt;
order in which they were made when the current read acquisitions complete.&lt;br /&gt;
&lt;br /&gt;
If a task waits on a rwmutex that it already holds a system log entry is&lt;br /&gt;
made (LOG_RWMUTEX_ALREADY_HELD) and an INTERNAL_ERROR status code returned.&lt;br /&gt;
&lt;br /&gt;
If a task attempts to release a rwmutex it does not hold a system log entry&lt;br /&gt;
is made (LOG_RWMUTEX_ALREADY_FREE) and an INTERNAL_ERROR status code returned.&lt;br /&gt;
&lt;br /&gt;
If a job holds more than one rwmutex at the same time these must be&lt;br /&gt;
acquired and released in a nested manner&lt;br /&gt;
(e.g. wait 1, wait 2, wait 3, signal 3, signal 2, signal 1).&lt;br /&gt;
&lt;br /&gt;
If a task exits while holding one or more rwmutexes these are returned and&lt;br /&gt;
a system log entry made (LOG_RWMUTEX_NOT_RETURNED).&lt;br /&gt;
&lt;br /&gt;
==== Read/Write Mutex data structures ====&lt;br /&gt;
&lt;br /&gt;
In OCEOSmp each rwmutex has a priority ceiling, the priority of the highest&lt;br /&gt;
priority task that acquires the rwmutex for read or for write.&lt;br /&gt;
OCEOSmp uses this to ensure that once a job on a particular CPU has the&lt;br /&gt;
rwmutex for reading or for writing no other job on that CPU can be started&lt;br /&gt;
that might try to obtain that rwmutex.&lt;br /&gt;
&lt;br /&gt;
The priority ceiling of a rwmutex is specified when the rwmutex is created&lt;br /&gt;
and does not change subsequently. Priority ceilings are stored in the&lt;br /&gt;
fixed data area as an array U8_t rwmutexCeilings[] indexed by mutex ID.&lt;br /&gt;
This array is extended to be a whole number of 32-bit words.&lt;br /&gt;
&lt;br /&gt;
A rwmutex has a unique rwmutex ID, an unsigned integer usually defined in&lt;br /&gt;
the application header file as an enum RWMUTEX_NAME{} thus allowing a&lt;br /&gt;
user-friendly name be associated with each rwmutex ID.&lt;br /&gt;
&lt;br /&gt;
Using an enum is strongly recommended as it allows a user-friendly name be&lt;br /&gt;
associated with each ID, and helps ensure IDs are contiguous from 0.&lt;br /&gt;
&lt;br /&gt;
These rwmutex IDs are used as indices into both fixed and dynamic data&lt;br /&gt;
arrays and must cover the range 0 to ((number of rwmutexes) -1). Using&lt;br /&gt;
enum RWMUTEX_NAME{} automatically assigns names to IDs 0, 1, 2...&lt;br /&gt;
&lt;br /&gt;
Read write mutex dynamic data such as the current write requests and&lt;br /&gt;
current read count are stored in the dynamic data area in an array of&lt;br /&gt;
struct rwmutex_dyn_block also indexed by the rwmutex ID.&lt;br /&gt;
&lt;br /&gt;
A further dynamic area array of guard_t is used in providing mutual&lt;br /&gt;
exclusion when updating the rwmutex dynamic data.&lt;br /&gt;
&lt;br /&gt;
==== Read/Write Mutex constants ====&lt;br /&gt;
&lt;br /&gt;
In OCEOSmp there can be a maximum of 63 rwmutexes,&lt;br /&gt;
with IDs from 0 to 62 (the value 63 is used as an invalid ID).&lt;br /&gt;
&lt;br /&gt;
The rwmutexes can be created in any order, but OCEOSmp will return an error&lt;br /&gt;
and fail to start if the resulting IDs fail to be contiguous from 0 as IDs&lt;br /&gt;
are used by OCEOS as indices into arrays.&lt;br /&gt;
&lt;br /&gt;
Each rwmutex has a priority ceiling, the priority of the highest priority&lt;br /&gt;
task that uses the rwmutex for reading or for writing. This is specified&lt;br /&gt;
when the rwmutex is created, does not change subsequently, and must be in&lt;br /&gt;
the range 1 (TASK_MAX_PRIORITY) to 254 (TASK_MIN_PRIORITY).&lt;br /&gt;
The application developer must ensure that the correct rwmutex ceiling&lt;br /&gt;
is used. OCEOSmp will detect an attempt to acquire a rwmutex by a task&lt;br /&gt;
with higher priority than that rwmutex's priority ceiling, make a&lt;br /&gt;
system log entry (LOG_RWMUTEX_BAD_CEILING) and return an INTERNAL_ERROR&lt;br /&gt;
status code.&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_rwmutex_create()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''rwmutex.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function ees a read/write mutex.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Creates a Read/Write Mutex (RWMUTEX)&lt;br /&gt;
 *&lt;br /&gt;
 * This function should only be called after OCEOSmp is initialised with&lt;br /&gt;
 * oceos_init() and before initialisation ends with oceos_init_finish()&lt;br /&gt;
 * and scheduling starts with oceos_start()&lt;br /&gt;
 *&lt;br /&gt;
 * @param rwm_id    Read/Write RWMUTEX ID, must be in range 0 to 62&lt;br /&gt;
 * @param priority  Priority ceiling of highest priority task that uses the RWMUTEX&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_WRONG_CPU_CORE          Executing directive on wrong CPU&lt;br /&gt;
 *          ERR_WRONG_PHASE             Called before oceos_init() is done&lt;br /&gt;
 *          ERR_TOO_MANY                MAX number of RWMUTEXs already created&lt;br /&gt;
 *          ERR_ID_INVALID              RWMUTEX ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                RWMUTEX ID &amp;gt;= number of RWMUTEXs&lt;br /&gt;
 *          ERR_RWMX_ALREADY_ALLOCATED  RWMUTEX ID already used&lt;br /&gt;
 *          ERR_RWMX_PRIORITY_WRONG     RWMUTEX priority ceiling outside allowed range 1 to 254&lt;br /&gt;
 */&lt;br /&gt;
S32_t   oceos_rwmutex_create(&lt;br /&gt;
    const U32_t rwm_id,   // RWMUTEX ID, must be in range 0 to max rwm&lt;br /&gt;
    const U8_t priority   // RWMUTEX priority ceiling&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| rwm_id || Read/Write RWMUTEX ID, must be in range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| priority || Priority ceiling of highest priority task that uses the RWMUTEX&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_CPU_CORE          || Executing directive on wrong CPU&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Called before oceos_init() is done&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TOO_MANY                || MAX number of RWMUTEXs already created&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || RWMUTEX ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || RWMUTEX ID &amp;gt;= number of RWMUTEXs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_RWMX_ALREADY_ALLOCATED  || RWMUTEX ID already used&lt;br /&gt;
|-&lt;br /&gt;
| ERR_RWMX_PRIORITY_WRONG     || RWMUTEX priority ceiling outside allowed range 1 to 254&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Create read/write mutex with ID rwm_2 and priority ceiling of 100 &lt;br /&gt;
status = oceos_rwmutex_create(rwm_1, 100);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_rwmutex_read_wait()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''rwmutex.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function acquires a read/write mutex for read. If successful, jobs on other CPUs can also acquire it for read, but no job will be able to acquire it for write while any read is under way. If job already holds RWMUTEX for read or for write the appropriate status code is returned, a system log entry made, and the job continues. It will not succeed while any job is waiting to obtain RWMUTEX for write, and will loop waiting for all pending writes on this RWMUTEX to complete.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Read wait on RWMUTEX.&lt;br /&gt;
 *&lt;br /&gt;
 * If successful jobs on other CPUs can also acquire it for read, but no job&lt;br /&gt;
 * will be able to acquire it for write while any read is under way.&lt;br /&gt;
 * If job already holds RWMUTEX for read or for write appropriate status code&lt;br /&gt;
 * is returned, a system log entry made, and the job continues.&lt;br /&gt;
 * Will not succeed while any job is waiting to obtain RWMUTEX for write,&lt;br /&gt;
 * will loop waiting for all pending writes on this RWMUTEX to complete.&lt;br /&gt;
 *&lt;br /&gt;
 * This should only be called after OCEOS scheduling has started.&lt;br /&gt;
 *&lt;br /&gt;
 * N.B.	The returned status code must be checked and appropriate action&lt;br /&gt;
 * 		taken.&lt;br /&gt;
 *&lt;br /&gt;
 * @param rwm_id    const U32_t  : value 0 to 62&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          WARN_RWMX_NOT_HIGHEST       Already holds a RWMUTEX higher in the RWMUTEX order&lt;br /&gt;
 *                                      (there then may be a risk of deadlock)&lt;br /&gt;
 *&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              RWMUTEX ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                RWMUTEX ID &amp;gt;= number of RWMUTEXs&lt;br /&gt;
 *          ERR_RWMX_CEILING_BAD        RWMUTEX ceiling not lower priority than job priority&lt;br /&gt;
 *          ERR_RWMX_ALREADY_HELD       RWMUTEX already held by this job&lt;br /&gt;
 *          ERR_RWMX_CPU_STACK_FULL     CPU priority ceiling stack full&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_rwmutex_read_wait(&lt;br /&gt;
    const U32_t rwm_id  // RWMUTEX ID, must be in range 0 to 62&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| rwm_id || U32_t rwmutex to be acquired for read (value 0 to 62)&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| WARN_RWMX_NOT_HIGHEST       || Already holds a RWMUTEX higher in the RWMUTEX order (deadlock risk)&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || RWMUTEX ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || RWMUTEX ID &amp;gt;= number of RWMUTEXs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_RWMX_CEILING_BAD        || RWMUTEX ceiling not lower priority than job priority&lt;br /&gt;
|-&lt;br /&gt;
| ERR_RWMX_ALREADY_HELD       || RWMUTEX already held by this job&lt;br /&gt;
|-&lt;br /&gt;
| ERR_RWMX_CPU_STACK_FULL     || CPU priority ceiling stack full&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Acquire read/write mutex rwm_1 for read&lt;br /&gt;
status = oceos_rwmutex_read_wait(rwm_1);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_rwmutex_write_wait()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''rwmutex.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function acquires the specified read/write mutex for write.&lt;br /&gt;
If successful, no other job can also obtain it for reading or for writing. Will not succeed while any other job has acquired RWMUTEX for write,&lt;br /&gt;
or any jobs have obtained RWMUTEX for read. Will then loop until the RWMUTEX is released and for its turn in the sequence of jobs that have tried to acquire the RWMUTEX for writing. If already holds the RWMUTEX for writing or reading an appropriate status code is returned, a system log entry made, and the job continues. While there are any outstanding attempts to obtain the RWMUTEX for write no job will be able to acquire it for reading.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Write wait on RWMUTEX.&lt;br /&gt;
 *&lt;br /&gt;
 * If successful no other job can also obtain it for reading or for writing.&lt;br /&gt;
 * Will not succeed while any other job has acquired RWMUTEX for write,&lt;br /&gt;
 * or any jobs have obtained RWMUTEX for read. Will then loop until the&lt;br /&gt;
 * RWMUTEX is released and for its turn in the sequence of jobs that have&lt;br /&gt;
 * tried to acquire the RWMUTEX for writing.&lt;br /&gt;
 * If already holds the RWMUTEX for writing or reading an appropriate status&lt;br /&gt;
 * code is returned, a system log entry made, and the job continues.&lt;br /&gt;
 * While there are any outstanding attempts to obtain the RWMUTEX for write&lt;br /&gt;
 * no job will be able to acquire it for reading.&lt;br /&gt;
 *&lt;br /&gt;
 * This should only be called after OCEOS scheduling has started.&lt;br /&gt;
 *&lt;br /&gt;
 * N.B.	The returned status code must be checked and appropriate action&lt;br /&gt;
 * 		taken.&lt;br /&gt;
 *&lt;br /&gt;
 * @param rwm_id     const U32_t  : value 0 to 62&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          WARN_RWMX_NOT_HIGHEST       Already holds a RWMUTEX higher in the RWMUTEX order&lt;br /&gt;
 *                                      (there then may be a risk of deadlock)&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              RWMUTEX ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                RWMUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
 *          ERR_RWMX_CEILING_BAD        RWMUTEX ceiling not lower priority than job priority&lt;br /&gt;
 *          ERR_RWMX_ALREADY_HELD       RWMUTEX already held by this job&lt;br /&gt;
 *          ERR_RWMX_CPU_STACK_FULL     CPU priority ceiling stack full&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_rwmutex_write_wait(&lt;br /&gt;
    const U32_t rwm_id  // RWMUTEX ID, must be in range 0 to 62&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| rwm_id || U32_t rwmutex to be acquired for write(value 0 to 62)&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| WARN_RWMX_NOT_HIGHEST       || Already holds a RWMUTEX higher in the RWMUTEX order (deadlock risk)&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || RWMUTEX ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || RWMUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_RWMX_CEILING_BAD        || RWMUTEX ceiling not lower priority than job priority&lt;br /&gt;
|-&lt;br /&gt;
| ERR_RWMX_ALREADY_HELD       || RWMUTEX already held by this job&lt;br /&gt;
|-&lt;br /&gt;
| ERR_RWMX_CPU_STACK_FULL     || CPU priority ceiling stack full&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Acquire read/write mutex rwm_1 for write&lt;br /&gt;
status = oceos_rwmutex_read_wait(rwm_1);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_rwmutex_signal()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''rwmutex.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function signals the specified read/write mutex.&lt;br /&gt;
It frees the RWMUTEX for use by other jobs, irrespective of whether the RWMUTEX is held for reading or for writing. If the RWMUTEX is not held by the job then it returns an appropriate status code. It does not take into account how many times a job has obtained the RWMUTEX for read or for write.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Signal a RWMUTEX&lt;br /&gt;
 *&lt;br /&gt;
 * Frees the RWMUTEX for use by other jobs, irrespective of whether&lt;br /&gt;
 * RWMUTEX is held for reading or for writing.&lt;br /&gt;
 * if the RWMUTEX is not held by the job returns an appropriate status code.&lt;br /&gt;
 * Does not take into account how many times a job has obtained the RWMUTEX&lt;br /&gt;
 * for read or for write.&lt;br /&gt;
 *&lt;br /&gt;
 * This should only be called after OCEOS scheduling has started.&lt;br /&gt;
 *&lt;br /&gt;
 * N.B. The returned status code must be checked and appropriate action taken.&lt;br /&gt;
 *&lt;br /&gt;
 * @param rwm_id    const U32_t  : value 0 to 62&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          WARN_RWMX_ALREADY_FREE      RWMUTEX is free already&lt;br /&gt;
 *&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              RWMUTEX ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                RWMUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
 *          ERR_RWMX_CEILING_BAD        RWMUTEX ceiling not lower priority than job priority&lt;br /&gt;
 *          ERR_RWMX_CPU_STACK_EMPTY    CPU priority ceiling stack empty&lt;br /&gt;
 *          ERR_RWMX_CEILING_INVALID    CPU current priority ceiling on the priority stack is invalid&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_rwmutex_signal(&lt;br /&gt;
    const U32_t rwm_id // RWMUTEX ID, must be in range 0 to 62&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| rwm_id || U32_t rwmutex to be signaled(value 0 to 62)&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| WARN_RWMX_ALREADY_FREE      || RWMUTEX is free already&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || RWMUTEX ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || RWMUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_RWMX_CEILING_BAD        || RWMUTEX ceiling not lower priority than job priority&lt;br /&gt;
|-&lt;br /&gt;
| ERR_RWMX_CPU_STACK_EMPTY    || CPU priority ceiling stack empty&lt;br /&gt;
|-&lt;br /&gt;
| ERR_RWMX_CEILING_INVALID    || CPU current priority ceiling on the priority stack is invalid&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Signal read/write mutex number rwm_4&lt;br /&gt;
status = oceos_rwmutex_signal(rwm_4);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_rwmutex_check_status()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''rwmutex.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function checks the status of a read/write mutex. The possible states are free, in-use for read, and in-use for write.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Check whether RWMUTEX is free&lt;br /&gt;
 *&lt;br /&gt;
 * @param rwm_id        must be in range 0 to 62&lt;br /&gt;
 * @param m_status      pointer to RWMUTEX status holder;&lt;br /&gt;
 *                      if return code OCEOS_SUCCESS RWMUTEX status:&lt;br /&gt;
 *                          0 =&amp;gt; Free for use&lt;br /&gt;
 *                          1 =&amp;gt; In use for read&lt;br /&gt;
 *                          2 =&amp;gt; In use for write&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              RWMUTEX ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                RWMUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
 *          ERR_RWMX_DATA_PTR_BAD       Pointer to RWMUTEX status return holder is null&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_rwmutex_check_status(&lt;br /&gt;
    const U32_t rwm_id, // RWMUTEX ID, must be in range 0 to 62&lt;br /&gt;
    U32_t *m_status&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| rwm_id || read/write mutex number in range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| m_status || U32_t pointer to RWMUTEX status holder (0 = free, 1 = in-use for read, 2 = in-use for write &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || RWMUTEX ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || RWMUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_RWMX_DATA_PTR_BAD       || Pointer to RWMUTEX status return holder is null&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, rwm_status;&lt;br /&gt;
...&lt;br /&gt;
// Check the status of read/write mutex rwm_2&lt;br /&gt;
status = oceos_rwmutex_check_status(rwm_2, &amp;amp;rwm_status);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_rwmutex_reading_count()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''rwmutex.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the current number of jobs holding a specified read/write mutex for read.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 *&lt;br /&gt;
 * Get current number of jobs holding RWMUTEX for read&lt;br /&gt;
 *&lt;br /&gt;
 * @param rwm_id    must be in range 0 to 62&lt;br /&gt;
 * @param m_count   pointer to RWMUTEX count holder&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              RWMUTEX ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                RWMUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
 *          ERR_RWMX_DATA_PTR_BAD       Pointer to RWMUTEX count return holder is null&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_rwmutex_reading_count(&lt;br /&gt;
    const U32_t rwm_id, // RWMUTEX ID, must be in range 0 to 62&lt;br /&gt;
    U32_t *m_count&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| rwm_id || U32 value of read/write mutex (in range 0 to 62)&lt;br /&gt;
|-&lt;br /&gt;
| m_count || U32_t pointer to read/write mutex count holder&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || RWMUTEX ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || RWMUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_RWMX_DATA_PTR_BAD       || Pointer to RWMUTEX count return holder is null&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, rwm_count;&lt;br /&gt;
...&lt;br /&gt;
// Get the number of jobs holding the read/write mutex rwm_2 for read&lt;br /&gt;
status = oceos_rwmutex_reading_count(rwm_2, &amp;amp;rwm_count);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_rwmutex_write_reqs_count()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''header.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the current number of write requests for the specified read/write mutex .&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Get current RWMUTEX write requests count&lt;br /&gt;
 *&lt;br /&gt;
 * @param rwm_id    must be in range 0 to 62&lt;br /&gt;
 * @param m_count   pointer to RWMUTEX count holder&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              RWMUTEX ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                RWMUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
 *          ERR_RWMX_DATA_PTR_BAD       Pointer to RWMUTEX count return holder is null&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_rwmutex_write_reqs_count(&lt;br /&gt;
    const U32_t rwm_id, // RWMUTEX ID, must be in range 0 to 62&lt;br /&gt;
    U32_t *m_count&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| rwm_id || U32_t value of read/write mutex (must be in range 0 to 62)&lt;br /&gt;
|-&lt;br /&gt;
| m_count || U32_t pointer to read/write mutex count holder&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || RWMUTEX ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || RWMUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_RWMX_DATA_PTR_BAD       || Pointer to RWMUTEX count return holder is null&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, rwm_count;&lt;br /&gt;
...&lt;br /&gt;
// Get the count of cuurent write requests for read/write mutex rwm_1&lt;br /&gt;
status = oceos_rwmutex_write_reqs_count(rwm_1, &amp;amp;rwm_count);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_rwmutex_writes_pending_count()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''rwmutex.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the current number of pending writes for the specified read/write mutex.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Get current RWMUTEX writes pending count&lt;br /&gt;
 *&lt;br /&gt;
 * @param rwm_id    must be in range 0 to 62&lt;br /&gt;
 * @param m_count   pointer to RWMUTEX count holder&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              RWMUTEX ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                RWMUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
 *          ERR_RWMX_DATA_PTR_BAD       Pointer to RWMUTEX pending count return holder is null&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_rwmutex_writes_pending_count(&lt;br /&gt;
    const U32_t rwm_id, // RWMUTEX ID, must be in range 0 to 62&lt;br /&gt;
    U32_t *m_count&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| rwm_id || U32_t value of read/write mutex (must be in range 0 to 62)&lt;br /&gt;
|-&lt;br /&gt;
| m_count || U32_t pointer to read/write mutex count holder&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || RWMUTEX ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || RWMUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_RWMX_DATA_PTR_BAD       || Pointer to RWMUTEX count return holder is null&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, rwm_count;&lt;br /&gt;
...&lt;br /&gt;
// Get the count of cuurent write requests for read/write mutex rwm_1&lt;br /&gt;
status = oceos_rwmutex_writes_pending_count(rwm_1, &amp;amp;rwm_count);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_rwmutex_holding()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''header.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the read/write mutexes currently held by this instance of this task (job).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Get RWMUTEXs currently held by this instance of the task (job)&lt;br /&gt;
 *&lt;br /&gt;
 * @param m_data    U64_t pointer, each bit indicating RWMUTEX held by current task&lt;br /&gt;
 *                          0 =&amp;gt; Not held by job&lt;br /&gt;
 *                          1 =&amp;gt; Held by job&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_RWMX_DATA_PTR_BAD       Pointer to RWMUTEX status return holder is null&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_rwmutex_holding(&lt;br /&gt;
    U64_t *m_data&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| m_data || U64_t pointer, each bit indicating RWMUTEX held by current task, 0 =&amp;gt; not held, 1 =&amp;gt; held &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_RWMX_DATA_PTR_BAD       || Pointer to RWMUTEX status return holder is null&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
U64_t rwm_held;&lt;br /&gt;
...&lt;br /&gt;
// Which read/write mutexes does this job hold&lt;br /&gt;
status = oceos_rwmutex_holding(&amp;amp;rwm_held);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Semaphores directives ==&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_sem_create()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''semaphore.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function creates a semaphore.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Create a counting semaphore&lt;br /&gt;
 *&lt;br /&gt;
 * @param sem_id            SEMAPHORE ID (from 0 to 62)&lt;br /&gt;
 * @param max_permits       number of max permits allowed for this SEMAPHORE, 1 to 4095&lt;br /&gt;
 * @param count_permits     starting number of permits available 0 to 4095&lt;br /&gt;
 * @param pending_q_size    MAX Number of tasks on SEMAPHORE pending queue 1 to 253&lt;br /&gt;
 * @param use_timeout       if TRUE, directive oceos_sem_wait_restart_timeout can be used&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_WRONG_CPU_CORE          Executing directive on wrong CPU&lt;br /&gt;
 *          ERR_WRONG_PHASE             Called before oceos_init() is done&lt;br /&gt;
 *          ERR_TOO_MANY                MAX number of SEMAPHOREs already created&lt;br /&gt;
 *          ERR_ID_INVALID              SEMAPHORE ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                SEMAPHORE ID &amp;gt;= number of SEMAPHOREs&lt;br /&gt;
 *          ERR_SM_ALREADY_ALLOCATED    SEMAPHORE ID already used&lt;br /&gt;
 *          ERR_SM_MAX_PERMIT_WRONG     MAX permits outside allowed range 1 to 4095&lt;br /&gt;
 *          ERR_SM_COUNT_PERMIT_WRONG   Count permits outside allowed range 0 to 4095&lt;br /&gt;
 *          ERR_SM_COUNT_PERMIT_INVALID Count permits is greater than MAX permits for this SEMAPHORE&lt;br /&gt;
 *          ERR_SM_PENQ_SIZE_WRONG      SEMAPHORE pending queue size outside allowed range 1 to 253&lt;br /&gt;
 *          ERR_SM_TA_MAX_NUM_REACHED   Number of timed actions exceeds MAX allowed 255,&lt;br /&gt;
 *                                      each task on SEMAPHORE pending queue is timed action&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_sem_create(&lt;br /&gt;
    sem_t sem_id,         // counting semaphore ID (MAX 63)&lt;br /&gt;
    U16_t max_permits,    // max number of permits (MAX 4095)&lt;br /&gt;
    U16_t count_permits,  // initial number of permits (MAX 4095)&lt;br /&gt;
    U8_t  pending_q_size, // max number of pending queue jobs (MAX 253)&lt;br /&gt;
    BOOLE_t use_timeout   // whether timeout is used in oceos_sem_wait_restart_timeout&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| sem_id || Semaphore ID to be created (from 0 to 62)&lt;br /&gt;
|-&lt;br /&gt;
| max_permits || number of max permits allowed for this semaphore, 1 to 4095&lt;br /&gt;
|-&lt;br /&gt;
| count_permits || starting number of permits available 0 to 4095&lt;br /&gt;
|-&lt;br /&gt;
| pending_q_size || Maximum Number of tasks on SEMAPHORE pending queue 1 to 253&lt;br /&gt;
|-&lt;br /&gt;
| use_timeout || if TRUE, directive oceos_sem_wait_restart_timeout can be used&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_CPU_CORE          || Executing directive on wrong CPU&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Called before oceos_init() is done&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TOO_MANY                || MAX number of SEMAPHOREs already created&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || SEMAPHORE ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || SEMAPHORE ID &amp;gt;= number of SEMAPHOREs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SM_ALREADY_ALLOCATED    || SEMAPHORE ID already used&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SM_MAX_PERMIT_WRONG     || MAX permits outside allowed range 1 to 4095&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SM_COUNT_PERMIT_WRONG   || Count permits outside allowed range 0 to 4095&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SM_COUNT_PERMIT_INVALID || Count permits is greater than MAX permits for this SEMAPHORE&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SM_PENQ_SIZE_WRONG      || SEMAPHORE pending queue size outside allowed range 1 to 253&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SM_TA_MAX_NUM_REACHED   || Number of timed actions exceeds MAX allowed 255&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, param;&lt;br /&gt;
...&lt;br /&gt;
// Create semaphore called s_audi with max permits of 1000, starting permits of zero, max of 10 tasks on pending queue, and no timeouts &lt;br /&gt;
status = oceos_sem_create(s_audi, 1000, 0, 10, FALSE);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_sem_signal()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''semaphore.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function signals a semaphore, increments its count and transfers pending jobs to the ready queue.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Signals a semaphore, increments and transfers pending jobs to ready queue&lt;br /&gt;
 *&lt;br /&gt;
 * @param sem_id counting SEM ID&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          WARN_JOB_NOT_GUARDED&lt;br /&gt;
 *&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              SEM ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                SEM ID &amp;gt;= number of SEMs&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to grab SEM guard&lt;br /&gt;
 *          ERR_TOO_MANY                SEM max permits count already reached&lt;br /&gt;
 *          ERR_SM_JOB_ID_WRONG         Job ID of the task on SEM pending queue is wrong&lt;br /&gt;
 *          ERR_TA_NOT_FOUND            Timed action index to be removed for job not found&lt;br /&gt;
 *          ERR_TA_START_FAILED         Timed action re-start failed after job remove from timed action queue&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_sem_signal(&lt;br /&gt;
    sem_t sem_id // counting SEM ID&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| sem_id || U32_t value of semaphore to be signalled (incremented)&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| WARN_JOB_NOT_GUARDED        || job not guarded, application should check system log&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || SEM ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || SEM ID &amp;gt;= number of SEMs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to grab SEM guard&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TOO_MANY                || SEM max permits count already reached&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SM_JOB_ID_WRONG         || Job ID of the task on SEM pending queue is wrong&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_NOT_FOUND            || Timed action index to be removed for job not found&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_START_FAILED         || Timed action re-start failed after job remove from timed action queue&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Signal s_audi semaphore (increment its count)&lt;br /&gt;
status = oceos_sem_signal(s_audi);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_sem_wait_continue()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''semaphore.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function decrements the available permits of a sempahore otherwise returns an unsuccessful status code.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Wait on semaphore,&lt;br /&gt;
 * decrement the number of available permits for semaphore,&lt;br /&gt;
 * if no permits continue and task should handle unsuccessful result&lt;br /&gt;
 *&lt;br /&gt;
 * @param sem_id SEM ID&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              SEM ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                SEM ID &amp;gt;= number of SEMs&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to grab SEM guard&lt;br /&gt;
 *          ERR_SM_NOT_AVAILABLE        No more permits available for this SEM&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_sem_wait_continue(&lt;br /&gt;
    sem_t sem_id // counting SEM ID&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| sem_id || U32_t value of semaphore to be decremented&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || SEM ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || SEM ID &amp;gt;= number of SEMs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to grab SEM guard&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SM_NOT_AVAILABLE        || No more permits available for this SEM&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Decrement available permits on semaphore s_1&lt;br /&gt;
status = oceos_sem_wait_continue(s_1);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_sem_wait_restart()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''semaphore.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function decrements the available permits of a sempahore and if none available, the job is put on the pending queue.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Waits on semaphore,&lt;br /&gt;
 * if fail, put job on pending queue and exit task&lt;br /&gt;
 *&lt;br /&gt;
 * @param sem_id SEM ID&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              SEM ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                SEM ID &amp;gt;= number of SEMs&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to grab SEM guard&lt;br /&gt;
 *          ERR_SM_J_START_FROM_TIMOUT  Task started from timeout already, SEM no permits available second time&lt;br /&gt;
 *          ERR_FAILED                  Should never return this&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_sem_wait_restart(&lt;br /&gt;
    sem_t sem_id  // counting SEM ID&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| sem_id || U32_t value of semaphore to be decremented&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || SEM ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || SEM ID &amp;gt;= number of SEMs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to grab SEM guard&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SM_J_START_FROM_TIMOUT  || Task started from timeout already, SEM no permits available second time&lt;br /&gt;
|-&lt;br /&gt;
| ERR_FAILED                  || Should never return this&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Decrement available permits on semaphore s_1 otherwise job is put on pending queue&lt;br /&gt;
status = oceos_sem_wait_restart(s_1);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_sem_wait_restart_timeout()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''semaphore.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function decrements the available permits of a sempahore and if none available, the job is put on the pending queue with a timeout enabled. The job is restarted either when a permit is available to be decremented or when the timeout has expired. In order to use this directive, semaphore must be created with flag use_timeout is set to TRUE.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Waits on semaphore,&lt;br /&gt;
 * if fail, put job on pending queue with optional timeout.&lt;br /&gt;
 * In order to use this directive, semaphore must be created with&lt;br /&gt;
 * flag use_timeout is set to TRUE&lt;br /&gt;
 *&lt;br /&gt;
 * @param sem_id         SEM ID&lt;br /&gt;
 * @param U64_t timeout  Restart time if no permits, 0 =&amp;gt; ignore&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_TA_NOT_INIT             Timed action intialisation is not done and tried to be used; or SEM created without timeouts&lt;br /&gt;
 *          ERR_ID_INVALID              SEM ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                SEM ID &amp;gt;= number of SEMs&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to grab SEM guard&lt;br /&gt;
 *          ERR_SM_J_START_FROM_TIMOUT  Task started from timeout already, SEM no permits available second time&lt;br /&gt;
 *          ERR_TOO_MANY                SEM pending queue is full&lt;br /&gt;
 *          ERR_FAILED                  Should never return this&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_sem_wait_restart_timeout(&lt;br /&gt;
    sem_t sem_id, // counting SEM ID&lt;br /&gt;
    U64_t timeout // timeout, restart time if no permits, 0 =&amp;gt; ignore&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| sem_id || U32_t value of semaphore to be decremented&lt;br /&gt;
|-&lt;br /&gt;
| timeout | U64_t timeout in time units. A value of 0 causes timeout to be ignored.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_NOT_INIT             || Timed action intialisation is not done and tried to be used; or SEM created without&lt;br /&gt;
timeouts&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || SEM ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || SEM ID &amp;gt;= number of SEMs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to grab SEM guard&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SM_J_START_FROM_TIMOUT  || Task started from timeout already, SEM no permits available second time&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TOO_MANY                || SEM pending queue is full&lt;br /&gt;
|-&lt;br /&gt;
| ERR_FAILED                  || Should never return this&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Decrement available permits on semaphore s_1 otherwise job is put on pending queue with timeout of 10,000 time units (usually usecs)&lt;br /&gt;
status = oceos_sem_wait_restart_timeout(s_1);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_sem_get_value()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''semaphore.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the number of available permits for the specified semaphore.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Returns number of available permits&lt;br /&gt;
 * for SEM ID&lt;br /&gt;
 *&lt;br /&gt;
 * @param sem_id        SEM id&lt;br /&gt;
 * @param s_permits     pointer to permits count holder&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              SEM ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                SEM ID &amp;gt;= number of SEMs&lt;br /&gt;
 *          ERR_SM_DATA_BAD             Data holder pointer is null&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_sem_get_value(&lt;br /&gt;
    sem_t sem_id,    // counting SEM ID&lt;br /&gt;
    U32_t *s_permits // pointer to permits count holder&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| sem_id || U32_t value of semaphore whose permit count is required&lt;br /&gt;
|-&lt;br /&gt;
| s_permits || U32_t pointer to permits count holder&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || SEM ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || SEM ID &amp;gt;= number of SEMs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SM_DATA_BAD             || Data holder pointer is null&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, permit_count;&lt;br /&gt;
...&lt;br /&gt;
// Get the available permits for semaphore s_1&lt;br /&gt;
status = oceos_sem_get_value(s_1, &amp;amp;permit_count);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_sem_penq_get_size()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''semaphore.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the number of jobs on the specified semaphore pending queue.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Returns number of jobs on semaphore pending queue&lt;br /&gt;
 * for semaphore ID&lt;br /&gt;
 *&lt;br /&gt;
 * @param sem_id    SEM id&lt;br /&gt;
 * @param s_size    pointer to pending queue size holder&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              SEM ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                SEM ID &amp;gt;= number of SEMs&lt;br /&gt;
 *          ERR_SM_DATA_BAD             Data holder pointer is null&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_sem_penq_get_size(&lt;br /&gt;
    sem_t sem_id,   // counting SEM ID&lt;br /&gt;
    U32_t *s_size   // pointer to pending queue size holder&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| sem_id || U32_t value of semaphore whose permit count is required&lt;br /&gt;
|-&lt;br /&gt;
| s_size || U32_t pointer to pending queue jobs count holder&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || SEM ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || SEM ID &amp;gt;= number of SEMs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SM_DATA_BAD             || Data holder pointer is null&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, job_count;&lt;br /&gt;
...&lt;br /&gt;
// Get the available permits for semaphore s_1&lt;br /&gt;
status = oceos_sem_penq_get_size(s_1, &amp;amp;job_count);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_sem_reset()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''semaphore.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function restores the permits to the original semaphore initial value and removes any jobs from the pending queue.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Restore permits to original value and&lt;br /&gt;
 * remove jobs from pending queue&lt;br /&gt;
 *&lt;br /&gt;
 * @param sem_id    SEM ID&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              SEM ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                SEM ID &amp;gt;= number of SEMs&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to grab SEM guard&lt;br /&gt;
 *          ERR_SM_JOB_ID_WRONG         Job ID of the task on SEM pending queue is wrong&lt;br /&gt;
 *          ERR_TA_NOT_FOUND            Timed action index to be removed for job not found&lt;br /&gt;
 *          ERR_TA_START_FAILED         Timed action re-start failed after job remove from timed action queue&lt;br /&gt;
 */&lt;br /&gt;
S32_t   oceos_sem_reset(&lt;br /&gt;
    sem_t sem_id   // counting SEM ID&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| sem_id || U32_t value of semaphore to be reset&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || SEM ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || SEM ID &amp;gt;= number of SEMs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to grab SEM guard&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SM_JOB_ID_WRONG         || Job ID of the task on SEM pending queue is wrong&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_NOT_FOUND            || Timed action index to be removed for job not found&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_START_FAILED         || Timed action re-start failed after job remove from timed action queue&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Reset semaphore s_1&lt;br /&gt;
status = oceos_sem_reset(s_1);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Data Queues ==&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_dataq_create()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''dataq.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function creates a data queue with the specified characteristics.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Create data queue&lt;br /&gt;
 * If use_timeout = TRUE, timed actions must be initialised&lt;br /&gt;
 *&lt;br /&gt;
 * @param dataq_id      data queue ID&lt;br /&gt;
 * @param dataq_size    data queue size&lt;br /&gt;
 * @param pen_q_size    pending jobs queue size&lt;br /&gt;
 * @param roll_over     whether to roll over when full&lt;br /&gt;
 * @param use_timeout   if TRUE, directive oceos_dataq_read_restart_timeout can be used&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_WRONG_CPU_CORE          Executing directive on wrong CPU&lt;br /&gt;
 *          ERR_WRONG_PHASE             Called before oceos_init() is done&lt;br /&gt;
 *          ERR_TOO_MANY                MAX number of DATAQs already created&lt;br /&gt;
 *          ERR_ID_INVALID              DATAQ ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                DATAQ ID &amp;gt;= number of DATAQs&lt;br /&gt;
 *          ERR_DQ_ALREADY_ALLOCATED    DATAQ ID already used&lt;br /&gt;
 *          ERR_DQ_SIZE_WRONG           DATAQ size outside allowed range 1 to 255&lt;br /&gt;
 *          ERR_DQ_PENQ_SIZE_WRONG      DATAQ pending queue size outside allowed range 1 to 253&lt;br /&gt;
 *          ERR_DQ_TA_MAX_NUM_REACHED   Number of timed actions exceeds MAX allowed 255,&lt;br /&gt;
 *                                      each task on DATAQ pending queue is timed action&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_dataq_create(&lt;br /&gt;
                         dataq_t dataq_id,    // data queue ID&lt;br /&gt;
                         U16_t dataq_size,    // data queue size&lt;br /&gt;
                         U16_t pen_q_size,    // pending jobs queue size&lt;br /&gt;
                         BOOLE_t roll_over,   // whether to roll over when full&lt;br /&gt;
                         BOOLE_t use_timeout  // whether timeout is used oceos_dataq_read_restart_timeout&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| dataq_id ||   dataq_t data queue ID (number between 0 and 62)&lt;br /&gt;
|-&lt;br /&gt;
| dataq_size ||   data queue size (max number of pointers than can be added to the queue)&lt;br /&gt;
|-&lt;br /&gt;
| pen_q_size ||   pending jobs queue size&lt;br /&gt;
|-&lt;br /&gt;
| roll_over ||    whether to roll over when full (0 =&amp;gt; disabled, 1 =&amp;gt; enabled)&lt;br /&gt;
|-&lt;br /&gt;
| use_timeout ||  if TRUE, directive oceos_dataq_read_restart_timeout can be used&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_CPU_CORE          || Executing directive on wrong CPU&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Called before oceos_init() is done&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TOO_MANY                || MAX number of DATAQs already created&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || DATAQ ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || DATAQ ID &amp;gt;= number of DATAQs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DQ_ALREADY_ALLOCATED    || DATAQ ID already used&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DQ_SIZE_WRONG           || DATAQ size outside allowed range 1 to 255&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DQ_PENQ_SIZE_WRONG      || DATAQ pending queue size outside allowed range 1 to 253&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DQ_TA_MAX_NUM_REACHED   || Number of timed actions exceeds MAX allowed 255, each task on DATAQ pending queue is timed action&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Create data queue d_3 with size 20, max pending jobs of 10, rollover enabled, timeouts disabled &lt;br /&gt;
status = oceos_dataq_create(d_3, 20, 10, 1, 0));&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_dataq_write()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''dataq.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function puts a non-null pointer on the specified data queue.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Puts pointer to the data on data queue.&lt;br /&gt;
 * Pointer to the data must not be NULL&lt;br /&gt;
 *&lt;br /&gt;
 * @param dataq_t dataq_id Data queue ID&lt;br /&gt;
 * @param void* data       Non-null pointer to data&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          WARN_DQ_NOW_FULL            Warning, DATAQ is full now&lt;br /&gt;
 *          WARN_JOB_NOT_GUARDED&lt;br /&gt;
 *&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              DATAQ ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                DATAQ ID &amp;gt;= number of DATAQs&lt;br /&gt;
 *          ERR_DQ_DATA_BAD             Data pointer is null&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to acquire guard&lt;br /&gt;
 *          ERR_TOO_MANY                DATAQ is full&lt;br /&gt;
 *          ERR_DQ_JOB_ID_WRONG         Job ID of the task on pending queue is wrong&lt;br /&gt;
 *          ERR_TA_NOT_FOUND            Timed action index to be removed for job not found&lt;br /&gt;
 *          ERR_TA_START_FAILED         Timed action re-start failed after job remove from timed action queue&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_dataq_write(&lt;br /&gt;
    dataq_t dataq_id, // data queue ID&lt;br /&gt;
    void *data        // non-null pointer to data&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| dataq_id || dataq_t with value of Data queue ID&lt;br /&gt;
|-&lt;br /&gt;
| ptr || void* pointer to application data (non-null pointer)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| WARN_DQ_NOW_FULL            || Warning, DATAQ is full now&lt;br /&gt;
|-&lt;br /&gt;
| WARN_JOB_NOT_GUARDED        || &lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || DATAQ ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || DATAQ ID &amp;gt;= number of DATAQs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DQ_DATA_BAD             || Data pointer is null&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to acquire guard&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TOO_MANY                || DATAQ is full&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DQ_JOB_ID_WRONG         || Job ID of the task on pending queue is wrong&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_NOT_FOUND            || Timed action index to be removed for job not found&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_START_FAILED         || Timed action re-start failed after job remove from timed action queue&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
char[100] message_in;&lt;br /&gt;
...&lt;br /&gt;
// Put pointer to message_in on data queue s_2 &lt;br /&gt;
status = oceos_dataq_write(s_2, (void *)message_in);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_dataq_read_continue()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''dataq.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns a pointer from the specified data queue.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Read data queue&lt;br /&gt;
 *&lt;br /&gt;
 * @param dataq_t dataq_id  Data queue ID&lt;br /&gt;
 * @param void*   data      Pointer to data&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              DATAQ ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                DATAQ ID &amp;gt;= number of DATAQs&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to acquire guard&lt;br /&gt;
 *          ERR_DQ_EMPTY                DATAQ empty(count zero)&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_dataq_read_continue(&lt;br /&gt;
    dataq_t dataq_id, // data queue ID&lt;br /&gt;
    void* *data        // return data&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Descriptionn&lt;br /&gt;
|-&lt;br /&gt;
| dataq_id || dataq_t with value of Data queue ID&lt;br /&gt;
|-&lt;br /&gt;
| ptr || void* pointer to store returned data queue pointer removed from the queue&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || DATAQ ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || DATAQ ID &amp;gt;= number of DATAQs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to acquire guard&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DQ_EMPTY                || DATAQ empty(count zero)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
char *data_ptr;&lt;br /&gt;
...&lt;br /&gt;
// Read pointer from data queue s_2 &lt;br /&gt;
status = oceos_dataq_read_continue(s_2, (void *)data_ptr);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_dataq_read_restart()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''dataq.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns a pointer from the specified data queue. If the queue is empty, the job is added top the dataq pending queue. The job will be restarted when data is available. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Read data queue next item.&lt;br /&gt;
 * If dataq is empty, task is put on pending Q for dataq and&lt;br /&gt;
 * restarted by oceos_dataq_write&lt;br /&gt;
 *&lt;br /&gt;
 * @param dataq_id Data queue ID&lt;br /&gt;
 * @param data     Pointer to return data&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              DATAQ ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                DATAQ ID &amp;gt;= number of DATAQs&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to acquire guard&lt;br /&gt;
 *          ERR_DQ_J_START_FROM_TIMOUT  Job started from timeout already, DATAQ empty second time&lt;br /&gt;
 *          ERR_FAILED                  Should never return this&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_dataq_read_restart(&lt;br /&gt;
    dataq_t dataq_id,    // data queue ID&lt;br /&gt;
    void* *data           // pointer to return data&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| dataq_id || dataq_t with value of Data queue ID&lt;br /&gt;
|-&lt;br /&gt;
| ptr || void* pointer to store returned data queue pointer removed from the queue&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || DATAQ ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || DATAQ ID &amp;gt;= number of DATAQs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to acquire guard&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DQ_J_START_FROM_TIMOUT  || Job started from timeout already, DATAQ empty second time&lt;br /&gt;
|-&lt;br /&gt;
| ERR_FAILED                  || Should never return this&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
char *data_ptr;&lt;br /&gt;
...&lt;br /&gt;
// Read pointer from data queue s_2 with restart when data is available&lt;br /&gt;
status = oceos_dataq_read_restart(s_2, (void *)data_ptr);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_dataq_read_restart_timeout()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''dataq.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns a pointer from the specified data queue. If the queue is empty, the job is added top the dataq pending queue. The job will be restarted either when data is available or the timeout has expired. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Read data queue next item.&lt;br /&gt;
 * If dataq is empty, task is put on pending Q for dataq and&lt;br /&gt;
 * restarted by oceos_dataq_write or by timeout if timeout != 0&lt;br /&gt;
 * In order to use this feature timed actions must be configured and&lt;br /&gt;
 * dataq created with use timeout set to true&lt;br /&gt;
 *&lt;br /&gt;
 * @param dataq_id          Data queue ID&lt;br /&gt;
 * @param data              Pointer to return data&lt;br /&gt;
 * @param timeout           Timeout, restart time if no entry, 0 =&amp;gt; ignore&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_TA_NOT_INIT             Timed action intialisation is not done and tried to be used; or DATAQ created without timeouts&lt;br /&gt;
 *          ERR_ID_INVALID              DATAQ ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                DATAQ ID &amp;gt;= number of DATAQs&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to acquire guard&lt;br /&gt;
 *          ERR_DQ_EMPTY                DATAQ empty(count zero)&lt;br /&gt;
 *          ERR_DQ_J_START_FROM_TIMOUT  Job started from timeout already, DATAQ empty second time&lt;br /&gt;
 *          ERR_TOO_MANY                DATAQ pending queue is full&lt;br /&gt;
 *          ERR_FAILED                  Should never return this&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_dataq_read_restart_timeout(&lt;br /&gt;
    dataq_t dataq_id,   // data queue ID&lt;br /&gt;
    void* *data,         // Pointer to return data&lt;br /&gt;
    U64_t timeout       // timeout, restart time if no entry, 0 =&amp;gt; ignore&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| dataq_id || dataq_t with value of Data queue ID&lt;br /&gt;
|-&lt;br /&gt;
| ptr || void* pointer to store returned data queue pointer removed from the queue&lt;br /&gt;
|-&lt;br /&gt;
| timeout || U64_t containing timeout value, restart time if no entry, 0 =&amp;gt; ignore&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_NOT_INIT             || Timed action intialisation is not done and tried to be used; or DATAQ created without timeouts&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || DATAQ ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || DATAQ ID &amp;gt;= number of DATAQs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to acquire guard&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DQ_EMPTY                || DATAQ empty(count zero)&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DQ_J_START_FROM_TIMOUT  || Job started from timeout already, DATAQ empty second time&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TOO_MANY                || DATAQ pending queue is full&lt;br /&gt;
|-&lt;br /&gt;
| ERR_FAILED                  || Should never return this&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
char *data_ptr;&lt;br /&gt;
...&lt;br /&gt;
// Read pointer from data queue s_2 with timeout after 10,000 time units if no data is available&lt;br /&gt;
status = oceos_dataq_read_restart_timeout(s_2, (void *)data_ptr, 10000ull);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_dataq_get_size()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''dataq.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the number of items on the specified data queue.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Returns number of items on the data queue with ID&lt;br /&gt;
 *&lt;br /&gt;
 * @param dataq_id   DATAQ Id&lt;br /&gt;
 * @param d_size     Pointer to size holder&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              DATAQ ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                DATAQ ID &amp;gt;= number of DATAQs&lt;br /&gt;
 *          ERR_DQ_DATA_BAD             DATAQ size holder pointer is null&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_dataq_get_size(&lt;br /&gt;
    dataq_t dataq_id,   // data queue ID&lt;br /&gt;
    U32_t *d_size&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| dataq_id ||  dataq_t with the ID of the data queue (value between 0 and 62)&lt;br /&gt;
|-&lt;br /&gt;
| d_size || U32_t *d_size pointer to the variable to store the size&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || DATAQ ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || DATAQ ID &amp;gt;= number of DATAQs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DQ_DATA_BAD             || DATAQ size holder pointer is null&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, d_size;&lt;br /&gt;
...&lt;br /&gt;
// Get the number of entries on data queue d_0&lt;br /&gt;
status = oceos_dataq_get_size(d_0, &amp;amp;d_size);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_dataq_penq_get_size()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''dataq.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns number of jobs on the specified data queue pending job's queue.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Returns number of jobs on the dataq pending job's queue&lt;br /&gt;
 *&lt;br /&gt;
 * @param dataq_id  DATAQ Id&lt;br /&gt;
 * @param d_size    Pointer to pending queue size holder&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              DATAQ ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                DATAQ ID &amp;gt;= number of DATAQs&lt;br /&gt;
 *          ERR_DQ_DATA_BAD             DATAQ pending size holder pointer is null&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_dataq_penq_get_size(&lt;br /&gt;
    dataq_t dataq_id,&lt;br /&gt;
    U32_t *d_size&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| dataq_id ||  dataq_t with the ID of the data queue (value between 0 and 62)&lt;br /&gt;
|-&lt;br /&gt;
| d_jobs || U32_t *d_jobs pointer to the variable to store the number of jobs on the pending queue&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || DATAQ ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || DATAQ ID &amp;gt;= number of DATAQs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DQ_DATA_BAD             || DATAQ pending size holder pointer is null&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, d_jobs;&lt;br /&gt;
...&lt;br /&gt;
// Get the number of jobs the the pending jubs queue for data queue d_1&lt;br /&gt;
status = oceos_dataq_penq_get_size(d_1, &amp;amp;d_jobs);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_dataq_clear()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''dataq.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function clears the specified data queue including pending jobs for that queue.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Clears data queue and&lt;br /&gt;
 * frees tasks on pending queue&lt;br /&gt;
 *&lt;br /&gt;
 * @param dataq_t dataq_id Data queue ID&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              DATAQ ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                DATAQ ID &amp;gt;= number of DATAQs&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to acquire guard&lt;br /&gt;
 *          ERR_DQ_JOB_ID_WRONG         Job ID of the task on DATAQ pending queue is wrong&lt;br /&gt;
 *          ERR_TA_NOT_FOUND            Timed action index to be removed for job not found&lt;br /&gt;
 *          ERR_TA_START_FAILED         Timed action re-start failed after job remove from timed action queue&lt;br /&gt;
 */&lt;br /&gt;
S32_t  oceos_dataq_clear(&lt;br /&gt;
    dataq_t dataq_id    // data queue ID&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| dataq_id ||  dataq_t with the ID of the data queue to be cleared (value between 0 and 62)&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || DATAQ ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || DATAQ ID &amp;gt;= number of DATAQs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to acquire guard&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DQ_JOB_ID_WRONG         || Job ID of the task on DATAQ pending queue is wrong&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_NOT_FOUND            || Timed action index to be removed for job not found&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_START_FAILED         || Timed action re-start failed after job remove from timed action queue&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Clear data queue d_1&lt;br /&gt;
status = oceos_dataq_penq_get_size(d_1);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Timed Actions ==&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_timed_output_add()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''timed_action.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function adds a timed action to the timed action queue. It writes a value to an address at a specified system time. An optional mask can be applied so that only those bits are changed.&lt;br /&gt;
The action types are WRITE_ACTION, RMW_ACTION. WRITE_ACTION writes the value to the address. RMW_ACTION reads the values at the address and modifies the bits specified by the mask and value.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Add output action to timed actions queue :&lt;br /&gt;
 *  1. Create timed output action&lt;br /&gt;
 *  2. Stop timer&lt;br /&gt;
 *  3. Add action to action_array&lt;br /&gt;
 *  4. Start timer or execute if time is right&lt;br /&gt;
 *&lt;br /&gt;
 * Returns timed action ID that can be used later to remove&lt;br /&gt;
 * if need by oceos_timed_output_remove&lt;br /&gt;
 *&lt;br /&gt;
 * @param enum ACTION_TYPE action_type  Action type&lt;br /&gt;
 * @param U64_t act_time                System time at which action should be done&lt;br /&gt;
 * @param U32_t before_time             Forward tolerance for time&lt;br /&gt;
 * @param U32_t after_time              Backward tolerance for time&lt;br /&gt;
 * @param adrs_t address                Output address&lt;br /&gt;
 * @param U32_t value                   Output value&lt;br /&gt;
 * @param U32_t mask                    Output mask&lt;br /&gt;
 * @param U32_ *ta_index                Pointer to store timed action index&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_TA_NOT_INIT             Timed action inialisation is not done and tried to be used&lt;br /&gt;
 *          ERR_TA_PTR_BAD              Timed action pointer is null&lt;br /&gt;
 *          ERR_TA_TYPE_WRONG           Timed action type is wrong&lt;br /&gt;
 *          ERR_TOO_LATE                Timed action time is too late&lt;br /&gt;
 *          ERR_SYS_BUSY                Timed action guard failed to acquire&lt;br /&gt;
 *          ERR_TA_Q_FULL               Timed action queue is full&lt;br /&gt;
 *          ERR_TA_START_FAILED         Timed action execute failed; See log&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_timed_output_add(&lt;br /&gt;
    const enum ACTION_TYPE action_type,// Action type&lt;br /&gt;
    U64_t act_time,                    // system time at which action should be done&lt;br /&gt;
    U32_t before_time,                 // forward tolerance for time&lt;br /&gt;
    U32_t after_time,                  // backward tolerance for time&lt;br /&gt;
    const adrs_t address,              // output address&lt;br /&gt;
    const U32_t value,                 // output value&lt;br /&gt;
    const U32_t mask,                  // output mask&lt;br /&gt;
    U32_t *ta_index                    // Pointer to store timed action index&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| enum ACTION_TYPE action_type  || Action type&lt;br /&gt;
|-&lt;br /&gt;
| U64_t act_time                || System time at which action should be done&lt;br /&gt;
|-&lt;br /&gt;
| U32_t before_time             || Forward tolerance for time&lt;br /&gt;
|-&lt;br /&gt;
| U32_t after_time              || Backward tolerance for time&lt;br /&gt;
|-&lt;br /&gt;
| adrs_t address                || Output address&lt;br /&gt;
|-&lt;br /&gt;
| U32_t value                   || Output value&lt;br /&gt;
|-&lt;br /&gt;
| U32_t mask                    || Output mask&lt;br /&gt;
|-&lt;br /&gt;
| U32_ *ta_index                || Pointer to store timed action index&lt;br /&gt;
|-&lt;br /&gt;
| param || parameter to function&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_NOT_INIT             || Timed action inialisation is not done and tried to be used&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_PTR_BAD              || Timed action pointer is null&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_TYPE_WRONG           || Timed action type is wrong&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TOO_LATE                || Timed action time is too late&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Timed action guard failed to acquire&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_Q_FULL               || Timed action queue is full&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_START_FAILED         || Timed action execute failed; See log&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
#define OUTPUT_TIMED_VAL    0xDEADBEEF&lt;br /&gt;
#define OUTPUT_TIMED_MASK   0x1000001&lt;br /&gt;
#define OUTPUT_TIME         0xfffff&lt;br /&gt;
#define OUTPUT_TIME_FW      0x1000&lt;br /&gt;
#define OUTPUT_TIME_BW      0x1000&lt;br /&gt;
&lt;br /&gt;
static U32_t test_data[16] = { 0 };&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Write OUTPUT_TIMED_VAL to test_data[0] at 0xfffff time units from now with a tolerance of 0x1000 before and after the specified time   &lt;br /&gt;
status = oceos_timed_output_add(&lt;br /&gt;
                                       WRITE_ACTION,&lt;br /&gt;
                                       OUTPUT_TIME,&lt;br /&gt;
                                       OUTPUT_TIME_FW,&lt;br /&gt;
                                       OUTPUT_TIME_BW,&lt;br /&gt;
                                       (adrs_t) &amp;amp;test_data[0],&lt;br /&gt;
                                       OUTPUT_TIMED_VAL,&lt;br /&gt;
                                       0,&lt;br /&gt;
                                       &amp;amp;timed_action_index));&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_timed_jobs_number()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''timed_action.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the number of jobs on the timed actions queue.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Get number of Jobs (request to start the task) waiting on timed action queue.&lt;br /&gt;
 * These jobs are added by oceos_task_timed_start() or&lt;br /&gt;
 * oceos_dataq_read_restart_timeout when data is not available (NULL) or&lt;br /&gt;
 * oceos_sem_wait_restart_timeout when counting semaphore is 0&lt;br /&gt;
 *&lt;br /&gt;
 * @param total_jobs    Pointer to store total jobs number waiting on timed action Q&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_TA_NOT_INIT             Timed action inialisation is not done and tried to be used&lt;br /&gt;
 *          ERR_TA_PTR_BAD              Timed action pointer is null&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_timed_jobs_number(U32_t *total_jobs);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| total_jobs || s32_t pointer to store total jobs number waiting on timed action Q&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_NOT_INIT             || Timed action inialisation is not done and tried to be used&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_PTR_BAD              || Timed action pointer is null&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, no_of_jobs;&lt;br /&gt;
...&lt;br /&gt;
// Get the number of jobs on the timed actions queue&lt;br /&gt;
status = oceos_timed_jobs_number(&amp;amp;no_of_jobs);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_timed_jobs_remove()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''timed_action.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function removes the specified timed action from the queue.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Remove job from timed action queue&lt;br /&gt;
 * When task started using oceos_task_timed_start(),&lt;br /&gt;
 * this directive requires pointer to store ID&lt;br /&gt;
 * of job that put on the timed action queue.&lt;br /&gt;
 * This job can be removed later using this directive and stored job ID.&lt;br /&gt;
 *&lt;br /&gt;
 * @param U32_t job_id  Job ID&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_TA_NOT_INIT             Timed action intialisation is not done and tried to be used&lt;br /&gt;
 *          ERR_TA_PTR_BAD              Timed action pointer corrupt&lt;br /&gt;
 *          ERR_ID_WRONG                Job ID is wrong&lt;br /&gt;
 *          ERR_TA_NOT_FOUND            Timed action ID not found for action with job_id or removed already&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to acquire timed action guard&lt;br /&gt;
 *          WARN_TA_Q_EMPTY             Timed action queue is empty&lt;br /&gt;
 *          ERR_TA_START_FAILED         Timed action execute failed; See log&lt;br /&gt;
 */&lt;br /&gt;
S32_t   oceos_timed_jobs_remove(&lt;br /&gt;
    U32_t job_id                             // Job ID&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| job_id || U32_t Job ID to be removed from the timed actions queue&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_NOT_INIT             || Timed action intialisation is not done and tried to be used&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_PTR_BAD              || Timed action pointer corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || Job ID is wrong&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_NOT_FOUND            || Timed action ID not found for action with job_id or removed already&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to acquire timed action guard&lt;br /&gt;
|-&lt;br /&gt;
| WARN_TA_Q_EMPTY             || Timed action queue is empty&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_START_FAILED         || Timed action execute failed; See log&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, job_id;&lt;br /&gt;
...&lt;br /&gt;
// Remove job_id from the timed actions queue&lt;br /&gt;
status = oceos_timed_jobs_remove(job_id);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_timed_jobs_reset()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''timed_action.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function removes all jobs from timed actions queue.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Remove all jobs (requests to start a task) from timed actions queue&lt;br /&gt;
 * These jobs were added by oceos_task_timed_start() or&lt;br /&gt;
 * oceos_dataq_read_restart_timeout when data is not available (NULL) or&lt;br /&gt;
 * oceos_sem_wait_restart_timeout when counting semaphore is 0&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_TA_NOT_INIT             Timed action intialisation is not done and tried to be used&lt;br /&gt;
 *          ERR_TA_PTR_BAD              Timed action pointer is null&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to acquire timed action guard&lt;br /&gt;
 *          WARN_TA_Q_EMPTY             Timed action queue is empty&lt;br /&gt;
 *          ERR_TA_NOT_FOUND            Timed action index not found&lt;br /&gt;
 *          ERR_TA_START_FAILED         Timed action execute failed; See log&lt;br /&gt;
 */&lt;br /&gt;
S32_t   oceos_timed_jobs_reset(void);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
There are no input parameters to this function&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_NOT_INIT             || Timed action intialisation is not done and tried to be used&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_PTR_BAD              || Timed action pointer is null&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to acquire timed action guard&lt;br /&gt;
|-&lt;br /&gt;
| WARN_TA_Q_EMPTY             || Timed action queue is empty&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_NOT_FOUND            || Timed action index not found&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_START_FAILED         || Timed action execute failed; See log&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Remove all jobs from the timed actions queue&lt;br /&gt;
status = oceos_timed_jobs_reset(job_id);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_timed_output_remove()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''timed_action.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function removes the specified timed output action from timed actions queue.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Remove timed output action from timed actions queue.&lt;br /&gt;
 * When action is created, action index should be stored&lt;br /&gt;
 * to remove if need&lt;br /&gt;
 *&lt;br /&gt;
 * @param action_index&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_TA_NOT_INIT             Timed action intialisation is not done and tried to be used&lt;br /&gt;
 *          ERR_TA_PTR_BAD              Timed action pointer is null&lt;br /&gt;
 *          ERR_ID_WRONG                Timed action id is wrong&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to acquire timed action guard&lt;br /&gt;
 *          ERR_TA_NOT_FOUND            Timed action index not found&lt;br /&gt;
 *          ERR_TA_START_FAILED         Timed action execute failed&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_timed_output_remove(&lt;br /&gt;
    const U8_t  action_index    // Index in action array, returned when action was created&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| action_index|| S32_t specifying the timed output action index returned when the timed output was added.&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| Error bit  || Description&lt;br /&gt;
|&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_NOT_INIT             || Timed action intialisation is not done and tried to be used&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_PTR_BAD              || Timed action pointer is null&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || Timed action id is wrong&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to acquire timed action guard&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_NOT_FOUND            || Timed action index not found&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_START_FAILED         || Timed action execute failed&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
U8_t action_index;&lt;br /&gt;
...&lt;br /&gt;
// Remove timed output with specified action_index&lt;br /&gt;
status = oceos_timed_output_remove(action_index);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_timed_output_reset()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''timed_action.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function removes all timed output actions from timed actions queue.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Remove all timed output actions from timed actions queue&lt;br /&gt;
 * These timed output actions were created by oceos_timed_output_add&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_TA_NOT_INIT             Timed action intialisation is not done and tried to be used&lt;br /&gt;
 *          ERR_TA_PTR_BAD              Timed action pointer is null&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to acquire timed action guard&lt;br /&gt;
 *          WARN_TA_Q_EMPTY             Timed action queue is empty&lt;br /&gt;
 *          ERR_TA_NOT_FOUND            Timed action index not found&lt;br /&gt;
 *          ERR_TA_START_FAILED         Timed action execute failed; See log&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_timed_output_reset(void);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
There are no input parameters to this function. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| Error bit  || Description&lt;br /&gt;
|&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_NOT_INIT             || Timed action intialisation is not done and tried to be used&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_PTR_BAD              || Timed action pointer is null&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to acquire timed action guard&lt;br /&gt;
|-&lt;br /&gt;
| WARN_TA_Q_EMPTY             || Timed action queue is empty&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_NOT_FOUND            || Timed action index not found&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_START_FAILED         || Timed action execute failed; See log&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Remove all timed outputs from the timed actions queue&lt;br /&gt;
status = oceos_timed_output_reset();&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Logging directives ==&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;Introduction&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Log Area Features  (for details of other areas see oceos_areas.h)&lt;br /&gt;
&lt;br /&gt;
The system log area holds the system log and the records of the present and previous values of the system state variable.&lt;br /&gt;
&lt;br /&gt;
It is set up initially as an array of 32-bit words that starts at a 32-bit aligned address provided by the application developer.&lt;br /&gt;
&lt;br /&gt;
It is recommended that this address be in non-volatile RAM memory if this is available to allow information be preserved across power-up cycles.&lt;br /&gt;
&lt;br /&gt;
OCEOS preserves log area information across resets as far as possible.&lt;br /&gt;
&lt;br /&gt;
The system log itself is a circular buffer of struct log entry. Older entries are overwritten by new entries once all entries are in use.&lt;br /&gt;
&lt;br /&gt;
The application developer can specify a function to be called when 3/4 of log entries are in use. This function is called again only after 3/4 of log entries have been read and the log has again become 3/4 full.&lt;br /&gt;
&lt;br /&gt;
The read and write indices are stored in the log area and if equal indicate that the log is empty.&lt;br /&gt;
&lt;br /&gt;
As with other OCEOS data areas, the log area starts with a header&lt;br /&gt;
*a 32-bit word holding a constant OCEOS_VERSION&lt;br /&gt;
*a 32-bit word holding the log area size in 32-bit words&lt;br /&gt;
*a 32-bit word, the system status variable&lt;br /&gt;
*a 32-bit word, the system status mask&lt;br /&gt;
*a 32-bit word, the accumulated system status&lt;br /&gt;
*a 32-bit word, the previous system status mask&lt;br /&gt;
*a 32-bit word, the log control, that gives whether the log full function was called&lt;br /&gt;
*the read index&lt;br /&gt;
*the write index&lt;br /&gt;
*an array of struct log_entry making up the system log itself&lt;br /&gt;
*ending with a 32-bit constant END_SENTINEL&lt;br /&gt;
&lt;br /&gt;
The system fixed meta structure at sysMetaPtr provides&lt;br /&gt;
&lt;br /&gt;
*system_log_ptr      the start address of the log area&lt;br /&gt;
*logEntries          the number of log entries&lt;br /&gt;
*logCreated          flag indicating log was created successfully&lt;br /&gt;
*logFullFunction     user defined function, called when the log becomes 3/4 full (or NULL if not used)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Log Entry Types and Structure'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/*****************************************************************************&lt;br /&gt;
 * LOG ENTRY TYPES&lt;br /&gt;
 *&lt;br /&gt;
 * A log entry type is an 8-bit number.&lt;br /&gt;
 * Values from 0 to 127 can be defined by the application.&lt;br /&gt;
 * Values from 128 to 255 are used by OCEOS as below.&lt;br /&gt;
 *&lt;br /&gt;
 *&lt;br /&gt;
 * NOTE: Add new log types at the end for backward compatibility&lt;br /&gt;
 */&lt;br /&gt;
enum LOG_ENTRY_TYPE{&lt;br /&gt;
  LOG_SYS_OK = 0x80U,&lt;br /&gt;
  LOG_OCEOS_ABORT,				// when exiting from oceos_start&lt;br /&gt;
  LOG_LOG_NOT_VALID_ENTRY,		// used to initialise log and when log empty&lt;br /&gt;
  LOG_INIT_TASK_START_FAIL,		// initial task passed to oceos_start failed&lt;br /&gt;
  LOG_DEADLINE_MISSED,			// task deadline missed&lt;br /&gt;
  LOG_JOB_NOT_ACTIVE,			// cpu_terminate but job not active, absurd&lt;br /&gt;
  LOG_JOB_NOT_FREE,				// job guarded but not free&lt;br /&gt;
  LOG_JOBS_INC_FAILED, 			// pending jobs increment failed&lt;br /&gt;
  LOG_JOB_NOT_GUARDED,			// paranoia&lt;br /&gt;
  LOG_CS_LOG_SPIN_FAIL,			// oceos_CPU_sleep, trying to update CS log&lt;br /&gt;
  LOG_MUTEX_ALREADY_HELD,		// oceos_mutex_wait, code returned, not needed&lt;br /&gt;
  LOG_MUTEX_INCORRECT_ORDER,	// oceos_mutex_wait&lt;br /&gt;
  LOG_MUTEX_EXIT_HOLDING,		// task exits holding one or more mutexes&lt;br /&gt;
  LOG_MUTEX_EXIT_NONE,			// __oceos_tasks_remove_mutexes called but no mutex held&lt;br /&gt;
  LOG_SEMAPHORE_PENDING_REMOVE_FAIL,	// timed_action.c&lt;br /&gt;
  LOG_SEMAPHORE_PENDING_QUEUE_FULL,		// __oceos_semaphore_add_pend&lt;br /&gt;
  LOG_SEMAPHORE_SPIN_FAILED,			// trying to access semaphore&lt;br /&gt;
  LOG_DATAQ_PENDING_QUEUE_FULL,&lt;br /&gt;
  LOG_DATAQ_PENDING_REMOVE_FAIL,&lt;br /&gt;
  LOG_DATAQ_SPIN_FAILED,&lt;br /&gt;
  LOG_TIMED_ACTION_TIMER_NULL,&lt;br /&gt;
  LOG_TIMED_ACTION_INVALID,&lt;br /&gt;
  LOG_TIMED_ACTION_BAD_INDEX,&lt;br /&gt;
  LOG_TIMED_ACTION_MISSED,&lt;br /&gt;
  LOG_TIMED_ACTION_Q_EMPTY,&lt;br /&gt;
  LOG_TIMED_ACTION_REMOVE_FAIL,&lt;br /&gt;
  LOG_TIMED_ACTION_BAD_JOB_ID,&lt;br /&gt;
  LOG_TIMED_Q_SPIN_FAIL,&lt;br /&gt;
  LOG_SYSTEM_ERROR,&lt;br /&gt;
  LOG_ATOMICINC_FAILED,&lt;br /&gt;
  LOG_PENDING_PRI_UPDATE_FAILED,&lt;br /&gt;
  LOG_KILL_TASK_INVALID_ID,      // Tried to kill task with invalid ID&lt;br /&gt;
  LOG_OCEOS_EXIT_REQUEST,         // oceos_exit command was called&lt;br /&gt;
  LOG_RWMUTEX_NOT_RETURNED,&lt;br /&gt;
  LOG_RWMUTEX_NOT_HIGHEST&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
/*****************************************************************************&lt;br /&gt;
 * Structures&lt;br /&gt;
 */&lt;br /&gt;
/**&lt;br /&gt;
 * Log entry structure&lt;br /&gt;
 */&lt;br /&gt;
struct log_entry{&lt;br /&gt;
  U64_t             time64;&lt;br /&gt;
&lt;br /&gt;
  unsigned int      entry_cpu          :8;&lt;br /&gt;
  unsigned int      entry_type         :8;&lt;br /&gt;
  unsigned int      entry_note         :16;	// not used at present&lt;br /&gt;
&lt;br /&gt;
  U32_t             entry_comment;&lt;br /&gt;
}__attribute__ ((aligned (8)));&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_log_add_entry()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''system_log.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function adds an entry to the log. The entry overwrites the oldest unread entry if the log is full.&lt;br /&gt;
Custom log entries can be added to enum LOG_ENTRY from 0 to 128.&lt;br /&gt;
The indices are incremented in a circular fashion. If the write index reaches the read_index the read index is moved on, as read and write indices equal would indicate an empty log.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Add an entry to the log.&lt;br /&gt;
 * this overwrites the oldest unread entry if the log is full.&lt;br /&gt;
 * Custom log entries can be added to enum LOG_ENTRY from 0 to 128&lt;br /&gt;
 *&lt;br /&gt;
 * N.B. The indices are incremented in a circular fashion.&lt;br /&gt;
 *      If the write index reaches the read_index the read index is moved on,&lt;br /&gt;
 *      as read and write indices equal would indicate an empty log.&lt;br /&gt;
 *&lt;br /&gt;
 * @param type  enum LOG_ENTRY_TYPE&lt;br /&gt;
 * @param info  extra information to be logged&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_LOG_CORRUPT         System Log area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Log directive called in wrong phase; can be used after oceos_init() called&lt;br /&gt;
 *          ERR_ID_INVALID              Log type invalid&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to acquire log guard&lt;br /&gt;
 *          ERR_LOG_INDEX_WRONG         Read/write log index is wrong&lt;br /&gt;
 */&lt;br /&gt;
S32_t   oceos_log_add_entry(&lt;br /&gt;
    enum LOG_ENTRY_TYPE type,   // 8 bits enum LOG_ENTRY_TYPE&lt;br /&gt;
    const U32_t        info     // information&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| enum LOG_ENTRY_TYPE || Log entry type (see previous section for a list)&lt;br /&gt;
|-&lt;br /&gt;
| info | U32_t with the log information&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit  !! Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_LOG_CORRUPT         || System Log area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Log directive called in wrong phase; can be used after oceos_init() called&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || Log type invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to acquire log guard&lt;br /&gt;
|-&lt;br /&gt;
| ERR_LOG_INDEX_WRONG         || Read/write log index is wrong&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, info;&lt;br /&gt;
...&lt;br /&gt;
// Log LOG_APP_COMMS__ERROR (defined in enum LOG_ENTRY_TYPE) and info with more details&lt;br /&gt;
status = oceos_log_add_entry(LOG_APP_COMMS__ERROR, info);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_log_get_indexed_entry()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''system_log.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the entry at the specified position in the log. The entry is not removed and the log and log indices are not changed.&lt;br /&gt;
One use of this function is to allow the log be examined after a reset.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Returns the entry at the specified position in the log.&lt;br /&gt;
 * The entry is not removed and the log and log indices are not changed.&lt;br /&gt;
 * (intended to allow the log be examined for example after reset)&lt;br /&gt;
 *&lt;br /&gt;
 * @param index         position in the log&lt;br /&gt;
 * @param outputPtr     pointer to return log entry&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_LOG_CORRUPT         System Log area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Log directive called in wrong phase; can be used after oceos_init() called&lt;br /&gt;
 *          ERR_LOG_INDEX_WRONG         Read log index is wrong&lt;br /&gt;
 *          ERR_LOG_DATA_PTR_BAD        Data holder pointer is null&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_log_get_indexed_entry(&lt;br /&gt;
    const unsigned int index,&lt;br /&gt;
    struct log_entry * const outputPtr&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| index || U32_t with position in the log&lt;br /&gt;
|-&lt;br /&gt;
| outputPtr || pointer to struct log_entry to hold the returned entry&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit  !! Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_LOG_CORRUPT         || System Log area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Log directive called in wrong phase; can be used after oceos_init() called&lt;br /&gt;
|-&lt;br /&gt;
| ERR_LOG_INDEX_WRONG         || Read log index is wrong&lt;br /&gt;
|-&lt;br /&gt;
| ERR_LOG_DATA_PTR_BAD        || Data holder pointer is null&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, index;&lt;br /&gt;
struct log_entry store_entry;&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
// Read log_entry at specified index into outputPtr&lt;br /&gt;
status = oceos_log_get_indexed_entry(index, &amp;amp;store_entry);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_log_remove_entry()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''system_log.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function reads and removes the oldest unread log entry. &lt;br /&gt;
If the log is not empty use the entry at the read index to update the value at the output pointer, returning OCEOS_SUCCESS.&lt;br /&gt;
If outputPtr is NULL, entry is removed but no returned.&lt;br /&gt;
If the log is empty, set the value at the output pointer to LOG_LOG_NOT_VALID_ENTRY and return ERR_LOG_EMPTY.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Read and remove the oldest unread log entry&lt;br /&gt;
 *&lt;br /&gt;
 * If the log is not empty use the entry at the read index to update the value&lt;br /&gt;
 * at the output pointer, returning OCEOS_SUCCESS.&lt;br /&gt;
 *&lt;br /&gt;
 * If outputPtr is NULL, entry is removed but no returned&lt;br /&gt;
 *&lt;br /&gt;
 * If the log is empty, set the value at the output pointer to LOG_LOG_NOT_VALID_ENTRY&lt;br /&gt;
 * and return ERR_LOG_EMPTY&lt;br /&gt;
 *&lt;br /&gt;
 * @param outputPtr   pointer to struct log_entry&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_LOG_CORRUPT         System Log area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Log directive called in wrong phase; can be used after oceos_init() called&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to acquire log guard&lt;br /&gt;
 *          ERR_LOG_INDEX_WRONG         Read/write log index is wrong&lt;br /&gt;
 *          ERR_LOG_EMPTY               Log is empty&lt;br /&gt;
 */&lt;br /&gt;
S32_t   oceos_log_remove_entry(&lt;br /&gt;
    struct log_entry * const outputPtr&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| outputPtr || pointer to struct log_entry&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit  !! Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_LOG_CORRUPT         || System Log area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Log directive called in wrong phase; can be used after oceos_init() called&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to acquire log guard&lt;br /&gt;
|-&lt;br /&gt;
| ERR_LOG_INDEX_WRONG         || Read/write log index is wrong&lt;br /&gt;
|-&lt;br /&gt;
| ERR_LOG_EMPTY               || Log is empty&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
struct log_entry *outputPtr;&lt;br /&gt;
...&lt;br /&gt;
// Read log_entry into outputPtr and remove the oldest unread log entry&lt;br /&gt;
status = oceos_log_remove_entry(outputPtr);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_log_reset()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''system_log.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function sets all log entries to LOG_LOG_NOT_VALID_ENTRY and the log to empty, with the read and write indices set to 0.&lt;br /&gt;
The log is empty if the index of the next write is the same as the index of the next read. It does not affect the system status variable. It does not affect the context switch log.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * oceos_log_reset()&lt;br /&gt;
 *&lt;br /&gt;
 * Set all log entries to LOG_LOG_NOT_VALID_ENTRY and the log to empty, with the&lt;br /&gt;
 * read and write indices set to 0. and function called flag 0&lt;br /&gt;
 *&lt;br /&gt;
 * The log is empty if the index of the next write&lt;br /&gt;
 * is the same as the index of the next read.&lt;br /&gt;
 *&lt;br /&gt;
 * Does not affect the system status variable&lt;br /&gt;
 * Does not affect the context switch log&lt;br /&gt;
 *&lt;br /&gt;
 * N.B The fixed data area may no longer be writable&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_LOG_CORRUPT         System Log area corrupt; reset failed&lt;br /&gt;
 *          ERR_WRONG_PHASE             Log directive called in wrong phase; can be used after oceos_init() called&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to acquire log guard&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_log_reset(void);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
There are no input parameters to this function.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit  !! Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_LOG_CORRUPT         || System Log area corrupt; reset failed&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Log directive called in wrong phase; can be used after oceos_init() called&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to acquire log guard&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
// Clear down the system log&lt;br /&gt;
status = oceos_log_reset();&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_log_get_size()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''system_log.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the number of entries in the log according to the current values of the read and write indices.&lt;br /&gt;
The value will be zero if the current values of the read and write indices are the same. There may still be useful information in the log, e.g. after system reset, this can be accessed using oceos_log_get_indexed_entry().&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Return the number of entries in the log&lt;br /&gt;
 * according to the current values of the read and write indices.&lt;br /&gt;
 *&lt;br /&gt;
 * The value will be zero if the current values of the read and write indices&lt;br /&gt;
 * are the same.&lt;br /&gt;
 *&lt;br /&gt;
 * There may still be useful information in the log, e.g. after system reset,&lt;br /&gt;
 * this can be accessed using oceos_log_get_indexed_entry()&lt;br /&gt;
 *&lt;br /&gt;
 * @param l_size        pointer to log size holder&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_LOG_CORRUPT         System Log area corrupt;&lt;br /&gt;
 *          ERR_WRONG_PHASE             Log directive called in wrong phase; can be used after oceos_init() called&lt;br /&gt;
 *          ERR_LOG_DATA_PTR_BAD        Pointer to log size holder is NULL&lt;br /&gt;
 *          ERR_LOG_INDEX_WRONG         Read/write log index is wrong&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_log_get_size(&lt;br /&gt;
    U32_t *l_size&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| l_size|| U32_t pointer where size will be written.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit  !! Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_LOG_CORRUPT         || System Log area corrupt;&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Log directive called in wrong phase; can be used after oceos_init() called&lt;br /&gt;
|-&lt;br /&gt;
| ERR_LOG_DATA_PTR_BAD        || Pointer to log size holder is NULL&lt;br /&gt;
|-&lt;br /&gt;
| ERR_LOG_INDEX_WRONG         || Read/write log index is wrong&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, size;&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
// Clear down the system log&lt;br /&gt;
status = oceos_log_get_size(&amp;amp;size);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;System State Variable and System State Mask&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The System State variable provides a record of anomalies or problems detected by OCEOSmp's automatic consistency checks. An application handler for these can be set to be called automatically.&lt;br /&gt;
&lt;br /&gt;
An anomaly or problem results in a flag bit being set in the 32-bit word used to store the system state variable. The flags are identified below.&lt;br /&gt;
&lt;br /&gt;
All flags are reset to zero by oceos_init() when OCEOSmp is initialised, and may also be reset by the application using the directive provided.&lt;br /&gt;
&lt;br /&gt;
To provide a record across OCEOSmp restarts a copy is updated automatically whenever the state variable is updated. This is not cleared by oceos_init() but may be cleared by the application using a directive.&lt;br /&gt;
&lt;br /&gt;
Application software can define a problem handling function to be called automatically when specified system state flags are set. The flags are specified by setting the corresponding bits in the system state mask. The function and the state mask are defined in the system configuration.&lt;br /&gt;
&lt;br /&gt;
Changing a state flag from clear to set results in the function being called (if defined). Subsequent settings of that flag have no effect until after it has been cleared using the directive provided.&lt;br /&gt;
&lt;br /&gt;
N.B. In many cases when OCEOSmp sets a System State flag it also makes an entry in the system log that provides further information.&lt;br /&gt;
&lt;br /&gt;
SYSTEM STATE VARIABLE FLAGS&lt;br /&gt;
&lt;br /&gt;
These flags are updated by OCEOSmp using inclusive 'OR' when a consistency check detects a problem or anomaly. A copy of the system state variable is updated also and accumulates a record of flag settings that is preserved across restarts of OCEOSmp. OCEOSmp restarts reset the system state variable but not the copy.&lt;br /&gt;
&lt;br /&gt;
Resetting the state variables is the responsibility of the application (except for the state variable reset done when OCEOSmp is restarted).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''System Status Bits'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
#define  STATUS_NORMAL                    0u    // No flag set                              YES&lt;br /&gt;
#define  STATUS_INVALID          0xffffffffu    // System status is invalid                 YES BUT NO DETAIL!!!&lt;br /&gt;
&lt;br /&gt;
#define  STATUS_MASK_NORMAL      0xffffffffu    // Always call user def fn                  YES&lt;br /&gt;
&lt;br /&gt;
/* Task related problems */&lt;br /&gt;
#define  STATUS_DISABLED_TASK_START    0x1U    // An attempt to start a disabled task&lt;br /&gt;
#define  STATUS_TASK_JOB_LIMIT_OVER    0x2U    // An attempt to execute a task when its jobs limit is already reached.&lt;br /&gt;
#define  STATUS_JOB_OVER_TIME          0x4U    // Job time from creation to completion exceeds allowed maximum for task. YES&lt;br /&gt;
#define  STATUS_JOB_INTERVAL_SHORT     0x8U    // Minimum time between job creations is less than the allowed minimum for task&lt;br /&gt;
#define  STATUS_READYQ_FULL           0x10U    // Ready queue unable to accept job as result of being full&lt;br /&gt;
#define  STATUS_READYQ_NO_REMOVE      0x20U    // Remove job from ready queue failed&lt;br /&gt;
&lt;br /&gt;
/* Mutex related problems */&lt;br /&gt;
#define  STATUS_MUTEX_ALREADY_HELD    0x40U    // Mutex wait() when mutex already held&lt;br /&gt;
#define  STATUS_MUTEX_NOT_HELD        0x80U    // Mutex signal() when not already held&lt;br /&gt;
#define  STATUS_MUTEX_NOT_RETURNED   0x100U    // Mutex not returned before job terminates&lt;br /&gt;
#define  STATUS_MUTEX_NOT_NESTED     0x200U    // Use of multiple mutexes not nested&lt;br /&gt;
&lt;br /&gt;
/* Counting semaphore and data queue related problems */&lt;br /&gt;
#define  STATUS_SEMAPHORE_JOBS_FULL  0x400U    // Attempt to add job to semaphore pending list when list full&lt;br /&gt;
#define  STATUS_DATAQ_JOBS_FULL      0x800U    // Attempt to add job to data queue pending list when list full&lt;br /&gt;
#define  STATUS_DATAQ_FULL          0x1000U    // Data queue write when queue already full&lt;br /&gt;
&lt;br /&gt;
/* Timed actions related problems */&lt;br /&gt;
#define  STATUS_TIMED_JOBS_FULL     0x2000U    // Timed actions queue already full for timed task start&lt;br /&gt;
#define  STATUS_TIMED_OUTPUT_FULL   0x4000U    // Timed actions queue already full for timed output&lt;br /&gt;
#define  STATUS_TIMED_ACTION_LATE   0x8000U    // Timed action late                          YES&lt;br /&gt;
&lt;br /&gt;
/* Default trap handler should have been replaced&lt;br /&gt;
 * NOT USED AT THE MOMENT*/&lt;br /&gt;
#define  STATUS_SYSTEM_ERROR       0x10000U    // ERROR was handled by default trap handler  YES&lt;br /&gt;
&lt;br /&gt;
/* Flag to indicate problem with Stack Pointer&lt;br /&gt;
 * NOT USED AT THE MOMENT*/&lt;br /&gt;
#define  STATUS_SP_WARNING         0x20000U    // SP not in expected range&lt;br /&gt;
/* Log system error */&lt;br /&gt;
#define  STATUS_BAD_LOG            0x40000U    // System log problem&lt;br /&gt;
#define  STATUS_SPIN_FAILED        0x80000U    // Get SPIN lock failed&lt;br /&gt;
/* Not using next few bits */&lt;br /&gt;
&lt;br /&gt;
/* Will have to exit */&lt;br /&gt;
#define  STATUS_BAD_SENTINEL     0x40000000U    // Area sentinel corrupt&lt;br /&gt;
#define  STATUS_BAD_META_PTR     0x80000000U    // Null meta pointer&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_system_state_get()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''system_log.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns of the system state variable.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Returns the value of the system state variable&lt;br /&gt;
 *&lt;br /&gt;
 * @param state  pointer to state holder&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_LOG_DATA_PTR_BAD        Data holder pointer is null&lt;br /&gt;
 *          ERR_SYS_LOG_CORRUPT         LOG dynamic pointer is null&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_system_state_get(&lt;br /&gt;
    U32_t *state // pointer to state holder&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| state || U32_t pointer to state holder&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit  !! Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_LOG_DATA_PTR_BAD        || Data holder pointer is null&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_LOG_CORRUPT         || LOG dynamic pointer is null&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, state;&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
// Get the system state&lt;br /&gt;
status = oceos_system_state_get(&amp;amp;state);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_system_state_set()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''system_log.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function sets system state variable.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Sets system state variable&lt;br /&gt;
 *&lt;br /&gt;
 * @param new_state&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_LOG_CORRUPT         LOG dynamic pointer is null&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_system_state_set(&lt;br /&gt;
    U32_t new_state   // new value of system state variable&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| new_state || U32_t containing new system state&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit  !! Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_LOG_CORRUPT         || LOG dynamic pointer is null&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, new_state;&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
// Set new system state&lt;br /&gt;
status = oceos_system_state_set(new_state);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_system_state_copy_get()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''system_log.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the value of the system state copy variable.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Returns the value of the copy of system state variable&lt;br /&gt;
 *&lt;br /&gt;
 * @param state  pointer to state holder&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_LOG_DATA_PTR_BAD        Data holder pointer is null&lt;br /&gt;
 *          ERR_SYS_LOG_CORRUPT         LOG dynamic pointer is null&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_system_state_copy_get(&lt;br /&gt;
    U32_t *state // pointer to state copy holder&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| state || U32_t pointer to state copy holder&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit  !! Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_LOG_DATA_PTR_BAD        || Data holder pointer is null&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_LOG_CORRUPT         || LOG dynamic pointer is null&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, copy_state;&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
// Get the system state copy&lt;br /&gt;
status = oceos_system_state_copy_get(&amp;amp;copy_state);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_system_state_copy_set()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''system_log.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function loads a value to tha system state copy variable.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Sets system state copy variable&lt;br /&gt;
 *&lt;br /&gt;
 * @param new_state&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_LOG_CORRUPT         LOG dynamic pointer is null&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_system_state_copy_set(&lt;br /&gt;
    U32_t new_state   // new value of system state variable&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| new_state || U32_t containing new system state copy&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit  !! Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_LOG_CORRUPT         || LOG dynamic pointer is null&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, new_state;&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
// Set new system state copy&lt;br /&gt;
status = oceos_system_state_copy_set(new_state);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Timing directives ==&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;Introduction&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''SPARC'''&lt;br /&gt;
&lt;br /&gt;
In OCEOS system time is based on two chained 32-bit timers.&lt;br /&gt;
&lt;br /&gt;
No interrupts are involved, the current system time is obtained by reading the two timer counter registers (in an atomic way) and then inverting the&lt;br /&gt;
values since the timers count down.&lt;br /&gt;
&lt;br /&gt;
The scaler associated with the timers is configured based on the system clock frequency to decrement the low order timer every microsecond. This&lt;br /&gt;
decrements the high order timer when it rolls over, every 71.6 minutes approximately. The 64-bit time range is very long, over 584,000 years.&lt;br /&gt;
&lt;br /&gt;
'''ARM Cortex-M'''&lt;br /&gt;
&lt;br /&gt;
In OCEOS for ARM Cortex-M, system time is based on SysTick. The processor has a 24-bit system timer, SysTick, that counts down from the reload value to zero, reloads (wraps to) the value in the LOAD register on the next clock edge, then counts down on subsequent clocks.&lt;br /&gt;
&lt;br /&gt;
Note: When the processor is halted for debugging the counter does not decrement.&lt;br /&gt;
&lt;br /&gt;
OCEOS initializes the timer to be driven from MCK and counting down to zero asserts SysTick exception request.&lt;br /&gt;
OCEOS has 64 bit counter which is increased by 0xFFFFFF value every time timer reloads.&lt;br /&gt;
&lt;br /&gt;
'''RISC-V'''&lt;br /&gt;
&lt;br /&gt;
In OCEOS for RISC-V systems time is based internally on clock cycles.&lt;br /&gt;
The RISC-V processor typically has a 64 bit counter (typically mtime) that  updates automatically on each clock cycle. Each hart typically has its own comparison register (typically mtimecmp) that can be used to interrupt that hart when a certain cycle count has been exceeded.&lt;br /&gt;
If a particular RISC-V implementation provides a more restricted clock cycle count this will be used with appropriate modifications as clock cycles give the best timing precision available.&lt;br /&gt;
&lt;br /&gt;
Note: The application configuration provides the constant needed to allow microseconds (as used in OCEOS directives) be converted to clock cycles. Time is reported by OCEOSmp as the number of microseconds since OCEOS was initialized.&lt;br /&gt;
&lt;br /&gt;
A potential difficulty arises if the main system clock rate can change for power saving or other reasons, each system is probably different with regard to this. OCEOSmp can handle this, if needed.&lt;br /&gt;
&lt;br /&gt;
The units of OCEOS system time are microseconds on SPARC and ARM and on RISC-V the period of the clock cycle.&lt;br /&gt;
&lt;br /&gt;
The system time is reset to 0 by oceos_init()&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_time_sys_get64()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''oceos_timer.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the current system time as a 64-bit number.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
**&lt;br /&gt;
 * Get the current system time (64-bit)&lt;br /&gt;
 *&lt;br /&gt;
 * @return U64_t&lt;br /&gt;
 */&lt;br /&gt;
U64_t oceos_time_sys_get64(void);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There are no parameters to this function.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S64_t with the current system time.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S64_t now;&lt;br /&gt;
...&lt;br /&gt;
// Get the time&lt;br /&gt;
now = oceos_time_sys_get64();&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_time_sys_get32()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''oceos_timer.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the low 32 bits of the system time.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Get the current system time (low 32 bits of 64 bit value)&lt;br /&gt;
 *&lt;br /&gt;
 * @return U32_t&lt;br /&gt;
 */&lt;br /&gt;
U32_t oceos_time_sys_get32(void);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
There are no parameters to this function.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with the current system time.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t now;&lt;br /&gt;
...&lt;br /&gt;
// Get the time&lt;br /&gt;
now = oceos_time_sys_get32();&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:backup]]&lt;/div&gt;</summary>
		<author><name>Bkavanagh</name></author>
	</entry>
	<entry>
		<id>https://wiki.ocetechnology.com/mediawiki/index.php?title=OCEOSmp/directive_reference&amp;diff=1703</id>
		<title>OCEOSmp/directive reference</title>
		<link rel="alternate" type="text/html" href="https://wiki.ocetechnology.com/mediawiki/index.php?title=OCEOSmp/directive_reference&amp;diff=1703"/>
		<updated>2024-05-03T16:59:36Z</updated>

		<summary type="html">&lt;p&gt;Bkavanagh: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Introduction =&lt;br /&gt;
&lt;br /&gt;
To be added&lt;br /&gt;
&lt;br /&gt;
= Directives =&lt;br /&gt;
&lt;br /&gt;
== Initialisation directives ==&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_init()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''initialisation.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Initialises OCEOS and  must be the first directive used.&lt;br /&gt;
&lt;br /&gt;
Initialises the OCEOS system meta data using the information supplied in the application configuration and prepares for creation of tasks etc.&lt;br /&gt;
&lt;br /&gt;
The values provided in the application configuration are checked as much as possible before being used.&lt;br /&gt;
&lt;br /&gt;
The system log also is created here.&lt;br /&gt;
&lt;br /&gt;
This function sets up sysMetaPtr and init_meta_ptr and must have completed successfully before tasks etc. can be created.&lt;br /&gt;
&lt;br /&gt;
It disables interrupts and leaves them disabled, they will be re-enabled to the previous level after all tasks etc. have been created and [[OCEOSmp/directive_reference#oceos_init_finish()|oceos_init_finish()]] has completed successfully.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Initialises OCEOS and  must be the first directive used.&lt;br /&gt;
 *&lt;br /&gt;
 * Initialises the OCEOS system meta data using the information supplied in&lt;br /&gt;
 * the application configuration and prepares for creation of tasks etc.&lt;br /&gt;
 *&lt;br /&gt;
 * The values provided in the application configuration are checked as much&lt;br /&gt;
 * as possible before being used.&lt;br /&gt;
 *&lt;br /&gt;
 * The system log also is created here.&lt;br /&gt;
 *&lt;br /&gt;
 * This function sets up sysMetaPtr and init_meta_ptr and must have completed&lt;br /&gt;
 * successfully before tasks etc. can be created.&lt;br /&gt;
 *&lt;br /&gt;
 * It disables interrupts and leaves them disabled, they will be re-enabled to&lt;br /&gt;
 * the previous level after all tasks etc. have been created and&lt;br /&gt;
 * oceos_init_finish() has completed successfully.&lt;br /&gt;
 *&lt;br /&gt;
 * @param app_config Pointer to configuration struct&lt;br /&gt;
 * @return SUCCESSFUL                        All OK&lt;br /&gt;
 *         WARN_LOG_SIZE_DEFAULT             Warning, log size is set to default value of 64 entries&lt;br /&gt;
 *         WARN_NO_ERROR_FUNCTION            Warning, user defined function for ERROR handling is not provided&lt;br /&gt;
 *         ERR_CPU_FIRST_CORE_INVALID        Start CPU not in a range of available cores for this target; or greater than end CPU&lt;br /&gt;
 *         ERR_CPU_LAST_CORE_INVALID         Last CPU not in a range of available cores for this target&lt;br /&gt;
 *         ERR_NOT_START_CPU_CORE            Executing oceos_init on wrong CPU&lt;br /&gt;
 *         ERR_STACK_START_MISALIGNED        Stack start address is not set by user misaligned&lt;br /&gt;
 *         ERR_STACK_PER_CORE_INVALID        Stack per CPU size is zero, or not 8byte aligned, or less then min require&lt;br /&gt;
 *         ERR_LOG_ADDR_MISALIGNED           Log start address is not 8 byte aligned&lt;br /&gt;
 *         ERR_FIX_ADDR_MISALIGNED           Fixed area start address is not 8 byte aligned&lt;br /&gt;
 *         ERR_DYN_ADDR_MISALIGNED           Dynamic area start address is not 8 byte aligned&lt;br /&gt;
 *         ERR_CPU_CORE_RANGE_WRONG          CPU cores in use exceed available CPUs on the SoC&lt;br /&gt;
 *         ERR_STACK_SPACE_WRONG             Current CPU SP is not within user provided stack range&lt;br /&gt;
 *         ERR_LOG_SIZE_INVALID              Log size outside expected range&lt;br /&gt;
 *         ERR_CS_LOG_SIZE_INVALID           Context switch log size invalid&lt;br /&gt;
 *         ERR_TASK_NUMBER_INVALID           Number of tasks invalid&lt;br /&gt;
 *         ERR_MUTEX_NUMBER_INVALID          Number of mutexes invalid&lt;br /&gt;
 *         ERR_RWMUTEX_NUMBER_INVALID        Number of rwmutexes invalid&lt;br /&gt;
 *         ERR_SEM_NUMBER_INVALID            Number of semaphores invalid&lt;br /&gt;
 *         ERR_DATAQ_NUMBER_INVALID          Number of datqs invalid&lt;br /&gt;
 *         ERR_TIMED_ACTIONS_NUMBER_INVALID  Number of timed actions invalid&lt;br /&gt;
 *         ERR_OVERLAP_STACK                 Overlap stack end address with (two overlap areas are set)&lt;br /&gt;
 *         ERR_OVERLAP_LOG                   Overlap log with (two overlap areas are set)&lt;br /&gt;
 *         ERR_OVERLAP_FIXED                 Overlap fixed area with (two overlap areas are set)&lt;br /&gt;
 *         ERR_OVERLAP_DYNAMIC               Overlap dynamic area with (two overlap areas are set)&lt;br /&gt;
 *         ERR_FIXED_MEMORY_FAILED           Fixed area memory write fail&lt;br /&gt;
 *         ERR_DYNAMIC_MEMORY_FAILED         Dynamic area memory write fail&lt;br /&gt;
 *         ERR_TIMER_ADDR_INVALID            Timer address not provided by user (null). SPARC only&lt;br /&gt;
 *         ERR_SYS_TIMER_INDEX_INVALID       System timer index of subtimer invalid; SPARC only; Subtimers start from index 1; Need index of subtimer plus one in front&lt;br /&gt;
 *         ERR_PERIPHERAL_CLOCK_INVALID      System peripheral code invalid&lt;br /&gt;
 *&lt;br /&gt;
 */&lt;br /&gt;
S32_t   oceos_init(&lt;br /&gt;
    const struct application_configuration app_config&lt;br /&gt;
);&lt;br /&gt;
 &amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| app_config || Pointer to configuration struct.  struct application_configuration defined in '''''basic_structs.h'''''&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| WARN_LOG_SIZE_DEFAULT             || Warning, log size is set to default value of 64 entries&lt;br /&gt;
|-&lt;br /&gt;
| WARN_NO_ERROR_FUNCTION            || Warning, user defined function for ERROR handling is not provided&lt;br /&gt;
|-&lt;br /&gt;
| ERR_CPU_FIRST_CORE_INVALID        || Start CPU not in a range of available cores for this target; or greater than end CPU&lt;br /&gt;
|-&lt;br /&gt;
| ERR_CPU_LAST_CORE_INVALID         || Last CPU not in a range of available cores for this target&lt;br /&gt;
|-&lt;br /&gt;
| ERR_NOT_START_CPU_CORE            || Executing oceos_init on wrong CPU&lt;br /&gt;
|-&lt;br /&gt;
| ERR_STACK_START_MISALIGNED        || Stack start address is not set by user misaligned&lt;br /&gt;
|-&lt;br /&gt;
| ERR_STACK_PER_CORE_INVALID        || Stack per CPU size is zero, or not 8byte aligned, or less then min require&lt;br /&gt;
|-&lt;br /&gt;
| ERR_LOG_ADDR_MISALIGNED           || Log start address is not 8 byte aligned&lt;br /&gt;
|-&lt;br /&gt;
| ERR_FIX_ADDR_MISALIGNED           || Fixed area start address is not 8 byte aligned&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DYN_ADDR_MISALIGNED           || Dynamic area start address is not 8 byte aligned&lt;br /&gt;
|-&lt;br /&gt;
| ERR_CPU_CORE_RANGE_WRONG          || CPU cores in use exceed available CPUs on the SoC&lt;br /&gt;
|-&lt;br /&gt;
| ERR_STACK_SPACE_WRONG             || Current CPU SP is not within user provided stack range&lt;br /&gt;
|-&lt;br /&gt;
| ERR_LOG_SIZE_INVALID              || Log size outside expected range&lt;br /&gt;
|-&lt;br /&gt;
| ERR_CS_LOG_SIZE_INVALID           || Context switch log size invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TASK_NUMBER_INVALID           || Number of tasks invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_MUTEX_NUMBER_INVALID          || Number of mutexes invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_RWMUTEX_NUMBER_INVALID        || Number of rwmutexes invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SEM_NUMBER_INVALID            || Number of semaphores invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DATAQ_NUMBER_INVALID          || Number of datqs invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TIMED_ACTIONS_NUMBER_INVALID  || Number of timed actions invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_OVERLAP_STACK                 || Overlap stack end address with (two overlap areas are set)&lt;br /&gt;
|-&lt;br /&gt;
| ERR_OVERLAP_LOG                   || Overlap log with (two overlap areas are set)&lt;br /&gt;
|-&lt;br /&gt;
| ERR_OVERLAP_FIXED                 || Overlap fixed area with (two overlap areas are set)&lt;br /&gt;
|-&lt;br /&gt;
| ERR_OVERLAP_DYNAMIC               || Overlap dynamic area with (two overlap areas are set)&lt;br /&gt;
|-&lt;br /&gt;
| ERR_FIXED_MEMORY_FAILED           || Fixed area memory write fail&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DYNAMIC_MEMORY_FAILED         || Dynamic area memory write fail&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TIMER_ADDR_INVALID            || Timer address not provided by user (null). SPARC only&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_TIMER_INDEX_INVALID       || System timer index of subtimer invalid; SPARC only; Subtimers start from index 1; Need index of subtimer plus one in front&lt;br /&gt;
|-&lt;br /&gt;
| ERR_PERIPHERAL_CLOCK_INVALID      || System peripheral code invalid&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
    /*&lt;br /&gt;
     * Create the application configuration structure&lt;br /&gt;
     */&lt;br /&gt;
    struct application_configuration           app_config = {0};&lt;br /&gt;
&lt;br /&gt;
    /*&lt;br /&gt;
     * Fill in the application parameters&lt;br /&gt;
     */&lt;br /&gt;
    app_config.log_address                   = (log_t)log_data;              // required&lt;br /&gt;
    app_config.fixed_data_address            = (adrs_t)fixed_data;            // required&lt;br /&gt;
    app_config.dynamic_data_address          = (adrs_t)dynamic_data;          // required&lt;br /&gt;
&lt;br /&gt;
    app_config.stack_start_address           = start_stack_array[OCEOS_START_CPU_INDEX];// OCEOSMP_STACK_START_ADDRESS;&lt;br /&gt;
    app_config.stack_size_per_cpu            = (U32_t)&amp;amp;__oceos_stack_size_per_cpu;  // OCEOSMP_STACK_LOW_BOUND_ADDRESS;&lt;br /&gt;
&lt;br /&gt;
    app_config.system_error_function         = oceosmp_on_error;               // NULL =&amp;gt; ignore&lt;br /&gt;
    app_config.log_full_function             = oceosmp_on_full_log;            // NULL =&amp;gt; ignore&lt;br /&gt;
&lt;br /&gt;
    // used in setting up system log and fixed data array&lt;br /&gt;
    app_config.log_number_of_entries         = NUMBER_OF_LOG_ENTRIES;          // 0 =&amp;gt; use default&lt;br /&gt;
&lt;br /&gt;
    app_config.number_of_tasks               = NUMBER_OF_TASKS;                // &amp;gt;= 1&lt;br /&gt;
&lt;br /&gt;
    app_config.number_of_mutexes             = NUMBER_OF_MUTEXES;&lt;br /&gt;
	app_config.number_of_rwmutexes			 = NUMBER_OF_RWMUTEXES;&lt;br /&gt;
    app_config.number_of_counting_semaphores = NUMBER_OF_SEMAPHORES;&lt;br /&gt;
    app_config.number_of_data_queues         = NUMBER_OF_DATAQS;&lt;br /&gt;
&lt;br /&gt;
    /**&lt;br /&gt;
     * FOR SPARC TARGET ONLY.&lt;br /&gt;
     */&lt;br /&gt;
    app_config.sys_time_timer_index          = SYS_TIME_TIMER_INDEX;           // 0 =&amp;gt; invalid index&lt;br /&gt;
    /**&lt;br /&gt;
     * FOR SPARC TARGET ONLY.&lt;br /&gt;
     * Not Used for ARM. Always Nested&lt;br /&gt;
     */&lt;br /&gt;
    app_config.interrupt_nesting_enabled     = TRUE;                           // TRUE =&amp;gt; single vector&lt;br /&gt;
    app_config.oceos_cpu_switch_int_number   = OCEOS_CPU_INTER_COM_INT_NUMBER; // User should provide SGI ID (0-15)&lt;br /&gt;
&lt;br /&gt;
    app_config.timed_actions_queue_size      = NUMBER_OF_ACTION_ENTRIES;&lt;br /&gt;
    app_config.CS_log_entries_base2          = CS_LOG_DEF_ENTRIES_BASE2;&lt;br /&gt;
    /**&lt;br /&gt;
     * Set starting index of CPU that will be used by OCEOSMP&lt;br /&gt;
     */&lt;br /&gt;
    app_config.oceos_cpu_start_index         = OCEOS_START_CPU_INDEX;&lt;br /&gt;
    /**&lt;br /&gt;
     * Set last index of CPU that will be used by OCEOSMP&lt;br /&gt;
     */&lt;br /&gt;
    app_config.oceos_cpu_last_index          = OCEOS_LAST_CPU_INDEX;&lt;br /&gt;
    /*&lt;br /&gt;
     * Set system/peripheral clock used to initialise system timer&lt;br /&gt;
     */&lt;br /&gt;
    app_config.soc_peripheral_clck           = BSP_SYSFREQ * 1000 * 1000;&lt;br /&gt;
&lt;br /&gt;
    // initialise OCEOSMP&lt;br /&gt;
    S32_t status;&lt;br /&gt;
    status = oceos_init(app_config);&lt;br /&gt;
    if (OCEOS_SUCCESS &amp;gt; status) {&lt;br /&gt;
      oceosmp_print(&amp;quot;\n oceos_init failure\n\r&amp;quot;);&lt;br /&gt;
      return 0;&lt;br /&gt;
    } else {&lt;br /&gt;
      return 1;&lt;br /&gt;
    }   // else&lt;br /&gt;
 &amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_init_finish()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''initialisation.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Finalizes the fixed data array after all tasks etc. have been created&lt;br /&gt;
&lt;br /&gt;
All information needed to start OCEOS can be found in the fixed data area&lt;br /&gt;
when oceos_init_finish() has completed.&lt;br /&gt;
&lt;br /&gt;
Once all tasks etc. have been created oceos_init_finish() checks the&lt;br /&gt;
accumulated information against the application configuration data&lt;br /&gt;
stored in the fixed meta structure.&lt;br /&gt;
&lt;br /&gt;
oceos_init_finish also calculates the size of the dynamic data area and&lt;br /&gt;
checks it does not overlap with the system stack, the system log, or the&lt;br /&gt;
fixed data, and if all ok sets up pointers to the various dynamic area&lt;br /&gt;
components in the fixed data.&lt;br /&gt;
&lt;br /&gt;
It then adds an XOR checksum to the fixed data area, and checks that this&lt;br /&gt;
is followed by FILLER, which it replaces with the end sentinel.&lt;br /&gt;
&lt;br /&gt;
On successful completion it restores the interrupt level to its value&lt;br /&gt;
before oceos_init() was called, otherwise interrupts remain disabled.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Finalizes the fixed data array after all tasks etc. have been created&lt;br /&gt;
 *&lt;br /&gt;
 * All information needed to start OCEOS can be found in the fixed data area&lt;br /&gt;
 * when oceos_init_finish() has completed.&lt;br /&gt;
 *&lt;br /&gt;
 * Once all tasks etc. have been created oceos_init_finish() checks the&lt;br /&gt;
 * accumulated information against the application configuration data&lt;br /&gt;
 * stored in the fixed meta structure.&lt;br /&gt;
 *&lt;br /&gt;
 * oceos_init_finish also calculates the size of the dynamic data area and&lt;br /&gt;
 * checks it does not overlap with the system stack, the system log, or the&lt;br /&gt;
 * fixed data, and if all ok sets up pointers to the various dynamic area&lt;br /&gt;
 * components in the fixed data.&lt;br /&gt;
 *&lt;br /&gt;
 * It then adds an XOR checksum to the fixed data area, and checks that this&lt;br /&gt;
 * is followed by FILLER, which it replaces with the end sentinel.&lt;br /&gt;
 *&lt;br /&gt;
 * On successful completion it restores the interrupt level to its value&lt;br /&gt;
 * before oceos_init() was called, otherwise interrupts remain disabled.&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS                             All OK&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT               System Meta data is NULL or corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT                 System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_CPU_CORE                  Executing directive on wrong CPU&lt;br /&gt;
 *          ERR_WRONG_PHASE                     Called before oceos_init()&lt;br /&gt;
 *          ERR_TASKS_INCOMPLETE                Created wrong number of tasks&lt;br /&gt;
 *          ERR_MUTEX_INCOMPLETE                Created wrong number of mutexes&lt;br /&gt;
 *          ERR_RWMUTEX_INCOMPLETE              Created wrong number of rwmutexes&lt;br /&gt;
 *          ERR_SEM_INCOMPLETE                  Created wrong number of semaphores&lt;br /&gt;
 *          ERR_DATAQ_INCOMPLETE                Created wrong number of dataqs&lt;br /&gt;
 *          ERR_TASK_MAX_ID_INVALID             Task's max id invalid&lt;br /&gt;
 *          ERR_MUTEX_MAX_ID_INVALID            Mutexe's max id invalid&lt;br /&gt;
 *          ERR_RWMUTEX_MAX_ID_INVALID          Rwmutexe's max id invalid&lt;br /&gt;
 *          ERR_SEM_MAX_ID_INVALID              Semaphore's max id invalid&lt;br /&gt;
 *          ERR_DATAQ_MAX_ID_INVALID            Dataq's max id invalid&lt;br /&gt;
 *          ERR_TOTAL_JOBS_NUMBER_WRONG         Wrong number of total jobs created&lt;br /&gt;
 *          ERR_ORDER_ARRAY_PTR_INVALID         Order array pointer is NULL or mis-aligned&lt;br /&gt;
 *          ERR_FIXED_AREA_TOO_SMALL            Not enough space for fixed data area&lt;br /&gt;
 */&lt;br /&gt;
S32_t   oceos_init_finish(void);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
There are no input parameters to this function.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit  || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT               || System Meta data is NULL or corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT                 || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_CPU_CORE                  || Executing directive on wrong CPU&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE                     || Called before oceos_init()&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TASKS_INCOMPLETE                || Created wrong number of tasks&lt;br /&gt;
|-&lt;br /&gt;
| ERR_MUTEX_INCOMPLETE                || Created wrong number of mutexes&lt;br /&gt;
|-&lt;br /&gt;
| ERR_RWMUTEX_INCOMPLETE              || Created wrong number of rwmutexes&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SEM_INCOMPLETE                  || Created wrong number of semaphores&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DATAQ_INCOMPLETE                || Created wrong number of dataqs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TASK_MAX_ID_INVALID             || Task's max id invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_MUTEX_MAX_ID_INVALID            || Mutexe's max id invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_RWMUTEX_MAX_ID_INVALID          || Rwmutexe's max id invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SEM_MAX_ID_INVALID              || Semaphore's max id invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DATAQ_MAX_ID_INVALID            || Dataq's max id invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TOTAL_JOBS_NUMBER_WRONG         || Wrong number of total jobs created&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ORDER_ARRAY_PTR_INVALID         || Order array pointer is NULL or mis-aligned&lt;br /&gt;
|-&lt;br /&gt;
| ERR_FIXED_AREA_TOO_SMALL            || Not enough space for fixed data area&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
    /*&lt;br /&gt;
     * Finish initialising OCEOS and setting up the fixed data&lt;br /&gt;
     */&lt;br /&gt;
    status = oceos_init_finish();&lt;br /&gt;
    if(OCEOS_SUCCESS &amp;gt; status){&lt;br /&gt;
        // LOG&lt;br /&gt;
      oceosmp_print(&amp;quot;\nAbandoning, problem ending OCEOS initialisation\n\r&amp;quot;);&lt;br /&gt;
        return -1;&lt;br /&gt;
    }   // if&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_start()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''initialisation.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Starts OCEOS scheduling.&amp;lt;br&amp;gt;&lt;br /&gt;
Create dynamic OCEOS structures and start scheduling.&amp;lt;br&amp;gt;&lt;br /&gt;
This function should only be called once and only after [[OCEOSmp/directive_reference#oceos_init()|oceos_init()]] and [[OCEOSmp/directive_reference#oceos_init_finish()|oceos_init_finish()]] have been called successfully.&amp;lt;br&amp;gt;&lt;br /&gt;
Normally this function does not return. &amp;lt;br&amp;gt;&lt;br /&gt;
If a problem is detected the function terminates and returns an appropriate DIRECTIVE_STATUS code, with interrupts disabled.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Starts OCEOS scheduling&lt;br /&gt;
 *&lt;br /&gt;
 * Create dynamic OCEOS structures and start scheduling&lt;br /&gt;
 *&lt;br /&gt;
 * This function should only be called once&lt;br /&gt;
 * and only after oceos_init()&lt;br /&gt;
 * and oceos_init_finish() have&lt;br /&gt;
 *  been called successfully.&lt;br /&gt;
 * Normally this function does not return.&lt;br /&gt;
 * If a problem is detected the function&lt;br /&gt;
 * terminates and returns an appropriate&lt;br /&gt;
 * DIRECTIVE_STATUS code, with interrupts disabled.&lt;br /&gt;
 *&lt;br /&gt;
 * @param fixed_array_ptr   Pointer to fixed data array&lt;br /&gt;
 * @param start_task        Task ID&lt;br /&gt;
 * @param data_ptr          Pointer to data to be passed to the task&lt;br /&gt;
 * @return  OCEOSMP_EXIT                        OCEOSMP return from scheduling and exit&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT               Fixed area pointer is null or bad sentinel&lt;br /&gt;
 *          ERR_FIXED_AREA_SIZE_WRONG           Fixed area size is zero&lt;br /&gt;
 *          ERR_FIXED_AREA_END_SENTINEL_BAD     Fixed data end sentinel corrupt&lt;br /&gt;
 *          ERR_FIXED_AREA_BAD_XOR              Fixed area bad checksum or checksum mis-match&lt;br /&gt;
 *          ERR_INIT_NOT_DONE                   oceos_start() called without initialisation&lt;br /&gt;
 *          ERR_DYN_AREA_PTR_BAD                Dynamic area pointer invalid in sysMetaPtr&lt;br /&gt;
 *          ERR_INT_HANDLER_BAD                 IRQ controller pointer provided by BCC is NULL;or OCEOS handler is not set&lt;br /&gt;
 *          ERR_DYN_JOB_PTR_BAD                 Job array pointer is NULL&lt;br /&gt;
 *          ERR_FIXED_TASK_PTR_BAD              Tasks array pointer is NULL&lt;br /&gt;
 *          ERR_JOB_COUNT_WRONG                 Total job count inconsistent&lt;br /&gt;
 *          ERR_DYN_MUTEX_PTR_BAD               Mutex dynamic pointer is NULL&lt;br /&gt;
 *          ERR_DYN_LOCK_PTR_BAD                Mutex lock array pointer is NULL&lt;br /&gt;
 *          ERR_DYN_RWMUTEX_PTR_BAD             Rwmutex dynamic pointer is NULL&lt;br /&gt;
 *          ERR_DYN_RWLOCK_PTR_BAD              Rwmutex lock array pointer is NULL&lt;br /&gt;
 *          ERR_FIXED_SEM_PTR_BAD               Semaphore fixed pointer is NULL&lt;br /&gt;
 *          ERR_DYN_SEM_PTR_BAD                 Semaphore dynamic pointer is NULL&lt;br /&gt;
 *          ERR_SEM_PEND_PTR_BAD                Semaphore pending queue pointer is NULL&lt;br /&gt;
 *          ERR_FIXED_DATAQ_PTR_BAD             Dataq fixed pointer is NULL&lt;br /&gt;
 *          ERR_DYN_DATAQ_PTR_BAD               Dataq dynamic pointer is NULL&lt;br /&gt;
 *          ERR_DATAQ_PEND_PTR_BAD              Dataq pending queue pointer is NULL&lt;br /&gt;
 *          ERR_DATAQ_DATA_PTR_BAD              Dataq data pointer is NULL&lt;br /&gt;
 *          ERR_CPU_INT_NUMBER_INVALID          SPARC only.IRQ number for CPU inter-comunication invalid(zero or used by timer)&lt;br /&gt;
 *          ERR_REGISTER_CPU_IRQ_FAILED         SPARC only. Failed to set CPU IRQ handler in BCC&lt;br /&gt;
 *          ERR_CPU_STACK_INVALID               Current CPU stack not within specified range&lt;br /&gt;
 *          ERR_CPU_PRIORITY_STACK_INVALID      Per CPU priority stack invalid&lt;br /&gt;
 *          ERR_LOG_AREA_END_SENTINEL_BAD       Log area end sentinel override&lt;br /&gt;
 *          ERR_TA_CONFIG_PTR_BAD               SPARC only; Timed action configuration data pointer is NULL&lt;br /&gt;
 *          ERR_TA_TIMER_INDEX_INVALID          SPARC only; Timed action sub-timer index in timer unit is invalid&lt;br /&gt;
 *          ERR_TA_IRQ_NUMBER_INVALID           SPARC only; Timer action timer IRQ number is invalid&lt;br /&gt;
 *          ERR_TA_BCC_IRQ_REGISTER_FAILED      SPARC only; Timed action timer IRQ handler failed to register&lt;br /&gt;
 */&lt;br /&gt;
S32_t   oceos_start(&lt;br /&gt;
    const U32_t * const fixed_array_ptr,// pointer to fixed data array&lt;br /&gt;
    const U32_t start_task,             // taskID&lt;br /&gt;
    void * const data_ptr               // pointer to data to be passed to task&lt;br /&gt;
);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| fixed_array_ptr || Pointer to fixed data array&lt;br /&gt;
|-&lt;br /&gt;
| start_task      || Task ID&lt;br /&gt;
|-&lt;br /&gt;
| data_ptr        || Pointer to data to be passed to the task&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit  || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT               || Fixed area pointer is null or bad sentinel&lt;br /&gt;
|-&lt;br /&gt;
| ERR_FIXED_AREA_SIZE_WRONG           || Fixed area size is zero&lt;br /&gt;
|-&lt;br /&gt;
| ERR_FIXED_AREA_END_SENTINEL_BAD     || Fixed data end sentinel corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_FIXED_AREA_BAD_XOR              || Fixed area bad checksum or checksum mis-match&lt;br /&gt;
|-&lt;br /&gt;
| ERR_INIT_NOT_DONE                   || oceos_start() called without initialisation&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DYN_AREA_PTR_BAD                || Dynamic area pointer invalid in sysMetaPtr&lt;br /&gt;
|-&lt;br /&gt;
| ERR_INT_HANDLER_BAD                 || IRQ controller pointer provided by BCC is NULL;or OCEOS handler is not set&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DYN_JOB_PTR_BAD                 || Job array pointer is NULL&lt;br /&gt;
|-&lt;br /&gt;
| ERR_FIXED_TASK_PTR_BAD              || Tasks array pointer is NULL&lt;br /&gt;
|-&lt;br /&gt;
| ERR_JOB_COUNT_WRONG                 || Total job count inconsistent&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DYN_MUTEX_PTR_BAD               || Mutex dynamic pointer is NULL&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DYN_LOCK_PTR_BAD                || Mutex lock array pointer is NULL&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DYN_RWMUTEX_PTR_BAD             || Rwmutex dynamic pointer is NULL&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DYN_RWLOCK_PTR_BAD              || Rwmutex lock array pointer is NULL&lt;br /&gt;
|-&lt;br /&gt;
| ERR_FIXED_SEM_PTR_BAD               || Semaphore fixed pointer is NULL&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DYN_SEM_PTR_BAD                 || Semaphore dynamic pointer is NULL&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SEM_PEND_PTR_BAD                || Semaphore pending queue pointer is NULL&lt;br /&gt;
|-&lt;br /&gt;
| ERR_FIXED_DATAQ_PTR_BAD             || Dataq fixed pointer is NULL&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DYN_DATAQ_PTR_BAD               || Dataq dynamic pointer is NULL&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DATAQ_PEND_PTR_BAD              || Dataq pending queue pointer is NULL&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DATAQ_DATA_PTR_BAD              || Dataq data pointer is NULL&lt;br /&gt;
|-&lt;br /&gt;
| ERR_CPU_INT_NUMBER_INVALID          || SPARC only.IRQ number for CPU inter-comunication invalid(zero or used by timer)&lt;br /&gt;
|-&lt;br /&gt;
| ERR_REGISTER_CPU_IRQ_FAILED         || SPARC only. Failed to set CPU IRQ handler in BCC&lt;br /&gt;
|-&lt;br /&gt;
| ERR_CPU_STACK_INVALID               || Current CPU stack not within specified range&lt;br /&gt;
|-&lt;br /&gt;
| ERR_CPU_PRIORITY_STACK_INVALID      || Per CPU priority stack invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_LOG_AREA_END_SENTINEL_BAD       || Log area end sentinel override&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_CONFIG_PTR_BAD               || SPARC only; Timed action configuration data pointer is NULL&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_TIMER_INDEX_INVALID          || SPARC only; Timed action sub-timer index in timer unit is invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_IRQ_NUMBER_INVALID           || SPARC only; Timer action timer IRQ number is invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_BCC_IRQ_REGISTER_FAILED      || SPARC only; Timed action timer IRQ handler failed to register&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/* Sample Task names - all here start with t_ to help avoid name confusion */&lt;br /&gt;
enum TASK_NAME{&lt;br /&gt;
    t_tom,                      // will have task ID 0&lt;br /&gt;
    t_dick,                     // will have task ID 1&lt;br /&gt;
};&lt;br /&gt;
extern U32_t fixed_data[];&lt;br /&gt;
...&lt;br /&gt;
S32_t status;&lt;br /&gt;
&lt;br /&gt;
status = oceos_start(fixed_data, t_tom, NULL);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_exit()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''initialisation.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Ends scheduling and exit from [[OCEOSmp/directive_reference#oceos_start()|oceos_start()]].&lt;br /&gt;
No task can be started after this.&amp;lt;br&amp;gt;&lt;br /&gt;
OCEOS will exit when the current job ends.&amp;lt;br&amp;gt;&lt;br /&gt;
An idle task in an endless loop should check that scheduling is enabled.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Ends scheduling and exit from oceos_start.&lt;br /&gt;
 * No task can be started after this.&lt;br /&gt;
 * OCEOS will exit when the current job ends.&lt;br /&gt;
 * An idle task in an endless loop should check that scheduling is enabled.&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Called before scheduling started&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_exit(void);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
There are no input parameters to this function.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit  || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Called before scheduling started&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
// Exit OCEOS&lt;br /&gt;
oceos_exit();&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_CPU_sleep()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''initialisation.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
 Puts CPU in sleep mode.&amp;lt;br&amp;gt;&lt;br /&gt;
 User must to be sure that interrupts are enabled.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Puts CPU in sleep mode.&lt;br /&gt;
 * User must to be sure that interrupts are enabled.&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_CPU_sleep(void);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
There are no input parameters to this function.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
// Put CPU to sleep&lt;br /&gt;
oceos_CPU_sleep();&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceosmp_cpu_disable()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''initialisation.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function ends execution of all tasks running on particular CPU and removes the CPU from scheduling.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Ends execution of all tasks running on particular CPU and removes this CPU from scheduling.&lt;br /&gt;
 * @param cpu_id&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              CPU ID outside allowed range 0 to 254&lt;br /&gt;
 *          ERR_ID_WRONG                CPU ID &amp;gt;= number of available CPUs&lt;br /&gt;
 *          ERR_CPU_ALREADY_DISABLED    CPU already disabled&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceosmp_cpu_disable(&lt;br /&gt;
    U32_t cpu_id&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| cpu_id || ID of CPU core to be disabled.&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit  || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || CPU ID outside allowed range 0 to 254&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || CPU ID &amp;gt;= number of available CPUs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_CPU_ALREADY_DISABLED    || CPU already disabled&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, faulty_cpu;&lt;br /&gt;
...&lt;br /&gt;
// Disable faulty CPU core&lt;br /&gt;
status = oceosmp_cpu_disable(faulty_cpu));&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceosmp_cpu_enable()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''initialisation.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function adds a disabled CPU core to the OCEOSmp scheduler. It should only be called after scheduling has started&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 *  Adds disabled CPU to OCEOSmp scheduler&lt;br /&gt;
 *&lt;br /&gt;
 *  N.B. This function should only be called after scheduling has started&lt;br /&gt;
 *&lt;br /&gt;
 * @param cpu_id&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              CPU ID outside allowed range 0 to 254&lt;br /&gt;
 *          ERR_ID_WRONG                CPU ID &amp;gt;= number of available CPUs; or the same as currently running&lt;br /&gt;
 *          ERR_CPU_ALREADY_ENABLED     CPU already enabled&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceosmp_cpu_enable(&lt;br /&gt;
    U32_t cpu_id&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| cpu_id || ID of CPU core to be enabled.&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit  || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || CPU ID outside allowed range 0 to 254&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || CPU ID &amp;gt;= number of available CPUs; or the same as currently running&lt;br /&gt;
|-&lt;br /&gt;
| ERR_CPU_ALREADY_ENABLED     || CPU already enabled&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, good_cpu;&lt;br /&gt;
...&lt;br /&gt;
// Enable CPU core&lt;br /&gt;
status = oceosmp_cpu_enable(good_cpu));&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceosmp_cpu_terminate()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''initialisation.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function removes a CPU core from the OCEOSmp scheduler and marks it so it cannot be restarted. It puts CPU to sleep with interrupts disabled. It should only be called after scheduling has started.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 *  Removes CPU from OCEOSMP scheduler and terminates, cannot be restarted.&lt;br /&gt;
 *  Puts CPU to sleep with interrupts disabled&lt;br /&gt;
 *&lt;br /&gt;
 *  N.B. This function should only be called after scheduling has started&lt;br /&gt;
 *  Steps:&lt;br /&gt;
 *     1. Set terminate flag on this CPU;&lt;br /&gt;
 *     2. Trigger software interrupt to transfer execution to IRQ handler;&lt;br /&gt;
 *     3. Check flag and if set =&amp;gt; put CPU to sleep in while loop with interrupts disabled;&lt;br /&gt;
 *     4. Set MAX priority on this CPU priority stack;&lt;br /&gt;
 *     5. Remove CPU from scheduling;&lt;br /&gt;
 *     6. Clean up all the tasks by calling task terminate function and free up all the&lt;br /&gt;
 *        preempted jobs by this CPU;&lt;br /&gt;
 *&lt;br /&gt;
 * @param cpu_id&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              CPU ID outside allowed range 0 to 254&lt;br /&gt;
 *          ERR_ID_WRONG                CPU ID &amp;gt;= number of available CPUs; or the same as currently running&lt;br /&gt;
 *          ERR_CPU_ALREADY_TERMINATED  CPU already terminated&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceosmp_cpu_terminate(&lt;br /&gt;
    U32_t cpu_id&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| cpu_id || ID of CPU core to be terminated.&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit  || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || CPU ID outside allowed range 0 to 254&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || CPU ID &amp;gt;= number of available CPUs; or the same as currently running&lt;br /&gt;
|-&lt;br /&gt;
| ERR_CPU_ALREADY_TERMINATED  || CPU already terminated&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, faulty_cpu;&lt;br /&gt;
...&lt;br /&gt;
// Terminate CPU core&lt;br /&gt;
status = oceosmp_cpu_terminate(faulty_cpu));&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;Task directives&amp;lt;/span&amp;gt;==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ API Functions&lt;br /&gt;
|-&lt;br /&gt;
| Directive                                                                     || Description                          || main || task || IRQ handler&lt;br /&gt;
|-&lt;br /&gt;
| [[OCEOSmp/directive reference#oceos_task_create()| oceos_task_create()]]             || Create Task                        || *    ||      || &lt;br /&gt;
|-&lt;br /&gt;
| [[OCEOSmp/directive reference#oceos_task_start()| oceos_task_start()]]               || Start Task                         ||      ||  *   || *&lt;br /&gt;
|-&lt;br /&gt;
| [[OCEOSmp/directive reference#oceos_task_timed_start()| oceos_task_timed_start()]]   || Schedule a task to start execution at a given system time||      ||  *   || *&lt;br /&gt;
|-&lt;br /&gt;
| [[OCEOSmp/directive reference#oceos_task_disable()| oceos_task_disable()]]           || Disable Task                       ||      ||  *   || *&lt;br /&gt;
|-&lt;br /&gt;
| [[OCEOSmp/directive reference#oceos_task_enable()| oceos_task_enable()]]             || Enable Task                        ||      ||  *   || *&lt;br /&gt;
|-&lt;br /&gt;
| [[OCEOSmp/directive reference#oceos_task_self()| oceos_task_self()]]                 || Returns the task ID of the currently executing task ||    ||  *   || *&lt;br /&gt;
|-&lt;br /&gt;
| [[OCEOSmp/directive reference#oceos_task_get_priority()| oceos_task_get_priority()]] || Get priority of a task             ||      ||  *   || *&lt;br /&gt;
|-&lt;br /&gt;
| [[OCEOSmp/directive reference#oceos_task_get_status()| oceos_task_get_status()]]     || Get status of a task               ||      ||  *   || *&lt;br /&gt;
|-&lt;br /&gt;
| [[OCEOSmp/directive reference#oceos_task_kill()| oceos_task_kill()]]                 || Directive to terminate current task||      ||  *   || *&lt;br /&gt;
|-&lt;br /&gt;
| [[OCEOSmp/directive reference#oceos_task_get_info()| oceos_task_get_info()]]         || Get task information               ||      ||  *   || *&lt;br /&gt;
|-&lt;br /&gt;
| [[OCEOSmp/directive reference#oceosmp_task_kill()| oceosmp_task_kill()]]                 || Directive to terminate current task||      ||  *   || *&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;Task data structures&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''tasks.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The following data structures are used by some of the task directives.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Data structures'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * A pointer to this structure is passed to oceos_task_create().&lt;br /&gt;
 * The structure is first initialised according to a tasks's parameters,&lt;br /&gt;
 * and is not used again after the task is created and may then be discarded.&lt;br /&gt;
 */&lt;br /&gt;
struct task_descriptor {&lt;br /&gt;
&lt;br /&gt;
	void (*function_start)(void*);	// name of task start function&lt;br /&gt;
	void (*function_end)(void*);	// optional, NULL or task end function&lt;br /&gt;
&lt;br /&gt;
	U32_t task_id;					// 0 to 254, usually an enum&lt;br /&gt;
	U32_t task_jobs_max;			// 1 to 15, max concurrent 'jobs'&lt;br /&gt;
	U32_t task_priority;			// 1 (highest) to 254 (lowest)&lt;br /&gt;
	U32_t task_threshold;			// &amp;gt;=1, &amp;lt;= task_priority (higher or same priority)&lt;br /&gt;
	U32_t task_turned_on_initially;	// 0: disabled initially, else enabled&lt;br /&gt;
&lt;br /&gt;
	U32_t time_deadline_microsecs;	// start request to finish, 0 to ignore&lt;br /&gt;
	U32_t time_min_interval_microsecs;	// between start requests, 0 to ignore&lt;br /&gt;
&lt;br /&gt;
	U32_t uses_cpu_affinity;		// 0: not restricted, else core restricted&lt;br /&gt;
	U32_t uses_cpu_affinity_core_id;// core ID to which restricted if affinity used&lt;br /&gt;
}__attribute__ ((aligned (8)));&lt;br /&gt;
&lt;br /&gt;
/**&lt;br /&gt;
 * Task info used with oceos_task_get_info&lt;br /&gt;
 */&lt;br /&gt;
struct task_info {&lt;br /&gt;
  U64_t           time_max_delay;               // maximum time job is waiting on ready queue before becoming active&lt;br /&gt;
  U64_t           time_max_finish;              // maximum time to finish job execution after starting&lt;br /&gt;
  U64_t           time_max_exec;                // maximum time spent executing&lt;br /&gt;
  U64_t           time_total_exec;              // total CPU time used by this task&lt;br /&gt;
  U64_t           time_min_gap_starts;          // minimum time between job creations, can be reset&lt;br /&gt;
  U64_t           time_min_gap_finish_start;    // minimum time between job ending and new job creation, can be reset&lt;br /&gt;
&lt;br /&gt;
  U64_t           time_last_start;              // time of most recent job creation&lt;br /&gt;
  U64_t           time_last_finish;             // time of most recent job finish&lt;br /&gt;
&lt;br /&gt;
  unsigned int    jobs_current_max  :16;        // maximum number of current jobs for this task, no roll over, can be reset&lt;br /&gt;
  unsigned int    jobs_total        :16;        // number of times this task was started, no roll-over, can be reset&lt;br /&gt;
  U32_t           jobs_current;                 // Number of task instances currently in use by oceos&lt;br /&gt;
&lt;br /&gt;
  U32_t           preempt_max;                  // maximum times any job was pre-empted, no roll-over, can be reset&lt;br /&gt;
}__attribute__ ((aligned (8)));&lt;br /&gt;
&lt;br /&gt;
/* A task's status is returned as below if queried */&lt;br /&gt;
enum TASK_STATUS {&lt;br /&gt;
    TASK_DISABLED,      // cannot be scheduled, and no current jobs&lt;br /&gt;
    TASK_ENABLED,       // can be scheduled, but no current jobs&lt;br /&gt;
    TASK_INVALID,       // task does not exist&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_task_create()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''tasks.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Create a task.&lt;br /&gt;
Can only be use before OCEOS starts. Stores the task information in the OCEOS fixed data area.&lt;br /&gt;
This directive populates the data structures for a task. It should be called after [[OCEOSmp/directive_reference#oceos_init()|oceos_init()]] and before [[OCEOSmp/directive_reference#oceos_init_finish()|oceos_init_finish()]].&amp;lt;br&amp;gt;&lt;br /&gt;
It must be called for each task otherwise [[OCEOSmp/directive_reference#oceos_start()|oceos_start()]] will return an error.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Create a task using a task descriptor structure&lt;br /&gt;
 *&lt;br /&gt;
 * Can only be used in Initialisation Phase.&lt;br /&gt;
 *&lt;br /&gt;
 * A task has twelve constant parameters set when the task is created.&lt;br /&gt;
 * Rather than setting a list of these parameters the named fields of a&lt;br /&gt;
 * task_descriptor structure are set and a pointer to it passed here.&lt;br /&gt;
 *&lt;br /&gt;
 * The task_descriptor structure fields are described above.&lt;br /&gt;
 * Once the task has been created the structure can be discarded.&lt;br /&gt;
 *&lt;br /&gt;
 * To create a task:&lt;br /&gt;
 *		set up a task_descriptor structure,&lt;br /&gt;
 *		set its fields to the parameter values for the task,&lt;br /&gt;
 *		pass a pointer to the structure to this directive.&lt;br /&gt;
 *&lt;br /&gt;
 * The structure is checked for validity by oceos_task_create and its&lt;br /&gt;
 * information used to set the task details in the OCEOS fixed data area.&lt;br /&gt;
 *&lt;br /&gt;
 * @param  struct task_descriptor *	fields give task characteristics&lt;br /&gt;
 *&lt;br /&gt;
 * @return OCEOS_SUCCESS            No errors or warnings&lt;br /&gt;
 *         WARN_NO_END_FUNCTION     Warning, no end task function specified&lt;br /&gt;
 *&lt;br /&gt;
 *         ERR_SYS_FIXED_CORRUPT    System Fixed area corrupt&lt;br /&gt;
 *         ERR_WRONG_CPU_CORE       Executing directive on wrong CPU&lt;br /&gt;
 *         ERR_WRONG_PHASE          Called before oceos_init() is done&lt;br /&gt;
 *         ERR_TOO_MANY             MAX number of tasks already created&lt;br /&gt;
 *         ERR_ID_INVALID           Task ID outside allowed range 0 to 254&lt;br /&gt;
 *         ERR_ID_WRONG             Task ID outside &amp;gt;= number of tasks&lt;br /&gt;
 *         ERR_T_ALREADY_ALLOCATED  Task ID already in use&lt;br /&gt;
 *         ERR_T_PRIORITY_INVALID   Task priority outside allowed range 1 to 254&lt;br /&gt;
 *         ERR_THRESHOLD_INVALID    Task threshold outside range 1 to 254&lt;br /&gt;
 *         ERR_THRESHOLD_WRONG      Task threshold  higher priority than task priority&lt;br /&gt;
 *         ERR_JOBS_MAX_INVALID     Job number outside range 1 to 15&lt;br /&gt;
 *         ERR_JOBS_TOO_MANY        System capacity exceeded&lt;br /&gt;
 *         ERR_AFFINITY_WRONG       CPU core specified is outside chosen range&lt;br /&gt;
 *         ERR_START_FUNCTION_BAD   Task start function address either NULL or misaligned&lt;br /&gt;
 */&lt;br /&gt;
S32_t   oceos_task_create(&lt;br /&gt;
    const struct task_descriptor * const task_description_ptr&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter           || Description&lt;br /&gt;
|-&lt;br /&gt;
|struct task_descriptor * || Pointer to task descriptor which contains task attributes&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit     || Description&lt;br /&gt;
|-&lt;br /&gt;
|WARN_NO_END_FUNCTION     || Warning, no end task function specified&lt;br /&gt;
|-&lt;br /&gt;
|ERR_SYS_FIXED_CORRUPT    || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
|ERR_WRONG_CPU_CORE       || Executing directive on wrong CPU&lt;br /&gt;
|-&lt;br /&gt;
|ERR_WRONG_PHASE          || Called before oceos_init() is done&lt;br /&gt;
|-&lt;br /&gt;
|ERR_TOO_MANY             || MAX number of tasks already created&lt;br /&gt;
|-&lt;br /&gt;
|ERR_ID_INVALID           || Task ID outside allowed range 0 to 254&lt;br /&gt;
|-&lt;br /&gt;
|ERR_ID_WRONG             || Task ID outside &amp;gt;= number of tasks&lt;br /&gt;
|-&lt;br /&gt;
|ERR_T_ALREADY_ALLOCATED  || Task ID already in use&lt;br /&gt;
|-&lt;br /&gt;
|ERR_T_PRIORITY_INVALID   || Task priority outside allowed range 1 to 254&lt;br /&gt;
|-&lt;br /&gt;
|ERR_THRESHOLD_INVALID    || Task threshold outside range 1 to 254&lt;br /&gt;
|-&lt;br /&gt;
|ERR_THRESHOLD_WRONG      || Task threshold  higher priority than task priority&lt;br /&gt;
|-&lt;br /&gt;
|ERR_JOBS_MAX_INVALID     || Job number outside range 1 to 15&lt;br /&gt;
|-&lt;br /&gt;
|ERR_JOBS_TOO_MANY        || System capacity exceeded&lt;br /&gt;
|-&lt;br /&gt;
|ERR_AFFINITY_WRONG       || CPU core specified is outside chosen range&lt;br /&gt;
|-&lt;br /&gt;
|ERR_START_FUNCTION_BAD   || Task start function address either NULL or misaligned&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
/* Sample Task names - all here start with t_ to help avoid name confusion */&lt;br /&gt;
enum TASK_NAME{&lt;br /&gt;
      t_0,&lt;br /&gt;
      t_1,&lt;br /&gt;
      t_2&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
/*&lt;br /&gt;
 * APPLICATION FUNCTION DECLARATIONS&lt;br /&gt;
 */&lt;br /&gt;
void fun0(void *);&lt;br /&gt;
void fun1(void *);&lt;br /&gt;
void fun2(void *);&lt;br /&gt;
void end_function(void *);&lt;br /&gt;
&lt;br /&gt;
const struct task_descriptor tasks_data[NUMBER_OF_TASKS] = {&lt;br /&gt;
    {fun0, end_function, t_0, 2, 10, 8, TASK_ENABLED, 0, 0, 0, 0},&lt;br /&gt;
    {fun1, end_function, t_1, 2, 10, 8, TASK_ENABLED, 0, 0, 0, 0},&lt;br /&gt;
    {fun2, end_function, t_2, 2, 10, 8, TASK_ENABLED, 0, 0, 0, 0}&lt;br /&gt;
}; &lt;br /&gt;
&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
    // create tasks (names are defined in the application header)&lt;br /&gt;
    for (i=0; i&amp;lt;NUMBER_OF_TASKS; i++){&lt;br /&gt;
        if ( oceos_task_create(&amp;amp;tasks_data[i]) != OCEOS_SUCCESS ){&lt;br /&gt;
        	oceosmp_print(&amp;quot;\nFailed to create task\n\r&amp;quot;);&lt;br /&gt;
        	return -i;&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_task_start()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''tasks.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function starts an instance of a task. An instance of a task is called a job in OCEOS terminology.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 *  Starting a task involves three main stages&lt;br /&gt;
 *      1 setting up a job&lt;br /&gt;
 *          finding a free job entry if available&lt;br /&gt;
 *          setting up this entry including passing it the data void *&lt;br /&gt;
 *&lt;br /&gt;
 *      2 placing the job on readyQ&lt;br /&gt;
 *&lt;br /&gt;
 *      3 doing a context switch&lt;br /&gt;
 * This function should only be called after OCEOS is initialised&lt;br /&gt;
 *       and the dynamic task and job structures set up&lt;br /&gt;
 *&lt;br /&gt;
 *  When used from an interrupt handler,&lt;br /&gt;
 *  the context switch is only done&lt;br /&gt;
 *  after all nested interrupts have unwound&lt;br /&gt;
 *&lt;br /&gt;
 * @param task_id Task ID must be in range 0 to 254&lt;br /&gt;
 * @param ptr     Pointer to task data&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT    System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT      System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE          Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID           Task ID is invalid&lt;br /&gt;
 *          ERR_ID_WRONG             Task ID is wrong&lt;br /&gt;
 *          ERR_START_TASK_DISABLED  Starting task is disabled&lt;br /&gt;
 *          ERR_TOO_MANY             There is no free job&lt;br /&gt;
 *          ERR_SYS_BUSY             Failed to grab the lock&lt;br /&gt;
 */&lt;br /&gt;
S32_t   oceos_task_start(&lt;br /&gt;
    const U32_t task_id, // task ID, must be in range 0 to 254&lt;br /&gt;
    void * const ptr    // pointer to data&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| task_id || U32_t with Task ID in range 0 to 254.&lt;br /&gt;
|-&lt;br /&gt;
| ptr    || void * pointer to task data&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit  || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT    || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT      || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE          || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID           || Task ID is invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG             || Task ID is wrong&lt;br /&gt;
|-&lt;br /&gt;
| ERR_START_TASK_DISABLED  || Starting task is disabled&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TOO_MANY             || There is no free job&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY             || Failed to grab the lock&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
void *ptr;&lt;br /&gt;
...&lt;br /&gt;
// Start instance of task T_1 passing pointer ptr&lt;br /&gt;
status = oceos_task_start(t_1,ptr);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_task_timed_start()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''tasks.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function schedules a task to start execution at a given system time.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 *  Schedule a task to start execution at a given system time&lt;br /&gt;
 *&lt;br /&gt;
 *  The before and after offsets define a window around the selected time&lt;br /&gt;
 *  in which the task may be started.&lt;br /&gt;
 *&lt;br /&gt;
 *  If the current system time is before the start window a job is created&lt;br /&gt;
 *  and a corresponding action put on the timed action queue.&lt;br /&gt;
 *&lt;br /&gt;
 *  If the current system time is within the time window for starting the task,&lt;br /&gt;
 *  it is started immediately.&lt;br /&gt;
 *&lt;br /&gt;
 *  If the current system time is after the window, an error is reported.&lt;br /&gt;
 *&lt;br /&gt;
 *  Times are in microseconds.&lt;br /&gt;
 *&lt;br /&gt;
 *  This function should only be called after OCEOS is initialised&lt;br /&gt;
 *  and the dynamic task and job structures set up&lt;br /&gt;
 *&lt;br /&gt;
 * @param taskID        Task ID must be in range 0 to 254&lt;br /&gt;
 * @param ptr           Pointer to data&lt;br /&gt;
 * @param start_time    System time at which job should start&lt;br /&gt;
 * @param before        Forward tolerance for time&lt;br /&gt;
 * @param after         Backward tolerance for time&lt;br /&gt;
 * @param return_job_id Return job_id to the user, to remove this job from timed action if needed&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              Task ID invalid&lt;br /&gt;
 *          ERR_ID_WRONG                Task ID is wrong&lt;br /&gt;
 *          ERR_TA_NOT_INIT             Timed action inialisation is not done and tried to be used&lt;br /&gt;
 *          ERR_START_TASK_DISABLED     Starting task is disabled&lt;br /&gt;
 *          ERR_TOO_MANY                There is no free job&lt;br /&gt;
 *          ERR_TOO_LATE                Starting task is too late(out of time frame)&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to grab the lock&lt;br /&gt;
 *          ERR_TA_Q_FULL               Timed action queue is full&lt;br /&gt;
 *          ERR_TA_START_FAILED         Timed action execute failed; See log&lt;br /&gt;
 */&lt;br /&gt;
S32_t   oceos_task_timed_start(&lt;br /&gt;
    const U32_t task_id,     // task ID, must be in range 0 to 254&lt;br /&gt;
    void * const ptr,        // pointer to data&lt;br /&gt;
    const U64_t start_time,  // system time at which job should start&lt;br /&gt;
    const U32_t before,      // forward tolerance for time&lt;br /&gt;
    const U32_t after,       // backward tolerance for time&lt;br /&gt;
    U32_t * return_job_id    // return job_id to the user, to remove this job from timed action if needed&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| taskID        || U32_t task ID must be in range 0 to 254&lt;br /&gt;
|-&lt;br /&gt;
| ptr           || void * pointer to data&lt;br /&gt;
|-&lt;br /&gt;
| start_time    || U64_t system time at which job should start&lt;br /&gt;
|-&lt;br /&gt;
| before        || U32_t forward tolerance for time&lt;br /&gt;
|-&lt;br /&gt;
| after         || U32_t backward tolerance for time&lt;br /&gt;
|-&lt;br /&gt;
| return_job_id || U32_t return job_id to the user, to remove this job from timed action if needed&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit  || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || Task ID invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || Task ID is wrong&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_NOT_INIT             || Timed action inialisation is not done and tried to be used&lt;br /&gt;
|-&lt;br /&gt;
| ERR_START_TASK_DISABLED     || Starting task is disabled&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TOO_MANY                || There is no free job&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TOO_LATE                || Starting task is too late(out of time frame)&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to grab the lock&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_Q_FULL               || Timed action queue is full&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_START_FAILED         || Timed action execute failed; See log&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
U32_t job_id;&lt;br /&gt;
U64_t cur_sys_time;&lt;br /&gt;
...&lt;br /&gt;
  cur_sys_time = oceos_time_sys_get64();&lt;br /&gt;
&lt;br /&gt;
  // Start task 10,000 microseconds (us) from now and advise if started more than 1,000 us before or 2,000 us after.&lt;br /&gt;
  status = oceos_task_timed_start(t_2, ptr, cur_sys_time + 10000, 1000, 2000, &amp;amp;job_id);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_task_disable()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''initialisation.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function disables a task and removes any current pending jobs from the readyQ.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 *  Disable a task and remove any current pending jobs on readyQ.&lt;br /&gt;
 *&lt;br /&gt;
 *  A disabled task's jobs  will not be put into execution nor put on readyQ.&lt;br /&gt;
 *&lt;br /&gt;
 *  Note that where execution of a task has already commenced,&lt;br /&gt;
 *  disabling the task will not prevent it from completing.&lt;br /&gt;
 *&lt;br /&gt;
 *  This function should only be called after OCEOS is initialised&lt;br /&gt;
 *  and the dynamic task and job structures set up&lt;br /&gt;
 *&lt;br /&gt;
 * @param taskID  Task ID must be in range 0 to 254&lt;br /&gt;
 * @return: OCEOS_SUCCESS&lt;br /&gt;
 *          WARN_ALREADY_DISABLED        Task already disabled&lt;br /&gt;
 *          WARN_SEM_PEND_REMOVE_FAILED  Failed to remove job from semaphore pending queue&lt;br /&gt;
 *          WARN_DQ_PEND_REMOVE_FAILED   Failed to remove job from dataq pending queue&lt;br /&gt;
 *&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT        System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT          System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE              Directive was called before OCEOS init is finished&lt;br /&gt;
 *          ERR_ID_INVALID               Task ID is invalid&lt;br /&gt;
 *          ERR_ID_WRONG                 Task ID is wrong&lt;br /&gt;
 *          ERR_SYS_BUSY                 Failed to grab the lock&lt;br /&gt;
 */&lt;br /&gt;
S32_t   oceos_task_disable(&lt;br /&gt;
    const U32_t task_id // task ID, must be in range 0 to 254&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| taskID || U32_t task ID must be in range 0 to 254&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit  || Description&lt;br /&gt;
|-&lt;br /&gt;
| WARN_ALREADY_DISABLED        || Task already disabled&lt;br /&gt;
|-&lt;br /&gt;
| WARN_SEM_PEND_REMOVE_FAILED  || Failed to remove job from semaphore pending queue&lt;br /&gt;
|-&lt;br /&gt;
| WARN_DQ_PEND_REMOVE_FAILED   || Failed to remove job from dataq pending queue&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT        || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT          || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE              || Directive was called before OCEOS init is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID               || Task ID is invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                 || Task ID is wrong&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                 || Failed to grab the lock&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Disable task t_1&lt;br /&gt;
status = oceos_task_disable(t_1);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_task_enable()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''tasks.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function enables a task. Only enabled tasks may be started.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 *  Enable a task - only enabled tasks are placed on readyQ or started.&lt;br /&gt;
 *&lt;br /&gt;
 *  This function should only be called after OCEOS is initialised&lt;br /&gt;
 *  and the dynamic task and job structures set up&lt;br /&gt;
 *&lt;br /&gt;
 * @param taskID   Task ID must be in range 0 to 254&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          WARN_ALREADY_ENABLED     Task already enabled&lt;br /&gt;
 *&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT    System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT      System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE          Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID           Task ID is invalid&lt;br /&gt;
 *          ERR_ID_WRONG             Task ID is wrong&lt;br /&gt;
 *          ERR_SYS_BUSY             Failed to grab the lock&lt;br /&gt;
 */&lt;br /&gt;
S32_t   oceos_task_enable(&lt;br /&gt;
    const U32_t task_id // task ID, must be in range 0 to 254&lt;br /&gt;
);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| taskID  || U32_t task ID must be in range 0 to 254&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit  || Description&lt;br /&gt;
|-&lt;br /&gt;
| WARN_ALREADY_ENABLED     || Task already enabled&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT    || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT      || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE          || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID           || Task ID is invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG             || Task ID is wrong&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY             || Failed to grab the lock&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Enable task t_2&lt;br /&gt;
status = oceos_task_enable(t_2);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_task_self()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''tasks.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the task number of the currently running task on the calling CPU.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Get currently running task on calling CPU&lt;br /&gt;
 *&lt;br /&gt;
 * @param t_id  Task ID holder&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT        System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT          System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE              Directive was called before OCEOS init is finished&lt;br /&gt;
 *          ERR_CPU_DYN_PTR_BAD          CPU dynamic area pointer corrupt&lt;br /&gt;
 */&lt;br /&gt;
S32_t  oceos_task_self(&lt;br /&gt;
    U32_t *t_id&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| t_id || S32_t * pointer to variable where task ID will be written.&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit  || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT        || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT          || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE              || Directive was called before OCEOS init is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_CPU_DYN_PTR_BAD          || CPU dynamic area pointer corrupt&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, task_running;&lt;br /&gt;
...&lt;br /&gt;
// Return task ID that's running on this core&lt;br /&gt;
status = oceos_task_self(&amp;amp;task_running);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_task_get_priority()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''tasks.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the priority of the task ID passed to it.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Get priority of the task&lt;br /&gt;
 *&lt;br /&gt;
 * @param taskID        ID of task, must be in range 0 to 254&lt;br /&gt;
 * @param t_priority    Pointer to task priority holder&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT        System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT          System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE              Directive was called before OCEOS init is finished&lt;br /&gt;
 *          ERR_ID_INVALID               Task ID is invalid&lt;br /&gt;
 *          ERR_ID_WRONG                 Task ID is wrong&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_task_get_priority(&lt;br /&gt;
    const U32_t task_id, // task ID, must be in range 0 to 254&lt;br /&gt;
    U32_t *t_priority   // Pointer to task priority holder&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| task_id || S32_t task ID of task whose priority is required&lt;br /&gt;
|-&lt;br /&gt;
| t_priority || S32_t * pointer to variable where priority will be written&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit  || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT        || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT          || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE              || Directive was called before OCEOS init is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID               || Task ID is invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                 || Task ID is wrong&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
U32_t t_priority;&lt;br /&gt;
...&lt;br /&gt;
// Return the priority of task ID t_4 &lt;br /&gt;
status = oceos_task_get_priority(t_4, &amp;amp;t_priority);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_task_get_status()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''tasks.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the status of the task ID passed to it.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Get status of the task;&lt;br /&gt;
 * if OK t_status holds enum TASK_STATUS&lt;br /&gt;
 *&lt;br /&gt;
 * @param taskID    ID of task, must be in range 0 to 254&lt;br /&gt;
 * @param t_status  enum TASK_STATUS holder&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT        System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT          System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE              Directive was called before OCEOS init is finished&lt;br /&gt;
 *          ERR_ID_INVALID               Task ID is invalid&lt;br /&gt;
 *          ERR_ID_WRONG                 Task ID is wrong&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_task_get_status(&lt;br /&gt;
    const U32_t task_id,&lt;br /&gt;
    U32_t *t_status&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| task_id || S32_t task ID of task whose priority is required&lt;br /&gt;
|-&lt;br /&gt;
| t_status || S32_t * pointer to variable where status will be written&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit  || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT        || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT          || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE              || Directive was called before OCEOS init is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID               || Task ID is invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                 || Task ID is wrong&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
U32_t t_status;&lt;br /&gt;
...&lt;br /&gt;
// Return the status of task ID t_4 &lt;br /&gt;
status = oceos_task_get_status(t_4, &amp;amp;t_status);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_task_get_info()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''tasks.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the task information for the specified task.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Get task information for task with ID.&lt;br /&gt;
 *&lt;br /&gt;
 * User must pass pointer to struct task_info in order to retrieve data.&lt;br /&gt;
 *&lt;br /&gt;
 * @param task_id  Task ID&lt;br /&gt;
 * @param info     Pointer to struct task_info&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT    System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT      System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE          Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID           Task ID invalid&lt;br /&gt;
 *          ERR_ID_WRONG             Task ID wrong&lt;br /&gt;
 *          ERR_TASK_INFO_PTR_BAD    Task info pointer provided by user is NULL&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_task_get_info (&lt;br /&gt;
    const U32_t task_id,   // Task ID&lt;br /&gt;
    struct task_info *info // Pointer to struct task_info&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| task_id || ID of task for which information is required&lt;br /&gt;
|-&lt;br /&gt;
| task_info || struct task_info * pointer to the structure where task information is to be written&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit  || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT    || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT      || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE          || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID           || Task ID invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG             || Task ID wrong&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TASK_INFO_PTR_BAD    || Task info pointer provided by user is NULL&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
struct task_info info;&lt;br /&gt;
...&lt;br /&gt;
// Get information for task T3&lt;br /&gt;
status = oceos_task_get_info(t_3, &amp;amp;info);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceosmp_task_kill()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''tasks.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function kills the specified task running on the specified CPU.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 *  Function to kill currently running task on CPU;&lt;br /&gt;
 *  Can be used:&lt;br /&gt;
 *      From Mode_SVC  =&amp;gt; normal running mode for application&lt;br /&gt;
 *          If nesting level is zero and Mode_SVC&lt;br /&gt;
 *      From Mode_IRQ  =&amp;gt; from IRQ handler&lt;br /&gt;
 *          If nesting level is not zero, set flag to call this function within IRQ handler&lt;br /&gt;
 *      From Exception =&amp;gt; Mode_ABT and Mode_UND&lt;br /&gt;
 *          If nesting level is zero and NOT Mode_SVC, it is exception;&lt;br /&gt;
 *              Disable IRQs on current CPU;&lt;br /&gt;
 *              Set kill current task flag to TRUE;&lt;br /&gt;
 *              Issue SGI on current CPU, will be interrupted on return from Exception and&lt;br /&gt;
 *              this function will be called within IRQ handler&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT    System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT      System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE          Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_CPU_DYN_PTR_BAD      CPU dynamic area pointer corrupt&lt;br /&gt;
 *          ERR_ID_INVALID           Task ID invalid&lt;br /&gt;
 *          ERR_ID_WRONG             Task ID wrong&lt;br /&gt;
 *          ERR_CPU_ID_WRONG         CPU ID wrong&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceosmp_task_kill(&lt;br /&gt;
    U32_t task_id,&lt;br /&gt;
    U32_t cpu_id&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| task_id  || U32_t task ID to be killed (must be in range 0 to 254)&lt;br /&gt;
|-&lt;br /&gt;
| cpu_id  || U32_t CPU ID where task_id is to be killed&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT    || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT      || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE          || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_CPU_DYN_PTR_BAD      || CPU dynamic area pointer corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID           || Task ID invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG             || Task ID wrong&lt;br /&gt;
|-&lt;br /&gt;
| ERR_CPU_ID_WRONG         || CPU ID wrong&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Kill task t_2 on CPU cpu_1&lt;br /&gt;
status = oceosmp_task_kill(t_2, cpu_1);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;Mutex directives&amp;lt;/span&amp;gt;==&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_mutex_create()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''mutex.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function creates a mutex of specified ID with a specified priority ceiling.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Creates a mutex with priority ceiling&lt;br /&gt;
 *&lt;br /&gt;
 * NOTE: This function should only be called after OCEOSmp is initialised with&lt;br /&gt;
 *  oceos_init() and before initialisation ends with oceos_init_finish()&lt;br /&gt;
 *  and scheduling starts with oceos_start()&lt;br /&gt;
 *&lt;br /&gt;
 * @param mutex_id  mutex ID value 0 to 62&lt;br /&gt;
 * @param priority  mutex priority ceiling 1 to 254 (high to low task priority)&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_WRONG_CPU_CORE          Executing directive on wrong CPU&lt;br /&gt;
 *          ERR_WRONG_PHASE             Called before oceos_init() is done&lt;br /&gt;
 *          ERR_TOO_MANY                MAX number of MUTEXs already created&lt;br /&gt;
 *          ERR_ID_INVALID              MUTEX ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                MUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
 *          ERR_MX_ALREADY_ALLOCATED    MUTEX ID already used&lt;br /&gt;
 *          ERR_MX_PRIORITY_WRONG       MUTEX priority ceiling outside allowed range 1 to 254&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_mutex_create(&lt;br /&gt;
    const U32_t mutex_id,  // mutex ID, must be in range 0 to 62&lt;br /&gt;
    const U8_t  priority  // mutex priority ceiling&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| mutex_id  || u32_t mutex ID to be created (value 0 to 62).&lt;br /&gt;
|-&lt;br /&gt;
| priority_ceiling ||  U32_t mutex priority ceiling 1 to 254 (high to low task priority)&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_CPU_CORE          || Executing directive on wrong CPU&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Called before oceos_init() is done&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TOO_MANY                || MAX number of MUTEXs already created&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || MUTEX ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || MUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_MX_ALREADY_ALLOCATED    || MUTEX ID already used&lt;br /&gt;
|-&lt;br /&gt;
| ERR_MX_PRIORITY_WRONG       || MUTEX priority ceiling outside allowed range 1 to 254&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Create mutex with ID print_mutex and priority ceiling of 5&lt;br /&gt;
status = oceos_mutex_create(print_mutex, 5);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_mutex_wait()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''mutex.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function makes the task wait until the specified mutex is available.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
 /*&lt;br /&gt;
  * Wait on mutex with ID.&lt;br /&gt;
  * If task succeeds in grabbing mutex, system level priority rises to&lt;br /&gt;
  * priority of this mutex, so tasks with lower or equal priority will&lt;br /&gt;
  * not be able to start till mutex is released.&lt;br /&gt;
  *&lt;br /&gt;
  * This should only be called after OCEOSmp scheduling has started.&lt;br /&gt;
  *&lt;br /&gt;
  * @param mutex_id     const U32_t  : value 0 to 62&lt;br /&gt;
  *&lt;br /&gt;
  * @return  OCEOS_SUCCESS&lt;br /&gt;
  *          WARN_MX_INCORRECT_ORDER     MUTEX acquired in incorrect order&lt;br /&gt;
  *&lt;br /&gt;
  *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
  *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
  *          ERR_WRONG_PHASE             Directive was called before OCEOSmp initialisation is finished&lt;br /&gt;
  *          ERR_ID_INVALID              MUTEX ID outside allowed range 0 to 62&lt;br /&gt;
  *           ERR_ID_WRONG                MUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
  *          ERR_MX_CEILING_BAD          MUTEX ceiling not lower priority than job priority&lt;br /&gt;
  *          ERR_MX_ALREADY_HELD         MUTEX already held by this job&lt;br /&gt;
  *          ERR_SYS_BUSY                Failed to grab context switch guard&lt;br /&gt;
  */&lt;br /&gt;
S32_t oceos_mutex_wait(&lt;br /&gt;
    const U32_t  mutex_id      // mutex ID, must be in range 0 to 62&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| mutex_id  || u32_t mutex ID to be waited on (value 0 to 62).&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| WARN_MX_INCORRECT_ORDER     || MUTEX acquired in incorrect order&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOSmp initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || MUTEX ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || MUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_MX_CEILING_BAD          || MUTEX ceiling not lower priority than job priority&lt;br /&gt;
|-&lt;br /&gt;
| ERR_MX_ALREADY_HELD         || MUTEX already held by this job&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to grab context switch guard&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Wait on mutex m_2&lt;br /&gt;
status = oceos_mutex_wait(m_2);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_mutex_signal()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''mutex.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function signals the specified mutex.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Signal a mutex with ID&lt;br /&gt;
 *&lt;br /&gt;
 * N.B. :&lt;br /&gt;
 *      This function should not be called from an interrupt handler&lt;br /&gt;
 *      This should only be called after OCEOSmp scheduling has started.&lt;br /&gt;
 *&lt;br /&gt;
 * @param mutex_id     const U32_t  : value 0 to 62&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          WARN_MX_ALREADY_FREE        MUTEX is free already&lt;br /&gt;
 *          WARN_MX_NESTING_BAD         MUTEX nesting incorrect&lt;br /&gt;
 *&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOSmp initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              MUTEX ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                MUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
 *          ERR_MX_WRONG_JOB            MUTEX not held by this job&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to grab context switch guard&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_mutex_signal(&lt;br /&gt;
    const U32_t  mutex_id     // mutex ID, must be in range 0 to 62&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| mutex_id  || u32_t mutex ID to be signalled (value 0 to 62).&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| WARN_MX_ALREADY_FREE        || MUTEX is free already&lt;br /&gt;
|-&lt;br /&gt;
| WARN_MX_NESTING_BAD         || MUTEX nesting incorrect&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOSmp initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || MUTEX ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || MUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_MX_WRONG_JOB            || MUTEX not held by this job&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to grab context switch guard&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Signal mutex m_2&lt;br /&gt;
status = oceos_mutex_signal(m_2);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_mutex_get_value()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''mutex.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the value of the specified mutex.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Get current value of mutex with ID&lt;br /&gt;
 *&lt;br /&gt;
 * @param mutex_id      const U32_t  : value 0 to 62&lt;br /&gt;
 * @param m_value       pointer to MUTEX value holder&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOSmp initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              MUTEX ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                MUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
 *          ERR_MX_DATA_PTR_BAD         Pointer to MUTEX value return holder is null&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_mutex_get_value(&lt;br /&gt;
    const U32_t  mutex_id,      // mutex ID, must be in range 0 to 62&lt;br /&gt;
    U32_t *m_value              // Pointer to MUTEX value holder&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| mutex_id  || u32_t mutex ID to be signalled (value 0 to 62)&lt;br /&gt;
|-&lt;br /&gt;
| m_value  || u32_t * pointer where mutex value is to be written&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOSmp initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || MUTEX ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || MUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_MX_DATA_PTR_BAD         || Pointer to MUTEX value return holder is null&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
U32_t value;&lt;br /&gt;
...&lt;br /&gt;
// Get value of mutex m_2&lt;br /&gt;
status = oceos_mutex_get_value(m_2, &amp;amp;value);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;Read/write mutex directives&amp;lt;/span&amp;gt;==&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;Read/write mutex overview&amp;lt;/span&amp;gt;===&lt;br /&gt;
&lt;br /&gt;
Contents:&lt;br /&gt;
&lt;br /&gt;
 1.  Read/Write Mutex features&lt;br /&gt;
 2.  Read/Write Mutex data structures&lt;br /&gt;
 3.  Read/Write Mutex constants&lt;br /&gt;
 4.  Read/Write Mutex manager Directives&lt;br /&gt;
&lt;br /&gt;
==== Read/Write Mutex Features ====&lt;br /&gt;
&lt;br /&gt;
Read/Write Mutexes (rwmutexes) can be held for 'read' at the same time&lt;br /&gt;
by multiple jobs on different CPUs, but once held for 'write' by any job&lt;br /&gt;
cannot be obtained for 'read' or for 'write' by another job until released.&lt;br /&gt;
&lt;br /&gt;
They can be used to allow data be read simultaneously by multiple jobs when&lt;br /&gt;
the data is not being updated while ensuring that no updating can take&lt;br /&gt;
place while any job is reading the data.&lt;br /&gt;
&lt;br /&gt;
Pending write requests take precedence over pending read requests and are&lt;br /&gt;
done on a first come, first served basis. Once any job on a CPU has a&lt;br /&gt;
rwmutex for 'read' no other job on that CPU can acquire it so as to avoid&lt;br /&gt;
potential problems and minimise delays in servicing write requests by other&lt;br /&gt;
CPUs.&lt;br /&gt;
&lt;br /&gt;
While any job holds a rwmutex for reading any job on another CPU can also&lt;br /&gt;
acquire it for reading. Other jobs on the same CPU that may attempt to&lt;br /&gt;
acquire the rwmutex are delayed in starting until return of the rwmutex.&lt;br /&gt;
No job can acquire the rwmutex for writing until all read acquisitions&lt;br /&gt;
have been returned.&lt;br /&gt;
&lt;br /&gt;
No job will acquire a rwmutex for reading if any job is trying to acquire&lt;br /&gt;
it for writing, giving write precedence over read. Multiple write requests&lt;br /&gt;
waiting for existing read acquisitions to complete are serviced in the&lt;br /&gt;
order in which they were made when the current read acquisitions complete.&lt;br /&gt;
&lt;br /&gt;
If a task waits on a rwmutex that it already holds a system log entry is&lt;br /&gt;
made (LOG_RWMUTEX_ALREADY_HELD) and an INTERNAL_ERROR status code returned.&lt;br /&gt;
&lt;br /&gt;
If a task attempts to release a rwmutex it does not hold a system log entry&lt;br /&gt;
is made (LOG_RWMUTEX_ALREADY_FREE) and an INTERNAL_ERROR status code returned.&lt;br /&gt;
&lt;br /&gt;
If a job holds more than one rwmutex at the same time these must be&lt;br /&gt;
acquired and released in a nested manner&lt;br /&gt;
(e.g. wait 1, wait 2, wait 3, signal 3, signal 2, signal 1).&lt;br /&gt;
&lt;br /&gt;
If a task exits while holding one or more rwmutexes these are returned and&lt;br /&gt;
a system log entry made (LOG_RWMUTEX_NOT_RETURNED).&lt;br /&gt;
&lt;br /&gt;
==== Read/Write Mutex data structures ====&lt;br /&gt;
&lt;br /&gt;
In OCEOSmp each rwmutex has a priority ceiling, the priority of the highest&lt;br /&gt;
priority task that acquires the rwmutex for read or for write.&lt;br /&gt;
OCEOSmp uses this to ensure that once a job on a particular CPU has the&lt;br /&gt;
rwmutex for reading or for writing no other job on that CPU can be started&lt;br /&gt;
that might try to obtain that rwmutex.&lt;br /&gt;
&lt;br /&gt;
The priority ceiling of a rwmutex is specified when the rwmutex is created&lt;br /&gt;
and does not change subsequently. Priority ceilings are stored in the&lt;br /&gt;
fixed data area as an array U8_t rwmutexCeilings[] indexed by mutex ID.&lt;br /&gt;
This array is extended to be a whole number of 32-bit words.&lt;br /&gt;
&lt;br /&gt;
A rwmutex has a unique rwmutex ID, an unsigned integer usually defined in&lt;br /&gt;
the application header file as an enum RWMUTEX_NAME{} thus allowing a&lt;br /&gt;
user-friendly name be associated with each rwmutex ID.&lt;br /&gt;
&lt;br /&gt;
Using an enum is strongly recommended as it allows a user-friendly name be&lt;br /&gt;
associated with each ID, and helps ensure IDs are contiguous from 0.&lt;br /&gt;
&lt;br /&gt;
These rwmutex IDs are used as indices into both fixed and dynamic data&lt;br /&gt;
arrays and must cover the range 0 to ((number of rwmutexes) -1). Using&lt;br /&gt;
enum RWMUTEX_NAME{} automatically assigns names to IDs 0, 1, 2...&lt;br /&gt;
&lt;br /&gt;
Read write mutex dynamic data such as the current write requests and&lt;br /&gt;
current read count are stored in the dynamic data area in an array of&lt;br /&gt;
struct rwmutex_dyn_block also indexed by the rwmutex ID.&lt;br /&gt;
&lt;br /&gt;
A further dynamic area array of guard_t is used in providing mutual&lt;br /&gt;
exclusion when updating the rwmutex dynamic data.&lt;br /&gt;
&lt;br /&gt;
==== Read/Write Mutex constants ====&lt;br /&gt;
&lt;br /&gt;
In OCEOSmp there can be a maximum of 63 rwmutexes,&lt;br /&gt;
with IDs from 0 to 62 (the value 63 is used as an invalid ID).&lt;br /&gt;
&lt;br /&gt;
The rwmutexes can be created in any order, but OCEOSmp will return an error&lt;br /&gt;
and fail to start if the resulting IDs fail to be contiguous from 0 as IDs&lt;br /&gt;
are used by OCEOS as indices into arrays.&lt;br /&gt;
&lt;br /&gt;
Each rwmutex has a priority ceiling, the priority of the highest priority&lt;br /&gt;
task that uses the rwmutex for reading or for writing. This is specified&lt;br /&gt;
when the rwmutex is created, does not change subsequently, and must be in&lt;br /&gt;
the range 1 (TASK_MAX_PRIORITY) to 254 (TASK_MIN_PRIORITY).&lt;br /&gt;
The application developer must ensure that the correct rwmutex ceiling&lt;br /&gt;
is used. OCEOSmp will detect an attempt to acquire a rwmutex by a task&lt;br /&gt;
with higher priority than that rwmutex's priority ceiling, make a&lt;br /&gt;
system log entry (LOG_RWMUTEX_BAD_CEILING) and return an INTERNAL_ERROR&lt;br /&gt;
status code.&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_rwmutex_create()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''rwmutex.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function ees a read/write mutex.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Creates a Read/Write Mutex (RWMUTEX)&lt;br /&gt;
 *&lt;br /&gt;
 * This function should only be called after OCEOSmp is initialised with&lt;br /&gt;
 * oceos_init() and before initialisation ends with oceos_init_finish()&lt;br /&gt;
 * and scheduling starts with oceos_start()&lt;br /&gt;
 *&lt;br /&gt;
 * @param rwm_id    Read/Write RWMUTEX ID, must be in range 0 to 62&lt;br /&gt;
 * @param priority  Priority ceiling of highest priority task that uses the RWMUTEX&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_WRONG_CPU_CORE          Executing directive on wrong CPU&lt;br /&gt;
 *          ERR_WRONG_PHASE             Called before oceos_init() is done&lt;br /&gt;
 *          ERR_TOO_MANY                MAX number of RWMUTEXs already created&lt;br /&gt;
 *          ERR_ID_INVALID              RWMUTEX ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                RWMUTEX ID &amp;gt;= number of RWMUTEXs&lt;br /&gt;
 *          ERR_RWMX_ALREADY_ALLOCATED  RWMUTEX ID already used&lt;br /&gt;
 *          ERR_RWMX_PRIORITY_WRONG     RWMUTEX priority ceiling outside allowed range 1 to 254&lt;br /&gt;
 */&lt;br /&gt;
S32_t   oceos_rwmutex_create(&lt;br /&gt;
    const U32_t rwm_id,   // RWMUTEX ID, must be in range 0 to max rwm&lt;br /&gt;
    const U8_t priority   // RWMUTEX priority ceiling&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| rwm_id || Read/Write RWMUTEX ID, must be in range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| priority || Priority ceiling of highest priority task that uses the RWMUTEX&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_CPU_CORE          || Executing directive on wrong CPU&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Called before oceos_init() is done&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TOO_MANY                || MAX number of RWMUTEXs already created&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || RWMUTEX ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || RWMUTEX ID &amp;gt;= number of RWMUTEXs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_RWMX_ALREADY_ALLOCATED  || RWMUTEX ID already used&lt;br /&gt;
|-&lt;br /&gt;
| ERR_RWMX_PRIORITY_WRONG     || RWMUTEX priority ceiling outside allowed range 1 to 254&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Create read/write mutex with ID rwm_2 and priority ceiling of 100 &lt;br /&gt;
status = oceos_rwmutex_create(rwm_1, 100);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_rwmutex_read_wait()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''rwmutex.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function acquires a read/write mutex for read. If successful, jobs on other CPUs can also acquire it for read, but no job will be able to acquire it for write while any read is under way. If job already holds RWMUTEX for read or for write the appropriate status code is returned, a system log entry made, and the job continues. It will not succeed while any job is waiting to obtain RWMUTEX for write, and will loop waiting for all pending writes on this RWMUTEX to complete.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Read wait on RWMUTEX.&lt;br /&gt;
 *&lt;br /&gt;
 * If successful jobs on other CPUs can also acquire it for read, but no job&lt;br /&gt;
 * will be able to acquire it for write while any read is under way.&lt;br /&gt;
 * If job already holds RWMUTEX for read or for write appropriate status code&lt;br /&gt;
 * is returned, a system log entry made, and the job continues.&lt;br /&gt;
 * Will not succeed while any job is waiting to obtain RWMUTEX for write,&lt;br /&gt;
 * will loop waiting for all pending writes on this RWMUTEX to complete.&lt;br /&gt;
 *&lt;br /&gt;
 * This should only be called after OCEOS scheduling has started.&lt;br /&gt;
 *&lt;br /&gt;
 * N.B.	The returned status code must be checked and appropriate action&lt;br /&gt;
 * 		taken.&lt;br /&gt;
 *&lt;br /&gt;
 * @param rwm_id    const U32_t  : value 0 to 62&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          WARN_RWMX_NOT_HIGHEST       Already holds a RWMUTEX higher in the RWMUTEX order&lt;br /&gt;
 *                                      (there then may be a risk of deadlock)&lt;br /&gt;
 *&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              RWMUTEX ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                RWMUTEX ID &amp;gt;= number of RWMUTEXs&lt;br /&gt;
 *          ERR_RWMX_CEILING_BAD        RWMUTEX ceiling not lower priority than job priority&lt;br /&gt;
 *          ERR_RWMX_ALREADY_HELD       RWMUTEX already held by this job&lt;br /&gt;
 *          ERR_RWMX_CPU_STACK_FULL     CPU priority ceiling stack full&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_rwmutex_read_wait(&lt;br /&gt;
    const U32_t rwm_id  // RWMUTEX ID, must be in range 0 to 62&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| rwm_id || U32_t rwmutex to be acquired for read (value 0 to 62)&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| WARN_RWMX_NOT_HIGHEST       || Already holds a RWMUTEX higher in the RWMUTEX order (deadlock risk)&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || RWMUTEX ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || RWMUTEX ID &amp;gt;= number of RWMUTEXs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_RWMX_CEILING_BAD        || RWMUTEX ceiling not lower priority than job priority&lt;br /&gt;
|-&lt;br /&gt;
| ERR_RWMX_ALREADY_HELD       || RWMUTEX already held by this job&lt;br /&gt;
|-&lt;br /&gt;
| ERR_RWMX_CPU_STACK_FULL     || CPU priority ceiling stack full&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Acquire read/write mutex rwm_1 for read&lt;br /&gt;
status = oceos_rwmutex_read_wait(rwm_1);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_rwmutex_write_wait()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''rwmutex.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function acquires the specified read/write mutex for write.&lt;br /&gt;
If successful, no other job can also obtain it for reading or for writing. Will not succeed while any other job has acquired RWMUTEX for write,&lt;br /&gt;
or any jobs have obtained RWMUTEX for read. Will then loop until the RWMUTEX is released and for its turn in the sequence of jobs that have tried to acquire the RWMUTEX for writing. If already holds the RWMUTEX for writing or reading an appropriate status code is returned, a system log entry made, and the job continues. While there are any outstanding attempts to obtain the RWMUTEX for write no job will be able to acquire it for reading.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Write wait on RWMUTEX.&lt;br /&gt;
 *&lt;br /&gt;
 * If successful no other job can also obtain it for reading or for writing.&lt;br /&gt;
 * Will not succeed while any other job has acquired RWMUTEX for write,&lt;br /&gt;
 * or any jobs have obtained RWMUTEX for read. Will then loop until the&lt;br /&gt;
 * RWMUTEX is released and for its turn in the sequence of jobs that have&lt;br /&gt;
 * tried to acquire the RWMUTEX for writing.&lt;br /&gt;
 * If already holds the RWMUTEX for writing or reading an appropriate status&lt;br /&gt;
 * code is returned, a system log entry made, and the job continues.&lt;br /&gt;
 * While there are any outstanding attempts to obtain the RWMUTEX for write&lt;br /&gt;
 * no job will be able to acquire it for reading.&lt;br /&gt;
 *&lt;br /&gt;
 * This should only be called after OCEOS scheduling has started.&lt;br /&gt;
 *&lt;br /&gt;
 * N.B.	The returned status code must be checked and appropriate action&lt;br /&gt;
 * 		taken.&lt;br /&gt;
 *&lt;br /&gt;
 * @param rwm_id     const U32_t  : value 0 to 62&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          WARN_RWMX_NOT_HIGHEST       Already holds a RWMUTEX higher in the RWMUTEX order&lt;br /&gt;
 *                                      (there then may be a risk of deadlock)&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              RWMUTEX ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                RWMUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
 *          ERR_RWMX_CEILING_BAD        RWMUTEX ceiling not lower priority than job priority&lt;br /&gt;
 *          ERR_RWMX_ALREADY_HELD       RWMUTEX already held by this job&lt;br /&gt;
 *          ERR_RWMX_CPU_STACK_FULL     CPU priority ceiling stack full&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_rwmutex_write_wait(&lt;br /&gt;
    const U32_t rwm_id  // RWMUTEX ID, must be in range 0 to 62&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| rwm_id || U32_t rwmutex to be acquired for write(value 0 to 62)&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| WARN_RWMX_NOT_HIGHEST       || Already holds a RWMUTEX higher in the RWMUTEX order (deadlock risk)&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || RWMUTEX ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || RWMUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_RWMX_CEILING_BAD        || RWMUTEX ceiling not lower priority than job priority&lt;br /&gt;
|-&lt;br /&gt;
| ERR_RWMX_ALREADY_HELD       || RWMUTEX already held by this job&lt;br /&gt;
|-&lt;br /&gt;
| ERR_RWMX_CPU_STACK_FULL     || CPU priority ceiling stack full&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Acquire read/write mutex rwm_1 for write&lt;br /&gt;
status = oceos_rwmutex_read_wait(rwm_1);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_rwmutex_signal()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''rwmutex.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function signals the specified read/write mutex.&lt;br /&gt;
It frees the RWMUTEX for use by other jobs, irrespective of whether the RWMUTEX is held for reading or for writing. If the RWMUTEX is not held by the job then it returns an appropriate status code. It does not take into account how many times a job has obtained the RWMUTEX for read or for write.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Signal a RWMUTEX&lt;br /&gt;
 *&lt;br /&gt;
 * Frees the RWMUTEX for use by other jobs, irrespective of whether&lt;br /&gt;
 * RWMUTEX is held for reading or for writing.&lt;br /&gt;
 * if the RWMUTEX is not held by the job returns an appropriate status code.&lt;br /&gt;
 * Does not take into account how many times a job has obtained the RWMUTEX&lt;br /&gt;
 * for read or for write.&lt;br /&gt;
 *&lt;br /&gt;
 * This should only be called after OCEOS scheduling has started.&lt;br /&gt;
 *&lt;br /&gt;
 * N.B. The returned status code must be checked and appropriate action taken.&lt;br /&gt;
 *&lt;br /&gt;
 * @param rwm_id    const U32_t  : value 0 to 62&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          WARN_RWMX_ALREADY_FREE      RWMUTEX is free already&lt;br /&gt;
 *&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              RWMUTEX ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                RWMUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
 *          ERR_RWMX_CEILING_BAD        RWMUTEX ceiling not lower priority than job priority&lt;br /&gt;
 *          ERR_RWMX_CPU_STACK_EMPTY    CPU priority ceiling stack empty&lt;br /&gt;
 *          ERR_RWMX_CEILING_INVALID    CPU current priority ceiling on the priority stack is invalid&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_rwmutex_signal(&lt;br /&gt;
    const U32_t rwm_id // RWMUTEX ID, must be in range 0 to 62&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| rwm_id || U32_t rwmutex to be signaled(value 0 to 62)&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| WARN_RWMX_ALREADY_FREE      || RWMUTEX is free already&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || RWMUTEX ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || RWMUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_RWMX_CEILING_BAD        || RWMUTEX ceiling not lower priority than job priority&lt;br /&gt;
|-&lt;br /&gt;
| ERR_RWMX_CPU_STACK_EMPTY    || CPU priority ceiling stack empty&lt;br /&gt;
|-&lt;br /&gt;
| ERR_RWMX_CEILING_INVALID    || CPU current priority ceiling on the priority stack is invalid&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Signal read/write mutex number rwm_4&lt;br /&gt;
status = oceos_rwmutex_signal(rwm_4);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_rwmutex_check_status()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''rwmutex.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function checks the status of a read/write mutex. The possible states are free, in-use for read, and in-use for write.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Check whether RWMUTEX is free&lt;br /&gt;
 *&lt;br /&gt;
 * @param rwm_id        must be in range 0 to 62&lt;br /&gt;
 * @param m_status      pointer to RWMUTEX status holder;&lt;br /&gt;
 *                      if return code OCEOS_SUCCESS RWMUTEX status:&lt;br /&gt;
 *                          0 =&amp;gt; Free for use&lt;br /&gt;
 *                          1 =&amp;gt; In use for read&lt;br /&gt;
 *                          2 =&amp;gt; In use for write&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              RWMUTEX ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                RWMUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
 *          ERR_RWMX_DATA_PTR_BAD       Pointer to RWMUTEX status return holder is null&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_rwmutex_check_status(&lt;br /&gt;
    const U32_t rwm_id, // RWMUTEX ID, must be in range 0 to 62&lt;br /&gt;
    U32_t *m_status&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| rwm_id || read/write mutex number in range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| m_status || U32_t pointer to RWMUTEX status holder (0 = free, 1 = in-use for read, 2 = in-use for write &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || RWMUTEX ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || RWMUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_RWMX_DATA_PTR_BAD       || Pointer to RWMUTEX status return holder is null&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, rwm_status;&lt;br /&gt;
...&lt;br /&gt;
// Check the status of read/write mutex rwm_2&lt;br /&gt;
status = oceos_rwmutex_check_status(rwm_2, &amp;amp;rwm_status);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_rwmutex_reading_count()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''rwmutex.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the current number of jobs holding a specified read/write mutex for read.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 *&lt;br /&gt;
 * Get current number of jobs holding RWMUTEX for read&lt;br /&gt;
 *&lt;br /&gt;
 * @param rwm_id    must be in range 0 to 62&lt;br /&gt;
 * @param m_count   pointer to RWMUTEX count holder&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              RWMUTEX ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                RWMUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
 *          ERR_RWMX_DATA_PTR_BAD       Pointer to RWMUTEX count return holder is null&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_rwmutex_reading_count(&lt;br /&gt;
    const U32_t rwm_id, // RWMUTEX ID, must be in range 0 to 62&lt;br /&gt;
    U32_t *m_count&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| rwm_id || U32 value of read/write mutex (in range 0 to 62)&lt;br /&gt;
|-&lt;br /&gt;
| m_count || U32_t pointer to read/write mutex count holder&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || RWMUTEX ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || RWMUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_RWMX_DATA_PTR_BAD       || Pointer to RWMUTEX count return holder is null&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, rwm_count;&lt;br /&gt;
...&lt;br /&gt;
// Get the number of jobs holding the read/write mutex rwm_2 for read&lt;br /&gt;
status = oceos_rwmutex_reading_count(rwm_2, &amp;amp;rwm_count);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_rwmutex_write_reqs_count()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''header.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the current number of write requests for the specified read/write mutex .&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Get current RWMUTEX write requests count&lt;br /&gt;
 *&lt;br /&gt;
 * @param rwm_id    must be in range 0 to 62&lt;br /&gt;
 * @param m_count   pointer to RWMUTEX count holder&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              RWMUTEX ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                RWMUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
 *          ERR_RWMX_DATA_PTR_BAD       Pointer to RWMUTEX count return holder is null&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_rwmutex_write_reqs_count(&lt;br /&gt;
    const U32_t rwm_id, // RWMUTEX ID, must be in range 0 to 62&lt;br /&gt;
    U32_t *m_count&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| rwm_id || U32_t value of read/write mutex (must be in range 0 to 62)&lt;br /&gt;
|-&lt;br /&gt;
| m_count || U32_t pointer to read/write mutex count holder&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || RWMUTEX ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || RWMUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_RWMX_DATA_PTR_BAD       || Pointer to RWMUTEX count return holder is null&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, rwm_count;&lt;br /&gt;
...&lt;br /&gt;
// Get the count of cuurent write requests for read/write mutex rwm_1&lt;br /&gt;
status = oceos_rwmutex_write_reqs_count(rwm_1, &amp;amp;rwm_count);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_rwmutex_writes_pending_count()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''rwmutex.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the current number of pending writes for the specified read/write mutex.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Get current RWMUTEX writes pending count&lt;br /&gt;
 *&lt;br /&gt;
 * @param rwm_id    must be in range 0 to 62&lt;br /&gt;
 * @param m_count   pointer to RWMUTEX count holder&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              RWMUTEX ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                RWMUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
 *          ERR_RWMX_DATA_PTR_BAD       Pointer to RWMUTEX pending count return holder is null&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_rwmutex_writes_pending_count(&lt;br /&gt;
    const U32_t rwm_id, // RWMUTEX ID, must be in range 0 to 62&lt;br /&gt;
    U32_t *m_count&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| rwm_id || U32_t value of read/write mutex (must be in range 0 to 62)&lt;br /&gt;
|-&lt;br /&gt;
| m_count || U32_t pointer to read/write mutex count holder&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || RWMUTEX ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || RWMUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_RWMX_DATA_PTR_BAD       || Pointer to RWMUTEX count return holder is null&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, rwm_count;&lt;br /&gt;
...&lt;br /&gt;
// Get the count of cuurent write requests for read/write mutex rwm_1&lt;br /&gt;
status = oceos_rwmutex_writes_pending_count(rwm_1, &amp;amp;rwm_count);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_rwmutex_holding()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''header.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the read/write mutexes currently held by this instance of this task (job).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Get RWMUTEXs currently held by this instance of the task (job)&lt;br /&gt;
 *&lt;br /&gt;
 * @param m_data    U64_t pointer, each bit indicating RWMUTEX held by current task&lt;br /&gt;
 *                          0 =&amp;gt; Not held by job&lt;br /&gt;
 *                          1 =&amp;gt; Held by job&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_RWMX_DATA_PTR_BAD       Pointer to RWMUTEX status return holder is null&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_rwmutex_holding(&lt;br /&gt;
    U64_t *m_data&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| m_data || U64_t pointer, each bit indicating RWMUTEX held by current task, 0 =&amp;gt; not held, 1 =&amp;gt; held &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_RWMX_DATA_PTR_BAD       || Pointer to RWMUTEX status return holder is null&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
U64_t rwm_held;&lt;br /&gt;
...&lt;br /&gt;
// Which read/write mutexes does this job hold&lt;br /&gt;
status = oceos_rwmutex_holding(&amp;amp;rwm_held);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Semaphores directives ==&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_sem_create()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''semaphore.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function creates a semaphore.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Create a counting semaphore&lt;br /&gt;
 *&lt;br /&gt;
 * @param sem_id            SEMAPHORE ID (from 0 to 62)&lt;br /&gt;
 * @param max_permits       number of max permits allowed for this SEMAPHORE, 1 to 4095&lt;br /&gt;
 * @param count_permits     starting number of permits available 0 to 4095&lt;br /&gt;
 * @param pending_q_size    MAX Number of tasks on SEMAPHORE pending queue 1 to 253&lt;br /&gt;
 * @param use_timeout       if TRUE, directive oceos_sem_wait_restart_timeout can be used&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_WRONG_CPU_CORE          Executing directive on wrong CPU&lt;br /&gt;
 *          ERR_WRONG_PHASE             Called before oceos_init() is done&lt;br /&gt;
 *          ERR_TOO_MANY                MAX number of SEMAPHOREs already created&lt;br /&gt;
 *          ERR_ID_INVALID              SEMAPHORE ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                SEMAPHORE ID &amp;gt;= number of SEMAPHOREs&lt;br /&gt;
 *          ERR_SM_ALREADY_ALLOCATED    SEMAPHORE ID already used&lt;br /&gt;
 *          ERR_SM_MAX_PERMIT_WRONG     MAX permits outside allowed range 1 to 4095&lt;br /&gt;
 *          ERR_SM_COUNT_PERMIT_WRONG   Count permits outside allowed range 0 to 4095&lt;br /&gt;
 *          ERR_SM_COUNT_PERMIT_INVALID Count permits is greater than MAX permits for this SEMAPHORE&lt;br /&gt;
 *          ERR_SM_PENQ_SIZE_WRONG      SEMAPHORE pending queue size outside allowed range 1 to 253&lt;br /&gt;
 *          ERR_SM_TA_MAX_NUM_REACHED   Number of timed actions exceeds MAX allowed 255,&lt;br /&gt;
 *                                      each task on SEMAPHORE pending queue is timed action&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_sem_create(&lt;br /&gt;
    sem_t sem_id,         // counting semaphore ID (MAX 63)&lt;br /&gt;
    U16_t max_permits,    // max number of permits (MAX 4095)&lt;br /&gt;
    U16_t count_permits,  // initial number of permits (MAX 4095)&lt;br /&gt;
    U8_t  pending_q_size, // max number of pending queue jobs (MAX 253)&lt;br /&gt;
    BOOLE_t use_timeout   // whether timeout is used in oceos_sem_wait_restart_timeout&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| sem_id || Semaphore ID to be created (from 0 to 62)&lt;br /&gt;
|-&lt;br /&gt;
| max_permits || number of max permits allowed for this semaphore, 1 to 4095&lt;br /&gt;
|-&lt;br /&gt;
| count_permits || starting number of permits available 0 to 4095&lt;br /&gt;
|-&lt;br /&gt;
| pending_q_size || Maximum Number of tasks on SEMAPHORE pending queue 1 to 253&lt;br /&gt;
|-&lt;br /&gt;
| use_timeout || if TRUE, directive oceos_sem_wait_restart_timeout can be used&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_CPU_CORE          || Executing directive on wrong CPU&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Called before oceos_init() is done&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TOO_MANY                || MAX number of SEMAPHOREs already created&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || SEMAPHORE ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || SEMAPHORE ID &amp;gt;= number of SEMAPHOREs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SM_ALREADY_ALLOCATED    || SEMAPHORE ID already used&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SM_MAX_PERMIT_WRONG     || MAX permits outside allowed range 1 to 4095&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SM_COUNT_PERMIT_WRONG   || Count permits outside allowed range 0 to 4095&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SM_COUNT_PERMIT_INVALID || Count permits is greater than MAX permits for this SEMAPHORE&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SM_PENQ_SIZE_WRONG      || SEMAPHORE pending queue size outside allowed range 1 to 253&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SM_TA_MAX_NUM_REACHED   || Number of timed actions exceeds MAX allowed 255&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, param;&lt;br /&gt;
...&lt;br /&gt;
// Create semaphore called s_audi with max permits of 1000, starting permits of zero, max of 10 tasks on pending queue, and no timeouts &lt;br /&gt;
status = oceos_sem_create(s_audi, 1000, 0, 10, FALSE);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_sem_signal()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''semaphore.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function signals a semaphore, increments its count and transfers pending jobs to the ready queue.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Signals a semaphore, increments and transfers pending jobs to ready queue&lt;br /&gt;
 *&lt;br /&gt;
 * @param sem_id counting SEM ID&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          WARN_JOB_NOT_GUARDED&lt;br /&gt;
 *&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              SEM ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                SEM ID &amp;gt;= number of SEMs&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to grab SEM guard&lt;br /&gt;
 *          ERR_TOO_MANY                SEM max permits count already reached&lt;br /&gt;
 *          ERR_SM_JOB_ID_WRONG         Job ID of the task on SEM pending queue is wrong&lt;br /&gt;
 *          ERR_TA_NOT_FOUND            Timed action index to be removed for job not found&lt;br /&gt;
 *          ERR_TA_START_FAILED         Timed action re-start failed after job remove from timed action queue&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_sem_signal(&lt;br /&gt;
    sem_t sem_id // counting SEM ID&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| sem_id || U32_t value of semaphore to be signalled (incremented)&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| WARN_JOB_NOT_GUARDED        || job not guarded, application should check system log&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || SEM ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || SEM ID &amp;gt;= number of SEMs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to grab SEM guard&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TOO_MANY                || SEM max permits count already reached&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SM_JOB_ID_WRONG         || Job ID of the task on SEM pending queue is wrong&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_NOT_FOUND            || Timed action index to be removed for job not found&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_START_FAILED         || Timed action re-start failed after job remove from timed action queue&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Signal s_audi semaphore (increment its count)&lt;br /&gt;
status = oceos_sem_signal(s_audi);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_sem_wait_continue()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''semaphore.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function decrements the available permits of a sempahore otherwise returns an unsuccessful status code.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Wait on semaphore,&lt;br /&gt;
 * decrement the number of available permits for semaphore,&lt;br /&gt;
 * if no permits continue and task should handle unsuccessful result&lt;br /&gt;
 *&lt;br /&gt;
 * @param sem_id SEM ID&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              SEM ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                SEM ID &amp;gt;= number of SEMs&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to grab SEM guard&lt;br /&gt;
 *          ERR_SM_NOT_AVAILABLE        No more permits available for this SEM&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_sem_wait_continue(&lt;br /&gt;
    sem_t sem_id // counting SEM ID&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| sem_id || U32_t value of semaphore to be decremented&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || SEM ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || SEM ID &amp;gt;= number of SEMs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to grab SEM guard&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SM_NOT_AVAILABLE        || No more permits available for this SEM&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Decrement available permits on semaphore s_1&lt;br /&gt;
status = oceos_sem_wait_continue(s_1);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_sem_wait_restart()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''semaphore.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function decrements the available permits of a sempahore and if none available, the job is put on the pending queue.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Waits on semaphore,&lt;br /&gt;
 * if fail, put job on pending queue and exit task&lt;br /&gt;
 *&lt;br /&gt;
 * @param sem_id SEM ID&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              SEM ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                SEM ID &amp;gt;= number of SEMs&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to grab SEM guard&lt;br /&gt;
 *          ERR_SM_J_START_FROM_TIMOUT  Task started from timeout already, SEM no permits available second time&lt;br /&gt;
 *          ERR_FAILED                  Should never return this&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_sem_wait_restart(&lt;br /&gt;
    sem_t sem_id  // counting SEM ID&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| sem_id || U32_t value of semaphore to be decremented&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || SEM ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || SEM ID &amp;gt;= number of SEMs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to grab SEM guard&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SM_J_START_FROM_TIMOUT  || Task started from timeout already, SEM no permits available second time&lt;br /&gt;
|-&lt;br /&gt;
| ERR_FAILED                  || Should never return this&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Decrement available permits on semaphore s_1 otherwise job is put on pending queue&lt;br /&gt;
status = oceos_sem_wait_restart(s_1);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_sem_wait_restart_timeout()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''semaphore.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function decrements the available permits of a sempahore and if none available, the job is put on the pending queue with a timeout enabled. The job is restarted either when a permit is available to be decremented or when the timeout has expired. In order to use this directive, semaphore must be created with flag use_timeout is set to TRUE.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Waits on semaphore,&lt;br /&gt;
 * if fail, put job on pending queue with optional timeout.&lt;br /&gt;
 * In order to use this directive, semaphore must be created with&lt;br /&gt;
 * flag use_timeout is set to TRUE&lt;br /&gt;
 *&lt;br /&gt;
 * @param sem_id         SEM ID&lt;br /&gt;
 * @param U64_t timeout  Restart time if no permits, 0 =&amp;gt; ignore&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_TA_NOT_INIT             Timed action intialisation is not done and tried to be used; or SEM created without timeouts&lt;br /&gt;
 *          ERR_ID_INVALID              SEM ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                SEM ID &amp;gt;= number of SEMs&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to grab SEM guard&lt;br /&gt;
 *          ERR_SM_J_START_FROM_TIMOUT  Task started from timeout already, SEM no permits available second time&lt;br /&gt;
 *          ERR_TOO_MANY                SEM pending queue is full&lt;br /&gt;
 *          ERR_FAILED                  Should never return this&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_sem_wait_restart_timeout(&lt;br /&gt;
    sem_t sem_id, // counting SEM ID&lt;br /&gt;
    U64_t timeout // timeout, restart time if no permits, 0 =&amp;gt; ignore&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| sem_id || U32_t value of semaphore to be decremented&lt;br /&gt;
|-&lt;br /&gt;
| timeout | U64_t timeout in time units. A value of 0 causes timeout to be ignored.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_NOT_INIT             || Timed action intialisation is not done and tried to be used; or SEM created without&lt;br /&gt;
timeouts&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || SEM ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || SEM ID &amp;gt;= number of SEMs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to grab SEM guard&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SM_J_START_FROM_TIMOUT  || Task started from timeout already, SEM no permits available second time&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TOO_MANY                || SEM pending queue is full&lt;br /&gt;
|-&lt;br /&gt;
| ERR_FAILED                  || Should never return this&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Decrement available permits on semaphore s_1 otherwise job is put on pending queue with timeout of 10,000 time units (usually usecs)&lt;br /&gt;
status = oceos_sem_wait_restart_timeout(s_1);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_sem_get_value()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''semaphore.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the number of available permits for the specified semaphore.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Returns number of available permits&lt;br /&gt;
 * for SEM ID&lt;br /&gt;
 *&lt;br /&gt;
 * @param sem_id        SEM id&lt;br /&gt;
 * @param s_permits     pointer to permits count holder&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              SEM ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                SEM ID &amp;gt;= number of SEMs&lt;br /&gt;
 *          ERR_SM_DATA_BAD             Data holder pointer is null&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_sem_get_value(&lt;br /&gt;
    sem_t sem_id,    // counting SEM ID&lt;br /&gt;
    U32_t *s_permits // pointer to permits count holder&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| sem_id || U32_t value of semaphore whose permit count is required&lt;br /&gt;
|-&lt;br /&gt;
| s_permits || U32_t pointer to permits count holder&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || SEM ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || SEM ID &amp;gt;= number of SEMs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SM_DATA_BAD             || Data holder pointer is null&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, permit_count;&lt;br /&gt;
...&lt;br /&gt;
// Get the available permits for semaphore s_1&lt;br /&gt;
status = oceos_sem_get_value(s_1, &amp;amp;permit_count);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_sem_penq_get_size()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''semaphore.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the number of jobs on the specified semaphore pending queue.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Returns number of jobs on semaphore pending queue&lt;br /&gt;
 * for semaphore ID&lt;br /&gt;
 *&lt;br /&gt;
 * @param sem_id    SEM id&lt;br /&gt;
 * @param s_size    pointer to pending queue size holder&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              SEM ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                SEM ID &amp;gt;= number of SEMs&lt;br /&gt;
 *          ERR_SM_DATA_BAD             Data holder pointer is null&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_sem_penq_get_size(&lt;br /&gt;
    sem_t sem_id,   // counting SEM ID&lt;br /&gt;
    U32_t *s_size   // pointer to pending queue size holder&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| sem_id || U32_t value of semaphore whose permit count is required&lt;br /&gt;
|-&lt;br /&gt;
| s_size || U32_t pointer to pending queue jobs count holder&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || SEM ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || SEM ID &amp;gt;= number of SEMs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SM_DATA_BAD             || Data holder pointer is null&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, job_count;&lt;br /&gt;
...&lt;br /&gt;
// Get the available permits for semaphore s_1&lt;br /&gt;
status = oceos_sem_penq_get_size(s_1, &amp;amp;job_count);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_sem_reset()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''semaphore.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function restores the permits to the original semaphore initial value and removes any jobs from the pending queue.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Restore permits to original value and&lt;br /&gt;
 * remove jobs from pending queue&lt;br /&gt;
 *&lt;br /&gt;
 * @param sem_id    SEM ID&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              SEM ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                SEM ID &amp;gt;= number of SEMs&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to grab SEM guard&lt;br /&gt;
 *          ERR_SM_JOB_ID_WRONG         Job ID of the task on SEM pending queue is wrong&lt;br /&gt;
 *          ERR_TA_NOT_FOUND            Timed action index to be removed for job not found&lt;br /&gt;
 *          ERR_TA_START_FAILED         Timed action re-start failed after job remove from timed action queue&lt;br /&gt;
 */&lt;br /&gt;
S32_t   oceos_sem_reset(&lt;br /&gt;
    sem_t sem_id   // counting SEM ID&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| sem_id || U32_t value of semaphore to be reset&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || SEM ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || SEM ID &amp;gt;= number of SEMs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to grab SEM guard&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SM_JOB_ID_WRONG         || Job ID of the task on SEM pending queue is wrong&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_NOT_FOUND            || Timed action index to be removed for job not found&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_START_FAILED         || Timed action re-start failed after job remove from timed action queue&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Reset semaphore s_1&lt;br /&gt;
status = oceos_sem_reset(s_1);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Data Queues ==&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_dataq_create()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''dataq.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function creates a data queue with the specified characteristics.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Create data queue&lt;br /&gt;
 * If use_timeout = TRUE, timed actions must be initialised&lt;br /&gt;
 *&lt;br /&gt;
 * @param dataq_id      data queue ID&lt;br /&gt;
 * @param dataq_size    data queue size&lt;br /&gt;
 * @param pen_q_size    pending jobs queue size&lt;br /&gt;
 * @param roll_over     whether to roll over when full&lt;br /&gt;
 * @param use_timeout   if TRUE, directive oceos_dataq_read_restart_timeout can be used&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_WRONG_CPU_CORE          Executing directive on wrong CPU&lt;br /&gt;
 *          ERR_WRONG_PHASE             Called before oceos_init() is done&lt;br /&gt;
 *          ERR_TOO_MANY                MAX number of DATAQs already created&lt;br /&gt;
 *          ERR_ID_INVALID              DATAQ ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                DATAQ ID &amp;gt;= number of DATAQs&lt;br /&gt;
 *          ERR_DQ_ALREADY_ALLOCATED    DATAQ ID already used&lt;br /&gt;
 *          ERR_DQ_SIZE_WRONG           DATAQ size outside allowed range 1 to 255&lt;br /&gt;
 *          ERR_DQ_PENQ_SIZE_WRONG      DATAQ pending queue size outside allowed range 1 to 253&lt;br /&gt;
 *          ERR_DQ_TA_MAX_NUM_REACHED   Number of timed actions exceeds MAX allowed 255,&lt;br /&gt;
 *                                      each task on DATAQ pending queue is timed action&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_dataq_create(&lt;br /&gt;
                         dataq_t dataq_id,    // data queue ID&lt;br /&gt;
                         U16_t dataq_size,    // data queue size&lt;br /&gt;
                         U16_t pen_q_size,    // pending jobs queue size&lt;br /&gt;
                         BOOLE_t roll_over,   // whether to roll over when full&lt;br /&gt;
                         BOOLE_t use_timeout  // whether timeout is used oceos_dataq_read_restart_timeout&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| dataq_id ||   dataq_t data queue ID (number between 0 and 62)&lt;br /&gt;
|-&lt;br /&gt;
| dataq_size ||   data queue size (max number of pointers than can be added to the queue)&lt;br /&gt;
|-&lt;br /&gt;
| pen_q_size ||   pending jobs queue size&lt;br /&gt;
|-&lt;br /&gt;
| roll_over ||    whether to roll over when full (0 =&amp;gt; disabled, 1 =&amp;gt; enabled)&lt;br /&gt;
|-&lt;br /&gt;
| use_timeout ||  if TRUE, directive oceos_dataq_read_restart_timeout can be used&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_CPU_CORE          || Executing directive on wrong CPU&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Called before oceos_init() is done&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TOO_MANY                || MAX number of DATAQs already created&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || DATAQ ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || DATAQ ID &amp;gt;= number of DATAQs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DQ_ALREADY_ALLOCATED    || DATAQ ID already used&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DQ_SIZE_WRONG           || DATAQ size outside allowed range 1 to 255&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DQ_PENQ_SIZE_WRONG      || DATAQ pending queue size outside allowed range 1 to 253&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DQ_TA_MAX_NUM_REACHED   || Number of timed actions exceeds MAX allowed 255, each task on DATAQ pending queue is timed action&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Create data queue d_3 with size 20, max pending jobs of 10, rollover enabled, timeouts disabled &lt;br /&gt;
status = oceos_dataq_create(d_3, 20, 10, 1, 0));&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_dataq_write()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''dataq.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function puts a non-null pointer on the specified data queue.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Puts pointer to the data on data queue.&lt;br /&gt;
 * Pointer to the data must not be NULL&lt;br /&gt;
 *&lt;br /&gt;
 * @param dataq_t dataq_id Data queue ID&lt;br /&gt;
 * @param void* data       Non-null pointer to data&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          WARN_DQ_NOW_FULL            Warning, DATAQ is full now&lt;br /&gt;
 *          WARN_JOB_NOT_GUARDED&lt;br /&gt;
 *&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              DATAQ ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                DATAQ ID &amp;gt;= number of DATAQs&lt;br /&gt;
 *          ERR_DQ_DATA_BAD             Data pointer is null&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to acquire guard&lt;br /&gt;
 *          ERR_TOO_MANY                DATAQ is full&lt;br /&gt;
 *          ERR_DQ_JOB_ID_WRONG         Job ID of the task on pending queue is wrong&lt;br /&gt;
 *          ERR_TA_NOT_FOUND            Timed action index to be removed for job not found&lt;br /&gt;
 *          ERR_TA_START_FAILED         Timed action re-start failed after job remove from timed action queue&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_dataq_write(&lt;br /&gt;
    dataq_t dataq_id, // data queue ID&lt;br /&gt;
    void *data        // non-null pointer to data&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| dataq_id || dataq_t with value of Data queue ID&lt;br /&gt;
|-&lt;br /&gt;
| ptr || void* pointer to application data (non-null pointer)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| WARN_DQ_NOW_FULL            || Warning, DATAQ is full now&lt;br /&gt;
|-&lt;br /&gt;
| WARN_JOB_NOT_GUARDED        || &lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || DATAQ ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || DATAQ ID &amp;gt;= number of DATAQs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DQ_DATA_BAD             || Data pointer is null&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to acquire guard&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TOO_MANY                || DATAQ is full&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DQ_JOB_ID_WRONG         || Job ID of the task on pending queue is wrong&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_NOT_FOUND            || Timed action index to be removed for job not found&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_START_FAILED         || Timed action re-start failed after job remove from timed action queue&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
char[100] message_in;&lt;br /&gt;
...&lt;br /&gt;
// Put pointer to message_in on data queue s_2 &lt;br /&gt;
status = oceos_dataq_write(s_2, (void *)message_in);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_dataq_read_continue()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''dataq.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns a pointer from the specified data queue.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Read data queue&lt;br /&gt;
 *&lt;br /&gt;
 * @param dataq_t dataq_id  Data queue ID&lt;br /&gt;
 * @param void*   data      Pointer to data&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              DATAQ ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                DATAQ ID &amp;gt;= number of DATAQs&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to acquire guard&lt;br /&gt;
 *          ERR_DQ_EMPTY                DATAQ empty(count zero)&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_dataq_read_continue(&lt;br /&gt;
    dataq_t dataq_id, // data queue ID&lt;br /&gt;
    void* *data        // return data&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Descriptionn&lt;br /&gt;
|-&lt;br /&gt;
| dataq_id || dataq_t with value of Data queue ID&lt;br /&gt;
|-&lt;br /&gt;
| ptr || void* pointer to store returned data queue pointer removed from the queue&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || DATAQ ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || DATAQ ID &amp;gt;= number of DATAQs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to acquire guard&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DQ_EMPTY                || DATAQ empty(count zero)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
char *data_ptr;&lt;br /&gt;
...&lt;br /&gt;
// Read pointer from data queue s_2 &lt;br /&gt;
status = oceos_dataq_read_continue(s_2, (void *)data_ptr);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_dataq_read_restart()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''dataq.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns a pointer from the specified data queue. If the queue is empty, the job is added top the dataq pending queue. The job will be restarted when data is available. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Read data queue next item.&lt;br /&gt;
 * If dataq is empty, task is put on pending Q for dataq and&lt;br /&gt;
 * restarted by oceos_dataq_write&lt;br /&gt;
 *&lt;br /&gt;
 * @param dataq_id Data queue ID&lt;br /&gt;
 * @param data     Pointer to return data&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              DATAQ ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                DATAQ ID &amp;gt;= number of DATAQs&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to acquire guard&lt;br /&gt;
 *          ERR_DQ_J_START_FROM_TIMOUT  Job started from timeout already, DATAQ empty second time&lt;br /&gt;
 *          ERR_FAILED                  Should never return this&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_dataq_read_restart(&lt;br /&gt;
    dataq_t dataq_id,    // data queue ID&lt;br /&gt;
    void* *data           // pointer to return data&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| dataq_id || dataq_t with value of Data queue ID&lt;br /&gt;
|-&lt;br /&gt;
| ptr || void* pointer to store returned data queue pointer removed from the queue&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || DATAQ ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || DATAQ ID &amp;gt;= number of DATAQs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to acquire guard&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DQ_J_START_FROM_TIMOUT  || Job started from timeout already, DATAQ empty second time&lt;br /&gt;
|-&lt;br /&gt;
| ERR_FAILED                  || Should never return this&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
char *data_ptr;&lt;br /&gt;
...&lt;br /&gt;
// Read pointer from data queue s_2 with restart when data is available&lt;br /&gt;
status = oceos_dataq_read_restart(s_2, (void *)data_ptr);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_dataq_read_restart_timeout()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''dataq.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns a pointer from the specified data queue. If the queue is empty, the job is added top the dataq pending queue. The job will be restarted either when data is available or the timeout has expired. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Read data queue next item.&lt;br /&gt;
 * If dataq is empty, task is put on pending Q for dataq and&lt;br /&gt;
 * restarted by oceos_dataq_write or by timeout if timeout != 0&lt;br /&gt;
 * In order to use this feature timed actions must be configured and&lt;br /&gt;
 * dataq created with use timeout set to true&lt;br /&gt;
 *&lt;br /&gt;
 * @param dataq_id          Data queue ID&lt;br /&gt;
 * @param data              Pointer to return data&lt;br /&gt;
 * @param timeout           Timeout, restart time if no entry, 0 =&amp;gt; ignore&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_TA_NOT_INIT             Timed action intialisation is not done and tried to be used; or DATAQ created without timeouts&lt;br /&gt;
 *          ERR_ID_INVALID              DATAQ ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                DATAQ ID &amp;gt;= number of DATAQs&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to acquire guard&lt;br /&gt;
 *          ERR_DQ_EMPTY                DATAQ empty(count zero)&lt;br /&gt;
 *          ERR_DQ_J_START_FROM_TIMOUT  Job started from timeout already, DATAQ empty second time&lt;br /&gt;
 *          ERR_TOO_MANY                DATAQ pending queue is full&lt;br /&gt;
 *          ERR_FAILED                  Should never return this&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_dataq_read_restart_timeout(&lt;br /&gt;
    dataq_t dataq_id,   // data queue ID&lt;br /&gt;
    void* *data,         // Pointer to return data&lt;br /&gt;
    U64_t timeout       // timeout, restart time if no entry, 0 =&amp;gt; ignore&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| dataq_id || dataq_t with value of Data queue ID&lt;br /&gt;
|-&lt;br /&gt;
| ptr || void* pointer to store returned data queue pointer removed from the queue&lt;br /&gt;
|-&lt;br /&gt;
| timeout || U64_t containing timeout value, restart time if no entry, 0 =&amp;gt; ignore&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_NOT_INIT             || Timed action intialisation is not done and tried to be used; or DATAQ created without timeouts&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || DATAQ ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || DATAQ ID &amp;gt;= number of DATAQs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to acquire guard&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DQ_EMPTY                || DATAQ empty(count zero)&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DQ_J_START_FROM_TIMOUT  || Job started from timeout already, DATAQ empty second time&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TOO_MANY                || DATAQ pending queue is full&lt;br /&gt;
|-&lt;br /&gt;
| ERR_FAILED                  || Should never return this&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
char *data_ptr;&lt;br /&gt;
...&lt;br /&gt;
// Read pointer from data queue s_2 with timeout after 10,000 time units if no data is available&lt;br /&gt;
status = oceos_dataq_read_restart_timeout(s_2, (void *)data_ptr, 10000ull);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_dataq_get_size()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''dataq.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the number of items on the specified data queue.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Returns number of items on the data queue with ID&lt;br /&gt;
 *&lt;br /&gt;
 * @param dataq_id   DATAQ Id&lt;br /&gt;
 * @param d_size     Pointer to size holder&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              DATAQ ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                DATAQ ID &amp;gt;= number of DATAQs&lt;br /&gt;
 *          ERR_DQ_DATA_BAD             DATAQ size holder pointer is null&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_dataq_get_size(&lt;br /&gt;
    dataq_t dataq_id,   // data queue ID&lt;br /&gt;
    U32_t *d_size&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| dataq_id ||  dataq_t with the ID of the data queue (value between 0 and 62)&lt;br /&gt;
|-&lt;br /&gt;
| d_size || U32_t *d_size pointer to the variable to store the size&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || DATAQ ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || DATAQ ID &amp;gt;= number of DATAQs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DQ_DATA_BAD             || DATAQ size holder pointer is null&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, d_size;&lt;br /&gt;
...&lt;br /&gt;
// Get the number of entries on data queue d_0&lt;br /&gt;
status = oceos_dataq_get_size(d_0, &amp;amp;d_size);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_dataq_penq_get_size()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''dataq.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns number of jobs on the specified data queue pending job's queue.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Returns number of jobs on the dataq pending job's queue&lt;br /&gt;
 *&lt;br /&gt;
 * @param dataq_id  DATAQ Id&lt;br /&gt;
 * @param d_size    Pointer to pending queue size holder&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              DATAQ ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                DATAQ ID &amp;gt;= number of DATAQs&lt;br /&gt;
 *          ERR_DQ_DATA_BAD             DATAQ pending size holder pointer is null&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_dataq_penq_get_size(&lt;br /&gt;
    dataq_t dataq_id,&lt;br /&gt;
    U32_t *d_size&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| dataq_id ||  dataq_t with the ID of the data queue (value between 0 and 62)&lt;br /&gt;
|-&lt;br /&gt;
| d_jobs || U32_t *d_jobs pointer to the variable to store the number of jobs on the pending queue&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || DATAQ ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || DATAQ ID &amp;gt;= number of DATAQs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DQ_DATA_BAD             || DATAQ pending size holder pointer is null&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, d_jobs;&lt;br /&gt;
...&lt;br /&gt;
// Get the number of jobs the the pending jubs queue for data queue d_1&lt;br /&gt;
status = oceos_dataq_penq_get_size(d_1, &amp;amp;d_jobs);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_dataq_clear()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''dataq.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function clears the specified data queue including pending jobs for that queue.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Clears data queue and&lt;br /&gt;
 * frees tasks on pending queue&lt;br /&gt;
 *&lt;br /&gt;
 * @param dataq_t dataq_id Data queue ID&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              DATAQ ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                DATAQ ID &amp;gt;= number of DATAQs&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to acquire guard&lt;br /&gt;
 *          ERR_DQ_JOB_ID_WRONG         Job ID of the task on DATAQ pending queue is wrong&lt;br /&gt;
 *          ERR_TA_NOT_FOUND            Timed action index to be removed for job not found&lt;br /&gt;
 *          ERR_TA_START_FAILED         Timed action re-start failed after job remove from timed action queue&lt;br /&gt;
 */&lt;br /&gt;
S32_t  oceos_dataq_clear(&lt;br /&gt;
    dataq_t dataq_id    // data queue ID&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| dataq_id ||  dataq_t with the ID of the data queue to be cleared (value between 0 and 62)&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || DATAQ ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || DATAQ ID &amp;gt;= number of DATAQs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to acquire guard&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DQ_JOB_ID_WRONG         || Job ID of the task on DATAQ pending queue is wrong&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_NOT_FOUND            || Timed action index to be removed for job not found&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_START_FAILED         || Timed action re-start failed after job remove from timed action queue&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Clear data queue d_1&lt;br /&gt;
status = oceos_dataq_penq_get_size(d_1);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Timed Actions ==&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_timed_output_add()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''timed_action.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function adds a timed action to the timed action queue. It writes a value to an address at a specified system time. An optional mask can be applied so that only those bits are changed.&lt;br /&gt;
The action types are WRITE_ACTION, RMW_ACTION. WRITE_ACTION writes the value to the address. RMW_ACTION reads the values at the address and modifies the bits specified by the mask and value.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Add output action to timed actions queue :&lt;br /&gt;
 *  1. Create timed output action&lt;br /&gt;
 *  2. Stop timer&lt;br /&gt;
 *  3. Add action to action_array&lt;br /&gt;
 *  4. Start timer or execute if time is right&lt;br /&gt;
 *&lt;br /&gt;
 * Returns timed action ID that can be used later to remove&lt;br /&gt;
 * if need by oceos_timed_output_remove&lt;br /&gt;
 *&lt;br /&gt;
 * @param enum ACTION_TYPE action_type  Action type&lt;br /&gt;
 * @param U64_t act_time                System time at which action should be done&lt;br /&gt;
 * @param U32_t before_time             Forward tolerance for time&lt;br /&gt;
 * @param U32_t after_time              Backward tolerance for time&lt;br /&gt;
 * @param adrs_t address                Output address&lt;br /&gt;
 * @param U32_t value                   Output value&lt;br /&gt;
 * @param U32_t mask                    Output mask&lt;br /&gt;
 * @param U32_ *ta_index                Pointer to store timed action index&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_TA_NOT_INIT             Timed action inialisation is not done and tried to be used&lt;br /&gt;
 *          ERR_TA_PTR_BAD              Timed action pointer is null&lt;br /&gt;
 *          ERR_TA_TYPE_WRONG           Timed action type is wrong&lt;br /&gt;
 *          ERR_TOO_LATE                Timed action time is too late&lt;br /&gt;
 *          ERR_SYS_BUSY                Timed action guard failed to acquire&lt;br /&gt;
 *          ERR_TA_Q_FULL               Timed action queue is full&lt;br /&gt;
 *          ERR_TA_START_FAILED         Timed action execute failed; See log&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_timed_output_add(&lt;br /&gt;
    const enum ACTION_TYPE action_type,// Action type&lt;br /&gt;
    U64_t act_time,                    // system time at which action should be done&lt;br /&gt;
    U32_t before_time,                 // forward tolerance for time&lt;br /&gt;
    U32_t after_time,                  // backward tolerance for time&lt;br /&gt;
    const adrs_t address,              // output address&lt;br /&gt;
    const U32_t value,                 // output value&lt;br /&gt;
    const U32_t mask,                  // output mask&lt;br /&gt;
    U32_t *ta_index                    // Pointer to store timed action index&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| enum ACTION_TYPE action_type  || Action type&lt;br /&gt;
|-&lt;br /&gt;
| U64_t act_time                || System time at which action should be done&lt;br /&gt;
|-&lt;br /&gt;
| U32_t before_time             || Forward tolerance for time&lt;br /&gt;
|-&lt;br /&gt;
| U32_t after_time              || Backward tolerance for time&lt;br /&gt;
|-&lt;br /&gt;
| adrs_t address                || Output address&lt;br /&gt;
|-&lt;br /&gt;
| U32_t value                   || Output value&lt;br /&gt;
|-&lt;br /&gt;
| U32_t mask                    || Output mask&lt;br /&gt;
|-&lt;br /&gt;
| U32_ *ta_index                || Pointer to store timed action index&lt;br /&gt;
|-&lt;br /&gt;
| param || parameter to function&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_NOT_INIT             || Timed action inialisation is not done and tried to be used&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_PTR_BAD              || Timed action pointer is null&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_TYPE_WRONG           || Timed action type is wrong&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TOO_LATE                || Timed action time is too late&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Timed action guard failed to acquire&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_Q_FULL               || Timed action queue is full&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_START_FAILED         || Timed action execute failed; See log&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
#define OUTPUT_TIMED_VAL    0xDEADBEEF&lt;br /&gt;
#define OUTPUT_TIMED_MASK   0x1000001&lt;br /&gt;
#define OUTPUT_TIME         0xfffff&lt;br /&gt;
#define OUTPUT_TIME_FW      0x1000&lt;br /&gt;
#define OUTPUT_TIME_BW      0x1000&lt;br /&gt;
&lt;br /&gt;
static U32_t test_data[16] = { 0 };&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Write OUTPUT_TIMED_VAL to test_data[0] at 0xfffff time units from now with a tolerance of 0x1000 before and after the specified time   &lt;br /&gt;
status = oceos_timed_output_add(&lt;br /&gt;
                                       WRITE_ACTION,&lt;br /&gt;
                                       OUTPUT_TIME,&lt;br /&gt;
                                       OUTPUT_TIME_FW,&lt;br /&gt;
                                       OUTPUT_TIME_BW,&lt;br /&gt;
                                       (adrs_t) &amp;amp;test_data[0],&lt;br /&gt;
                                       OUTPUT_TIMED_VAL,&lt;br /&gt;
                                       0,&lt;br /&gt;
                                       &amp;amp;timed_action_index));&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_timed_jobs_number()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''timed_action.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the number of jobs on the timed actions queue.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Get number of Jobs (request to start the task) waiting on timed action queue.&lt;br /&gt;
 * These jobs are added by oceos_task_timed_start() or&lt;br /&gt;
 * oceos_dataq_read_restart_timeout when data is not available (NULL) or&lt;br /&gt;
 * oceos_sem_wait_restart_timeout when counting semaphore is 0&lt;br /&gt;
 *&lt;br /&gt;
 * @param total_jobs    Pointer to store total jobs number waiting on timed action Q&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_TA_NOT_INIT             Timed action inialisation is not done and tried to be used&lt;br /&gt;
 *          ERR_TA_PTR_BAD              Timed action pointer is null&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_timed_jobs_number(U32_t *total_jobs);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| total_jobs || s32_t pointer to store total jobs number waiting on timed action Q&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_NOT_INIT             || Timed action inialisation is not done and tried to be used&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_PTR_BAD              || Timed action pointer is null&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, no_of_jobs;&lt;br /&gt;
...&lt;br /&gt;
// Get the number of jobs on the timed actions queue&lt;br /&gt;
status = oceos_timed_jobs_number(&amp;amp;no_of_jobs);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_timed_jobs_remove()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''timed_action.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function removes the specified timed action from the queue.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Remove job from timed action queue&lt;br /&gt;
 * When task started using oceos_task_timed_start(),&lt;br /&gt;
 * this directive requires pointer to store ID&lt;br /&gt;
 * of job that put on the timed action queue.&lt;br /&gt;
 * This job can be removed later using this directive and stored job ID.&lt;br /&gt;
 *&lt;br /&gt;
 * @param U32_t job_id  Job ID&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_TA_NOT_INIT             Timed action intialisation is not done and tried to be used&lt;br /&gt;
 *          ERR_TA_PTR_BAD              Timed action pointer corrupt&lt;br /&gt;
 *          ERR_ID_WRONG                Job ID is wrong&lt;br /&gt;
 *          ERR_TA_NOT_FOUND            Timed action ID not found for action with job_id or removed already&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to acquire timed action guard&lt;br /&gt;
 *          WARN_TA_Q_EMPTY             Timed action queue is empty&lt;br /&gt;
 *          ERR_TA_START_FAILED         Timed action execute failed; See log&lt;br /&gt;
 */&lt;br /&gt;
S32_t   oceos_timed_jobs_remove(&lt;br /&gt;
    U32_t job_id                             // Job ID&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| job_id || U32_t Job ID to be removed from the timed actions queue&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_NOT_INIT             || Timed action intialisation is not done and tried to be used&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_PTR_BAD              || Timed action pointer corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || Job ID is wrong&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_NOT_FOUND            || Timed action ID not found for action with job_id or removed already&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to acquire timed action guard&lt;br /&gt;
|-&lt;br /&gt;
| WARN_TA_Q_EMPTY             || Timed action queue is empty&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_START_FAILED         || Timed action execute failed; See log&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, job_id;&lt;br /&gt;
...&lt;br /&gt;
// Remove job_id from the timed actions queue&lt;br /&gt;
status = oceos_timed_jobs_remove(job_id);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_timed_jobs_reset()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''timed_action.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function removes all jobs from timed actions queue.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Remove all jobs (requests to start a task) from timed actions queue&lt;br /&gt;
 * These jobs were added by oceos_task_timed_start() or&lt;br /&gt;
 * oceos_dataq_read_restart_timeout when data is not available (NULL) or&lt;br /&gt;
 * oceos_sem_wait_restart_timeout when counting semaphore is 0&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_TA_NOT_INIT             Timed action intialisation is not done and tried to be used&lt;br /&gt;
 *          ERR_TA_PTR_BAD              Timed action pointer is null&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to acquire timed action guard&lt;br /&gt;
 *          WARN_TA_Q_EMPTY             Timed action queue is empty&lt;br /&gt;
 *          ERR_TA_NOT_FOUND            Timed action index not found&lt;br /&gt;
 *          ERR_TA_START_FAILED         Timed action execute failed; See log&lt;br /&gt;
 */&lt;br /&gt;
S32_t   oceos_timed_jobs_reset(void);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
There are no input parameters to this function&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_NOT_INIT             || Timed action intialisation is not done and tried to be used&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_PTR_BAD              || Timed action pointer is null&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to acquire timed action guard&lt;br /&gt;
|-&lt;br /&gt;
| WARN_TA_Q_EMPTY             || Timed action queue is empty&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_NOT_FOUND            || Timed action index not found&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_START_FAILED         || Timed action execute failed; See log&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Remove all jobs from the timed actions queue&lt;br /&gt;
status = oceos_timed_jobs_reset(job_id);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_timed_output_remove()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''timed_action.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function removes the specified timed output action from timed actions queue.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Remove timed output action from timed actions queue.&lt;br /&gt;
 * When action is created, action index should be stored&lt;br /&gt;
 * to remove if need&lt;br /&gt;
 *&lt;br /&gt;
 * @param action_index&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_TA_NOT_INIT             Timed action intialisation is not done and tried to be used&lt;br /&gt;
 *          ERR_TA_PTR_BAD              Timed action pointer is null&lt;br /&gt;
 *          ERR_ID_WRONG                Timed action id is wrong&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to acquire timed action guard&lt;br /&gt;
 *          ERR_TA_NOT_FOUND            Timed action index not found&lt;br /&gt;
 *          ERR_TA_START_FAILED         Timed action execute failed&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_timed_output_remove(&lt;br /&gt;
    const U8_t  action_index    // Index in action array, returned when action was created&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| action_index|| S32_t specifying the timed output action index returned when the timed output was added.&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| Error bit  || Description&lt;br /&gt;
|&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_NOT_INIT             || Timed action intialisation is not done and tried to be used&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_PTR_BAD              || Timed action pointer is null&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || Timed action id is wrong&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to acquire timed action guard&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_NOT_FOUND            || Timed action index not found&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_START_FAILED         || Timed action execute failed&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
U8_t action_index;&lt;br /&gt;
...&lt;br /&gt;
// Remove timed output with specified action_index&lt;br /&gt;
status = oceos_timed_output_remove(action_index);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_timed_output_reset()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''timed_action.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function removes all timed output actions from timed actions queue.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Remove all timed output actions from timed actions queue&lt;br /&gt;
 * These timed output actions were created by oceos_timed_output_add&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_TA_NOT_INIT             Timed action intialisation is not done and tried to be used&lt;br /&gt;
 *          ERR_TA_PTR_BAD              Timed action pointer is null&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to acquire timed action guard&lt;br /&gt;
 *          WARN_TA_Q_EMPTY             Timed action queue is empty&lt;br /&gt;
 *          ERR_TA_NOT_FOUND            Timed action index not found&lt;br /&gt;
 *          ERR_TA_START_FAILED         Timed action execute failed; See log&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_timed_output_reset(void);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
There are no input parameters to this function. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| Error bit  || Description&lt;br /&gt;
|&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_NOT_INIT             || Timed action intialisation is not done and tried to be used&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_PTR_BAD              || Timed action pointer is null&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to acquire timed action guard&lt;br /&gt;
|-&lt;br /&gt;
| WARN_TA_Q_EMPTY             || Timed action queue is empty&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_NOT_FOUND            || Timed action index not found&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_START_FAILED         || Timed action execute failed; See log&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Remove all timed outputs from the timed actions queue&lt;br /&gt;
status = oceos_timed_output_reset();&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Logging directives ==&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;Introduction&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Log Area Features  (for details of other areas see oceos_areas.h)&lt;br /&gt;
&lt;br /&gt;
The system log area holds the system log and the records of the present and previous values of the system state variable.&lt;br /&gt;
&lt;br /&gt;
It is set up initially as an array of 32-bit words that starts at a 32-bit aligned address provided by the application developer.&lt;br /&gt;
&lt;br /&gt;
It is recommended that this address be in non-volatile RAM memory if this is available to allow information be preserved across power-up cycles.&lt;br /&gt;
&lt;br /&gt;
OCEOS preserves log area information across resets as far as possible.&lt;br /&gt;
&lt;br /&gt;
The system log itself is a circular buffer of struct log entry. Older entries are overwritten by new entries once all entries are in use.&lt;br /&gt;
&lt;br /&gt;
The application developer can specify a function to be called when 3/4 of log entries are in use. This function is called again only after 3/4 of log entries have been read and the log has again become 3/4 full.&lt;br /&gt;
&lt;br /&gt;
The read and write indices are stored in the log area and if equal indicate that the log is empty.&lt;br /&gt;
&lt;br /&gt;
As with other OCEOS data areas, the log area starts with a header&lt;br /&gt;
*a 32-bit word holding a constant OCEOS_VERSION&lt;br /&gt;
*a 32-bit word holding the log area size in 32-bit words&lt;br /&gt;
*a 32-bit word, the system status variable&lt;br /&gt;
*a 32-bit word, the system status mask&lt;br /&gt;
*a 32-bit word, the accumulated system status&lt;br /&gt;
*a 32-bit word, the previous system status mask&lt;br /&gt;
*a 32-bit word, the log control, that gives whether the log full function was called&lt;br /&gt;
*the read index&lt;br /&gt;
*the write index&lt;br /&gt;
*an array of struct log_entry making up the system log itself&lt;br /&gt;
*ending with a 32-bit constant END_SENTINEL&lt;br /&gt;
&lt;br /&gt;
The system fixed meta structure at sysMetaPtr provides&lt;br /&gt;
&lt;br /&gt;
*system_log_ptr      the start address of the log area&lt;br /&gt;
*logEntries          the number of log entries&lt;br /&gt;
*logCreated          flag indicating log was created successfully&lt;br /&gt;
*logFullFunction     user defined function, called when the log becomes 3/4 full (or NULL if not used)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Log Entry Types and Structure'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/*****************************************************************************&lt;br /&gt;
 * LOG ENTRY TYPES&lt;br /&gt;
 *&lt;br /&gt;
 * A log entry type is an 8-bit number.&lt;br /&gt;
 * Values from 0 to 127 can be defined by the application.&lt;br /&gt;
 * Values from 128 to 255 are used by OCEOS as below.&lt;br /&gt;
 *&lt;br /&gt;
 *&lt;br /&gt;
 * NOTE: Add new log types at the end for backward compatibility&lt;br /&gt;
 */&lt;br /&gt;
enum LOG_ENTRY_TYPE{&lt;br /&gt;
  LOG_SYS_OK = 0x80U,&lt;br /&gt;
  LOG_OCEOS_ABORT,				// when exiting from oceos_start&lt;br /&gt;
  LOG_LOG_NOT_VALID_ENTRY,		// used to initialise log and when log empty&lt;br /&gt;
  LOG_INIT_TASK_START_FAIL,		// initial task passed to oceos_start failed&lt;br /&gt;
  LOG_DEADLINE_MISSED,			// task deadline missed&lt;br /&gt;
  LOG_JOB_NOT_ACTIVE,			// cpu_terminate but job not active, absurd&lt;br /&gt;
  LOG_JOB_NOT_FREE,				// job guarded but not free&lt;br /&gt;
  LOG_JOBS_INC_FAILED, 			// pending jobs increment failed&lt;br /&gt;
  LOG_JOB_NOT_GUARDED,			// paranoia&lt;br /&gt;
  LOG_CS_LOG_SPIN_FAIL,			// oceos_CPU_sleep, trying to update CS log&lt;br /&gt;
  LOG_MUTEX_ALREADY_HELD,		// oceos_mutex_wait, code returned, not needed&lt;br /&gt;
  LOG_MUTEX_INCORRECT_ORDER,	// oceos_mutex_wait&lt;br /&gt;
  LOG_MUTEX_EXIT_HOLDING,		// task exits holding one or more mutexes&lt;br /&gt;
  LOG_MUTEX_EXIT_NONE,			// __oceos_tasks_remove_mutexes called but no mutex held&lt;br /&gt;
  LOG_SEMAPHORE_PENDING_REMOVE_FAIL,	// timed_action.c&lt;br /&gt;
  LOG_SEMAPHORE_PENDING_QUEUE_FULL,		// __oceos_semaphore_add_pend&lt;br /&gt;
  LOG_SEMAPHORE_SPIN_FAILED,			// trying to access semaphore&lt;br /&gt;
  LOG_DATAQ_PENDING_QUEUE_FULL,&lt;br /&gt;
  LOG_DATAQ_PENDING_REMOVE_FAIL,&lt;br /&gt;
  LOG_DATAQ_SPIN_FAILED,&lt;br /&gt;
  LOG_TIMED_ACTION_TIMER_NULL,&lt;br /&gt;
  LOG_TIMED_ACTION_INVALID,&lt;br /&gt;
  LOG_TIMED_ACTION_BAD_INDEX,&lt;br /&gt;
  LOG_TIMED_ACTION_MISSED,&lt;br /&gt;
  LOG_TIMED_ACTION_Q_EMPTY,&lt;br /&gt;
  LOG_TIMED_ACTION_REMOVE_FAIL,&lt;br /&gt;
  LOG_TIMED_ACTION_BAD_JOB_ID,&lt;br /&gt;
  LOG_TIMED_Q_SPIN_FAIL,&lt;br /&gt;
  LOG_SYSTEM_ERROR,&lt;br /&gt;
  LOG_ATOMICINC_FAILED,&lt;br /&gt;
  LOG_PENDING_PRI_UPDATE_FAILED,&lt;br /&gt;
  LOG_KILL_TASK_INVALID_ID,      // Tried to kill task with invalid ID&lt;br /&gt;
  LOG_OCEOS_EXIT_REQUEST,         // oceos_exit command was called&lt;br /&gt;
  LOG_RWMUTEX_NOT_RETURNED,&lt;br /&gt;
  LOG_RWMUTEX_NOT_HIGHEST&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
/*****************************************************************************&lt;br /&gt;
 * Structures&lt;br /&gt;
 */&lt;br /&gt;
/**&lt;br /&gt;
 * Log entry structure&lt;br /&gt;
 */&lt;br /&gt;
struct log_entry{&lt;br /&gt;
  U64_t             time64;&lt;br /&gt;
&lt;br /&gt;
  unsigned int      entry_cpu          :8;&lt;br /&gt;
  unsigned int      entry_type         :8;&lt;br /&gt;
  unsigned int      entry_note         :16;	// not used at present&lt;br /&gt;
&lt;br /&gt;
  U32_t             entry_comment;&lt;br /&gt;
}__attribute__ ((aligned (8)));&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_log_add_entry()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''system_log.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function adds an entry to the log. The entry overwrites the oldest unread entry if the log is full.&lt;br /&gt;
Custom log entries can be added to enum LOG_ENTRY from 0 to 128.&lt;br /&gt;
The indices are incremented in a circular fashion. If the write index reaches the read_index the read index is moved on, as read and write indices equal would indicate an empty log.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Add an entry to the log.&lt;br /&gt;
 * this overwrites the oldest unread entry if the log is full.&lt;br /&gt;
 * Custom log entries can be added to enum LOG_ENTRY from 0 to 128&lt;br /&gt;
 *&lt;br /&gt;
 * N.B. The indices are incremented in a circular fashion.&lt;br /&gt;
 *      If the write index reaches the read_index the read index is moved on,&lt;br /&gt;
 *      as read and write indices equal would indicate an empty log.&lt;br /&gt;
 *&lt;br /&gt;
 * @param type  enum LOG_ENTRY_TYPE&lt;br /&gt;
 * @param info  extra information to be logged&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_LOG_CORRUPT         System Log area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Log directive called in wrong phase; can be used after oceos_init() called&lt;br /&gt;
 *          ERR_ID_INVALID              Log type invalid&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to acquire log guard&lt;br /&gt;
 *          ERR_LOG_INDEX_WRONG         Read/write log index is wrong&lt;br /&gt;
 */&lt;br /&gt;
S32_t   oceos_log_add_entry(&lt;br /&gt;
    enum LOG_ENTRY_TYPE type,   // 8 bits enum LOG_ENTRY_TYPE&lt;br /&gt;
    const U32_t        info     // information&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| enum LOG_ENTRY_TYPE || Log entry type (see previous section for a list)&lt;br /&gt;
|-&lt;br /&gt;
| info | U32_t with the log information&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit  !! Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_LOG_CORRUPT         || System Log area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Log directive called in wrong phase; can be used after oceos_init() called&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || Log type invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to acquire log guard&lt;br /&gt;
|-&lt;br /&gt;
| ERR_LOG_INDEX_WRONG         || Read/write log index is wrong&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, info;&lt;br /&gt;
...&lt;br /&gt;
// Log LOG_APP_COMMS__ERROR (defined in enum LOG_ENTRY_TYPE) and info with more details&lt;br /&gt;
status = oceos_log_add_entry(LOG_APP_COMMS__ERROR, info);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_log_get_indexed_entry()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''system_log.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the entry at the specified position in the log. The entry is not removed and the log and log indices are not changed.&lt;br /&gt;
One use of this function is to allow the log be examined after a reset.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Returns the entry at the specified position in the log.&lt;br /&gt;
 * The entry is not removed and the log and log indices are not changed.&lt;br /&gt;
 * (intended to allow the log be examined for example after reset)&lt;br /&gt;
 *&lt;br /&gt;
 * @param index         position in the log&lt;br /&gt;
 * @param outputPtr     pointer to return log entry&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_LOG_CORRUPT         System Log area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Log directive called in wrong phase; can be used after oceos_init() called&lt;br /&gt;
 *          ERR_LOG_INDEX_WRONG         Read log index is wrong&lt;br /&gt;
 *          ERR_LOG_DATA_PTR_BAD        Data holder pointer is null&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_log_get_indexed_entry(&lt;br /&gt;
    const unsigned int index,&lt;br /&gt;
    struct log_entry * const outputPtr&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| index || U32_t with position in the log&lt;br /&gt;
|-&lt;br /&gt;
| outputPtr || pointer to struct log_entry to hold the returned entry&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit  !! Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_LOG_CORRUPT         || System Log area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Log directive called in wrong phase; can be used after oceos_init() called&lt;br /&gt;
|-&lt;br /&gt;
| ERR_LOG_INDEX_WRONG         || Read log index is wrong&lt;br /&gt;
|-&lt;br /&gt;
| ERR_LOG_DATA_PTR_BAD        || Data holder pointer is null&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, index;&lt;br /&gt;
struct log_entry store_entry;&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
// Read log_entry at specified index into outputPtr&lt;br /&gt;
status = oceos_log_get_indexed_entry(index, &amp;amp;store_entry);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_log_remove_entry()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''system_log.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function reads and removes the oldest unread log entry. &lt;br /&gt;
If the log is not empty use the entry at the read index to update the value at the output pointer, returning OCEOS_SUCCESS.&lt;br /&gt;
If outputPtr is NULL, entry is removed but no returned.&lt;br /&gt;
If the log is empty, set the value at the output pointer to LOG_LOG_NOT_VALID_ENTRY and return ERR_LOG_EMPTY.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Read and remove the oldest unread log entry&lt;br /&gt;
 *&lt;br /&gt;
 * If the log is not empty use the entry at the read index to update the value&lt;br /&gt;
 * at the output pointer, returning OCEOS_SUCCESS.&lt;br /&gt;
 *&lt;br /&gt;
 * If outputPtr is NULL, entry is removed but no returned&lt;br /&gt;
 *&lt;br /&gt;
 * If the log is empty, set the value at the output pointer to LOG_LOG_NOT_VALID_ENTRY&lt;br /&gt;
 * and return ERR_LOG_EMPTY&lt;br /&gt;
 *&lt;br /&gt;
 * @param outputPtr   pointer to struct log_entry&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_LOG_CORRUPT         System Log area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Log directive called in wrong phase; can be used after oceos_init() called&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to acquire log guard&lt;br /&gt;
 *          ERR_LOG_INDEX_WRONG         Read/write log index is wrong&lt;br /&gt;
 *          ERR_LOG_EMPTY               Log is empty&lt;br /&gt;
 */&lt;br /&gt;
S32_t   oceos_log_remove_entry(&lt;br /&gt;
    struct log_entry * const outputPtr&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| outputPtr || pointer to struct log_entry&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit  !! Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_LOG_CORRUPT         || System Log area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Log directive called in wrong phase; can be used after oceos_init() called&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to acquire log guard&lt;br /&gt;
|-&lt;br /&gt;
| ERR_LOG_INDEX_WRONG         || Read/write log index is wrong&lt;br /&gt;
|-&lt;br /&gt;
| ERR_LOG_EMPTY               || Log is empty&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
struct log_entry *outputPtr;&lt;br /&gt;
...&lt;br /&gt;
// Read log_entry into outputPtr and remove the oldest unread log entry&lt;br /&gt;
status = oceos_log_remove_entry(outputPtr);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_log_reset()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''system_log.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function sets all log entries to LOG_LOG_NOT_VALID_ENTRY and the log to empty, with the read and write indices set to 0.&lt;br /&gt;
The log is empty if the index of the next write is the same as the index of the next read. It does not affect the system status variable. It does not affect the context switch log.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * oceos_log_reset()&lt;br /&gt;
 *&lt;br /&gt;
 * Set all log entries to LOG_LOG_NOT_VALID_ENTRY and the log to empty, with the&lt;br /&gt;
 * read and write indices set to 0. and function called flag 0&lt;br /&gt;
 *&lt;br /&gt;
 * The log is empty if the index of the next write&lt;br /&gt;
 * is the same as the index of the next read.&lt;br /&gt;
 *&lt;br /&gt;
 * Does not affect the system status variable&lt;br /&gt;
 * Does not affect the context switch log&lt;br /&gt;
 *&lt;br /&gt;
 * N.B The fixed data area may no longer be writable&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_LOG_CORRUPT         System Log area corrupt; reset failed&lt;br /&gt;
 *          ERR_WRONG_PHASE             Log directive called in wrong phase; can be used after oceos_init() called&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to acquire log guard&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_log_reset(void);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
There are no input parameters to this function.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit  !! Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_LOG_CORRUPT         || System Log area corrupt; reset failed&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Log directive called in wrong phase; can be used after oceos_init() called&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to acquire log guard&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
// Clear down the system log&lt;br /&gt;
status = oceos_log_reset();&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_log_get_size()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''system_log.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the number of entries in the log according to the current values of the read and write indices.&lt;br /&gt;
The value will be zero if the current values of the read and write indices are the same. There may still be useful information in the log, e.g. after system reset, this can be accessed using oceos_log_get_indexed_entry().&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Return the number of entries in the log&lt;br /&gt;
 * according to the current values of the read and write indices.&lt;br /&gt;
 *&lt;br /&gt;
 * The value will be zero if the current values of the read and write indices&lt;br /&gt;
 * are the same.&lt;br /&gt;
 *&lt;br /&gt;
 * There may still be useful information in the log, e.g. after system reset,&lt;br /&gt;
 * this can be accessed using oceos_log_get_indexed_entry()&lt;br /&gt;
 *&lt;br /&gt;
 * @param l_size        pointer to log size holder&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_LOG_CORRUPT         System Log area corrupt;&lt;br /&gt;
 *          ERR_WRONG_PHASE             Log directive called in wrong phase; can be used after oceos_init() called&lt;br /&gt;
 *          ERR_LOG_DATA_PTR_BAD        Pointer to log size holder is NULL&lt;br /&gt;
 *          ERR_LOG_INDEX_WRONG         Read/write log index is wrong&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_log_get_size(&lt;br /&gt;
    U32_t *l_size&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| l_size|| U32_t pointer where size will be written.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit  !! Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_LOG_CORRUPT         || System Log area corrupt;&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Log directive called in wrong phase; can be used after oceos_init() called&lt;br /&gt;
|-&lt;br /&gt;
| ERR_LOG_DATA_PTR_BAD        || Pointer to log size holder is NULL&lt;br /&gt;
|-&lt;br /&gt;
| ERR_LOG_INDEX_WRONG         || Read/write log index is wrong&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, size;&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
// Clear down the system log&lt;br /&gt;
status = oceos_log_get_size(&amp;amp;size);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;System State Variable and System State Mask&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The System State variable provides a record of anomalies or problems detected by OCEOSmp's automatic consistency checks. An application handler for these can be set to be called automatically.&lt;br /&gt;
&lt;br /&gt;
An anomaly or problem results in a flag bit being set in the 32-bit word used to store the system state variable. The flags are identified below.&lt;br /&gt;
&lt;br /&gt;
All flags are reset to zero by oceos_init() when OCEOSmp is initialised, and may also be reset by the application using the directive provided.&lt;br /&gt;
&lt;br /&gt;
To provide a record across OCEOSmp restarts a copy is updated automatically whenever the state variable is updated. This is not cleared by oceos_init() but may be cleared by the application using a directive.&lt;br /&gt;
&lt;br /&gt;
Application software can define a problem handling function to be called automatically when specified system state flags are set. The flags are specified by setting the corresponding bits in the system state mask. The function and the state mask are defined in the system configuration.&lt;br /&gt;
&lt;br /&gt;
Changing a state flag from clear to set results in the function being called (if defined). Subsequent settings of that flag have no effect until after it has been cleared using the directive provided.&lt;br /&gt;
&lt;br /&gt;
N.B. In many cases when OCEOSmp sets a System State flag it also makes an entry in the system log that provides further information.&lt;br /&gt;
&lt;br /&gt;
SYSTEM STATE VARIABLE FLAGS&lt;br /&gt;
&lt;br /&gt;
These flags are updated by OCEOSmp using inclusive 'OR' when a consistency check detects a problem or anomaly. A copy of the system state variable is updated also and accumulates a record of flag settings that is preserved across restarts of OCEOSmp. OCEOSmp restarts reset the system state variable but not the copy.&lt;br /&gt;
&lt;br /&gt;
Resetting the state variables is the responsibility of the application (except for the state variable reset done when OCEOSmp is restarted).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''System Status Bits'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
#define  STATUS_NORMAL                    0u    // No flag set                              YES&lt;br /&gt;
#define  STATUS_INVALID          0xffffffffu    // System status is invalid                 YES BUT NO DETAIL!!!&lt;br /&gt;
&lt;br /&gt;
#define  STATUS_MASK_NORMAL      0xffffffffu    // Always call user def fn                  YES&lt;br /&gt;
&lt;br /&gt;
/* Task related problems */&lt;br /&gt;
#define  STATUS_DISABLED_TASK_START    0x1U    // An attempt to start a disabled task&lt;br /&gt;
#define  STATUS_TASK_JOB_LIMIT_OVER    0x2U    // An attempt to execute a task when its jobs limit is already reached.&lt;br /&gt;
#define  STATUS_JOB_OVER_TIME          0x4U    // Job time from creation to completion exceeds allowed maximum for task. YES&lt;br /&gt;
#define  STATUS_JOB_INTERVAL_SHORT     0x8U    // Minimum time between job creations is less than the allowed minimum for task&lt;br /&gt;
#define  STATUS_READYQ_FULL           0x10U    // Ready queue unable to accept job as result of being full&lt;br /&gt;
#define  STATUS_READYQ_NO_REMOVE      0x20U    // Remove job from ready queue failed&lt;br /&gt;
&lt;br /&gt;
/* Mutex related problems */&lt;br /&gt;
#define  STATUS_MUTEX_ALREADY_HELD    0x40U    // Mutex wait() when mutex already held&lt;br /&gt;
#define  STATUS_MUTEX_NOT_HELD        0x80U    // Mutex signal() when not already held&lt;br /&gt;
#define  STATUS_MUTEX_NOT_RETURNED   0x100U    // Mutex not returned before job terminates&lt;br /&gt;
#define  STATUS_MUTEX_NOT_NESTED     0x200U    // Use of multiple mutexes not nested&lt;br /&gt;
&lt;br /&gt;
/* Counting semaphore and data queue related problems */&lt;br /&gt;
#define  STATUS_SEMAPHORE_JOBS_FULL  0x400U    // Attempt to add job to semaphore pending list when list full&lt;br /&gt;
#define  STATUS_DATAQ_JOBS_FULL      0x800U    // Attempt to add job to data queue pending list when list full&lt;br /&gt;
#define  STATUS_DATAQ_FULL          0x1000U    // Data queue write when queue already full&lt;br /&gt;
&lt;br /&gt;
/* Timed actions related problems */&lt;br /&gt;
#define  STATUS_TIMED_JOBS_FULL     0x2000U    // Timed actions queue already full for timed task start&lt;br /&gt;
#define  STATUS_TIMED_OUTPUT_FULL   0x4000U    // Timed actions queue already full for timed output&lt;br /&gt;
#define  STATUS_TIMED_ACTION_LATE   0x8000U    // Timed action late                          YES&lt;br /&gt;
&lt;br /&gt;
/* Default trap handler should have been replaced&lt;br /&gt;
 * NOT USED AT THE MOMENT*/&lt;br /&gt;
#define  STATUS_SYSTEM_ERROR       0x10000U    // ERROR was handled by default trap handler  YES&lt;br /&gt;
&lt;br /&gt;
/* Flag to indicate problem with Stack Pointer&lt;br /&gt;
 * NOT USED AT THE MOMENT*/&lt;br /&gt;
#define  STATUS_SP_WARNING         0x20000U    // SP not in expected range&lt;br /&gt;
/* Log system error */&lt;br /&gt;
#define  STATUS_BAD_LOG            0x40000U    // System log problem&lt;br /&gt;
#define  STATUS_SPIN_FAILED        0x80000U    // Get SPIN lock failed&lt;br /&gt;
/* Not using next few bits */&lt;br /&gt;
&lt;br /&gt;
/* Will have to exit */&lt;br /&gt;
#define  STATUS_BAD_SENTINEL     0x40000000U    // Area sentinel corrupt&lt;br /&gt;
#define  STATUS_BAD_META_PTR     0x80000000U    // Null meta pointer&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_system_state_get()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''system_log.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns of the system state variable.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Returns the value of the system state variable&lt;br /&gt;
 *&lt;br /&gt;
 * @param state  pointer to state holder&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_LOG_DATA_PTR_BAD        Data holder pointer is null&lt;br /&gt;
 *          ERR_SYS_LOG_CORRUPT         LOG dynamic pointer is null&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_system_state_get(&lt;br /&gt;
    U32_t *state // pointer to state holder&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| state || U32_t pointer to state holder&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit  !! Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_LOG_DATA_PTR_BAD        || Data holder pointer is null&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_LOG_CORRUPT         || LOG dynamic pointer is null&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, state;&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
// Get the system state&lt;br /&gt;
status = oceos_system_state_get(&amp;amp;state);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_system_state_set()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''system_log.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function sets system state variable.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Sets system state variable&lt;br /&gt;
 *&lt;br /&gt;
 * @param new_state&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_LOG_CORRUPT         LOG dynamic pointer is null&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_system_state_set(&lt;br /&gt;
    U32_t new_state   // new value of system state variable&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| new_state || U32_t containing new system state&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit  !! Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_LOG_CORRUPT         || LOG dynamic pointer is null&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, new_state;&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
// Set new system state&lt;br /&gt;
status = oceos_system_state_set(new_state);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_system_state_copy_get()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''system_log.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the value of the system state copy variable.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Returns the value of the copy of system state variable&lt;br /&gt;
 *&lt;br /&gt;
 * @param state  pointer to state holder&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_LOG_DATA_PTR_BAD        Data holder pointer is null&lt;br /&gt;
 *          ERR_SYS_LOG_CORRUPT         LOG dynamic pointer is null&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_system_state_copy_get(&lt;br /&gt;
    U32_t *state // pointer to state copy holder&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| state || U32_t pointer to state copy holder&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit  !! Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_LOG_DATA_PTR_BAD        || Data holder pointer is null&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_LOG_CORRUPT         || LOG dynamic pointer is null&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, copy_state;&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
// Get the system state copy&lt;br /&gt;
status = oceos_system_state_copy_get(&amp;amp;copy_state);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_system_state_copy_set()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''system_log.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function loads a value to tha system state copy variable.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Sets system state copy variable&lt;br /&gt;
 *&lt;br /&gt;
 * @param new_state&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_LOG_CORRUPT         LOG dynamic pointer is null&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_system_state_copy_set(&lt;br /&gt;
    U32_t new_state   // new value of system state variable&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| new_state || U32_t containing new system state copy&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit  !! Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_LOG_CORRUPT         || LOG dynamic pointer is null&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, new_state;&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
// Set new system state copy&lt;br /&gt;
status = oceos_system_state_copy_set(new_state);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Timing directives ==&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;Introduction&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''SPARC'''&lt;br /&gt;
&lt;br /&gt;
In OCEOS system time is based on two chained 32-bit timers.&lt;br /&gt;
&lt;br /&gt;
No interrupts are involved, the current system time is obtained by reading the two timer counter registers (in an atomic way) and then inverting the&lt;br /&gt;
values since the timers count down.&lt;br /&gt;
&lt;br /&gt;
The scaler associated with the timers is configured based on the system clock frequency to decrement the low order timer every microsecond. This&lt;br /&gt;
decrements the high order timer when it rolls over, every 71.6 minutes approximately. The 64-bit time range is very long, over 584,000 years.&lt;br /&gt;
&lt;br /&gt;
'''ARM Cortex-M'''&lt;br /&gt;
&lt;br /&gt;
In OCEOS for ARM Cortex-M, system time is based on SysTick. The processor has a 24-bit system timer, SysTick, that counts down from the reload value to zero, reloads (wraps to) the value in the LOAD register on the next clock edge, then counts down on subsequent clocks.&lt;br /&gt;
&lt;br /&gt;
Note: When the processor is halted for debugging the counter does not decrement.&lt;br /&gt;
&lt;br /&gt;
OCEOS initializes the timer to be driven from MCK and counting down to zero asserts SysTick exception request.&lt;br /&gt;
OCEOS has 64 bit counter which is increased by 0xFFFFFF value every time timer reloads.&lt;br /&gt;
&lt;br /&gt;
'''RISC-V'''&lt;br /&gt;
&lt;br /&gt;
In OCEOS for RISC-V systems time is based internally on clock cycles.&lt;br /&gt;
The RISC-V processor typically has a 64 bit counter (typically mtime) that  updates automatically on each clock cycle. Each hart typically has its own comparison register (typically mtimecmp) that can be used to interrupt that hart when a certain cycle count has been exceeded.&lt;br /&gt;
If a particular RISC-V implementation provides a more restricted clock cycle count this will be used with appropriate modifications as clock cycles give the best timing precision available.&lt;br /&gt;
&lt;br /&gt;
Note: The application configuration provides the constant needed to allow microseconds (as used in OCEOS directives) be converted to clock cycles. Time is reported by OCEOSmp as the number of microseconds since OCEOS was initialized.&lt;br /&gt;
&lt;br /&gt;
A potential difficulty arises if the main system clock rate can change for power saving or other reasons, each system is probably different with regard to this. OCEOSmp can handle this, if needed.&lt;br /&gt;
&lt;br /&gt;
The units of OCEOS system time are microseconds on SPARC and ARM and on RISC-V the period of the clock cycle.&lt;br /&gt;
&lt;br /&gt;
The system time is reset to 0 by oceos_init()&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_time_sys_get64()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''oceos_timer.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the current system time as a 64-bit number.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
**&lt;br /&gt;
 * Get the current system time (64-bit)&lt;br /&gt;
 *&lt;br /&gt;
 * @return U64_t&lt;br /&gt;
 */&lt;br /&gt;
U64_t oceos_time_sys_get64(void);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There are no parameters to this function.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S64_t with the current system time.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S64_t now;&lt;br /&gt;
...&lt;br /&gt;
// Get the time&lt;br /&gt;
now = oceos_time_sys_get64();&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_time_sys_get32()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''oceos_timer.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the low 32 bits of the system time.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Get the current system time (low 32 bits of 64 bit value)&lt;br /&gt;
 *&lt;br /&gt;
 * @return U32_t&lt;br /&gt;
 */&lt;br /&gt;
U32_t oceos_time_sys_get32(void);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
There are no parameters to this function.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with the current system time.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t now;&lt;br /&gt;
...&lt;br /&gt;
// Get the time&lt;br /&gt;
now = oceos_time_sys_get32();&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:backup]]&lt;/div&gt;</summary>
		<author><name>Bkavanagh</name></author>
	</entry>
	<entry>
		<id>https://wiki.ocetechnology.com/mediawiki/index.php?title=OCEOSmp/blank&amp;diff=1702</id>
		<title>OCEOSmp/blank</title>
		<link rel="alternate" type="text/html" href="https://wiki.ocetechnology.com/mediawiki/index.php?title=OCEOSmp/blank&amp;diff=1702"/>
		<updated>2024-05-03T16:56:12Z</updated>

		<summary type="html">&lt;p&gt;Bkavanagh: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Next Section ==&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;blank_function()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''header.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function does xyz...&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t oceosmp_blank(&lt;br /&gt;
    U32_t param&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| param || parameter to function&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit  !! Description&lt;br /&gt;
|-&lt;br /&gt;
| Error_name|| description&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, param;&lt;br /&gt;
...&lt;br /&gt;
// Do xyz&lt;br /&gt;
status = oceosmp_blank(param));&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:backup]]&lt;/div&gt;</summary>
		<author><name>Bkavanagh</name></author>
	</entry>
	<entry>
		<id>https://wiki.ocetechnology.com/mediawiki/index.php?title=OCEOSmp/blank&amp;diff=1701</id>
		<title>OCEOSmp/blank</title>
		<link rel="alternate" type="text/html" href="https://wiki.ocetechnology.com/mediawiki/index.php?title=OCEOSmp/blank&amp;diff=1701"/>
		<updated>2024-05-03T16:55:10Z</updated>

		<summary type="html">&lt;p&gt;Bkavanagh: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Next Section ==&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;Task directives&amp;lt;/span&amp;gt;==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''tasks.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The following data structures are used by some of the task directives.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_task_create()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;blank_function()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''header.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function does xyz...&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t oceosmp_blank(&lt;br /&gt;
    U32_t param&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| param || parameter to function&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit  !! Description&lt;br /&gt;
|-&lt;br /&gt;
| Error_name|| description&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, param;&lt;br /&gt;
...&lt;br /&gt;
// Do xyz&lt;br /&gt;
status = oceosmp_blank(param));&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:backup]]&lt;/div&gt;</summary>
		<author><name>Bkavanagh</name></author>
	</entry>
	<entry>
		<id>https://wiki.ocetechnology.com/mediawiki/index.php?title=OCEOSmp/blank&amp;diff=1700</id>
		<title>OCEOSmp/blank</title>
		<link rel="alternate" type="text/html" href="https://wiki.ocetechnology.com/mediawiki/index.php?title=OCEOSmp/blank&amp;diff=1700"/>
		<updated>2024-05-03T16:51:50Z</updated>

		<summary type="html">&lt;p&gt;Bkavanagh: /* Task directives */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Next Section ==&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;Task directives&amp;lt;/span&amp;gt;==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''tasks.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The following data structures are used by some of the task directives.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_task_create()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;blank_function()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''header.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function does xyz...&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t oceosmp_blank(&lt;br /&gt;
    U32_t param&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| param || parameter to function&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit  !! Description&lt;br /&gt;
|-&lt;br /&gt;
| Error_name|| description&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, param;&lt;br /&gt;
...&lt;br /&gt;
// Do xyz&lt;br /&gt;
status = oceosmp_blank(param));&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:backup]]&lt;/div&gt;</summary>
		<author><name>Bkavanagh</name></author>
	</entry>
	<entry>
		<id>https://wiki.ocetechnology.com/mediawiki/index.php?title=OCEOSmp/blank&amp;diff=1699</id>
		<title>OCEOSmp/blank</title>
		<link rel="alternate" type="text/html" href="https://wiki.ocetechnology.com/mediawiki/index.php?title=OCEOSmp/blank&amp;diff=1699"/>
		<updated>2024-05-03T16:48:35Z</updated>

		<summary type="html">&lt;p&gt;Bkavanagh: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Next Section ==&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;Task directives&amp;lt;/span&amp;gt;==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''tasks.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The following data structures are used by some of the task directives.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Data structures'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_task_create()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''tasks.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;blank_function()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''header.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function does xyz...&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t oceosmp_blank(&lt;br /&gt;
    U32_t param&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| param || parameter to function&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit  !! Description&lt;br /&gt;
|-&lt;br /&gt;
| Error_name|| description&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, param;&lt;br /&gt;
...&lt;br /&gt;
// Do xyz&lt;br /&gt;
status = oceosmp_blank(param));&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:backup]]&lt;/div&gt;</summary>
		<author><name>Bkavanagh</name></author>
	</entry>
	<entry>
		<id>https://wiki.ocetechnology.com/mediawiki/index.php?title=OCEOSmp/blank&amp;diff=1698</id>
		<title>OCEOSmp/blank</title>
		<link rel="alternate" type="text/html" href="https://wiki.ocetechnology.com/mediawiki/index.php?title=OCEOSmp/blank&amp;diff=1698"/>
		<updated>2024-05-03T16:47:14Z</updated>

		<summary type="html">&lt;p&gt;Bkavanagh: /* Next Section */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Next Section ==&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;Task directives&amp;lt;/span&amp;gt;==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''tasks.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The following data structures are used by some of the task directives.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Data structures'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_task_create()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''tasks.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;blank_function()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''header.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function does xyz...&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t oceosmp_blank(&lt;br /&gt;
    U32_t param&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| param || parameter to function&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit  !! Description&lt;br /&gt;
|-&lt;br /&gt;
| Error_name|| description&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, param;&lt;br /&gt;
...&lt;br /&gt;
// Do xyz&lt;br /&gt;
status = oceosmp_blank(param));&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:backup]]&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;Task directives&amp;lt;/span&amp;gt;==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''tasks.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The following data structures are used by some of the task directives.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Data structures'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_task_create()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''tasks.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Create a task.&lt;br /&gt;
Can only be use before OCEOS starts. Stores the task information in the OCEOS fixed data area.&lt;br /&gt;
This directive populates the data structures for a task. It should be called after [[OCEOSmp/directive_reference#oceos_init()|oceos_init()]] and before [[OCEOSmp/directive_reference#oceos_init_finish()|oceos_init_finish()]].&amp;lt;br&amp;gt;&lt;br /&gt;
It must be called for each task otherwise [[OCEOSmp/directive_reference#oceos_start()|oceos_start()]] will return an error.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;blank_function()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''header.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function does xyz...&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t oceosmp_blank(&lt;br /&gt;
    U32_t param&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| param || parameter to function&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit  !! Description&lt;br /&gt;
|-&lt;br /&gt;
| Error_name|| description&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, param;&lt;br /&gt;
...&lt;br /&gt;
// Do xyz&lt;br /&gt;
status = oceosmp_blank(param));&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:backup]]&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;Task directives&amp;lt;/span&amp;gt;==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Data structures'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_task_create()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''tasks.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Create a task.&lt;br /&gt;
Can only be use before OCEOS starts. Stores the task information in the OCEOS fixed data area.&lt;br /&gt;
This directive populates the data structures for a task. It should be called after [[OCEOSmp/directive_reference#oceos_init()|oceos_init()]] and before [[OCEOSmp/directive_reference#oceos_init_finish()|oceos_init_finish()]].&amp;lt;br&amp;gt;&lt;br /&gt;
It must be called for each task otherwise [[OCEOSmp/directive_reference#oceos_start()|oceos_start()]] will return an error.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;blank_function()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''header.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function does xyz...&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t oceosmp_blank(&lt;br /&gt;
    U32_t param&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| param || parameter to function&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit  !! Description&lt;br /&gt;
|-&lt;br /&gt;
| Error_name|| description&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, param;&lt;br /&gt;
...&lt;br /&gt;
// Do xyz&lt;br /&gt;
status = oceosmp_blank(param));&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:backup]]&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;Task directives&amp;lt;/span&amp;gt;==&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;Task data structures&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_task_create()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''tasks.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Create a task.&lt;br /&gt;
Can only be use before OCEOS starts. Stores the task information in the OCEOS fixed data area.&lt;br /&gt;
This directive populates the data structures for a task. It should be called after [[OCEOSmp/directive_reference#oceos_init()|oceos_init()]] and before [[OCEOSmp/directive_reference#oceos_init_finish()|oceos_init_finish()]].&amp;lt;br&amp;gt;&lt;br /&gt;
It must be called for each task otherwise [[OCEOSmp/directive_reference#oceos_start()|oceos_start()]] will return an error.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;blank_function()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''header.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function does xyz...&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t oceosmp_blank(&lt;br /&gt;
    U32_t param&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| param || parameter to function&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit  !! Description&lt;br /&gt;
|-&lt;br /&gt;
| Error_name|| description&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, param;&lt;br /&gt;
...&lt;br /&gt;
// Do xyz&lt;br /&gt;
status = oceosmp_blank(param));&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:backup]]&lt;/div&gt;</summary>
		<author><name>Bkavanagh</name></author>
	</entry>
	<entry>
		<id>https://wiki.ocetechnology.com/mediawiki/index.php?title=OCEOSmp/blank&amp;diff=1697</id>
		<title>OCEOSmp/blank</title>
		<link rel="alternate" type="text/html" href="https://wiki.ocetechnology.com/mediawiki/index.php?title=OCEOSmp/blank&amp;diff=1697"/>
		<updated>2024-05-03T16:44:39Z</updated>

		<summary type="html">&lt;p&gt;Bkavanagh: /* Next Section */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Next Section ==&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;Task directives&amp;lt;/span&amp;gt;==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''tasks.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The following data structures are used by some of the task directives.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Data structures'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_task_create()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''tasks.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Create a task.&lt;br /&gt;
Can only be use before OCEOS starts. Stores the task information in the OCEOS fixed data area.&lt;br /&gt;
This directive populates the data structures for a task. It should be called after [[OCEOSmp/directive_reference#oceos_init()|oceos_init()]] and before [[OCEOSmp/directive_reference#oceos_init_finish()|oceos_init_finish()]].&amp;lt;br&amp;gt;&lt;br /&gt;
It must be called for each task otherwise [[OCEOSmp/directive_reference#oceos_start()|oceos_start()]] will return an error.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;blank_function()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''header.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function does xyz...&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t oceosmp_blank(&lt;br /&gt;
    U32_t param&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| param || parameter to function&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit  !! Description&lt;br /&gt;
|-&lt;br /&gt;
| Error_name|| description&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, param;&lt;br /&gt;
...&lt;br /&gt;
// Do xyz&lt;br /&gt;
status = oceosmp_blank(param));&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:backup]]&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;Task directives&amp;lt;/span&amp;gt;==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Data structures'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_task_create()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''tasks.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Create a task.&lt;br /&gt;
Can only be use before OCEOS starts. Stores the task information in the OCEOS fixed data area.&lt;br /&gt;
This directive populates the data structures for a task. It should be called after [[OCEOSmp/directive_reference#oceos_init()|oceos_init()]] and before [[OCEOSmp/directive_reference#oceos_init_finish()|oceos_init_finish()]].&amp;lt;br&amp;gt;&lt;br /&gt;
It must be called for each task otherwise [[OCEOSmp/directive_reference#oceos_start()|oceos_start()]] will return an error.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;blank_function()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''header.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function does xyz...&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t oceosmp_blank(&lt;br /&gt;
    U32_t param&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| param || parameter to function&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit  !! Description&lt;br /&gt;
|-&lt;br /&gt;
| Error_name|| description&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, param;&lt;br /&gt;
...&lt;br /&gt;
// Do xyz&lt;br /&gt;
status = oceosmp_blank(param));&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:backup]]&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;Task directives&amp;lt;/span&amp;gt;==&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;Task data structures&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_task_create()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''tasks.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Create a task.&lt;br /&gt;
Can only be use before OCEOS starts. Stores the task information in the OCEOS fixed data area.&lt;br /&gt;
This directive populates the data structures for a task. It should be called after [[OCEOSmp/directive_reference#oceos_init()|oceos_init()]] and before [[OCEOSmp/directive_reference#oceos_init_finish()|oceos_init_finish()]].&amp;lt;br&amp;gt;&lt;br /&gt;
It must be called for each task otherwise [[OCEOSmp/directive_reference#oceos_start()|oceos_start()]] will return an error.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;blank_function()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''header.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function does xyz...&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t oceosmp_blank(&lt;br /&gt;
    U32_t param&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| param || parameter to function&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit  !! Description&lt;br /&gt;
|-&lt;br /&gt;
| Error_name|| description&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, param;&lt;br /&gt;
...&lt;br /&gt;
// Do xyz&lt;br /&gt;
status = oceosmp_blank(param));&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:backup]]&lt;/div&gt;</summary>
		<author><name>Bkavanagh</name></author>
	</entry>
	<entry>
		<id>https://wiki.ocetechnology.com/mediawiki/index.php?title=OCEOSmp/blank&amp;diff=1696</id>
		<title>OCEOSmp/blank</title>
		<link rel="alternate" type="text/html" href="https://wiki.ocetechnology.com/mediawiki/index.php?title=OCEOSmp/blank&amp;diff=1696"/>
		<updated>2024-05-03T16:43:31Z</updated>

		<summary type="html">&lt;p&gt;Bkavanagh: /* Next Section */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Next Section ==&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;Task directives&amp;lt;/span&amp;gt;==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Data structures'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_task_create()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''tasks.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Create a task.&lt;br /&gt;
Can only be use before OCEOS starts. Stores the task information in the OCEOS fixed data area.&lt;br /&gt;
This directive populates the data structures for a task. It should be called after [[OCEOSmp/directive_reference#oceos_init()|oceos_init()]] and before [[OCEOSmp/directive_reference#oceos_init_finish()|oceos_init_finish()]].&amp;lt;br&amp;gt;&lt;br /&gt;
It must be called for each task otherwise [[OCEOSmp/directive_reference#oceos_start()|oceos_start()]] will return an error.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;blank_function()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''header.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function does xyz...&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t oceosmp_blank(&lt;br /&gt;
    U32_t param&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| param || parameter to function&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit  !! Description&lt;br /&gt;
|-&lt;br /&gt;
| Error_name|| description&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, param;&lt;br /&gt;
...&lt;br /&gt;
// Do xyz&lt;br /&gt;
status = oceosmp_blank(param));&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:backup]]&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;Task directives&amp;lt;/span&amp;gt;==&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;Task data structures&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_task_create()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''tasks.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Create a task.&lt;br /&gt;
Can only be use before OCEOS starts. Stores the task information in the OCEOS fixed data area.&lt;br /&gt;
This directive populates the data structures for a task. It should be called after [[OCEOSmp/directive_reference#oceos_init()|oceos_init()]] and before [[OCEOSmp/directive_reference#oceos_init_finish()|oceos_init_finish()]].&amp;lt;br&amp;gt;&lt;br /&gt;
It must be called for each task otherwise [[OCEOSmp/directive_reference#oceos_start()|oceos_start()]] will return an error.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;blank_function()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''header.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function does xyz...&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t oceosmp_blank(&lt;br /&gt;
    U32_t param&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| param || parameter to function&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit  !! Description&lt;br /&gt;
|-&lt;br /&gt;
| Error_name|| description&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, param;&lt;br /&gt;
...&lt;br /&gt;
// Do xyz&lt;br /&gt;
status = oceosmp_blank(param));&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:backup]]&lt;/div&gt;</summary>
		<author><name>Bkavanagh</name></author>
	</entry>
	<entry>
		<id>https://wiki.ocetechnology.com/mediawiki/index.php?title=OCEOSmp/blank&amp;diff=1695</id>
		<title>OCEOSmp/blank</title>
		<link rel="alternate" type="text/html" href="https://wiki.ocetechnology.com/mediawiki/index.php?title=OCEOSmp/blank&amp;diff=1695"/>
		<updated>2024-05-03T16:41:47Z</updated>

		<summary type="html">&lt;p&gt;Bkavanagh: /* Next Section */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Next Section ==&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;Task directives&amp;lt;/span&amp;gt;==&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;Task data structures&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_task_create()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''tasks.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Create a task.&lt;br /&gt;
Can only be use before OCEOS starts. Stores the task information in the OCEOS fixed data area.&lt;br /&gt;
This directive populates the data structures for a task. It should be called after [[OCEOSmp/directive_reference#oceos_init()|oceos_init()]] and before [[OCEOSmp/directive_reference#oceos_init_finish()|oceos_init_finish()]].&amp;lt;br&amp;gt;&lt;br /&gt;
It must be called for each task otherwise [[OCEOSmp/directive_reference#oceos_start()|oceos_start()]] will return an error.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;blank_function()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''header.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function does xyz...&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t oceosmp_blank(&lt;br /&gt;
    U32_t param&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| param || parameter to function&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit  !! Description&lt;br /&gt;
|-&lt;br /&gt;
| Error_name|| description&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, param;&lt;br /&gt;
...&lt;br /&gt;
// Do xyz&lt;br /&gt;
status = oceosmp_blank(param));&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:backup]]&lt;/div&gt;</summary>
		<author><name>Bkavanagh</name></author>
	</entry>
	<entry>
		<id>https://wiki.ocetechnology.com/mediawiki/index.php?title=OCEOSmp/directive_reference&amp;diff=1694</id>
		<title>OCEOSmp/directive reference</title>
		<link rel="alternate" type="text/html" href="https://wiki.ocetechnology.com/mediawiki/index.php?title=OCEOSmp/directive_reference&amp;diff=1694"/>
		<updated>2024-05-03T16:08:53Z</updated>

		<summary type="html">&lt;p&gt;Bkavanagh: /* Introduction */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Introduction =&lt;br /&gt;
&lt;br /&gt;
To be added&lt;br /&gt;
&lt;br /&gt;
= Directives =&lt;br /&gt;
&lt;br /&gt;
== Initialisation directives ==&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_init()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''initialisation.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Initialises OCEOS and  must be the first directive used.&lt;br /&gt;
&lt;br /&gt;
Initialises the OCEOS system meta data using the information supplied in the application configuration and prepares for creation of tasks etc.&lt;br /&gt;
&lt;br /&gt;
The values provided in the application configuration are checked as much as possible before being used.&lt;br /&gt;
&lt;br /&gt;
The system log also is created here.&lt;br /&gt;
&lt;br /&gt;
This function sets up sysMetaPtr and init_meta_ptr and must have completed successfully before tasks etc. can be created.&lt;br /&gt;
&lt;br /&gt;
It disables interrupts and leaves them disabled, they will be re-enabled to the previous level after all tasks etc. have been created and [[OCEOSmp/directive_reference#oceos_init_finish()|oceos_init_finish()]] has completed successfully.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Initialises OCEOS and  must be the first directive used.&lt;br /&gt;
 *&lt;br /&gt;
 * Initialises the OCEOS system meta data using the information supplied in&lt;br /&gt;
 * the application configuration and prepares for creation of tasks etc.&lt;br /&gt;
 *&lt;br /&gt;
 * The values provided in the application configuration are checked as much&lt;br /&gt;
 * as possible before being used.&lt;br /&gt;
 *&lt;br /&gt;
 * The system log also is created here.&lt;br /&gt;
 *&lt;br /&gt;
 * This function sets up sysMetaPtr and init_meta_ptr and must have completed&lt;br /&gt;
 * successfully before tasks etc. can be created.&lt;br /&gt;
 *&lt;br /&gt;
 * It disables interrupts and leaves them disabled, they will be re-enabled to&lt;br /&gt;
 * the previous level after all tasks etc. have been created and&lt;br /&gt;
 * oceos_init_finish() has completed successfully.&lt;br /&gt;
 *&lt;br /&gt;
 * @param app_config Pointer to configuration struct&lt;br /&gt;
 * @return SUCCESSFUL                        All OK&lt;br /&gt;
 *         WARN_LOG_SIZE_DEFAULT             Warning, log size is set to default value of 64 entries&lt;br /&gt;
 *         WARN_NO_ERROR_FUNCTION            Warning, user defined function for ERROR handling is not provided&lt;br /&gt;
 *         ERR_CPU_FIRST_CORE_INVALID        Start CPU not in a range of available cores for this target; or greater than end CPU&lt;br /&gt;
 *         ERR_CPU_LAST_CORE_INVALID         Last CPU not in a range of available cores for this target&lt;br /&gt;
 *         ERR_NOT_START_CPU_CORE            Executing oceos_init on wrong CPU&lt;br /&gt;
 *         ERR_STACK_START_MISALIGNED        Stack start address is not set by user misaligned&lt;br /&gt;
 *         ERR_STACK_PER_CORE_INVALID        Stack per CPU size is zero, or not 8byte aligned, or less then min require&lt;br /&gt;
 *         ERR_LOG_ADDR_MISALIGNED           Log start address is not 8 byte aligned&lt;br /&gt;
 *         ERR_FIX_ADDR_MISALIGNED           Fixed area start address is not 8 byte aligned&lt;br /&gt;
 *         ERR_DYN_ADDR_MISALIGNED           Dynamic area start address is not 8 byte aligned&lt;br /&gt;
 *         ERR_CPU_CORE_RANGE_WRONG          CPU cores in use exceed available CPUs on the SoC&lt;br /&gt;
 *         ERR_STACK_SPACE_WRONG             Current CPU SP is not within user provided stack range&lt;br /&gt;
 *         ERR_LOG_SIZE_INVALID              Log size outside expected range&lt;br /&gt;
 *         ERR_CS_LOG_SIZE_INVALID           Context switch log size invalid&lt;br /&gt;
 *         ERR_TASK_NUMBER_INVALID           Number of tasks invalid&lt;br /&gt;
 *         ERR_MUTEX_NUMBER_INVALID          Number of mutexes invalid&lt;br /&gt;
 *         ERR_RWMUTEX_NUMBER_INVALID        Number of rwmutexes invalid&lt;br /&gt;
 *         ERR_SEM_NUMBER_INVALID            Number of semaphores invalid&lt;br /&gt;
 *         ERR_DATAQ_NUMBER_INVALID          Number of datqs invalid&lt;br /&gt;
 *         ERR_TIMED_ACTIONS_NUMBER_INVALID  Number of timed actions invalid&lt;br /&gt;
 *         ERR_OVERLAP_STACK                 Overlap stack end address with (two overlap areas are set)&lt;br /&gt;
 *         ERR_OVERLAP_LOG                   Overlap log with (two overlap areas are set)&lt;br /&gt;
 *         ERR_OVERLAP_FIXED                 Overlap fixed area with (two overlap areas are set)&lt;br /&gt;
 *         ERR_OVERLAP_DYNAMIC               Overlap dynamic area with (two overlap areas are set)&lt;br /&gt;
 *         ERR_FIXED_MEMORY_FAILED           Fixed area memory write fail&lt;br /&gt;
 *         ERR_DYNAMIC_MEMORY_FAILED         Dynamic area memory write fail&lt;br /&gt;
 *         ERR_TIMER_ADDR_INVALID            Timer address not provided by user (null). SPARC only&lt;br /&gt;
 *         ERR_SYS_TIMER_INDEX_INVALID       System timer index of subtimer invalid; SPARC only; Subtimers start from index 1; Need index of subtimer plus one in front&lt;br /&gt;
 *         ERR_PERIPHERAL_CLOCK_INVALID      System peripheral code invalid&lt;br /&gt;
 *&lt;br /&gt;
 */&lt;br /&gt;
S32_t   oceos_init(&lt;br /&gt;
    const struct application_configuration app_config&lt;br /&gt;
);&lt;br /&gt;
 &amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| app_config || Pointer to configuration struct.  struct application_configuration defined in '''''basic_structs.h'''''&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| WARN_LOG_SIZE_DEFAULT             || Warning, log size is set to default value of 64 entries&lt;br /&gt;
|-&lt;br /&gt;
| WARN_NO_ERROR_FUNCTION            || Warning, user defined function for ERROR handling is not provided&lt;br /&gt;
|-&lt;br /&gt;
| ERR_CPU_FIRST_CORE_INVALID        || Start CPU not in a range of available cores for this target; or greater than end CPU&lt;br /&gt;
|-&lt;br /&gt;
| ERR_CPU_LAST_CORE_INVALID         || Last CPU not in a range of available cores for this target&lt;br /&gt;
|-&lt;br /&gt;
| ERR_NOT_START_CPU_CORE            || Executing oceos_init on wrong CPU&lt;br /&gt;
|-&lt;br /&gt;
| ERR_STACK_START_MISALIGNED        || Stack start address is not set by user misaligned&lt;br /&gt;
|-&lt;br /&gt;
| ERR_STACK_PER_CORE_INVALID        || Stack per CPU size is zero, or not 8byte aligned, or less then min require&lt;br /&gt;
|-&lt;br /&gt;
| ERR_LOG_ADDR_MISALIGNED           || Log start address is not 8 byte aligned&lt;br /&gt;
|-&lt;br /&gt;
| ERR_FIX_ADDR_MISALIGNED           || Fixed area start address is not 8 byte aligned&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DYN_ADDR_MISALIGNED           || Dynamic area start address is not 8 byte aligned&lt;br /&gt;
|-&lt;br /&gt;
| ERR_CPU_CORE_RANGE_WRONG          || CPU cores in use exceed available CPUs on the SoC&lt;br /&gt;
|-&lt;br /&gt;
| ERR_STACK_SPACE_WRONG             || Current CPU SP is not within user provided stack range&lt;br /&gt;
|-&lt;br /&gt;
| ERR_LOG_SIZE_INVALID              || Log size outside expected range&lt;br /&gt;
|-&lt;br /&gt;
| ERR_CS_LOG_SIZE_INVALID           || Context switch log size invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TASK_NUMBER_INVALID           || Number of tasks invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_MUTEX_NUMBER_INVALID          || Number of mutexes invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_RWMUTEX_NUMBER_INVALID        || Number of rwmutexes invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SEM_NUMBER_INVALID            || Number of semaphores invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DATAQ_NUMBER_INVALID          || Number of datqs invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TIMED_ACTIONS_NUMBER_INVALID  || Number of timed actions invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_OVERLAP_STACK                 || Overlap stack end address with (two overlap areas are set)&lt;br /&gt;
|-&lt;br /&gt;
| ERR_OVERLAP_LOG                   || Overlap log with (two overlap areas are set)&lt;br /&gt;
|-&lt;br /&gt;
| ERR_OVERLAP_FIXED                 || Overlap fixed area with (two overlap areas are set)&lt;br /&gt;
|-&lt;br /&gt;
| ERR_OVERLAP_DYNAMIC               || Overlap dynamic area with (two overlap areas are set)&lt;br /&gt;
|-&lt;br /&gt;
| ERR_FIXED_MEMORY_FAILED           || Fixed area memory write fail&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DYNAMIC_MEMORY_FAILED         || Dynamic area memory write fail&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TIMER_ADDR_INVALID            || Timer address not provided by user (null). SPARC only&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_TIMER_INDEX_INVALID       || System timer index of subtimer invalid; SPARC only; Subtimers start from index 1; Need index of subtimer plus one in front&lt;br /&gt;
|-&lt;br /&gt;
| ERR_PERIPHERAL_CLOCK_INVALID      || System peripheral code invalid&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
    /*&lt;br /&gt;
     * Create the application configuration structure&lt;br /&gt;
     */&lt;br /&gt;
    struct application_configuration           app_config = {0};&lt;br /&gt;
&lt;br /&gt;
    /*&lt;br /&gt;
     * Fill in the application parameters&lt;br /&gt;
     */&lt;br /&gt;
    app_config.log_address                   = (log_t)log_data;              // required&lt;br /&gt;
    app_config.fixed_data_address            = (adrs_t)fixed_data;            // required&lt;br /&gt;
    app_config.dynamic_data_address          = (adrs_t)dynamic_data;          // required&lt;br /&gt;
&lt;br /&gt;
    app_config.stack_start_address           = start_stack_array[OCEOS_START_CPU_INDEX];// OCEOSMP_STACK_START_ADDRESS;&lt;br /&gt;
    app_config.stack_size_per_cpu            = (U32_t)&amp;amp;__oceos_stack_size_per_cpu;  // OCEOSMP_STACK_LOW_BOUND_ADDRESS;&lt;br /&gt;
&lt;br /&gt;
    app_config.system_error_function         = oceosmp_on_error;               // NULL =&amp;gt; ignore&lt;br /&gt;
    app_config.log_full_function             = oceosmp_on_full_log;            // NULL =&amp;gt; ignore&lt;br /&gt;
&lt;br /&gt;
    // used in setting up system log and fixed data array&lt;br /&gt;
    app_config.log_number_of_entries         = NUMBER_OF_LOG_ENTRIES;          // 0 =&amp;gt; use default&lt;br /&gt;
&lt;br /&gt;
    app_config.number_of_tasks               = NUMBER_OF_TASKS;                // &amp;gt;= 1&lt;br /&gt;
&lt;br /&gt;
    app_config.number_of_mutexes             = NUMBER_OF_MUTEXES;&lt;br /&gt;
	app_config.number_of_rwmutexes			 = NUMBER_OF_RWMUTEXES;&lt;br /&gt;
    app_config.number_of_counting_semaphores = NUMBER_OF_SEMAPHORES;&lt;br /&gt;
    app_config.number_of_data_queues         = NUMBER_OF_DATAQS;&lt;br /&gt;
&lt;br /&gt;
    /**&lt;br /&gt;
     * FOR SPARC TARGET ONLY.&lt;br /&gt;
     */&lt;br /&gt;
    app_config.sys_time_timer_index          = SYS_TIME_TIMER_INDEX;           // 0 =&amp;gt; invalid index&lt;br /&gt;
    /**&lt;br /&gt;
     * FOR SPARC TARGET ONLY.&lt;br /&gt;
     * Not Used for ARM. Always Nested&lt;br /&gt;
     */&lt;br /&gt;
    app_config.interrupt_nesting_enabled     = TRUE;                           // TRUE =&amp;gt; single vector&lt;br /&gt;
    app_config.oceos_cpu_switch_int_number   = OCEOS_CPU_INTER_COM_INT_NUMBER; // User should provide SGI ID (0-15)&lt;br /&gt;
&lt;br /&gt;
    app_config.timed_actions_queue_size      = NUMBER_OF_ACTION_ENTRIES;&lt;br /&gt;
    app_config.CS_log_entries_base2          = CS_LOG_DEF_ENTRIES_BASE2;&lt;br /&gt;
    /**&lt;br /&gt;
     * Set starting index of CPU that will be used by OCEOSMP&lt;br /&gt;
     */&lt;br /&gt;
    app_config.oceos_cpu_start_index         = OCEOS_START_CPU_INDEX;&lt;br /&gt;
    /**&lt;br /&gt;
     * Set last index of CPU that will be used by OCEOSMP&lt;br /&gt;
     */&lt;br /&gt;
    app_config.oceos_cpu_last_index          = OCEOS_LAST_CPU_INDEX;&lt;br /&gt;
    /*&lt;br /&gt;
     * Set system/peripheral clock used to initialise system timer&lt;br /&gt;
     */&lt;br /&gt;
    app_config.soc_peripheral_clck           = BSP_SYSFREQ * 1000 * 1000;&lt;br /&gt;
&lt;br /&gt;
    // initialise OCEOSMP&lt;br /&gt;
    S32_t status;&lt;br /&gt;
    status = oceos_init(app_config);&lt;br /&gt;
    if (OCEOS_SUCCESS &amp;gt; status) {&lt;br /&gt;
      oceosmp_print(&amp;quot;\n oceos_init failure\n\r&amp;quot;);&lt;br /&gt;
      return 0;&lt;br /&gt;
    } else {&lt;br /&gt;
      return 1;&lt;br /&gt;
    }   // else&lt;br /&gt;
 &amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_init_finish()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''initialisation.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Finalizes the fixed data array after all tasks etc. have been created&lt;br /&gt;
&lt;br /&gt;
All information needed to start OCEOS can be found in the fixed data area&lt;br /&gt;
when oceos_init_finish() has completed.&lt;br /&gt;
&lt;br /&gt;
Once all tasks etc. have been created oceos_init_finish() checks the&lt;br /&gt;
accumulated information against the application configuration data&lt;br /&gt;
stored in the fixed meta structure.&lt;br /&gt;
&lt;br /&gt;
oceos_init_finish also calculates the size of the dynamic data area and&lt;br /&gt;
checks it does not overlap with the system stack, the system log, or the&lt;br /&gt;
fixed data, and if all ok sets up pointers to the various dynamic area&lt;br /&gt;
components in the fixed data.&lt;br /&gt;
&lt;br /&gt;
It then adds an XOR checksum to the fixed data area, and checks that this&lt;br /&gt;
is followed by FILLER, which it replaces with the end sentinel.&lt;br /&gt;
&lt;br /&gt;
On successful completion it restores the interrupt level to its value&lt;br /&gt;
before oceos_init() was called, otherwise interrupts remain disabled.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Finalizes the fixed data array after all tasks etc. have been created&lt;br /&gt;
 *&lt;br /&gt;
 * All information needed to start OCEOS can be found in the fixed data area&lt;br /&gt;
 * when oceos_init_finish() has completed.&lt;br /&gt;
 *&lt;br /&gt;
 * Once all tasks etc. have been created oceos_init_finish() checks the&lt;br /&gt;
 * accumulated information against the application configuration data&lt;br /&gt;
 * stored in the fixed meta structure.&lt;br /&gt;
 *&lt;br /&gt;
 * oceos_init_finish also calculates the size of the dynamic data area and&lt;br /&gt;
 * checks it does not overlap with the system stack, the system log, or the&lt;br /&gt;
 * fixed data, and if all ok sets up pointers to the various dynamic area&lt;br /&gt;
 * components in the fixed data.&lt;br /&gt;
 *&lt;br /&gt;
 * It then adds an XOR checksum to the fixed data area, and checks that this&lt;br /&gt;
 * is followed by FILLER, which it replaces with the end sentinel.&lt;br /&gt;
 *&lt;br /&gt;
 * On successful completion it restores the interrupt level to its value&lt;br /&gt;
 * before oceos_init() was called, otherwise interrupts remain disabled.&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS                             All OK&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT               System Meta data is NULL or corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT                 System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_CPU_CORE                  Executing directive on wrong CPU&lt;br /&gt;
 *          ERR_WRONG_PHASE                     Called before oceos_init()&lt;br /&gt;
 *          ERR_TASKS_INCOMPLETE                Created wrong number of tasks&lt;br /&gt;
 *          ERR_MUTEX_INCOMPLETE                Created wrong number of mutexes&lt;br /&gt;
 *          ERR_RWMUTEX_INCOMPLETE              Created wrong number of rwmutexes&lt;br /&gt;
 *          ERR_SEM_INCOMPLETE                  Created wrong number of semaphores&lt;br /&gt;
 *          ERR_DATAQ_INCOMPLETE                Created wrong number of dataqs&lt;br /&gt;
 *          ERR_TASK_MAX_ID_INVALID             Task's max id invalid&lt;br /&gt;
 *          ERR_MUTEX_MAX_ID_INVALID            Mutexe's max id invalid&lt;br /&gt;
 *          ERR_RWMUTEX_MAX_ID_INVALID          Rwmutexe's max id invalid&lt;br /&gt;
 *          ERR_SEM_MAX_ID_INVALID              Semaphore's max id invalid&lt;br /&gt;
 *          ERR_DATAQ_MAX_ID_INVALID            Dataq's max id invalid&lt;br /&gt;
 *          ERR_TOTAL_JOBS_NUMBER_WRONG         Wrong number of total jobs created&lt;br /&gt;
 *          ERR_ORDER_ARRAY_PTR_INVALID         Order array pointer is NULL or mis-aligned&lt;br /&gt;
 *          ERR_FIXED_AREA_TOO_SMALL            Not enough space for fixed data area&lt;br /&gt;
 */&lt;br /&gt;
S32_t   oceos_init_finish(void);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
There are no input parameters to this function.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit  || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT               || System Meta data is NULL or corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT                 || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_CPU_CORE                  || Executing directive on wrong CPU&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE                     || Called before oceos_init()&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TASKS_INCOMPLETE                || Created wrong number of tasks&lt;br /&gt;
|-&lt;br /&gt;
| ERR_MUTEX_INCOMPLETE                || Created wrong number of mutexes&lt;br /&gt;
|-&lt;br /&gt;
| ERR_RWMUTEX_INCOMPLETE              || Created wrong number of rwmutexes&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SEM_INCOMPLETE                  || Created wrong number of semaphores&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DATAQ_INCOMPLETE                || Created wrong number of dataqs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TASK_MAX_ID_INVALID             || Task's max id invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_MUTEX_MAX_ID_INVALID            || Mutexe's max id invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_RWMUTEX_MAX_ID_INVALID          || Rwmutexe's max id invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SEM_MAX_ID_INVALID              || Semaphore's max id invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DATAQ_MAX_ID_INVALID            || Dataq's max id invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TOTAL_JOBS_NUMBER_WRONG         || Wrong number of total jobs created&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ORDER_ARRAY_PTR_INVALID         || Order array pointer is NULL or mis-aligned&lt;br /&gt;
|-&lt;br /&gt;
| ERR_FIXED_AREA_TOO_SMALL            || Not enough space for fixed data area&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
    /*&lt;br /&gt;
     * Finish initialising OCEOS and setting up the fixed data&lt;br /&gt;
     */&lt;br /&gt;
    status = oceos_init_finish();&lt;br /&gt;
    if(OCEOS_SUCCESS &amp;gt; status){&lt;br /&gt;
        // LOG&lt;br /&gt;
      oceosmp_print(&amp;quot;\nAbandoning, problem ending OCEOS initialisation\n\r&amp;quot;);&lt;br /&gt;
        return -1;&lt;br /&gt;
    }   // if&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_start()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''initialisation.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Starts OCEOS scheduling.&amp;lt;br&amp;gt;&lt;br /&gt;
Create dynamic OCEOS structures and start scheduling.&amp;lt;br&amp;gt;&lt;br /&gt;
This function should only be called once and only after [[OCEOSmp/directive_reference#oceos_init()|oceos_init()]] and [[OCEOSmp/directive_reference#oceos_init_finish()|oceos_init_finish()]] have been called successfully.&amp;lt;br&amp;gt;&lt;br /&gt;
Normally this function does not return. &amp;lt;br&amp;gt;&lt;br /&gt;
If a problem is detected the function terminates and returns an appropriate DIRECTIVE_STATUS code, with interrupts disabled.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Starts OCEOS scheduling&lt;br /&gt;
 *&lt;br /&gt;
 * Create dynamic OCEOS structures and start scheduling&lt;br /&gt;
 *&lt;br /&gt;
 * This function should only be called once&lt;br /&gt;
 * and only after oceos_init()&lt;br /&gt;
 * and oceos_init_finish() have&lt;br /&gt;
 *  been called successfully.&lt;br /&gt;
 * Normally this function does not return.&lt;br /&gt;
 * If a problem is detected the function&lt;br /&gt;
 * terminates and returns an appropriate&lt;br /&gt;
 * DIRECTIVE_STATUS code, with interrupts disabled.&lt;br /&gt;
 *&lt;br /&gt;
 * @param fixed_array_ptr   Pointer to fixed data array&lt;br /&gt;
 * @param start_task        Task ID&lt;br /&gt;
 * @param data_ptr          Pointer to data to be passed to the task&lt;br /&gt;
 * @return  OCEOSMP_EXIT                        OCEOSMP return from scheduling and exit&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT               Fixed area pointer is null or bad sentinel&lt;br /&gt;
 *          ERR_FIXED_AREA_SIZE_WRONG           Fixed area size is zero&lt;br /&gt;
 *          ERR_FIXED_AREA_END_SENTINEL_BAD     Fixed data end sentinel corrupt&lt;br /&gt;
 *          ERR_FIXED_AREA_BAD_XOR              Fixed area bad checksum or checksum mis-match&lt;br /&gt;
 *          ERR_INIT_NOT_DONE                   oceos_start() called without initialisation&lt;br /&gt;
 *          ERR_DYN_AREA_PTR_BAD                Dynamic area pointer invalid in sysMetaPtr&lt;br /&gt;
 *          ERR_INT_HANDLER_BAD                 IRQ controller pointer provided by BCC is NULL;or OCEOS handler is not set&lt;br /&gt;
 *          ERR_DYN_JOB_PTR_BAD                 Job array pointer is NULL&lt;br /&gt;
 *          ERR_FIXED_TASK_PTR_BAD              Tasks array pointer is NULL&lt;br /&gt;
 *          ERR_JOB_COUNT_WRONG                 Total job count inconsistent&lt;br /&gt;
 *          ERR_DYN_MUTEX_PTR_BAD               Mutex dynamic pointer is NULL&lt;br /&gt;
 *          ERR_DYN_LOCK_PTR_BAD                Mutex lock array pointer is NULL&lt;br /&gt;
 *          ERR_DYN_RWMUTEX_PTR_BAD             Rwmutex dynamic pointer is NULL&lt;br /&gt;
 *          ERR_DYN_RWLOCK_PTR_BAD              Rwmutex lock array pointer is NULL&lt;br /&gt;
 *          ERR_FIXED_SEM_PTR_BAD               Semaphore fixed pointer is NULL&lt;br /&gt;
 *          ERR_DYN_SEM_PTR_BAD                 Semaphore dynamic pointer is NULL&lt;br /&gt;
 *          ERR_SEM_PEND_PTR_BAD                Semaphore pending queue pointer is NULL&lt;br /&gt;
 *          ERR_FIXED_DATAQ_PTR_BAD             Dataq fixed pointer is NULL&lt;br /&gt;
 *          ERR_DYN_DATAQ_PTR_BAD               Dataq dynamic pointer is NULL&lt;br /&gt;
 *          ERR_DATAQ_PEND_PTR_BAD              Dataq pending queue pointer is NULL&lt;br /&gt;
 *          ERR_DATAQ_DATA_PTR_BAD              Dataq data pointer is NULL&lt;br /&gt;
 *          ERR_CPU_INT_NUMBER_INVALID          SPARC only.IRQ number for CPU inter-comunication invalid(zero or used by timer)&lt;br /&gt;
 *          ERR_REGISTER_CPU_IRQ_FAILED         SPARC only. Failed to set CPU IRQ handler in BCC&lt;br /&gt;
 *          ERR_CPU_STACK_INVALID               Current CPU stack not within specified range&lt;br /&gt;
 *          ERR_CPU_PRIORITY_STACK_INVALID      Per CPU priority stack invalid&lt;br /&gt;
 *          ERR_LOG_AREA_END_SENTINEL_BAD       Log area end sentinel override&lt;br /&gt;
 *          ERR_TA_CONFIG_PTR_BAD               SPARC only; Timed action configuration data pointer is NULL&lt;br /&gt;
 *          ERR_TA_TIMER_INDEX_INVALID          SPARC only; Timed action sub-timer index in timer unit is invalid&lt;br /&gt;
 *          ERR_TA_IRQ_NUMBER_INVALID           SPARC only; Timer action timer IRQ number is invalid&lt;br /&gt;
 *          ERR_TA_BCC_IRQ_REGISTER_FAILED      SPARC only; Timed action timer IRQ handler failed to register&lt;br /&gt;
 */&lt;br /&gt;
S32_t   oceos_start(&lt;br /&gt;
    const U32_t * const fixed_array_ptr,// pointer to fixed data array&lt;br /&gt;
    const U32_t start_task,             // taskID&lt;br /&gt;
    void * const data_ptr               // pointer to data to be passed to task&lt;br /&gt;
);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| fixed_array_ptr || Pointer to fixed data array&lt;br /&gt;
|-&lt;br /&gt;
| start_task      || Task ID&lt;br /&gt;
|-&lt;br /&gt;
| data_ptr        || Pointer to data to be passed to the task&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit  || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT               || Fixed area pointer is null or bad sentinel&lt;br /&gt;
|-&lt;br /&gt;
| ERR_FIXED_AREA_SIZE_WRONG           || Fixed area size is zero&lt;br /&gt;
|-&lt;br /&gt;
| ERR_FIXED_AREA_END_SENTINEL_BAD     || Fixed data end sentinel corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_FIXED_AREA_BAD_XOR              || Fixed area bad checksum or checksum mis-match&lt;br /&gt;
|-&lt;br /&gt;
| ERR_INIT_NOT_DONE                   || oceos_start() called without initialisation&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DYN_AREA_PTR_BAD                || Dynamic area pointer invalid in sysMetaPtr&lt;br /&gt;
|-&lt;br /&gt;
| ERR_INT_HANDLER_BAD                 || IRQ controller pointer provided by BCC is NULL;or OCEOS handler is not set&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DYN_JOB_PTR_BAD                 || Job array pointer is NULL&lt;br /&gt;
|-&lt;br /&gt;
| ERR_FIXED_TASK_PTR_BAD              || Tasks array pointer is NULL&lt;br /&gt;
|-&lt;br /&gt;
| ERR_JOB_COUNT_WRONG                 || Total job count inconsistent&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DYN_MUTEX_PTR_BAD               || Mutex dynamic pointer is NULL&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DYN_LOCK_PTR_BAD                || Mutex lock array pointer is NULL&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DYN_RWMUTEX_PTR_BAD             || Rwmutex dynamic pointer is NULL&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DYN_RWLOCK_PTR_BAD              || Rwmutex lock array pointer is NULL&lt;br /&gt;
|-&lt;br /&gt;
| ERR_FIXED_SEM_PTR_BAD               || Semaphore fixed pointer is NULL&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DYN_SEM_PTR_BAD                 || Semaphore dynamic pointer is NULL&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SEM_PEND_PTR_BAD                || Semaphore pending queue pointer is NULL&lt;br /&gt;
|-&lt;br /&gt;
| ERR_FIXED_DATAQ_PTR_BAD             || Dataq fixed pointer is NULL&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DYN_DATAQ_PTR_BAD               || Dataq dynamic pointer is NULL&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DATAQ_PEND_PTR_BAD              || Dataq pending queue pointer is NULL&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DATAQ_DATA_PTR_BAD              || Dataq data pointer is NULL&lt;br /&gt;
|-&lt;br /&gt;
| ERR_CPU_INT_NUMBER_INVALID          || SPARC only.IRQ number for CPU inter-comunication invalid(zero or used by timer)&lt;br /&gt;
|-&lt;br /&gt;
| ERR_REGISTER_CPU_IRQ_FAILED         || SPARC only. Failed to set CPU IRQ handler in BCC&lt;br /&gt;
|-&lt;br /&gt;
| ERR_CPU_STACK_INVALID               || Current CPU stack not within specified range&lt;br /&gt;
|-&lt;br /&gt;
| ERR_CPU_PRIORITY_STACK_INVALID      || Per CPU priority stack invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_LOG_AREA_END_SENTINEL_BAD       || Log area end sentinel override&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_CONFIG_PTR_BAD               || SPARC only; Timed action configuration data pointer is NULL&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_TIMER_INDEX_INVALID          || SPARC only; Timed action sub-timer index in timer unit is invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_IRQ_NUMBER_INVALID           || SPARC only; Timer action timer IRQ number is invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_BCC_IRQ_REGISTER_FAILED      || SPARC only; Timed action timer IRQ handler failed to register&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/* Sample Task names - all here start with t_ to help avoid name confusion */&lt;br /&gt;
enum TASK_NAME{&lt;br /&gt;
    t_tom,                      // will have task ID 0&lt;br /&gt;
    t_dick,                     // will have task ID 1&lt;br /&gt;
};&lt;br /&gt;
extern U32_t fixed_data[];&lt;br /&gt;
...&lt;br /&gt;
S32_t status;&lt;br /&gt;
&lt;br /&gt;
status = oceos_start(fixed_data, t_tom, NULL);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_exit()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''initialisation.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Ends scheduling and exit from [[OCEOSmp/directive_reference#oceos_start()|oceos_start()]].&lt;br /&gt;
No task can be started after this.&amp;lt;br&amp;gt;&lt;br /&gt;
OCEOS will exit when the current job ends.&amp;lt;br&amp;gt;&lt;br /&gt;
An idle task in an endless loop should check that scheduling is enabled.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Ends scheduling and exit from oceos_start.&lt;br /&gt;
 * No task can be started after this.&lt;br /&gt;
 * OCEOS will exit when the current job ends.&lt;br /&gt;
 * An idle task in an endless loop should check that scheduling is enabled.&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Called before scheduling started&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_exit(void);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
There are no input parameters to this function.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit  || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Called before scheduling started&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
// Exit OCEOS&lt;br /&gt;
oceos_exit();&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_CPU_sleep()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''initialisation.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
 Puts CPU in sleep mode.&amp;lt;br&amp;gt;&lt;br /&gt;
 User must to be sure that interrupts are enabled.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Puts CPU in sleep mode.&lt;br /&gt;
 * User must to be sure that interrupts are enabled.&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_CPU_sleep(void);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
There are no input parameters to this function.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
// Put CPU to sleep&lt;br /&gt;
oceos_CPU_sleep();&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceosmp_cpu_disable()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''initialisation.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function ends execution of all tasks running on particular CPU and removes the CPU from scheduling.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Ends execution of all tasks running on particular CPU and removes this CPU from scheduling.&lt;br /&gt;
 * @param cpu_id&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              CPU ID outside allowed range 0 to 254&lt;br /&gt;
 *          ERR_ID_WRONG                CPU ID &amp;gt;= number of available CPUs&lt;br /&gt;
 *          ERR_CPU_ALREADY_DISABLED    CPU already disabled&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceosmp_cpu_disable(&lt;br /&gt;
    U32_t cpu_id&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| cpu_id || ID of CPU core to be disabled.&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit  || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || CPU ID outside allowed range 0 to 254&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || CPU ID &amp;gt;= number of available CPUs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_CPU_ALREADY_DISABLED    || CPU already disabled&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, faulty_cpu;&lt;br /&gt;
...&lt;br /&gt;
// Disable faulty CPU core&lt;br /&gt;
status = oceosmp_cpu_disable(faulty_cpu));&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceosmp_cpu_enable()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''initialisation.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function adds a disabled CPU core to the OCEOSmp scheduler. It should only be called after scheduling has started&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 *  Adds disabled CPU to OCEOSmp scheduler&lt;br /&gt;
 *&lt;br /&gt;
 *  N.B. This function should only be called after scheduling has started&lt;br /&gt;
 *&lt;br /&gt;
 * @param cpu_id&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              CPU ID outside allowed range 0 to 254&lt;br /&gt;
 *          ERR_ID_WRONG                CPU ID &amp;gt;= number of available CPUs; or the same as currently running&lt;br /&gt;
 *          ERR_CPU_ALREADY_ENABLED     CPU already enabled&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceosmp_cpu_enable(&lt;br /&gt;
    U32_t cpu_id&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| cpu_id || ID of CPU core to be enabled.&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit  || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || CPU ID outside allowed range 0 to 254&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || CPU ID &amp;gt;= number of available CPUs; or the same as currently running&lt;br /&gt;
|-&lt;br /&gt;
| ERR_CPU_ALREADY_ENABLED     || CPU already enabled&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, good_cpu;&lt;br /&gt;
...&lt;br /&gt;
// Enable CPU core&lt;br /&gt;
status = oceosmp_cpu_enable(good_cpu));&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceosmp_cpu_terminate()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''initialisation.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function removes a CPU core from the OCEOSmp scheduler and marks it so it cannot be restarted. It puts CPU to sleep with interrupts disabled. It should only be called after scheduling has started.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 *  Removes CPU from OCEOSMP scheduler and terminates, cannot be restarted.&lt;br /&gt;
 *  Puts CPU to sleep with interrupts disabled&lt;br /&gt;
 *&lt;br /&gt;
 *  N.B. This function should only be called after scheduling has started&lt;br /&gt;
 *  Steps:&lt;br /&gt;
 *     1. Set terminate flag on this CPU;&lt;br /&gt;
 *     2. Trigger software interrupt to transfer execution to IRQ handler;&lt;br /&gt;
 *     3. Check flag and if set =&amp;gt; put CPU to sleep in while loop with interrupts disabled;&lt;br /&gt;
 *     4. Set MAX priority on this CPU priority stack;&lt;br /&gt;
 *     5. Remove CPU from scheduling;&lt;br /&gt;
 *     6. Clean up all the tasks by calling task terminate function and free up all the&lt;br /&gt;
 *        preempted jobs by this CPU;&lt;br /&gt;
 *&lt;br /&gt;
 * @param cpu_id&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              CPU ID outside allowed range 0 to 254&lt;br /&gt;
 *          ERR_ID_WRONG                CPU ID &amp;gt;= number of available CPUs; or the same as currently running&lt;br /&gt;
 *          ERR_CPU_ALREADY_TERMINATED  CPU already terminated&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceosmp_cpu_terminate(&lt;br /&gt;
    U32_t cpu_id&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| cpu_id || ID of CPU core to be terminated.&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit  || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || CPU ID outside allowed range 0 to 254&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || CPU ID &amp;gt;= number of available CPUs; or the same as currently running&lt;br /&gt;
|-&lt;br /&gt;
| ERR_CPU_ALREADY_TERMINATED  || CPU already terminated&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, faulty_cpu;&lt;br /&gt;
...&lt;br /&gt;
// Terminate CPU core&lt;br /&gt;
status = oceosmp_cpu_terminate(faulty_cpu));&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;Task directives&amp;lt;/span&amp;gt;==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ API Functions&lt;br /&gt;
|-&lt;br /&gt;
| Directive                                                                     || Description                          || main || task || IRQ handler&lt;br /&gt;
|-&lt;br /&gt;
| [[OCEOSmp/directive reference#oceos_task_create()| oceos_task_create()]]             || Create Task                        || *    ||      || &lt;br /&gt;
|-&lt;br /&gt;
| [[OCEOSmp/directive reference#oceos_task_start()| oceos_task_start()]]               || Start Task                         ||      ||  *   || *&lt;br /&gt;
|-&lt;br /&gt;
| [[OCEOSmp/directive reference#oceos_task_timed_start()| oceos_task_timed_start()]]   || Schedule a task to start execution at a given system time||      ||  *   || *&lt;br /&gt;
|-&lt;br /&gt;
| [[OCEOSmp/directive reference#oceos_task_disable()| oceos_task_disable()]]           || Disable Task                       ||      ||  *   || *&lt;br /&gt;
|-&lt;br /&gt;
| [[OCEOSmp/directive reference#oceos_task_enable()| oceos_task_enable()]]             || Enable Task                        ||      ||  *   || *&lt;br /&gt;
|-&lt;br /&gt;
| [[OCEOSmp/directive reference#oceos_task_self()| oceos_task_self()]]                 || Returns the task ID of the currently executing task ||    ||  *   || *&lt;br /&gt;
|-&lt;br /&gt;
| [[OCEOSmp/directive reference#oceos_task_get_priority()| oceos_task_get_priority()]] || Get priority of a task             ||      ||  *   || *&lt;br /&gt;
|-&lt;br /&gt;
| [[OCEOSmp/directive reference#oceos_task_get_status()| oceos_task_get_status()]]     || Get status of a task               ||      ||  *   || *&lt;br /&gt;
|-&lt;br /&gt;
| [[OCEOSmp/directive reference#oceos_task_kill()| oceos_task_kill()]]                 || Directive to terminate current task||      ||  *   || *&lt;br /&gt;
|-&lt;br /&gt;
| [[OCEOSmp/directive reference#oceos_task_get_info()| oceos_task_get_info()]]         || Get task information               ||      ||  *   || *&lt;br /&gt;
|-&lt;br /&gt;
| [[OCEOSmp/directive reference#oceosmp_task_kill()| oceosmp_task_kill()]]                 || Directive to terminate current task||      ||  *   || *&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;Task data structures&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''tasks.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The following data structures are used by some of the task directives.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Data structures'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * A pointer to this structure is passed to oceos_task_create().&lt;br /&gt;
 * The structure is first initialised according to a tasks's parameters,&lt;br /&gt;
 * and is not used again after the task is created and may then be discarded.&lt;br /&gt;
 */&lt;br /&gt;
struct task_descriptor {&lt;br /&gt;
&lt;br /&gt;
	void (*function_start)(void*);	// name of task start function&lt;br /&gt;
	void (*function_end)(void*);	// optional, NULL or task end function&lt;br /&gt;
&lt;br /&gt;
	U32_t task_id;					// 0 to 254, usually an enum&lt;br /&gt;
	U32_t task_jobs_max;			// 1 to 15, max concurrent 'jobs'&lt;br /&gt;
	U32_t task_priority;			// 1 (highest) to 254 (lowest)&lt;br /&gt;
	U32_t task_threshold;			// &amp;gt;=1, &amp;lt;= task_priority (higher or same priority)&lt;br /&gt;
	U32_t task_turned_on_initially;	// 0: disabled initially, else enabled&lt;br /&gt;
&lt;br /&gt;
	U32_t time_deadline_microsecs;	// start request to finish, 0 to ignore&lt;br /&gt;
	U32_t time_min_interval_microsecs;	// between start requests, 0 to ignore&lt;br /&gt;
&lt;br /&gt;
	U32_t uses_cpu_affinity;		// 0: not restricted, else core restricted&lt;br /&gt;
	U32_t uses_cpu_affinity_core_id;// core ID to which restricted if affinity used&lt;br /&gt;
}__attribute__ ((aligned (8)));&lt;br /&gt;
&lt;br /&gt;
/**&lt;br /&gt;
 * Task info used with oceos_task_get_info&lt;br /&gt;
 */&lt;br /&gt;
struct task_info {&lt;br /&gt;
  U64_t           time_max_delay;               // maximum time job is waiting on ready queue before becoming active&lt;br /&gt;
  U64_t           time_max_finish;              // maximum time to finish job execution after starting&lt;br /&gt;
  U64_t           time_max_exec;                // maximum time spent executing&lt;br /&gt;
  U64_t           time_total_exec;              // total CPU time used by this task&lt;br /&gt;
  U64_t           time_min_gap_starts;          // minimum time between job creations, can be reset&lt;br /&gt;
  U64_t           time_min_gap_finish_start;    // minimum time between job ending and new job creation, can be reset&lt;br /&gt;
&lt;br /&gt;
  U64_t           time_last_start;              // time of most recent job creation&lt;br /&gt;
  U64_t           time_last_finish;             // time of most recent job finish&lt;br /&gt;
&lt;br /&gt;
  unsigned int    jobs_current_max  :16;        // maximum number of current jobs for this task, no roll over, can be reset&lt;br /&gt;
  unsigned int    jobs_total        :16;        // number of times this task was started, no roll-over, can be reset&lt;br /&gt;
  U32_t           jobs_current;                 // Number of task instances currently in use by oceos&lt;br /&gt;
&lt;br /&gt;
  U32_t           preempt_max;                  // maximum times any job was pre-empted, no roll-over, can be reset&lt;br /&gt;
}__attribute__ ((aligned (8)));&lt;br /&gt;
&lt;br /&gt;
/* A task's status is returned as below if queried */&lt;br /&gt;
enum TASK_STATUS {&lt;br /&gt;
    TASK_DISABLED,      // cannot be scheduled, and no current jobs&lt;br /&gt;
    TASK_ENABLED,       // can be scheduled, but no current jobs&lt;br /&gt;
    TASK_INVALID,       // task does not exist&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_task_create()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''tasks.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Create a task.&lt;br /&gt;
Can only be use before OCEOS starts. Stores the task information in the OCEOS fixed data area.&lt;br /&gt;
This directive populates the data structures for a task. It should be called after [[OCEOSmp/directive_reference#oceos_init()|oceos_init()]] and before [[OCEOSmp/directive_reference#oceos_init_finish()|oceos_init_finish()]].&amp;lt;br&amp;gt;&lt;br /&gt;
It must be called for each task otherwise [[OCEOSmp/directive_reference#oceos_start()|oceos_start()]] will return an error.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Create a task using a task descriptor structure&lt;br /&gt;
 *&lt;br /&gt;
 * Can only be used in Initialisation Phase.&lt;br /&gt;
 *&lt;br /&gt;
 * A task has twelve constant parameters set when the task is created.&lt;br /&gt;
 * Rather than setting a list of these parameters the named fields of a&lt;br /&gt;
 * task_descriptor structure are set and a pointer to it passed here.&lt;br /&gt;
 *&lt;br /&gt;
 * The task_descriptor structure fields are described above.&lt;br /&gt;
 * Once the task has been created the structure can be discarded.&lt;br /&gt;
 *&lt;br /&gt;
 * To create a task:&lt;br /&gt;
 *		set up a task_descriptor structure,&lt;br /&gt;
 *		set its fields to the parameter values for the task,&lt;br /&gt;
 *		pass a pointer to the structure to this directive.&lt;br /&gt;
 *&lt;br /&gt;
 * The structure is checked for validity by oceos_task_create and its&lt;br /&gt;
 * information used to set the task details in the OCEOS fixed data area.&lt;br /&gt;
 *&lt;br /&gt;
 * @param  struct task_descriptor *	fields give task characteristics&lt;br /&gt;
 *&lt;br /&gt;
 * @return OCEOS_SUCCESS            No errors or warnings&lt;br /&gt;
 *         WARN_NO_END_FUNCTION     Warning, no end task function specified&lt;br /&gt;
 *&lt;br /&gt;
 *         ERR_SYS_FIXED_CORRUPT    System Fixed area corrupt&lt;br /&gt;
 *         ERR_WRONG_CPU_CORE       Executing directive on wrong CPU&lt;br /&gt;
 *         ERR_WRONG_PHASE          Called before oceos_init() is done&lt;br /&gt;
 *         ERR_TOO_MANY             MAX number of tasks already created&lt;br /&gt;
 *         ERR_ID_INVALID           Task ID outside allowed range 0 to 254&lt;br /&gt;
 *         ERR_ID_WRONG             Task ID outside &amp;gt;= number of tasks&lt;br /&gt;
 *         ERR_T_ALREADY_ALLOCATED  Task ID already in use&lt;br /&gt;
 *         ERR_T_PRIORITY_INVALID   Task priority outside allowed range 1 to 254&lt;br /&gt;
 *         ERR_THRESHOLD_INVALID    Task threshold outside range 1 to 254&lt;br /&gt;
 *         ERR_THRESHOLD_WRONG      Task threshold  higher priority than task priority&lt;br /&gt;
 *         ERR_JOBS_MAX_INVALID     Job number outside range 1 to 15&lt;br /&gt;
 *         ERR_JOBS_TOO_MANY        System capacity exceeded&lt;br /&gt;
 *         ERR_AFFINITY_WRONG       CPU core specified is outside chosen range&lt;br /&gt;
 *         ERR_START_FUNCTION_BAD   Task start function address either NULL or misaligned&lt;br /&gt;
 */&lt;br /&gt;
S32_t   oceos_task_create(&lt;br /&gt;
    const struct task_descriptor * const task_description_ptr&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter           || Description&lt;br /&gt;
|-&lt;br /&gt;
|struct task_descriptor * || Pointer to task descriptor which contains task attributes&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit     || Description&lt;br /&gt;
|-&lt;br /&gt;
|WARN_NO_END_FUNCTION     || Warning, no end task function specified&lt;br /&gt;
|-&lt;br /&gt;
|ERR_SYS_FIXED_CORRUPT    || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
|ERR_WRONG_CPU_CORE       || Executing directive on wrong CPU&lt;br /&gt;
|-&lt;br /&gt;
|ERR_WRONG_PHASE          || Called before oceos_init() is done&lt;br /&gt;
|-&lt;br /&gt;
|ERR_TOO_MANY             || MAX number of tasks already created&lt;br /&gt;
|-&lt;br /&gt;
|ERR_ID_INVALID           || Task ID outside allowed range 0 to 254&lt;br /&gt;
|-&lt;br /&gt;
|ERR_ID_WRONG             || Task ID outside &amp;gt;= number of tasks&lt;br /&gt;
|-&lt;br /&gt;
|ERR_T_ALREADY_ALLOCATED  || Task ID already in use&lt;br /&gt;
|-&lt;br /&gt;
|ERR_T_PRIORITY_INVALID   || Task priority outside allowed range 1 to 254&lt;br /&gt;
|-&lt;br /&gt;
|ERR_THRESHOLD_INVALID    || Task threshold outside range 1 to 254&lt;br /&gt;
|-&lt;br /&gt;
|ERR_THRESHOLD_WRONG      || Task threshold  higher priority than task priority&lt;br /&gt;
|-&lt;br /&gt;
|ERR_JOBS_MAX_INVALID     || Job number outside range 1 to 15&lt;br /&gt;
|-&lt;br /&gt;
|ERR_JOBS_TOO_MANY        || System capacity exceeded&lt;br /&gt;
|-&lt;br /&gt;
|ERR_AFFINITY_WRONG       || CPU core specified is outside chosen range&lt;br /&gt;
|-&lt;br /&gt;
|ERR_START_FUNCTION_BAD   || Task start function address either NULL or misaligned&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
/* Sample Task names - all here start with t_ to help avoid name confusion */&lt;br /&gt;
enum TASK_NAME{&lt;br /&gt;
      t_0,&lt;br /&gt;
      t_1,&lt;br /&gt;
      t_2&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
/*&lt;br /&gt;
 * APPLICATION FUNCTION DECLARATIONS&lt;br /&gt;
 */&lt;br /&gt;
void fun0(void *);&lt;br /&gt;
void fun1(void *);&lt;br /&gt;
void fun2(void *);&lt;br /&gt;
void end_function(void *);&lt;br /&gt;
&lt;br /&gt;
const struct task_descriptor tasks_data[NUMBER_OF_TASKS] = {&lt;br /&gt;
    {fun0, end_function, t_0, 2, 10, 8, TASK_ENABLED, 0, 0, 0, 0},&lt;br /&gt;
    {fun1, end_function, t_1, 2, 10, 8, TASK_ENABLED, 0, 0, 0, 0},&lt;br /&gt;
    {fun2, end_function, t_2, 2, 10, 8, TASK_ENABLED, 0, 0, 0, 0}&lt;br /&gt;
}; &lt;br /&gt;
&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
    // create tasks (names are defined in the application header)&lt;br /&gt;
    for (i=0; i&amp;lt;NUMBER_OF_TASKS; i++){&lt;br /&gt;
        if ( oceos_task_create(&amp;amp;tasks_data[i]) != OCEOS_SUCCESS ){&lt;br /&gt;
        	oceosmp_print(&amp;quot;\nFailed to create task\n\r&amp;quot;);&lt;br /&gt;
        	return -i;&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_task_start()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''tasks.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function starts an instance of a task. An instance of a task is called a job in OCEOS terminology.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 *  Starting a task involves three main stages&lt;br /&gt;
 *      1 setting up a job&lt;br /&gt;
 *          finding a free job entry if available&lt;br /&gt;
 *          setting up this entry including passing it the data void *&lt;br /&gt;
 *&lt;br /&gt;
 *      2 placing the job on readyQ&lt;br /&gt;
 *&lt;br /&gt;
 *      3 doing a context switch&lt;br /&gt;
 * This function should only be called after OCEOS is initialised&lt;br /&gt;
 *       and the dynamic task and job structures set up&lt;br /&gt;
 *&lt;br /&gt;
 *  When used from an interrupt handler,&lt;br /&gt;
 *  the context switch is only done&lt;br /&gt;
 *  after all nested interrupts have unwound&lt;br /&gt;
 *&lt;br /&gt;
 * @param task_id Task ID must be in range 0 to 254&lt;br /&gt;
 * @param ptr     Pointer to task data&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT    System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT      System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE          Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID           Task ID is invalid&lt;br /&gt;
 *          ERR_ID_WRONG             Task ID is wrong&lt;br /&gt;
 *          ERR_START_TASK_DISABLED  Starting task is disabled&lt;br /&gt;
 *          ERR_TOO_MANY             There is no free job&lt;br /&gt;
 *          ERR_SYS_BUSY             Failed to grab the lock&lt;br /&gt;
 */&lt;br /&gt;
S32_t   oceos_task_start(&lt;br /&gt;
    const U32_t task_id, // task ID, must be in range 0 to 254&lt;br /&gt;
    void * const ptr    // pointer to data&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| task_id || U32_t with Task ID in range 0 to 254.&lt;br /&gt;
|-&lt;br /&gt;
| ptr    || void * pointer to task data&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit  || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT    || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT      || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE          || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID           || Task ID is invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG             || Task ID is wrong&lt;br /&gt;
|-&lt;br /&gt;
| ERR_START_TASK_DISABLED  || Starting task is disabled&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TOO_MANY             || There is no free job&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY             || Failed to grab the lock&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
void *ptr;&lt;br /&gt;
...&lt;br /&gt;
// Start instance of task T_1 passing pointer ptr&lt;br /&gt;
status = oceos_task_start(t_1,ptr);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_task_timed_start()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''tasks.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function schedules a task to start execution at a given system time.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 *  Schedule a task to start execution at a given system time&lt;br /&gt;
 *&lt;br /&gt;
 *  The before and after offsets define a window around the selected time&lt;br /&gt;
 *  in which the task may be started.&lt;br /&gt;
 *&lt;br /&gt;
 *  If the current system time is before the start window a job is created&lt;br /&gt;
 *  and a corresponding action put on the timed action queue.&lt;br /&gt;
 *&lt;br /&gt;
 *  If the current system time is within the time window for starting the task,&lt;br /&gt;
 *  it is started immediately.&lt;br /&gt;
 *&lt;br /&gt;
 *  If the current system time is after the window, an error is reported.&lt;br /&gt;
 *&lt;br /&gt;
 *  Times are in microseconds.&lt;br /&gt;
 *&lt;br /&gt;
 *  This function should only be called after OCEOS is initialised&lt;br /&gt;
 *  and the dynamic task and job structures set up&lt;br /&gt;
 *&lt;br /&gt;
 * @param taskID        Task ID must be in range 0 to 254&lt;br /&gt;
 * @param ptr           Pointer to data&lt;br /&gt;
 * @param start_time    System time at which job should start&lt;br /&gt;
 * @param before        Forward tolerance for time&lt;br /&gt;
 * @param after         Backward tolerance for time&lt;br /&gt;
 * @param return_job_id Return job_id to the user, to remove this job from timed action if needed&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              Task ID invalid&lt;br /&gt;
 *          ERR_ID_WRONG                Task ID is wrong&lt;br /&gt;
 *          ERR_TA_NOT_INIT             Timed action inialisation is not done and tried to be used&lt;br /&gt;
 *          ERR_START_TASK_DISABLED     Starting task is disabled&lt;br /&gt;
 *          ERR_TOO_MANY                There is no free job&lt;br /&gt;
 *          ERR_TOO_LATE                Starting task is too late(out of time frame)&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to grab the lock&lt;br /&gt;
 *          ERR_TA_Q_FULL               Timed action queue is full&lt;br /&gt;
 *          ERR_TA_START_FAILED         Timed action execute failed; See log&lt;br /&gt;
 */&lt;br /&gt;
S32_t   oceos_task_timed_start(&lt;br /&gt;
    const U32_t task_id,     // task ID, must be in range 0 to 254&lt;br /&gt;
    void * const ptr,        // pointer to data&lt;br /&gt;
    const U64_t start_time,  // system time at which job should start&lt;br /&gt;
    const U32_t before,      // forward tolerance for time&lt;br /&gt;
    const U32_t after,       // backward tolerance for time&lt;br /&gt;
    U32_t * return_job_id    // return job_id to the user, to remove this job from timed action if needed&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| taskID        || U32_t task ID must be in range 0 to 254&lt;br /&gt;
|-&lt;br /&gt;
| ptr           || void * pointer to data&lt;br /&gt;
|-&lt;br /&gt;
| start_time    || U64_t system time at which job should start&lt;br /&gt;
|-&lt;br /&gt;
| before        || U32_t forward tolerance for time&lt;br /&gt;
|-&lt;br /&gt;
| after         || U32_t backward tolerance for time&lt;br /&gt;
|-&lt;br /&gt;
| return_job_id || U32_t return job_id to the user, to remove this job from timed action if needed&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit  || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || Task ID invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || Task ID is wrong&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_NOT_INIT             || Timed action inialisation is not done and tried to be used&lt;br /&gt;
|-&lt;br /&gt;
| ERR_START_TASK_DISABLED     || Starting task is disabled&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TOO_MANY                || There is no free job&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TOO_LATE                || Starting task is too late(out of time frame)&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to grab the lock&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_Q_FULL               || Timed action queue is full&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_START_FAILED         || Timed action execute failed; See log&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
U32_t job_id;&lt;br /&gt;
U64_t cur_sys_time;&lt;br /&gt;
...&lt;br /&gt;
  cur_sys_time = oceos_time_sys_get64();&lt;br /&gt;
&lt;br /&gt;
  // Start task 10,000 microseconds (us) from now and advise if started more than 1,000 us before or 2,000 us after.&lt;br /&gt;
  status = oceos_task_timed_start(t_2, ptr, cur_sys_time + 10000, 1000, 2000, &amp;amp;job_id);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_task_disable()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''initialisation.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function disables a task and removes any current pending jobs from the readyQ.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 *  Disable a task and remove any current pending jobs on readyQ.&lt;br /&gt;
 *&lt;br /&gt;
 *  A disabled task's jobs  will not be put into execution nor put on readyQ.&lt;br /&gt;
 *&lt;br /&gt;
 *  Note that where execution of a task has already commenced,&lt;br /&gt;
 *  disabling the task will not prevent it from completing.&lt;br /&gt;
 *&lt;br /&gt;
 *  This function should only be called after OCEOS is initialised&lt;br /&gt;
 *  and the dynamic task and job structures set up&lt;br /&gt;
 *&lt;br /&gt;
 * @param taskID  Task ID must be in range 0 to 254&lt;br /&gt;
 * @return: OCEOS_SUCCESS&lt;br /&gt;
 *          WARN_ALREADY_DISABLED        Task already disabled&lt;br /&gt;
 *          WARN_SEM_PEND_REMOVE_FAILED  Failed to remove job from semaphore pending queue&lt;br /&gt;
 *          WARN_DQ_PEND_REMOVE_FAILED   Failed to remove job from dataq pending queue&lt;br /&gt;
 *&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT        System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT          System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE              Directive was called before OCEOS init is finished&lt;br /&gt;
 *          ERR_ID_INVALID               Task ID is invalid&lt;br /&gt;
 *          ERR_ID_WRONG                 Task ID is wrong&lt;br /&gt;
 *          ERR_SYS_BUSY                 Failed to grab the lock&lt;br /&gt;
 */&lt;br /&gt;
S32_t   oceos_task_disable(&lt;br /&gt;
    const U32_t task_id // task ID, must be in range 0 to 254&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| taskID || U32_t task ID must be in range 0 to 254&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit  || Description&lt;br /&gt;
|-&lt;br /&gt;
| WARN_ALREADY_DISABLED        || Task already disabled&lt;br /&gt;
|-&lt;br /&gt;
| WARN_SEM_PEND_REMOVE_FAILED  || Failed to remove job from semaphore pending queue&lt;br /&gt;
|-&lt;br /&gt;
| WARN_DQ_PEND_REMOVE_FAILED   || Failed to remove job from dataq pending queue&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT        || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT          || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE              || Directive was called before OCEOS init is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID               || Task ID is invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                 || Task ID is wrong&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                 || Failed to grab the lock&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Disable task t_1&lt;br /&gt;
status = oceos_task_disable(t_1);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_task_enable()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''tasks.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function enables a task. Only enabled tasks may be started.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 *  Enable a task - only enabled tasks are placed on readyQ or started.&lt;br /&gt;
 *&lt;br /&gt;
 *  This function should only be called after OCEOS is initialised&lt;br /&gt;
 *  and the dynamic task and job structures set up&lt;br /&gt;
 *&lt;br /&gt;
 * @param taskID   Task ID must be in range 0 to 254&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          WARN_ALREADY_ENABLED     Task already enabled&lt;br /&gt;
 *&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT    System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT      System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE          Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID           Task ID is invalid&lt;br /&gt;
 *          ERR_ID_WRONG             Task ID is wrong&lt;br /&gt;
 *          ERR_SYS_BUSY             Failed to grab the lock&lt;br /&gt;
 */&lt;br /&gt;
S32_t   oceos_task_enable(&lt;br /&gt;
    const U32_t task_id // task ID, must be in range 0 to 254&lt;br /&gt;
);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| taskID  || U32_t task ID must be in range 0 to 254&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit  || Description&lt;br /&gt;
|-&lt;br /&gt;
| WARN_ALREADY_ENABLED     || Task already enabled&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT    || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT      || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE          || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID           || Task ID is invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG             || Task ID is wrong&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY             || Failed to grab the lock&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Enable task t_2&lt;br /&gt;
status = oceos_task_enable(t_2);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_task_self()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''tasks.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the task number of the currently running task on the calling CPU.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Get currently running task on calling CPU&lt;br /&gt;
 *&lt;br /&gt;
 * @param t_id  Task ID holder&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT        System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT          System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE              Directive was called before OCEOS init is finished&lt;br /&gt;
 *          ERR_CPU_DYN_PTR_BAD          CPU dynamic area pointer corrupt&lt;br /&gt;
 */&lt;br /&gt;
S32_t  oceos_task_self(&lt;br /&gt;
    U32_t *t_id&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| t_id || S32_t * pointer to variable where task ID will be written.&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit  || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT        || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT          || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE              || Directive was called before OCEOS init is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_CPU_DYN_PTR_BAD          || CPU dynamic area pointer corrupt&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, task_running;&lt;br /&gt;
...&lt;br /&gt;
// Return task ID that's running on this core&lt;br /&gt;
status = oceos_task_self(&amp;amp;task_running);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_task_get_priority()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''tasks.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the priority of the task ID passed to it.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Get priority of the task&lt;br /&gt;
 *&lt;br /&gt;
 * @param taskID        ID of task, must be in range 0 to 254&lt;br /&gt;
 * @param t_priority    Pointer to task priority holder&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT        System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT          System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE              Directive was called before OCEOS init is finished&lt;br /&gt;
 *          ERR_ID_INVALID               Task ID is invalid&lt;br /&gt;
 *          ERR_ID_WRONG                 Task ID is wrong&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_task_get_priority(&lt;br /&gt;
    const U32_t task_id, // task ID, must be in range 0 to 254&lt;br /&gt;
    U32_t *t_priority   // Pointer to task priority holder&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| task_id || S32_t task ID of task whose priority is required&lt;br /&gt;
|-&lt;br /&gt;
| t_priority || S32_t * pointer to variable where priority will be written&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit  || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT        || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT          || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE              || Directive was called before OCEOS init is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID               || Task ID is invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                 || Task ID is wrong&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
U32_t t_priority;&lt;br /&gt;
...&lt;br /&gt;
// Return the priority of task ID t_4 &lt;br /&gt;
status = oceos_task_get_priority(t_4, &amp;amp;t_priority);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_task_get_status()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''tasks.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the status of the task ID passed to it.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Get status of the task;&lt;br /&gt;
 * if OK t_status holds enum TASK_STATUS&lt;br /&gt;
 *&lt;br /&gt;
 * @param taskID    ID of task, must be in range 0 to 254&lt;br /&gt;
 * @param t_status  enum TASK_STATUS holder&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT        System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT          System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE              Directive was called before OCEOS init is finished&lt;br /&gt;
 *          ERR_ID_INVALID               Task ID is invalid&lt;br /&gt;
 *          ERR_ID_WRONG                 Task ID is wrong&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_task_get_status(&lt;br /&gt;
    const U32_t task_id,&lt;br /&gt;
    U32_t *t_status&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| task_id || S32_t task ID of task whose priority is required&lt;br /&gt;
|-&lt;br /&gt;
| t_status || S32_t * pointer to variable where status will be written&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit  || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT        || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT          || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE              || Directive was called before OCEOS init is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID               || Task ID is invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                 || Task ID is wrong&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
U32_t t_status;&lt;br /&gt;
...&lt;br /&gt;
// Return the status of task ID t_4 &lt;br /&gt;
status = oceos_task_get_status(t_4, &amp;amp;t_status);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_task_get_info()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''tasks.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the task information for the specified task.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Get task information for task with ID.&lt;br /&gt;
 *&lt;br /&gt;
 * User must pass pointer to struct task_info in order to retrieve data.&lt;br /&gt;
 *&lt;br /&gt;
 * @param task_id  Task ID&lt;br /&gt;
 * @param info     Pointer to struct task_info&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT    System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT      System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE          Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID           Task ID invalid&lt;br /&gt;
 *          ERR_ID_WRONG             Task ID wrong&lt;br /&gt;
 *          ERR_TASK_INFO_PTR_BAD    Task info pointer provided by user is NULL&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_task_get_info (&lt;br /&gt;
    const U32_t task_id,   // Task ID&lt;br /&gt;
    struct task_info *info // Pointer to struct task_info&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| task_id || ID of task for which information is required&lt;br /&gt;
|-&lt;br /&gt;
| task_info || struct task_info * pointer to the structure where task information is to be written&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit  || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT    || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT      || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE          || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID           || Task ID invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG             || Task ID wrong&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TASK_INFO_PTR_BAD    || Task info pointer provided by user is NULL&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
struct task_info info;&lt;br /&gt;
...&lt;br /&gt;
// Get information for task T3&lt;br /&gt;
status = oceos_task_get_info(t_3, &amp;amp;info);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceosmp_task_kill()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''tasks.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function kills the specified task running on the specified CPU.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 *  Function to kill currently running task on CPU;&lt;br /&gt;
 *  Can be used:&lt;br /&gt;
 *      From Mode_SVC  =&amp;gt; normal running mode for application&lt;br /&gt;
 *          If nesting level is zero and Mode_SVC&lt;br /&gt;
 *      From Mode_IRQ  =&amp;gt; from IRQ handler&lt;br /&gt;
 *          If nesting level is not zero, set flag to call this function within IRQ handler&lt;br /&gt;
 *      From Exception =&amp;gt; Mode_ABT and Mode_UND&lt;br /&gt;
 *          If nesting level is zero and NOT Mode_SVC, it is exception;&lt;br /&gt;
 *              Disable IRQs on current CPU;&lt;br /&gt;
 *              Set kill current task flag to TRUE;&lt;br /&gt;
 *              Issue SGI on current CPU, will be interrupted on return from Exception and&lt;br /&gt;
 *              this function will be called within IRQ handler&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT    System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT      System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE          Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_CPU_DYN_PTR_BAD      CPU dynamic area pointer corrupt&lt;br /&gt;
 *          ERR_ID_INVALID           Task ID invalid&lt;br /&gt;
 *          ERR_ID_WRONG             Task ID wrong&lt;br /&gt;
 *          ERR_CPU_ID_WRONG         CPU ID wrong&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceosmp_task_kill(&lt;br /&gt;
    U32_t task_id,&lt;br /&gt;
    U32_t cpu_id&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| task_id  || U32_t task ID to be killed (must be in range 0 to 254)&lt;br /&gt;
|-&lt;br /&gt;
| cpu_id  || U32_t CPU ID where task_id is to be killed&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT    || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT      || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE          || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_CPU_DYN_PTR_BAD      || CPU dynamic area pointer corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID           || Task ID invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG             || Task ID wrong&lt;br /&gt;
|-&lt;br /&gt;
| ERR_CPU_ID_WRONG         || CPU ID wrong&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Kill task t_2 on CPU cpu_1&lt;br /&gt;
status = oceosmp_task_kill(t_2, cpu_1);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;Mutex directives&amp;lt;/span&amp;gt;==&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_mutex_create()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''mutex.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function creates a mutex of specified ID with a specified priority ceiling.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Creates a mutex with priority ceiling&lt;br /&gt;
 *&lt;br /&gt;
 * NOTE: This function should only be called after OCEOSmp is initialised with&lt;br /&gt;
 *  oceos_init() and before initialisation ends with oceos_init_finish()&lt;br /&gt;
 *  and scheduling starts with oceos_start()&lt;br /&gt;
 *&lt;br /&gt;
 * @param mutex_id  mutex ID value 0 to 62&lt;br /&gt;
 * @param priority  mutex priority ceiling 1 to 254 (high to low task priority)&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_WRONG_CPU_CORE          Executing directive on wrong CPU&lt;br /&gt;
 *          ERR_WRONG_PHASE             Called before oceos_init() is done&lt;br /&gt;
 *          ERR_TOO_MANY                MAX number of MUTEXs already created&lt;br /&gt;
 *          ERR_ID_INVALID              MUTEX ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                MUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
 *          ERR_MX_ALREADY_ALLOCATED    MUTEX ID already used&lt;br /&gt;
 *          ERR_MX_PRIORITY_WRONG       MUTEX priority ceiling outside allowed range 1 to 254&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_mutex_create(&lt;br /&gt;
    const U32_t mutex_id,  // mutex ID, must be in range 0 to 62&lt;br /&gt;
    const U8_t  priority  // mutex priority ceiling&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| mutex_id  || u32_t mutex ID to be created (value 0 to 62).&lt;br /&gt;
|-&lt;br /&gt;
| priority_ceiling ||  U32_t mutex priority ceiling 1 to 254 (high to low task priority)&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_CPU_CORE          || Executing directive on wrong CPU&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Called before oceos_init() is done&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TOO_MANY                || MAX number of MUTEXs already created&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || MUTEX ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || MUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_MX_ALREADY_ALLOCATED    || MUTEX ID already used&lt;br /&gt;
|-&lt;br /&gt;
| ERR_MX_PRIORITY_WRONG       || MUTEX priority ceiling outside allowed range 1 to 254&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Create mutex with ID print_mutex and priority ceiling of 5&lt;br /&gt;
status = oceos_mutex_create(print_mutex, 5);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_mutex_wait()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''mutex.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function makes the task wait until the specified mutex is available.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
 /*&lt;br /&gt;
  * Wait on mutex with ID.&lt;br /&gt;
  * If task succeeds in grabbing mutex, system level priority rises to&lt;br /&gt;
  * priority of this mutex, so tasks with lower or equal priority will&lt;br /&gt;
  * not be able to start till mutex is released.&lt;br /&gt;
  *&lt;br /&gt;
  * This should only be called after OCEOSmp scheduling has started.&lt;br /&gt;
  *&lt;br /&gt;
  * @param mutex_id     const U32_t  : value 0 to 62&lt;br /&gt;
  *&lt;br /&gt;
  * @return  OCEOS_SUCCESS&lt;br /&gt;
  *          WARN_MX_INCORRECT_ORDER     MUTEX acquired in incorrect order&lt;br /&gt;
  *&lt;br /&gt;
  *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
  *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
  *          ERR_WRONG_PHASE             Directive was called before OCEOSmp initialisation is finished&lt;br /&gt;
  *          ERR_ID_INVALID              MUTEX ID outside allowed range 0 to 62&lt;br /&gt;
  *           ERR_ID_WRONG                MUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
  *          ERR_MX_CEILING_BAD          MUTEX ceiling not lower priority than job priority&lt;br /&gt;
  *          ERR_MX_ALREADY_HELD         MUTEX already held by this job&lt;br /&gt;
  *          ERR_SYS_BUSY                Failed to grab context switch guard&lt;br /&gt;
  */&lt;br /&gt;
S32_t oceos_mutex_wait(&lt;br /&gt;
    const U32_t  mutex_id      // mutex ID, must be in range 0 to 62&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| mutex_id  || u32_t mutex ID to be waited on (value 0 to 62).&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| WARN_MX_INCORRECT_ORDER     || MUTEX acquired in incorrect order&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOSmp initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || MUTEX ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || MUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_MX_CEILING_BAD          || MUTEX ceiling not lower priority than job priority&lt;br /&gt;
|-&lt;br /&gt;
| ERR_MX_ALREADY_HELD         || MUTEX already held by this job&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to grab context switch guard&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Wait on mutex m_2&lt;br /&gt;
status = oceos_mutex_wait(m_2);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_mutex_signal()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''mutex.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function signals the specified mutex.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Signal a mutex with ID&lt;br /&gt;
 *&lt;br /&gt;
 * N.B. :&lt;br /&gt;
 *      This function should not be called from an interrupt handler&lt;br /&gt;
 *      This should only be called after OCEOSmp scheduling has started.&lt;br /&gt;
 *&lt;br /&gt;
 * @param mutex_id     const U32_t  : value 0 to 62&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          WARN_MX_ALREADY_FREE        MUTEX is free already&lt;br /&gt;
 *          WARN_MX_NESTING_BAD         MUTEX nesting incorrect&lt;br /&gt;
 *&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOSmp initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              MUTEX ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                MUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
 *          ERR_MX_WRONG_JOB            MUTEX not held by this job&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to grab context switch guard&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_mutex_signal(&lt;br /&gt;
    const U32_t  mutex_id     // mutex ID, must be in range 0 to 62&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| mutex_id  || u32_t mutex ID to be signalled (value 0 to 62).&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| WARN_MX_ALREADY_FREE        || MUTEX is free already&lt;br /&gt;
|-&lt;br /&gt;
| WARN_MX_NESTING_BAD         || MUTEX nesting incorrect&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOSmp initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || MUTEX ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || MUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_MX_WRONG_JOB            || MUTEX not held by this job&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to grab context switch guard&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Signal mutex m_2&lt;br /&gt;
status = oceos_mutex_signal(m_2);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_mutex_get_value()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''mutex.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the value of the specified mutex.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Get current value of mutex with ID&lt;br /&gt;
 *&lt;br /&gt;
 * @param mutex_id      const U32_t  : value 0 to 62&lt;br /&gt;
 * @param m_value       pointer to MUTEX value holder&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOSmp initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              MUTEX ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                MUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
 *          ERR_MX_DATA_PTR_BAD         Pointer to MUTEX value return holder is null&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_mutex_get_value(&lt;br /&gt;
    const U32_t  mutex_id,      // mutex ID, must be in range 0 to 62&lt;br /&gt;
    U32_t *m_value              // Pointer to MUTEX value holder&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| mutex_id  || u32_t mutex ID to be signalled (value 0 to 62)&lt;br /&gt;
|-&lt;br /&gt;
| m_value  || u32_t * pointer where mutex value is to be written&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOSmp initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || MUTEX ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || MUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_MX_DATA_PTR_BAD         || Pointer to MUTEX value return holder is null&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
U32_t value;&lt;br /&gt;
...&lt;br /&gt;
// Get value of mutex m_2&lt;br /&gt;
status = oceos_mutex_get_value(m_2, &amp;amp;value);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;Read/write mutex directives&amp;lt;/span&amp;gt;==&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;Read/write mutex overview&amp;lt;/span&amp;gt;===&lt;br /&gt;
&lt;br /&gt;
Contents:&lt;br /&gt;
&lt;br /&gt;
 1.  Read/Write Mutex features&lt;br /&gt;
 2.  Read/Write Mutex data structures&lt;br /&gt;
 3.  Read/Write Mutex constants&lt;br /&gt;
 4.  Read/Write Mutex manager Directives&lt;br /&gt;
&lt;br /&gt;
==== Read/Write Mutex Features ====&lt;br /&gt;
&lt;br /&gt;
Read/Write Mutexes (rwmutexes) can be held for 'read' at the same time&lt;br /&gt;
by multiple jobs on different CPUs, but once held for 'write' by any job&lt;br /&gt;
cannot be obtained for 'read' or for 'write' by another job until released.&lt;br /&gt;
&lt;br /&gt;
They can be used to allow data be read simultaneously by multiple jobs when&lt;br /&gt;
the data is not being updated while ensuring that no updating can take&lt;br /&gt;
place while any job is reading the data.&lt;br /&gt;
&lt;br /&gt;
Pending write requests take precedence over pending read requests and are&lt;br /&gt;
done on a first come, first served basis. Once any job on a CPU has a&lt;br /&gt;
rwmutex for 'read' no other job on that CPU can acquire it so as to avoid&lt;br /&gt;
potential problems and minimise delays in servicing write requests by other&lt;br /&gt;
CPUs.&lt;br /&gt;
&lt;br /&gt;
While any job holds a rwmutex for reading any job on another CPU can also&lt;br /&gt;
acquire it for reading. Other jobs on the same CPU that may attempt to&lt;br /&gt;
acquire the rwmutex are delayed in starting until return of the rwmutex.&lt;br /&gt;
No job can acquire the rwmutex for writing until all read acquisitions&lt;br /&gt;
have been returned.&lt;br /&gt;
&lt;br /&gt;
No job will acquire a rwmutex for reading if any job is trying to acquire&lt;br /&gt;
it for writing, giving write precedence over read. Multiple write requests&lt;br /&gt;
waiting for existing read acquisitions to complete are serviced in the&lt;br /&gt;
order in which they were made when the current read acquisitions complete.&lt;br /&gt;
&lt;br /&gt;
If a task waits on a rwmutex that it already holds a system log entry is&lt;br /&gt;
made (LOG_RWMUTEX_ALREADY_HELD) and an INTERNAL_ERROR status code returned.&lt;br /&gt;
&lt;br /&gt;
If a task attempts to release a rwmutex it does not hold a system log entry&lt;br /&gt;
is made (LOG_RWMUTEX_ALREADY_FREE) and an INTERNAL_ERROR status code returned.&lt;br /&gt;
&lt;br /&gt;
If a job holds more than one rwmutex at the same time these must be&lt;br /&gt;
acquired and released in a nested manner&lt;br /&gt;
(e.g. wait 1, wait 2, wait 3, signal 3, signal 2, signal 1).&lt;br /&gt;
&lt;br /&gt;
If a task exits while holding one or more rwmutexes these are returned and&lt;br /&gt;
a system log entry made (LOG_RWMUTEX_NOT_RETURNED).&lt;br /&gt;
&lt;br /&gt;
==== Read/Write Mutex data structures ====&lt;br /&gt;
&lt;br /&gt;
In OCEOSmp each rwmutex has a priority ceiling, the priority of the highest&lt;br /&gt;
priority task that acquires the rwmutex for read or for write.&lt;br /&gt;
OCEOSmp uses this to ensure that once a job on a particular CPU has the&lt;br /&gt;
rwmutex for reading or for writing no other job on that CPU can be started&lt;br /&gt;
that might try to obtain that rwmutex.&lt;br /&gt;
&lt;br /&gt;
The priority ceiling of a rwmutex is specified when the rwmutex is created&lt;br /&gt;
and does not change subsequently. Priority ceilings are stored in the&lt;br /&gt;
fixed data area as an array U8_t rwmutexCeilings[] indexed by mutex ID.&lt;br /&gt;
This array is extended to be a whole number of 32-bit words.&lt;br /&gt;
&lt;br /&gt;
A rwmutex has a unique rwmutex ID, an unsigned integer usually defined in&lt;br /&gt;
the application header file as an enum RWMUTEX_NAME{} thus allowing a&lt;br /&gt;
user-friendly name be associated with each rwmutex ID.&lt;br /&gt;
&lt;br /&gt;
Using an enum is strongly recommended as it allows a user-friendly name be&lt;br /&gt;
associated with each ID, and helps ensure IDs are contiguous from 0.&lt;br /&gt;
&lt;br /&gt;
These rwmutex IDs are used as indices into both fixed and dynamic data&lt;br /&gt;
arrays and must cover the range 0 to ((number of rwmutexes) -1). Using&lt;br /&gt;
enum RWMUTEX_NAME{} automatically assigns names to IDs 0, 1, 2...&lt;br /&gt;
&lt;br /&gt;
Read write mutex dynamic data such as the current write requests and&lt;br /&gt;
current read count are stored in the dynamic data area in an array of&lt;br /&gt;
struct rwmutex_dyn_block also indexed by the rwmutex ID.&lt;br /&gt;
&lt;br /&gt;
A further dynamic area array of guard_t is used in providing mutual&lt;br /&gt;
exclusion when updating the rwmutex dynamic data.&lt;br /&gt;
&lt;br /&gt;
==== Read/Write Mutex constants ====&lt;br /&gt;
&lt;br /&gt;
In OCEOSmp there can be a maximum of 63 rwmutexes,&lt;br /&gt;
with IDs from 0 to 62 (the value 63 is used as an invalid ID).&lt;br /&gt;
&lt;br /&gt;
The rwmutexes can be created in any order, but OCEOSmp will return an error&lt;br /&gt;
and fail to start if the resulting IDs fail to be contiguous from 0 as IDs&lt;br /&gt;
are used by OCEOS as indices into arrays.&lt;br /&gt;
&lt;br /&gt;
Each rwmutex has a priority ceiling, the priority of the highest priority&lt;br /&gt;
task that uses the rwmutex for reading or for writing. This is specified&lt;br /&gt;
when the rwmutex is created, does not change subsequently, and must be in&lt;br /&gt;
the range 1 (TASK_MAX_PRIORITY) to 254 (TASK_MIN_PRIORITY).&lt;br /&gt;
The application developer must ensure that the correct rwmutex ceiling&lt;br /&gt;
is used. OCEOSmp will detect an attempt to acquire a rwmutex by a task&lt;br /&gt;
with higher priority than that rwmutex's priority ceiling, make a&lt;br /&gt;
system log entry (LOG_RWMUTEX_BAD_CEILING) and return an INTERNAL_ERROR&lt;br /&gt;
status code.&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_rwmutex_create()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''rwmutex.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function ees a read/write mutex.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Creates a Read/Write Mutex (RWMUTEX)&lt;br /&gt;
 *&lt;br /&gt;
 * This function should only be called after OCEOSmp is initialised with&lt;br /&gt;
 * oceos_init() and before initialisation ends with oceos_init_finish()&lt;br /&gt;
 * and scheduling starts with oceos_start()&lt;br /&gt;
 *&lt;br /&gt;
 * @param rwm_id    Read/Write RWMUTEX ID, must be in range 0 to 62&lt;br /&gt;
 * @param priority  Priority ceiling of highest priority task that uses the RWMUTEX&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_WRONG_CPU_CORE          Executing directive on wrong CPU&lt;br /&gt;
 *          ERR_WRONG_PHASE             Called before oceos_init() is done&lt;br /&gt;
 *          ERR_TOO_MANY                MAX number of RWMUTEXs already created&lt;br /&gt;
 *          ERR_ID_INVALID              RWMUTEX ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                RWMUTEX ID &amp;gt;= number of RWMUTEXs&lt;br /&gt;
 *          ERR_RWMX_ALREADY_ALLOCATED  RWMUTEX ID already used&lt;br /&gt;
 *          ERR_RWMX_PRIORITY_WRONG     RWMUTEX priority ceiling outside allowed range 1 to 254&lt;br /&gt;
 */&lt;br /&gt;
S32_t   oceos_rwmutex_create(&lt;br /&gt;
    const U32_t rwm_id,   // RWMUTEX ID, must be in range 0 to max rwm&lt;br /&gt;
    const U8_t priority   // RWMUTEX priority ceiling&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| rwm_id || Read/Write RWMUTEX ID, must be in range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| priority || Priority ceiling of highest priority task that uses the RWMUTEX&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_CPU_CORE          || Executing directive on wrong CPU&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Called before oceos_init() is done&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TOO_MANY                || MAX number of RWMUTEXs already created&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || RWMUTEX ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || RWMUTEX ID &amp;gt;= number of RWMUTEXs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_RWMX_ALREADY_ALLOCATED  || RWMUTEX ID already used&lt;br /&gt;
|-&lt;br /&gt;
| ERR_RWMX_PRIORITY_WRONG     || RWMUTEX priority ceiling outside allowed range 1 to 254&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Create read/write mutex with ID rwm_2 and priority ceiling of 100 &lt;br /&gt;
status = oceos_rwmutex_create(rwm_1, 100);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_rwmutex_read_wait()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''rwmutex.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function acquires a read/write mutex for read. If successful, jobs on other CPUs can also acquire it for read, but no job will be able to acquire it for write while any read is under way. If job already holds RWMUTEX for read or for write the appropriate status code is returned, a system log entry made, and the job continues. It will not succeed while any job is waiting to obtain RWMUTEX for write, and will loop waiting for all pending writes on this RWMUTEX to complete.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Read wait on RWMUTEX.&lt;br /&gt;
 *&lt;br /&gt;
 * If successful jobs on other CPUs can also acquire it for read, but no job&lt;br /&gt;
 * will be able to acquire it for write while any read is under way.&lt;br /&gt;
 * If job already holds RWMUTEX for read or for write appropriate status code&lt;br /&gt;
 * is returned, a system log entry made, and the job continues.&lt;br /&gt;
 * Will not succeed while any job is waiting to obtain RWMUTEX for write,&lt;br /&gt;
 * will loop waiting for all pending writes on this RWMUTEX to complete.&lt;br /&gt;
 *&lt;br /&gt;
 * This should only be called after OCEOS scheduling has started.&lt;br /&gt;
 *&lt;br /&gt;
 * N.B.	The returned status code must be checked and appropriate action&lt;br /&gt;
 * 		taken.&lt;br /&gt;
 *&lt;br /&gt;
 * @param rwm_id    const U32_t  : value 0 to 62&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          WARN_RWMX_NOT_HIGHEST       Already holds a RWMUTEX higher in the RWMUTEX order&lt;br /&gt;
 *                                      (there then may be a risk of deadlock)&lt;br /&gt;
 *&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              RWMUTEX ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                RWMUTEX ID &amp;gt;= number of RWMUTEXs&lt;br /&gt;
 *          ERR_RWMX_CEILING_BAD        RWMUTEX ceiling not lower priority than job priority&lt;br /&gt;
 *          ERR_RWMX_ALREADY_HELD       RWMUTEX already held by this job&lt;br /&gt;
 *          ERR_RWMX_CPU_STACK_FULL     CPU priority ceiling stack full&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_rwmutex_read_wait(&lt;br /&gt;
    const U32_t rwm_id  // RWMUTEX ID, must be in range 0 to 62&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| rwm_id || U32_t rwmutex to be acquired for read (value 0 to 62)&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| WARN_RWMX_NOT_HIGHEST       || Already holds a RWMUTEX higher in the RWMUTEX order (deadlock risk)&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || RWMUTEX ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || RWMUTEX ID &amp;gt;= number of RWMUTEXs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_RWMX_CEILING_BAD        || RWMUTEX ceiling not lower priority than job priority&lt;br /&gt;
|-&lt;br /&gt;
| ERR_RWMX_ALREADY_HELD       || RWMUTEX already held by this job&lt;br /&gt;
|-&lt;br /&gt;
| ERR_RWMX_CPU_STACK_FULL     || CPU priority ceiling stack full&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Acquire read/write mutex rwm_1 for read&lt;br /&gt;
status = oceos_rwmutex_read_wait(rwm_1);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_rwmutex_write_wait()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''rwmutex.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function acquires the specified read/write mutex for write.&lt;br /&gt;
If successful, no other job can also obtain it for reading or for writing. Will not succeed while any other job has acquired RWMUTEX for write,&lt;br /&gt;
or any jobs have obtained RWMUTEX for read. Will then loop until the RWMUTEX is released and for its turn in the sequence of jobs that have tried to acquire the RWMUTEX for writing. If already holds the RWMUTEX for writing or reading an appropriate status code is returned, a system log entry made, and the job continues. While there are any outstanding attempts to obtain the RWMUTEX for write no job will be able to acquire it for reading.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Write wait on RWMUTEX.&lt;br /&gt;
 *&lt;br /&gt;
 * If successful no other job can also obtain it for reading or for writing.&lt;br /&gt;
 * Will not succeed while any other job has acquired RWMUTEX for write,&lt;br /&gt;
 * or any jobs have obtained RWMUTEX for read. Will then loop until the&lt;br /&gt;
 * RWMUTEX is released and for its turn in the sequence of jobs that have&lt;br /&gt;
 * tried to acquire the RWMUTEX for writing.&lt;br /&gt;
 * If already holds the RWMUTEX for writing or reading an appropriate status&lt;br /&gt;
 * code is returned, a system log entry made, and the job continues.&lt;br /&gt;
 * While there are any outstanding attempts to obtain the RWMUTEX for write&lt;br /&gt;
 * no job will be able to acquire it for reading.&lt;br /&gt;
 *&lt;br /&gt;
 * This should only be called after OCEOS scheduling has started.&lt;br /&gt;
 *&lt;br /&gt;
 * N.B.	The returned status code must be checked and appropriate action&lt;br /&gt;
 * 		taken.&lt;br /&gt;
 *&lt;br /&gt;
 * @param rwm_id     const U32_t  : value 0 to 62&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          WARN_RWMX_NOT_HIGHEST       Already holds a RWMUTEX higher in the RWMUTEX order&lt;br /&gt;
 *                                      (there then may be a risk of deadlock)&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              RWMUTEX ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                RWMUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
 *          ERR_RWMX_CEILING_BAD        RWMUTEX ceiling not lower priority than job priority&lt;br /&gt;
 *          ERR_RWMX_ALREADY_HELD       RWMUTEX already held by this job&lt;br /&gt;
 *          ERR_RWMX_CPU_STACK_FULL     CPU priority ceiling stack full&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_rwmutex_write_wait(&lt;br /&gt;
    const U32_t rwm_id  // RWMUTEX ID, must be in range 0 to 62&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| rwm_id || U32_t rwmutex to be acquired for write(value 0 to 62)&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| WARN_RWMX_NOT_HIGHEST       || Already holds a RWMUTEX higher in the RWMUTEX order (deadlock risk)&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || RWMUTEX ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || RWMUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_RWMX_CEILING_BAD        || RWMUTEX ceiling not lower priority than job priority&lt;br /&gt;
|-&lt;br /&gt;
| ERR_RWMX_ALREADY_HELD       || RWMUTEX already held by this job&lt;br /&gt;
|-&lt;br /&gt;
| ERR_RWMX_CPU_STACK_FULL     || CPU priority ceiling stack full&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Acquire read/write mutex rwm_1 for write&lt;br /&gt;
status = oceos_rwmutex_read_wait(rwm_1);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_rwmutex_signal()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''rwmutex.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function signals the specified read/write mutex.&lt;br /&gt;
It frees the RWMUTEX for use by other jobs, irrespective of whether the RWMUTEX is held for reading or for writing. If the RWMUTEX is not held by the job then it returns an appropriate status code. It does not take into account how many times a job has obtained the RWMUTEX for read or for write.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Signal a RWMUTEX&lt;br /&gt;
 *&lt;br /&gt;
 * Frees the RWMUTEX for use by other jobs, irrespective of whether&lt;br /&gt;
 * RWMUTEX is held for reading or for writing.&lt;br /&gt;
 * if the RWMUTEX is not held by the job returns an appropriate status code.&lt;br /&gt;
 * Does not take into account how many times a job has obtained the RWMUTEX&lt;br /&gt;
 * for read or for write.&lt;br /&gt;
 *&lt;br /&gt;
 * This should only be called after OCEOS scheduling has started.&lt;br /&gt;
 *&lt;br /&gt;
 * N.B. The returned status code must be checked and appropriate action taken.&lt;br /&gt;
 *&lt;br /&gt;
 * @param rwm_id    const U32_t  : value 0 to 62&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          WARN_RWMX_ALREADY_FREE      RWMUTEX is free already&lt;br /&gt;
 *&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              RWMUTEX ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                RWMUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
 *          ERR_RWMX_CEILING_BAD        RWMUTEX ceiling not lower priority than job priority&lt;br /&gt;
 *          ERR_RWMX_CPU_STACK_EMPTY    CPU priority ceiling stack empty&lt;br /&gt;
 *          ERR_RWMX_CEILING_INVALID    CPU current priority ceiling on the priority stack is invalid&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_rwmutex_signal(&lt;br /&gt;
    const U32_t rwm_id // RWMUTEX ID, must be in range 0 to 62&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| rwm_id || U32_t rwmutex to be signaled(value 0 to 62)&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| WARN_RWMX_ALREADY_FREE      || RWMUTEX is free already&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || RWMUTEX ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || RWMUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_RWMX_CEILING_BAD        || RWMUTEX ceiling not lower priority than job priority&lt;br /&gt;
|-&lt;br /&gt;
| ERR_RWMX_CPU_STACK_EMPTY    || CPU priority ceiling stack empty&lt;br /&gt;
|-&lt;br /&gt;
| ERR_RWMX_CEILING_INVALID    || CPU current priority ceiling on the priority stack is invalid&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Signal read/write mutex number rwm_4&lt;br /&gt;
status = oceos_rwmutex_signal(rwm_4);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_rwmutex_check_status()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''rwmutex.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function checks the status of a read/write mutex. The possible states are free, in-use for read, and in-use for write.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Check whether RWMUTEX is free&lt;br /&gt;
 *&lt;br /&gt;
 * @param rwm_id        must be in range 0 to 62&lt;br /&gt;
 * @param m_status      pointer to RWMUTEX status holder;&lt;br /&gt;
 *                      if return code OCEOS_SUCCESS RWMUTEX status:&lt;br /&gt;
 *                          0 =&amp;gt; Free for use&lt;br /&gt;
 *                          1 =&amp;gt; In use for read&lt;br /&gt;
 *                          2 =&amp;gt; In use for write&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              RWMUTEX ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                RWMUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
 *          ERR_RWMX_DATA_PTR_BAD       Pointer to RWMUTEX status return holder is null&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_rwmutex_check_status(&lt;br /&gt;
    const U32_t rwm_id, // RWMUTEX ID, must be in range 0 to 62&lt;br /&gt;
    U32_t *m_status&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| rwm_id || read/write mutex number in range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| m_status || U32_t pointer to RWMUTEX status holder (0 = free, 1 = in-use for read, 2 = in-use for write &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || RWMUTEX ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || RWMUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_RWMX_DATA_PTR_BAD       || Pointer to RWMUTEX status return holder is null&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, rwm_status;&lt;br /&gt;
...&lt;br /&gt;
// Check the status of read/write mutex rwm_2&lt;br /&gt;
status = oceos_rwmutex_check_status(rwm_2, &amp;amp;rwm_status);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_rwmutex_reading_count()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''rwmutex.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the current number of jobs holding a specified read/write mutex for read.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 *&lt;br /&gt;
 * Get current number of jobs holding RWMUTEX for read&lt;br /&gt;
 *&lt;br /&gt;
 * @param rwm_id    must be in range 0 to 62&lt;br /&gt;
 * @param m_count   pointer to RWMUTEX count holder&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              RWMUTEX ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                RWMUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
 *          ERR_RWMX_DATA_PTR_BAD       Pointer to RWMUTEX count return holder is null&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_rwmutex_reading_count(&lt;br /&gt;
    const U32_t rwm_id, // RWMUTEX ID, must be in range 0 to 62&lt;br /&gt;
    U32_t *m_count&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| rwm_id || U32 value of read/write mutex (in range 0 to 62)&lt;br /&gt;
|-&lt;br /&gt;
| m_count || U32_t pointer to read/write mutex count holder&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || RWMUTEX ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || RWMUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_RWMX_DATA_PTR_BAD       || Pointer to RWMUTEX count return holder is null&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, rwm_count;&lt;br /&gt;
...&lt;br /&gt;
// Get the number of jobs holding the read/write mutex rwm_2 for read&lt;br /&gt;
status = oceos_rwmutex_reading_count(rwm_2, &amp;amp;rwm_count);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_rwmutex_write_reqs_count()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''header.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the current number of write requests for the specified read/write mutex .&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Get current RWMUTEX write requests count&lt;br /&gt;
 *&lt;br /&gt;
 * @param rwm_id    must be in range 0 to 62&lt;br /&gt;
 * @param m_count   pointer to RWMUTEX count holder&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              RWMUTEX ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                RWMUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
 *          ERR_RWMX_DATA_PTR_BAD       Pointer to RWMUTEX count return holder is null&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_rwmutex_write_reqs_count(&lt;br /&gt;
    const U32_t rwm_id, // RWMUTEX ID, must be in range 0 to 62&lt;br /&gt;
    U32_t *m_count&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| rwm_id || U32_t value of read/write mutex (must be in range 0 to 62)&lt;br /&gt;
|-&lt;br /&gt;
| m_count || U32_t pointer to read/write mutex count holder&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || RWMUTEX ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || RWMUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_RWMX_DATA_PTR_BAD       || Pointer to RWMUTEX count return holder is null&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, rwm_count;&lt;br /&gt;
...&lt;br /&gt;
// Get the count of cuurent write requests for read/write mutex rwm_1&lt;br /&gt;
status = oceos_rwmutex_write_reqs_count(rwm_1, &amp;amp;rwm_count);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_rwmutex_writes_pending_count()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''rwmutex.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the current number of pending writes for the specified read/write mutex.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Get current RWMUTEX writes pending count&lt;br /&gt;
 *&lt;br /&gt;
 * @param rwm_id    must be in range 0 to 62&lt;br /&gt;
 * @param m_count   pointer to RWMUTEX count holder&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              RWMUTEX ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                RWMUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
 *          ERR_RWMX_DATA_PTR_BAD       Pointer to RWMUTEX pending count return holder is null&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_rwmutex_writes_pending_count(&lt;br /&gt;
    const U32_t rwm_id, // RWMUTEX ID, must be in range 0 to 62&lt;br /&gt;
    U32_t *m_count&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| rwm_id || U32_t value of read/write mutex (must be in range 0 to 62)&lt;br /&gt;
|-&lt;br /&gt;
| m_count || U32_t pointer to read/write mutex count holder&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || RWMUTEX ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || RWMUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_RWMX_DATA_PTR_BAD       || Pointer to RWMUTEX count return holder is null&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, rwm_count;&lt;br /&gt;
...&lt;br /&gt;
// Get the count of cuurent write requests for read/write mutex rwm_1&lt;br /&gt;
status = oceos_rwmutex_writes_pending_count(rwm_1, &amp;amp;rwm_count);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_rwmutex_holding()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''header.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the read/write mutexes currently held by this instance of this task (job).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Get RWMUTEXs currently held by this instance of the task (job)&lt;br /&gt;
 *&lt;br /&gt;
 * @param m_data    U64_t pointer, each bit indicating RWMUTEX held by current task&lt;br /&gt;
 *                          0 =&amp;gt; Not held by job&lt;br /&gt;
 *                          1 =&amp;gt; Held by job&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_RWMX_DATA_PTR_BAD       Pointer to RWMUTEX status return holder is null&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_rwmutex_holding(&lt;br /&gt;
    U64_t *m_data&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| m_data || U64_t pointer, each bit indicating RWMUTEX held by current task, 0 =&amp;gt; not held, 1 =&amp;gt; held &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_RWMX_DATA_PTR_BAD       || Pointer to RWMUTEX status return holder is null&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
U64_t rwm_held;&lt;br /&gt;
...&lt;br /&gt;
// Which read/write mutexes does this job hold&lt;br /&gt;
status = oceos_rwmutex_holding(&amp;amp;rwm_held);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Semaphores directives ==&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_sem_create()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''semaphore.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function creates a semaphore.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Create a counting semaphore&lt;br /&gt;
 *&lt;br /&gt;
 * @param sem_id            SEMAPHORE ID (from 0 to 62)&lt;br /&gt;
 * @param max_permits       number of max permits allowed for this SEMAPHORE, 1 to 4095&lt;br /&gt;
 * @param count_permits     starting number of permits available 0 to 4095&lt;br /&gt;
 * @param pending_q_size    MAX Number of tasks on SEMAPHORE pending queue 1 to 253&lt;br /&gt;
 * @param use_timeout       if TRUE, directive oceos_sem_wait_restart_timeout can be used&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_WRONG_CPU_CORE          Executing directive on wrong CPU&lt;br /&gt;
 *          ERR_WRONG_PHASE             Called before oceos_init() is done&lt;br /&gt;
 *          ERR_TOO_MANY                MAX number of SEMAPHOREs already created&lt;br /&gt;
 *          ERR_ID_INVALID              SEMAPHORE ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                SEMAPHORE ID &amp;gt;= number of SEMAPHOREs&lt;br /&gt;
 *          ERR_SM_ALREADY_ALLOCATED    SEMAPHORE ID already used&lt;br /&gt;
 *          ERR_SM_MAX_PERMIT_WRONG     MAX permits outside allowed range 1 to 4095&lt;br /&gt;
 *          ERR_SM_COUNT_PERMIT_WRONG   Count permits outside allowed range 0 to 4095&lt;br /&gt;
 *          ERR_SM_COUNT_PERMIT_INVALID Count permits is greater than MAX permits for this SEMAPHORE&lt;br /&gt;
 *          ERR_SM_PENQ_SIZE_WRONG      SEMAPHORE pending queue size outside allowed range 1 to 253&lt;br /&gt;
 *          ERR_SM_TA_MAX_NUM_REACHED   Number of timed actions exceeds MAX allowed 255,&lt;br /&gt;
 *                                      each task on SEMAPHORE pending queue is timed action&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_sem_create(&lt;br /&gt;
    sem_t sem_id,         // counting semaphore ID (MAX 63)&lt;br /&gt;
    U16_t max_permits,    // max number of permits (MAX 4095)&lt;br /&gt;
    U16_t count_permits,  // initial number of permits (MAX 4095)&lt;br /&gt;
    U8_t  pending_q_size, // max number of pending queue jobs (MAX 253)&lt;br /&gt;
    BOOLE_t use_timeout   // whether timeout is used in oceos_sem_wait_restart_timeout&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| sem_id || Semaphore ID to be created (from 0 to 62)&lt;br /&gt;
|-&lt;br /&gt;
| max_permits || number of max permits allowed for this semaphore, 1 to 4095&lt;br /&gt;
|-&lt;br /&gt;
| count_permits || starting number of permits available 0 to 4095&lt;br /&gt;
|-&lt;br /&gt;
| pending_q_size || Maximum Number of tasks on SEMAPHORE pending queue 1 to 253&lt;br /&gt;
|-&lt;br /&gt;
| use_timeout || if TRUE, directive oceos_sem_wait_restart_timeout can be used&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_CPU_CORE          || Executing directive on wrong CPU&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Called before oceos_init() is done&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TOO_MANY                || MAX number of SEMAPHOREs already created&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || SEMAPHORE ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || SEMAPHORE ID &amp;gt;= number of SEMAPHOREs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SM_ALREADY_ALLOCATED    || SEMAPHORE ID already used&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SM_MAX_PERMIT_WRONG     || MAX permits outside allowed range 1 to 4095&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SM_COUNT_PERMIT_WRONG   || Count permits outside allowed range 0 to 4095&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SM_COUNT_PERMIT_INVALID || Count permits is greater than MAX permits for this SEMAPHORE&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SM_PENQ_SIZE_WRONG      || SEMAPHORE pending queue size outside allowed range 1 to 253&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SM_TA_MAX_NUM_REACHED   || Number of timed actions exceeds MAX allowed 255&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, param;&lt;br /&gt;
...&lt;br /&gt;
// Create semaphore called s_audi with max permits of 1000, starting permits of zero, max of 10 tasks on pending queue, and no timeouts &lt;br /&gt;
status = oceos_sem_create(s_audi, 1000, 0, 10, FALSE);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_sem_signal()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''semaphore.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function signals a semaphore, increments its count and transfers pending jobs to the ready queue.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Signals a semaphore, increments and transfers pending jobs to ready queue&lt;br /&gt;
 *&lt;br /&gt;
 * @param sem_id counting SEM ID&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          WARN_JOB_NOT_GUARDED&lt;br /&gt;
 *&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              SEM ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                SEM ID &amp;gt;= number of SEMs&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to grab SEM guard&lt;br /&gt;
 *          ERR_TOO_MANY                SEM max permits count already reached&lt;br /&gt;
 *          ERR_SM_JOB_ID_WRONG         Job ID of the task on SEM pending queue is wrong&lt;br /&gt;
 *          ERR_TA_NOT_FOUND            Timed action index to be removed for job not found&lt;br /&gt;
 *          ERR_TA_START_FAILED         Timed action re-start failed after job remove from timed action queue&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_sem_signal(&lt;br /&gt;
    sem_t sem_id // counting SEM ID&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| sem_id || U32_t value of semaphore to be signalled (incremented)&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| WARN_JOB_NOT_GUARDED        || job not guarded, application should check system log&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || SEM ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || SEM ID &amp;gt;= number of SEMs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to grab SEM guard&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TOO_MANY                || SEM max permits count already reached&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SM_JOB_ID_WRONG         || Job ID of the task on SEM pending queue is wrong&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_NOT_FOUND            || Timed action index to be removed for job not found&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_START_FAILED         || Timed action re-start failed after job remove from timed action queue&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Signal s_audi semaphore (increment its count)&lt;br /&gt;
status = oceos_sem_signal(s_audi);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_sem_wait_continue()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''semaphore.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function decrements the available permits of a sempahore otherwise returns an unsuccessful status code.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Wait on semaphore,&lt;br /&gt;
 * decrement the number of available permits for semaphore,&lt;br /&gt;
 * if no permits continue and task should handle unsuccessful result&lt;br /&gt;
 *&lt;br /&gt;
 * @param sem_id SEM ID&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              SEM ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                SEM ID &amp;gt;= number of SEMs&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to grab SEM guard&lt;br /&gt;
 *          ERR_SM_NOT_AVAILABLE        No more permits available for this SEM&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_sem_wait_continue(&lt;br /&gt;
    sem_t sem_id // counting SEM ID&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| sem_id || U32_t value of semaphore to be decremented&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || SEM ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || SEM ID &amp;gt;= number of SEMs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to grab SEM guard&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SM_NOT_AVAILABLE        || No more permits available for this SEM&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Decrement available permits on semaphore s_1&lt;br /&gt;
status = oceos_sem_wait_continue(s_1);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_sem_wait_restart()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''semaphore.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function decrements the available permits of a sempahore and if none available, the job is put on the pending queue.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Waits on semaphore,&lt;br /&gt;
 * if fail, put job on pending queue and exit task&lt;br /&gt;
 *&lt;br /&gt;
 * @param sem_id SEM ID&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              SEM ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                SEM ID &amp;gt;= number of SEMs&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to grab SEM guard&lt;br /&gt;
 *          ERR_SM_J_START_FROM_TIMOUT  Task started from timeout already, SEM no permits available second time&lt;br /&gt;
 *          ERR_FAILED                  Should never return this&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_sem_wait_restart(&lt;br /&gt;
    sem_t sem_id  // counting SEM ID&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| sem_id || U32_t value of semaphore to be decremented&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || SEM ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || SEM ID &amp;gt;= number of SEMs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to grab SEM guard&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SM_J_START_FROM_TIMOUT  || Task started from timeout already, SEM no permits available second time&lt;br /&gt;
|-&lt;br /&gt;
| ERR_FAILED                  || Should never return this&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Decrement available permits on semaphore s_1 otherwise job is put on pending queue&lt;br /&gt;
status = oceos_sem_wait_restart(s_1);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_sem_wait_restart_timeout()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''semaphore.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function decrements the available permits of a sempahore and if none available, the job is put on the pending queue with a timeout enabled. The job is restarted either when a permit is available to be decremented or when the timeout has expired. In order to use this directive, semaphore must be created with flag use_timeout is set to TRUE.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Waits on semaphore,&lt;br /&gt;
 * if fail, put job on pending queue with optional timeout.&lt;br /&gt;
 * In order to use this directive, semaphore must be created with&lt;br /&gt;
 * flag use_timeout is set to TRUE&lt;br /&gt;
 *&lt;br /&gt;
 * @param sem_id         SEM ID&lt;br /&gt;
 * @param U64_t timeout  Restart time if no permits, 0 =&amp;gt; ignore&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_TA_NOT_INIT             Timed action intialisation is not done and tried to be used; or SEM created without timeouts&lt;br /&gt;
 *          ERR_ID_INVALID              SEM ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                SEM ID &amp;gt;= number of SEMs&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to grab SEM guard&lt;br /&gt;
 *          ERR_SM_J_START_FROM_TIMOUT  Task started from timeout already, SEM no permits available second time&lt;br /&gt;
 *          ERR_TOO_MANY                SEM pending queue is full&lt;br /&gt;
 *          ERR_FAILED                  Should never return this&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_sem_wait_restart_timeout(&lt;br /&gt;
    sem_t sem_id, // counting SEM ID&lt;br /&gt;
    U64_t timeout // timeout, restart time if no permits, 0 =&amp;gt; ignore&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| sem_id || U32_t value of semaphore to be decremented&lt;br /&gt;
|-&lt;br /&gt;
| timeout | U64_t timeout in time units. A value of 0 causes timeout to be ignored.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_NOT_INIT             || Timed action intialisation is not done and tried to be used; or SEM created without&lt;br /&gt;
timeouts&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || SEM ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || SEM ID &amp;gt;= number of SEMs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to grab SEM guard&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SM_J_START_FROM_TIMOUT  || Task started from timeout already, SEM no permits available second time&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TOO_MANY                || SEM pending queue is full&lt;br /&gt;
|-&lt;br /&gt;
| ERR_FAILED                  || Should never return this&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Decrement available permits on semaphore s_1 otherwise job is put on pending queue with timeout of 10,000 time units (usually usecs)&lt;br /&gt;
status = oceos_sem_wait_restart_timeout(s_1);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_sem_get_value()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''semaphore.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the number of available permits for the specified semaphore.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Returns number of available permits&lt;br /&gt;
 * for SEM ID&lt;br /&gt;
 *&lt;br /&gt;
 * @param sem_id        SEM id&lt;br /&gt;
 * @param s_permits     pointer to permits count holder&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              SEM ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                SEM ID &amp;gt;= number of SEMs&lt;br /&gt;
 *          ERR_SM_DATA_BAD             Data holder pointer is null&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_sem_get_value(&lt;br /&gt;
    sem_t sem_id,    // counting SEM ID&lt;br /&gt;
    U32_t *s_permits // pointer to permits count holder&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| sem_id || U32_t value of semaphore whose permit count is required&lt;br /&gt;
|-&lt;br /&gt;
| s_permits || U32_t pointer to permits count holder&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || SEM ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || SEM ID &amp;gt;= number of SEMs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SM_DATA_BAD             || Data holder pointer is null&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, permit_count;&lt;br /&gt;
...&lt;br /&gt;
// Get the available permits for semaphore s_1&lt;br /&gt;
status = oceos_sem_get_value(s_1, &amp;amp;permit_count);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_sem_penq_get_size()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''semaphore.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the number of jobs on the specified semaphore pending queue.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Returns number of jobs on semaphore pending queue&lt;br /&gt;
 * for semaphore ID&lt;br /&gt;
 *&lt;br /&gt;
 * @param sem_id    SEM id&lt;br /&gt;
 * @param s_size    pointer to pending queue size holder&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              SEM ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                SEM ID &amp;gt;= number of SEMs&lt;br /&gt;
 *          ERR_SM_DATA_BAD             Data holder pointer is null&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_sem_penq_get_size(&lt;br /&gt;
    sem_t sem_id,   // counting SEM ID&lt;br /&gt;
    U32_t *s_size   // pointer to pending queue size holder&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| sem_id || U32_t value of semaphore whose permit count is required&lt;br /&gt;
|-&lt;br /&gt;
| s_size || U32_t pointer to pending queue jobs count holder&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || SEM ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || SEM ID &amp;gt;= number of SEMs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SM_DATA_BAD             || Data holder pointer is null&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, job_count;&lt;br /&gt;
...&lt;br /&gt;
// Get the available permits for semaphore s_1&lt;br /&gt;
status = oceos_sem_penq_get_size(s_1, &amp;amp;job_count);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_sem_reset()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''semaphore.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function restores the permits to the original semaphore initial value and removes any jobs from the pending queue.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Restore permits to original value and&lt;br /&gt;
 * remove jobs from pending queue&lt;br /&gt;
 *&lt;br /&gt;
 * @param sem_id    SEM ID&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              SEM ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                SEM ID &amp;gt;= number of SEMs&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to grab SEM guard&lt;br /&gt;
 *          ERR_SM_JOB_ID_WRONG         Job ID of the task on SEM pending queue is wrong&lt;br /&gt;
 *          ERR_TA_NOT_FOUND            Timed action index to be removed for job not found&lt;br /&gt;
 *          ERR_TA_START_FAILED         Timed action re-start failed after job remove from timed action queue&lt;br /&gt;
 */&lt;br /&gt;
S32_t   oceos_sem_reset(&lt;br /&gt;
    sem_t sem_id   // counting SEM ID&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| sem_id || U32_t value of semaphore to be reset&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || SEM ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || SEM ID &amp;gt;= number of SEMs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to grab SEM guard&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SM_JOB_ID_WRONG         || Job ID of the task on SEM pending queue is wrong&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_NOT_FOUND            || Timed action index to be removed for job not found&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_START_FAILED         || Timed action re-start failed after job remove from timed action queue&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Reset semaphore s_1&lt;br /&gt;
status = oceos_sem_reset(s_1);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Data Queues ==&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_dataq_create()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''dataq.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function creates a data queue with the specified characteristics.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Create data queue&lt;br /&gt;
 * If use_timeout = TRUE, timed actions must be initialised&lt;br /&gt;
 *&lt;br /&gt;
 * @param dataq_id      data queue ID&lt;br /&gt;
 * @param dataq_size    data queue size&lt;br /&gt;
 * @param pen_q_size    pending jobs queue size&lt;br /&gt;
 * @param roll_over     whether to roll over when full&lt;br /&gt;
 * @param use_timeout   if TRUE, directive oceos_dataq_read_restart_timeout can be used&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_WRONG_CPU_CORE          Executing directive on wrong CPU&lt;br /&gt;
 *          ERR_WRONG_PHASE             Called before oceos_init() is done&lt;br /&gt;
 *          ERR_TOO_MANY                MAX number of DATAQs already created&lt;br /&gt;
 *          ERR_ID_INVALID              DATAQ ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                DATAQ ID &amp;gt;= number of DATAQs&lt;br /&gt;
 *          ERR_DQ_ALREADY_ALLOCATED    DATAQ ID already used&lt;br /&gt;
 *          ERR_DQ_SIZE_WRONG           DATAQ size outside allowed range 1 to 255&lt;br /&gt;
 *          ERR_DQ_PENQ_SIZE_WRONG      DATAQ pending queue size outside allowed range 1 to 253&lt;br /&gt;
 *          ERR_DQ_TA_MAX_NUM_REACHED   Number of timed actions exceeds MAX allowed 255,&lt;br /&gt;
 *                                      each task on DATAQ pending queue is timed action&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_dataq_create(&lt;br /&gt;
                         dataq_t dataq_id,    // data queue ID&lt;br /&gt;
                         U16_t dataq_size,    // data queue size&lt;br /&gt;
                         U16_t pen_q_size,    // pending jobs queue size&lt;br /&gt;
                         BOOLE_t roll_over,   // whether to roll over when full&lt;br /&gt;
                         BOOLE_t use_timeout  // whether timeout is used oceos_dataq_read_restart_timeout&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| dataq_id ||   dataq_t data queue ID (number between 0 and 62)&lt;br /&gt;
|-&lt;br /&gt;
| dataq_size ||   data queue size (max number of pointers than can be added to the queue)&lt;br /&gt;
|-&lt;br /&gt;
| pen_q_size ||   pending jobs queue size&lt;br /&gt;
|-&lt;br /&gt;
| roll_over ||    whether to roll over when full (0 =&amp;gt; disabled, 1 =&amp;gt; enabled)&lt;br /&gt;
|-&lt;br /&gt;
| use_timeout ||  if TRUE, directive oceos_dataq_read_restart_timeout can be used&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_CPU_CORE          || Executing directive on wrong CPU&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Called before oceos_init() is done&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TOO_MANY                || MAX number of DATAQs already created&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || DATAQ ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || DATAQ ID &amp;gt;= number of DATAQs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DQ_ALREADY_ALLOCATED    || DATAQ ID already used&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DQ_SIZE_WRONG           || DATAQ size outside allowed range 1 to 255&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DQ_PENQ_SIZE_WRONG      || DATAQ pending queue size outside allowed range 1 to 253&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DQ_TA_MAX_NUM_REACHED   || Number of timed actions exceeds MAX allowed 255, each task on DATAQ pending queue is timed action&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Create data queue d_3 with size 20, max pending jobs of 10, rollover enabled, timeouts disabled &lt;br /&gt;
status = oceos_dataq_create(d_3, 20, 10, 1, 0));&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_dataq_write()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''dataq.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function puts a non-null pointer on the specified data queue.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Puts pointer to the data on data queue.&lt;br /&gt;
 * Pointer to the data must not be NULL&lt;br /&gt;
 *&lt;br /&gt;
 * @param dataq_t dataq_id Data queue ID&lt;br /&gt;
 * @param void* data       Non-null pointer to data&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          WARN_DQ_NOW_FULL            Warning, DATAQ is full now&lt;br /&gt;
 *          WARN_JOB_NOT_GUARDED&lt;br /&gt;
 *&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              DATAQ ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                DATAQ ID &amp;gt;= number of DATAQs&lt;br /&gt;
 *          ERR_DQ_DATA_BAD             Data pointer is null&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to acquire guard&lt;br /&gt;
 *          ERR_TOO_MANY                DATAQ is full&lt;br /&gt;
 *          ERR_DQ_JOB_ID_WRONG         Job ID of the task on pending queue is wrong&lt;br /&gt;
 *          ERR_TA_NOT_FOUND            Timed action index to be removed for job not found&lt;br /&gt;
 *          ERR_TA_START_FAILED         Timed action re-start failed after job remove from timed action queue&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_dataq_write(&lt;br /&gt;
    dataq_t dataq_id, // data queue ID&lt;br /&gt;
    void *data        // non-null pointer to data&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| dataq_id || dataq_t with value of Data queue ID&lt;br /&gt;
|-&lt;br /&gt;
| ptr || void* pointer to application data (non-null pointer)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| WARN_DQ_NOW_FULL            || Warning, DATAQ is full now&lt;br /&gt;
|-&lt;br /&gt;
| WARN_JOB_NOT_GUARDED        || &lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || DATAQ ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || DATAQ ID &amp;gt;= number of DATAQs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DQ_DATA_BAD             || Data pointer is null&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to acquire guard&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TOO_MANY                || DATAQ is full&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DQ_JOB_ID_WRONG         || Job ID of the task on pending queue is wrong&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_NOT_FOUND            || Timed action index to be removed for job not found&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_START_FAILED         || Timed action re-start failed after job remove from timed action queue&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
char[100] message_in;&lt;br /&gt;
...&lt;br /&gt;
// Put pointer to message_in on data queue s_2 &lt;br /&gt;
status = oceos_dataq_write(s_2, (void *)message_in);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_dataq_read_continue()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''dataq.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns a pointer from the specified data queue.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Read data queue&lt;br /&gt;
 *&lt;br /&gt;
 * @param dataq_t dataq_id  Data queue ID&lt;br /&gt;
 * @param void*   data      Pointer to data&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              DATAQ ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                DATAQ ID &amp;gt;= number of DATAQs&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to acquire guard&lt;br /&gt;
 *          ERR_DQ_EMPTY                DATAQ empty(count zero)&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_dataq_read_continue(&lt;br /&gt;
    dataq_t dataq_id, // data queue ID&lt;br /&gt;
    void* *data        // return data&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Descriptionn&lt;br /&gt;
|-&lt;br /&gt;
| dataq_id || dataq_t with value of Data queue ID&lt;br /&gt;
|-&lt;br /&gt;
| ptr || void* pointer to store returned data queue pointer removed from the queue&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || DATAQ ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || DATAQ ID &amp;gt;= number of DATAQs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to acquire guard&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DQ_EMPTY                || DATAQ empty(count zero)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
char *data_ptr;&lt;br /&gt;
...&lt;br /&gt;
// Read pointer from data queue s_2 &lt;br /&gt;
status = oceos_dataq_read_continue(s_2, (void *)data_ptr);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_dataq_read_restart()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''dataq.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns a pointer from the specified data queue. If the queue is empty, the job is added top the dataq pending queue. The job will be restarted when data is available. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Read data queue next item.&lt;br /&gt;
 * If dataq is empty, task is put on pending Q for dataq and&lt;br /&gt;
 * restarted by oceos_dataq_write&lt;br /&gt;
 *&lt;br /&gt;
 * @param dataq_id Data queue ID&lt;br /&gt;
 * @param data     Pointer to return data&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              DATAQ ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                DATAQ ID &amp;gt;= number of DATAQs&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to acquire guard&lt;br /&gt;
 *          ERR_DQ_J_START_FROM_TIMOUT  Job started from timeout already, DATAQ empty second time&lt;br /&gt;
 *          ERR_FAILED                  Should never return this&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_dataq_read_restart(&lt;br /&gt;
    dataq_t dataq_id,    // data queue ID&lt;br /&gt;
    void* *data           // pointer to return data&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| dataq_id || dataq_t with value of Data queue ID&lt;br /&gt;
|-&lt;br /&gt;
| ptr || void* pointer to store returned data queue pointer removed from the queue&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || DATAQ ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || DATAQ ID &amp;gt;= number of DATAQs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to acquire guard&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DQ_J_START_FROM_TIMOUT  || Job started from timeout already, DATAQ empty second time&lt;br /&gt;
|-&lt;br /&gt;
| ERR_FAILED                  || Should never return this&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
char *data_ptr;&lt;br /&gt;
...&lt;br /&gt;
// Read pointer from data queue s_2 with restart when data is available&lt;br /&gt;
status = oceos_dataq_read_restart(s_2, (void *)data_ptr);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_dataq_read_restart_timeout()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''dataq.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns a pointer from the specified data queue. If the queue is empty, the job is added top the dataq pending queue. The job will be restarted either when data is available or the timeout has expired. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Read data queue next item.&lt;br /&gt;
 * If dataq is empty, task is put on pending Q for dataq and&lt;br /&gt;
 * restarted by oceos_dataq_write or by timeout if timeout != 0&lt;br /&gt;
 * In order to use this feature timed actions must be configured and&lt;br /&gt;
 * dataq created with use timeout set to true&lt;br /&gt;
 *&lt;br /&gt;
 * @param dataq_id          Data queue ID&lt;br /&gt;
 * @param data              Pointer to return data&lt;br /&gt;
 * @param timeout           Timeout, restart time if no entry, 0 =&amp;gt; ignore&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_TA_NOT_INIT             Timed action intialisation is not done and tried to be used; or DATAQ created without timeouts&lt;br /&gt;
 *          ERR_ID_INVALID              DATAQ ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                DATAQ ID &amp;gt;= number of DATAQs&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to acquire guard&lt;br /&gt;
 *          ERR_DQ_EMPTY                DATAQ empty(count zero)&lt;br /&gt;
 *          ERR_DQ_J_START_FROM_TIMOUT  Job started from timeout already, DATAQ empty second time&lt;br /&gt;
 *          ERR_TOO_MANY                DATAQ pending queue is full&lt;br /&gt;
 *          ERR_FAILED                  Should never return this&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_dataq_read_restart_timeout(&lt;br /&gt;
    dataq_t dataq_id,   // data queue ID&lt;br /&gt;
    void* *data,         // Pointer to return data&lt;br /&gt;
    U64_t timeout       // timeout, restart time if no entry, 0 =&amp;gt; ignore&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| dataq_id || dataq_t with value of Data queue ID&lt;br /&gt;
|-&lt;br /&gt;
| ptr || void* pointer to store returned data queue pointer removed from the queue&lt;br /&gt;
|-&lt;br /&gt;
| timeout || U64_t containing timeout value, restart time if no entry, 0 =&amp;gt; ignore&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_NOT_INIT             || Timed action intialisation is not done and tried to be used; or DATAQ created without timeouts&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || DATAQ ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || DATAQ ID &amp;gt;= number of DATAQs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to acquire guard&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DQ_EMPTY                || DATAQ empty(count zero)&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DQ_J_START_FROM_TIMOUT  || Job started from timeout already, DATAQ empty second time&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TOO_MANY                || DATAQ pending queue is full&lt;br /&gt;
|-&lt;br /&gt;
| ERR_FAILED                  || Should never return this&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
char *data_ptr;&lt;br /&gt;
...&lt;br /&gt;
// Read pointer from data queue s_2 with timeout after 10,000 time units if no data is available&lt;br /&gt;
status = oceos_dataq_read_restart_timeout(s_2, (void *)data_ptr, 10000ull);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_dataq_get_size()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''dataq.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the number of items on the specified data queue.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Returns number of items on the data queue with ID&lt;br /&gt;
 *&lt;br /&gt;
 * @param dataq_id   DATAQ Id&lt;br /&gt;
 * @param d_size     Pointer to size holder&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              DATAQ ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                DATAQ ID &amp;gt;= number of DATAQs&lt;br /&gt;
 *          ERR_DQ_DATA_BAD             DATAQ size holder pointer is null&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_dataq_get_size(&lt;br /&gt;
    dataq_t dataq_id,   // data queue ID&lt;br /&gt;
    U32_t *d_size&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| dataq_id ||  dataq_t with the ID of the data queue (value between 0 and 62)&lt;br /&gt;
|-&lt;br /&gt;
| d_size || U32_t *d_size pointer to the variable to store the size&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || DATAQ ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || DATAQ ID &amp;gt;= number of DATAQs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DQ_DATA_BAD             || DATAQ size holder pointer is null&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, d_size;&lt;br /&gt;
...&lt;br /&gt;
// Get the number of entries on data queue d_0&lt;br /&gt;
status = oceos_dataq_get_size(d_0, &amp;amp;d_size);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_dataq_penq_get_size()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''dataq.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns number of jobs on the specified data queue pending job's queue.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Returns number of jobs on the dataq pending job's queue&lt;br /&gt;
 *&lt;br /&gt;
 * @param dataq_id  DATAQ Id&lt;br /&gt;
 * @param d_size    Pointer to pending queue size holder&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              DATAQ ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                DATAQ ID &amp;gt;= number of DATAQs&lt;br /&gt;
 *          ERR_DQ_DATA_BAD             DATAQ pending size holder pointer is null&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_dataq_penq_get_size(&lt;br /&gt;
    dataq_t dataq_id,&lt;br /&gt;
    U32_t *d_size&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| dataq_id ||  dataq_t with the ID of the data queue (value between 0 and 62)&lt;br /&gt;
|-&lt;br /&gt;
| d_jobs || U32_t *d_jobs pointer to the variable to store the number of jobs on the pending queue&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || DATAQ ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || DATAQ ID &amp;gt;= number of DATAQs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DQ_DATA_BAD             || DATAQ pending size holder pointer is null&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, d_jobs;&lt;br /&gt;
...&lt;br /&gt;
// Get the number of jobs the the pending jubs queue for data queue d_1&lt;br /&gt;
status = oceos_dataq_penq_get_size(d_1, &amp;amp;d_jobs);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_dataq_clear()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''dataq.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function clears the specified data queue including pending jobs for that queue.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Clears data queue and&lt;br /&gt;
 * frees tasks on pending queue&lt;br /&gt;
 *&lt;br /&gt;
 * @param dataq_t dataq_id Data queue ID&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              DATAQ ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                DATAQ ID &amp;gt;= number of DATAQs&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to acquire guard&lt;br /&gt;
 *          ERR_DQ_JOB_ID_WRONG         Job ID of the task on DATAQ pending queue is wrong&lt;br /&gt;
 *          ERR_TA_NOT_FOUND            Timed action index to be removed for job not found&lt;br /&gt;
 *          ERR_TA_START_FAILED         Timed action re-start failed after job remove from timed action queue&lt;br /&gt;
 */&lt;br /&gt;
S32_t  oceos_dataq_clear(&lt;br /&gt;
    dataq_t dataq_id    // data queue ID&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| dataq_id ||  dataq_t with the ID of the data queue to be cleared (value between 0 and 62)&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || DATAQ ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || DATAQ ID &amp;gt;= number of DATAQs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to acquire guard&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DQ_JOB_ID_WRONG         || Job ID of the task on DATAQ pending queue is wrong&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_NOT_FOUND            || Timed action index to be removed for job not found&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_START_FAILED         || Timed action re-start failed after job remove from timed action queue&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Clear data queue d_1&lt;br /&gt;
status = oceos_dataq_penq_get_size(d_1);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Timed Actions ==&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_timed_output_add()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''timed_action.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function adds a timed action to the timed action queue. It writes a value to an address at a specified system time. An optional mask can be applied so that only those bits are changed.&lt;br /&gt;
The action types are WRITE_ACTION, RMW_ACTION. WRITE_ACTION writes the value to the address. RMW_ACTION reads the values at the address and modifies the bits specified by the mask and value.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Add output action to timed actions queue :&lt;br /&gt;
 *  1. Create timed output action&lt;br /&gt;
 *  2. Stop timer&lt;br /&gt;
 *  3. Add action to action_array&lt;br /&gt;
 *  4. Start timer or execute if time is right&lt;br /&gt;
 *&lt;br /&gt;
 * Returns timed action ID that can be used later to remove&lt;br /&gt;
 * if need by oceos_timed_output_remove&lt;br /&gt;
 *&lt;br /&gt;
 * @param enum ACTION_TYPE action_type  Action type&lt;br /&gt;
 * @param U64_t act_time                System time at which action should be done&lt;br /&gt;
 * @param U32_t before_time             Forward tolerance for time&lt;br /&gt;
 * @param U32_t after_time              Backward tolerance for time&lt;br /&gt;
 * @param adrs_t address                Output address&lt;br /&gt;
 * @param U32_t value                   Output value&lt;br /&gt;
 * @param U32_t mask                    Output mask&lt;br /&gt;
 * @param U32_ *ta_index                Pointer to store timed action index&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_TA_NOT_INIT             Timed action inialisation is not done and tried to be used&lt;br /&gt;
 *          ERR_TA_PTR_BAD              Timed action pointer is null&lt;br /&gt;
 *          ERR_TA_TYPE_WRONG           Timed action type is wrong&lt;br /&gt;
 *          ERR_TOO_LATE                Timed action time is too late&lt;br /&gt;
 *          ERR_SYS_BUSY                Timed action guard failed to acquire&lt;br /&gt;
 *          ERR_TA_Q_FULL               Timed action queue is full&lt;br /&gt;
 *          ERR_TA_START_FAILED         Timed action execute failed; See log&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_timed_output_add(&lt;br /&gt;
    const enum ACTION_TYPE action_type,// Action type&lt;br /&gt;
    U64_t act_time,                    // system time at which action should be done&lt;br /&gt;
    U32_t before_time,                 // forward tolerance for time&lt;br /&gt;
    U32_t after_time,                  // backward tolerance for time&lt;br /&gt;
    const adrs_t address,              // output address&lt;br /&gt;
    const U32_t value,                 // output value&lt;br /&gt;
    const U32_t mask,                  // output mask&lt;br /&gt;
    U32_t *ta_index                    // Pointer to store timed action index&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| enum ACTION_TYPE action_type  || Action type&lt;br /&gt;
|-&lt;br /&gt;
| U64_t act_time                || System time at which action should be done&lt;br /&gt;
|-&lt;br /&gt;
| U32_t before_time             || Forward tolerance for time&lt;br /&gt;
|-&lt;br /&gt;
| U32_t after_time              || Backward tolerance for time&lt;br /&gt;
|-&lt;br /&gt;
| adrs_t address                || Output address&lt;br /&gt;
|-&lt;br /&gt;
| U32_t value                   || Output value&lt;br /&gt;
|-&lt;br /&gt;
| U32_t mask                    || Output mask&lt;br /&gt;
|-&lt;br /&gt;
| U32_ *ta_index                || Pointer to store timed action index&lt;br /&gt;
|-&lt;br /&gt;
| param || parameter to function&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_NOT_INIT             || Timed action inialisation is not done and tried to be used&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_PTR_BAD              || Timed action pointer is null&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_TYPE_WRONG           || Timed action type is wrong&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TOO_LATE                || Timed action time is too late&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Timed action guard failed to acquire&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_Q_FULL               || Timed action queue is full&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_START_FAILED         || Timed action execute failed; See log&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
#define OUTPUT_TIMED_VAL    0xDEADBEEF&lt;br /&gt;
#define OUTPUT_TIMED_MASK   0x1000001&lt;br /&gt;
#define OUTPUT_TIME         0xfffff&lt;br /&gt;
#define OUTPUT_TIME_FW      0x1000&lt;br /&gt;
#define OUTPUT_TIME_BW      0x1000&lt;br /&gt;
&lt;br /&gt;
static U32_t test_data[16] = { 0 };&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Write OUTPUT_TIMED_VAL to test_data[0] at 0xfffff time units from now with a tolerance of 0x1000 before and after the specified time   &lt;br /&gt;
status = oceos_timed_output_add(&lt;br /&gt;
                                       WRITE_ACTION,&lt;br /&gt;
                                       OUTPUT_TIME,&lt;br /&gt;
                                       OUTPUT_TIME_FW,&lt;br /&gt;
                                       OUTPUT_TIME_BW,&lt;br /&gt;
                                       (adrs_t) &amp;amp;test_data[0],&lt;br /&gt;
                                       OUTPUT_TIMED_VAL,&lt;br /&gt;
                                       0,&lt;br /&gt;
                                       &amp;amp;timed_action_index));&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_timed_jobs_number()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''timed_action.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the number of jobs on the timed actions queue.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Get number of Jobs (request to start the task) waiting on timed action queue.&lt;br /&gt;
 * These jobs are added by oceos_task_timed_start() or&lt;br /&gt;
 * oceos_dataq_read_restart_timeout when data is not available (NULL) or&lt;br /&gt;
 * oceos_sem_wait_restart_timeout when counting semaphore is 0&lt;br /&gt;
 *&lt;br /&gt;
 * @param total_jobs    Pointer to store total jobs number waiting on timed action Q&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_TA_NOT_INIT             Timed action inialisation is not done and tried to be used&lt;br /&gt;
 *          ERR_TA_PTR_BAD              Timed action pointer is null&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_timed_jobs_number(U32_t *total_jobs);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| total_jobs || s32_t pointer to store total jobs number waiting on timed action Q&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_NOT_INIT             || Timed action inialisation is not done and tried to be used&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_PTR_BAD              || Timed action pointer is null&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, no_of_jobs;&lt;br /&gt;
...&lt;br /&gt;
// Get the number of jobs on the timed actions queue&lt;br /&gt;
status = oceos_timed_jobs_number(&amp;amp;no_of_jobs);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_timed_jobs_remove()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''timed_action.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function removes the specified timed action from the queue.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Remove job from timed action queue&lt;br /&gt;
 * When task started using oceos_task_timed_start(),&lt;br /&gt;
 * this directive requires pointer to store ID&lt;br /&gt;
 * of job that put on the timed action queue.&lt;br /&gt;
 * This job can be removed later using this directive and stored job ID.&lt;br /&gt;
 *&lt;br /&gt;
 * @param U32_t job_id  Job ID&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_TA_NOT_INIT             Timed action intialisation is not done and tried to be used&lt;br /&gt;
 *          ERR_TA_PTR_BAD              Timed action pointer corrupt&lt;br /&gt;
 *          ERR_ID_WRONG                Job ID is wrong&lt;br /&gt;
 *          ERR_TA_NOT_FOUND            Timed action ID not found for action with job_id or removed already&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to acquire timed action guard&lt;br /&gt;
 *          WARN_TA_Q_EMPTY             Timed action queue is empty&lt;br /&gt;
 *          ERR_TA_START_FAILED         Timed action execute failed; See log&lt;br /&gt;
 */&lt;br /&gt;
S32_t   oceos_timed_jobs_remove(&lt;br /&gt;
    U32_t job_id                             // Job ID&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| job_id || U32_t Job ID to be removed from the timed actions queue&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_NOT_INIT             || Timed action intialisation is not done and tried to be used&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_PTR_BAD              || Timed action pointer corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || Job ID is wrong&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_NOT_FOUND            || Timed action ID not found for action with job_id or removed already&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to acquire timed action guard&lt;br /&gt;
|-&lt;br /&gt;
| WARN_TA_Q_EMPTY             || Timed action queue is empty&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_START_FAILED         || Timed action execute failed; See log&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, job_id;&lt;br /&gt;
...&lt;br /&gt;
// Remove job_id from the timed actions queue&lt;br /&gt;
status = oceos_timed_jobs_remove(job_id);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_timed_jobs_reset()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''timed_action.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function removes all jobs from timed actions queue.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Remove all jobs (requests to start a task) from timed actions queue&lt;br /&gt;
 * These jobs were added by oceos_task_timed_start() or&lt;br /&gt;
 * oceos_dataq_read_restart_timeout when data is not available (NULL) or&lt;br /&gt;
 * oceos_sem_wait_restart_timeout when counting semaphore is 0&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_TA_NOT_INIT             Timed action intialisation is not done and tried to be used&lt;br /&gt;
 *          ERR_TA_PTR_BAD              Timed action pointer is null&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to acquire timed action guard&lt;br /&gt;
 *          WARN_TA_Q_EMPTY             Timed action queue is empty&lt;br /&gt;
 *          ERR_TA_NOT_FOUND            Timed action index not found&lt;br /&gt;
 *          ERR_TA_START_FAILED         Timed action execute failed; See log&lt;br /&gt;
 */&lt;br /&gt;
S32_t   oceos_timed_jobs_reset(void);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
There are no input parameters to this function&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_NOT_INIT             || Timed action intialisation is not done and tried to be used&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_PTR_BAD              || Timed action pointer is null&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to acquire timed action guard&lt;br /&gt;
|-&lt;br /&gt;
| WARN_TA_Q_EMPTY             || Timed action queue is empty&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_NOT_FOUND            || Timed action index not found&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_START_FAILED         || Timed action execute failed; See log&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Remove all jobs from the timed actions queue&lt;br /&gt;
status = oceos_timed_jobs_reset(job_id);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_timed_output_remove()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''timed_action.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function removes the specified timed output action from timed actions queue.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Remove timed output action from timed actions queue.&lt;br /&gt;
 * When action is created, action index should be stored&lt;br /&gt;
 * to remove if need&lt;br /&gt;
 *&lt;br /&gt;
 * @param action_index&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_TA_NOT_INIT             Timed action intialisation is not done and tried to be used&lt;br /&gt;
 *          ERR_TA_PTR_BAD              Timed action pointer is null&lt;br /&gt;
 *          ERR_ID_WRONG                Timed action id is wrong&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to acquire timed action guard&lt;br /&gt;
 *          ERR_TA_NOT_FOUND            Timed action index not found&lt;br /&gt;
 *          ERR_TA_START_FAILED         Timed action execute failed&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_timed_output_remove(&lt;br /&gt;
    const U8_t  action_index    // Index in action array, returned when action was created&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| action_index|| S32_t specifying the timed output action index returned when the timed output was added.&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| Error bit  || Description&lt;br /&gt;
|&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_NOT_INIT             || Timed action intialisation is not done and tried to be used&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_PTR_BAD              || Timed action pointer is null&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || Timed action id is wrong&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to acquire timed action guard&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_NOT_FOUND            || Timed action index not found&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_START_FAILED         || Timed action execute failed&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
U8_t action_index;&lt;br /&gt;
...&lt;br /&gt;
// Remove timed output with specified action_index&lt;br /&gt;
status = oceos_timed_output_remove(action_index);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_timed_output_reset()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''timed_action.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function removes all timed output actions from timed actions queue.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Remove all timed output actions from timed actions queue&lt;br /&gt;
 * These timed output actions were created by oceos_timed_output_add&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_TA_NOT_INIT             Timed action intialisation is not done and tried to be used&lt;br /&gt;
 *          ERR_TA_PTR_BAD              Timed action pointer is null&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to acquire timed action guard&lt;br /&gt;
 *          WARN_TA_Q_EMPTY             Timed action queue is empty&lt;br /&gt;
 *          ERR_TA_NOT_FOUND            Timed action index not found&lt;br /&gt;
 *          ERR_TA_START_FAILED         Timed action execute failed; See log&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_timed_output_reset(void);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
There are no input parameters to this function. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| Error bit  || Description&lt;br /&gt;
|&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_NOT_INIT             || Timed action intialisation is not done and tried to be used&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_PTR_BAD              || Timed action pointer is null&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to acquire timed action guard&lt;br /&gt;
|-&lt;br /&gt;
| WARN_TA_Q_EMPTY             || Timed action queue is empty&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_NOT_FOUND            || Timed action index not found&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_START_FAILED         || Timed action execute failed; See log&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Remove all timed outputs from the timed actions queue&lt;br /&gt;
status = oceos_timed_output_reset();&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Logging directives ==&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;Introduction&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Log Area Features  (for details of other areas see oceos_areas.h)&lt;br /&gt;
&lt;br /&gt;
The system log area holds the system log and the records of the present and previous values of the system state variable.&lt;br /&gt;
&lt;br /&gt;
It is set up initially as an array of 32-bit words that starts at a 32-bit aligned address provided by the application developer.&lt;br /&gt;
&lt;br /&gt;
It is recommended that this address be in non-volatile RAM memory if this is available to allow information be preserved across power-up cycles.&lt;br /&gt;
&lt;br /&gt;
OCEOS preserves log area information across resets as far as possible.&lt;br /&gt;
&lt;br /&gt;
The system log itself is a circular buffer of struct log entry. Older entries are overwritten by new entries once all entries are in use.&lt;br /&gt;
&lt;br /&gt;
The application developer can specify a function to be called when 3/4 of log entries are in use. This function is called again only after 3/4 of log entries have been read and the log has again become 3/4 full.&lt;br /&gt;
&lt;br /&gt;
The read and write indices are stored in the log area and if equal indicate that the log is empty.&lt;br /&gt;
&lt;br /&gt;
As with other OCEOS data areas, the log area starts with a header&lt;br /&gt;
*a 32-bit word holding a constant OCEOS_VERSION&lt;br /&gt;
*a 32-bit word holding the log area size in 32-bit words&lt;br /&gt;
*a 32-bit word, the system status variable&lt;br /&gt;
*a 32-bit word, the system status mask&lt;br /&gt;
*a 32-bit word, the accumulated system status&lt;br /&gt;
*a 32-bit word, the previous system status mask&lt;br /&gt;
*a 32-bit word, the log control, that gives whether the log full function was called&lt;br /&gt;
*the read index&lt;br /&gt;
*the write index&lt;br /&gt;
*an array of struct log_entry making up the system log itself&lt;br /&gt;
*ending with a 32-bit constant END_SENTINEL&lt;br /&gt;
&lt;br /&gt;
The system fixed meta structure at sysMetaPtr provides&lt;br /&gt;
&lt;br /&gt;
*system_log_ptr      the start address of the log area&lt;br /&gt;
*logEntries          the number of log entries&lt;br /&gt;
*logCreated          flag indicating log was created successfully&lt;br /&gt;
*logFullFunction     user defined function, called when the log becomes 3/4 full (or NULL if not used)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Log Entry Types and Structure'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/*****************************************************************************&lt;br /&gt;
 * LOG ENTRY TYPES&lt;br /&gt;
 *&lt;br /&gt;
 * A log entry type is an 8-bit number.&lt;br /&gt;
 * Values from 0 to 127 can be defined by the application.&lt;br /&gt;
 * Values from 128 to 255 are used by OCEOS as below.&lt;br /&gt;
 *&lt;br /&gt;
 *&lt;br /&gt;
 * NOTE: Add new log types at the end for backward compatibility&lt;br /&gt;
 */&lt;br /&gt;
enum LOG_ENTRY_TYPE{&lt;br /&gt;
  LOG_SYS_OK = 0x80U,&lt;br /&gt;
  LOG_OCEOS_ABORT,				// when exiting from oceos_start&lt;br /&gt;
  LOG_LOG_NOT_VALID_ENTRY,		// used to initialise log and when log empty&lt;br /&gt;
  LOG_INIT_TASK_START_FAIL,		// initial task passed to oceos_start failed&lt;br /&gt;
  LOG_DEADLINE_MISSED,			// task deadline missed&lt;br /&gt;
  LOG_JOB_NOT_ACTIVE,			// cpu_terminate but job not active, absurd&lt;br /&gt;
  LOG_JOB_NOT_FREE,				// job guarded but not free&lt;br /&gt;
  LOG_JOBS_INC_FAILED, 			// pending jobs increment failed&lt;br /&gt;
  LOG_JOB_NOT_GUARDED,			// paranoia&lt;br /&gt;
  LOG_CS_LOG_SPIN_FAIL,			// oceos_CPU_sleep, trying to update CS log&lt;br /&gt;
  LOG_MUTEX_ALREADY_HELD,		// oceos_mutex_wait, code returned, not needed&lt;br /&gt;
  LOG_MUTEX_INCORRECT_ORDER,	// oceos_mutex_wait&lt;br /&gt;
  LOG_MUTEX_EXIT_HOLDING,		// task exits holding one or more mutexes&lt;br /&gt;
  LOG_MUTEX_EXIT_NONE,			// __oceos_tasks_remove_mutexes called but no mutex held&lt;br /&gt;
  LOG_SEMAPHORE_PENDING_REMOVE_FAIL,	// timed_action.c&lt;br /&gt;
  LOG_SEMAPHORE_PENDING_QUEUE_FULL,		// __oceos_semaphore_add_pend&lt;br /&gt;
  LOG_SEMAPHORE_SPIN_FAILED,			// trying to access semaphore&lt;br /&gt;
  LOG_DATAQ_PENDING_QUEUE_FULL,&lt;br /&gt;
  LOG_DATAQ_PENDING_REMOVE_FAIL,&lt;br /&gt;
  LOG_DATAQ_SPIN_FAILED,&lt;br /&gt;
  LOG_TIMED_ACTION_TIMER_NULL,&lt;br /&gt;
  LOG_TIMED_ACTION_INVALID,&lt;br /&gt;
  LOG_TIMED_ACTION_BAD_INDEX,&lt;br /&gt;
  LOG_TIMED_ACTION_MISSED,&lt;br /&gt;
  LOG_TIMED_ACTION_Q_EMPTY,&lt;br /&gt;
  LOG_TIMED_ACTION_REMOVE_FAIL,&lt;br /&gt;
  LOG_TIMED_ACTION_BAD_JOB_ID,&lt;br /&gt;
  LOG_TIMED_Q_SPIN_FAIL,&lt;br /&gt;
  LOG_SYSTEM_ERROR,&lt;br /&gt;
  LOG_ATOMICINC_FAILED,&lt;br /&gt;
  LOG_PENDING_PRI_UPDATE_FAILED,&lt;br /&gt;
  LOG_KILL_TASK_INVALID_ID,      // Tried to kill task with invalid ID&lt;br /&gt;
  LOG_OCEOS_EXIT_REQUEST,         // oceos_exit command was called&lt;br /&gt;
  LOG_RWMUTEX_NOT_RETURNED,&lt;br /&gt;
  LOG_RWMUTEX_NOT_HIGHEST&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
/*****************************************************************************&lt;br /&gt;
 * Structures&lt;br /&gt;
 */&lt;br /&gt;
/**&lt;br /&gt;
 * Log entry structure&lt;br /&gt;
 */&lt;br /&gt;
struct log_entry{&lt;br /&gt;
  U64_t             time64;&lt;br /&gt;
&lt;br /&gt;
  unsigned int      entry_cpu          :8;&lt;br /&gt;
  unsigned int      entry_type         :8;&lt;br /&gt;
  unsigned int      entry_note         :16;	// not used at present&lt;br /&gt;
&lt;br /&gt;
  U32_t             entry_comment;&lt;br /&gt;
}__attribute__ ((aligned (8)));&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_log_add_entry()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''system_log.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function adds an entry to the log. The entry overwrites the oldest unread entry if the log is full.&lt;br /&gt;
Custom log entries can be added to enum LOG_ENTRY from 0 to 128.&lt;br /&gt;
The indices are incremented in a circular fashion. If the write index reaches the read_index the read index is moved on, as read and write indices equal would indicate an empty log.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Add an entry to the log.&lt;br /&gt;
 * this overwrites the oldest unread entry if the log is full.&lt;br /&gt;
 * Custom log entries can be added to enum LOG_ENTRY from 0 to 128&lt;br /&gt;
 *&lt;br /&gt;
 * N.B. The indices are incremented in a circular fashion.&lt;br /&gt;
 *      If the write index reaches the read_index the read index is moved on,&lt;br /&gt;
 *      as read and write indices equal would indicate an empty log.&lt;br /&gt;
 *&lt;br /&gt;
 * @param type  enum LOG_ENTRY_TYPE&lt;br /&gt;
 * @param info  extra information to be logged&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_LOG_CORRUPT         System Log area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Log directive called in wrong phase; can be used after oceos_init() called&lt;br /&gt;
 *          ERR_ID_INVALID              Log type invalid&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to acquire log guard&lt;br /&gt;
 *          ERR_LOG_INDEX_WRONG         Read/write log index is wrong&lt;br /&gt;
 */&lt;br /&gt;
S32_t   oceos_log_add_entry(&lt;br /&gt;
    enum LOG_ENTRY_TYPE type,   // 8 bits enum LOG_ENTRY_TYPE&lt;br /&gt;
    const U32_t        info     // information&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| enum LOG_ENTRY_TYPE || Log entry type (see previous section for a list)&lt;br /&gt;
|-&lt;br /&gt;
| info | U32_t with the log information&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit  !! Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_LOG_CORRUPT         || System Log area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Log directive called in wrong phase; can be used after oceos_init() called&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || Log type invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to acquire log guard&lt;br /&gt;
|-&lt;br /&gt;
| ERR_LOG_INDEX_WRONG         || Read/write log index is wrong&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, info;&lt;br /&gt;
...&lt;br /&gt;
// Log LOG_APP_COMMS__ERROR (defined in enum LOG_ENTRY_TYPE) and info with more details&lt;br /&gt;
status = oceos_log_add_entry(LOG_APP_COMMS__ERROR, info);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_log_get_indexed_entry()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''system_log.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the entry at the specified position in the log. The entry is not removed and the log and log indices are not changed.&lt;br /&gt;
One use of this function is to allow the log be examined after a reset.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Returns the entry at the specified position in the log.&lt;br /&gt;
 * The entry is not removed and the log and log indices are not changed.&lt;br /&gt;
 * (intended to allow the log be examined for example after reset)&lt;br /&gt;
 *&lt;br /&gt;
 * @param index         position in the log&lt;br /&gt;
 * @param outputPtr     pointer to return log entry&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_LOG_CORRUPT         System Log area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Log directive called in wrong phase; can be used after oceos_init() called&lt;br /&gt;
 *          ERR_LOG_INDEX_WRONG         Read log index is wrong&lt;br /&gt;
 *          ERR_LOG_DATA_PTR_BAD        Data holder pointer is null&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_log_get_indexed_entry(&lt;br /&gt;
    const unsigned int index,&lt;br /&gt;
    struct log_entry * const outputPtr&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| index || U32_t with position in the log&lt;br /&gt;
|-&lt;br /&gt;
| outputPtr || pointer to struct log_entry to hold the returned entry&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit  !! Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_LOG_CORRUPT         || System Log area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Log directive called in wrong phase; can be used after oceos_init() called&lt;br /&gt;
|-&lt;br /&gt;
| ERR_LOG_INDEX_WRONG         || Read log index is wrong&lt;br /&gt;
|-&lt;br /&gt;
| ERR_LOG_DATA_PTR_BAD        || Data holder pointer is null&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, index;&lt;br /&gt;
struct log_entry store_entry;&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
// Read log_entry at specified index into outputPtr&lt;br /&gt;
status = oceos_log_get_indexed_entry(index, &amp;amp;store_entry);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_log_remove_entry()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''system_log.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function reads and removes the oldest unread log entry. &lt;br /&gt;
If the log is not empty use the entry at the read index to update the value at the output pointer, returning OCEOS_SUCCESS.&lt;br /&gt;
If outputPtr is NULL, entry is removed but no returned.&lt;br /&gt;
If the log is empty, set the value at the output pointer to LOG_LOG_NOT_VALID_ENTRY and return ERR_LOG_EMPTY.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Read and remove the oldest unread log entry&lt;br /&gt;
 *&lt;br /&gt;
 * If the log is not empty use the entry at the read index to update the value&lt;br /&gt;
 * at the output pointer, returning OCEOS_SUCCESS.&lt;br /&gt;
 *&lt;br /&gt;
 * If outputPtr is NULL, entry is removed but no returned&lt;br /&gt;
 *&lt;br /&gt;
 * If the log is empty, set the value at the output pointer to LOG_LOG_NOT_VALID_ENTRY&lt;br /&gt;
 * and return ERR_LOG_EMPTY&lt;br /&gt;
 *&lt;br /&gt;
 * @param outputPtr   pointer to struct log_entry&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_LOG_CORRUPT         System Log area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Log directive called in wrong phase; can be used after oceos_init() called&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to acquire log guard&lt;br /&gt;
 *          ERR_LOG_INDEX_WRONG         Read/write log index is wrong&lt;br /&gt;
 *          ERR_LOG_EMPTY               Log is empty&lt;br /&gt;
 */&lt;br /&gt;
S32_t   oceos_log_remove_entry(&lt;br /&gt;
    struct log_entry * const outputPtr&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| outputPtr || pointer to struct log_entry&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit  !! Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_LOG_CORRUPT         || System Log area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Log directive called in wrong phase; can be used after oceos_init() called&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to acquire log guard&lt;br /&gt;
|-&lt;br /&gt;
| ERR_LOG_INDEX_WRONG         || Read/write log index is wrong&lt;br /&gt;
|-&lt;br /&gt;
| ERR_LOG_EMPTY               || Log is empty&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
struct log_entry *outputPtr;&lt;br /&gt;
...&lt;br /&gt;
// Read log_entry into outputPtr and remove the oldest unread log entry&lt;br /&gt;
status = oceos_log_remove_entry(outputPtr);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_log_reset()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''system_log.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function sets all log entries to LOG_LOG_NOT_VALID_ENTRY and the log to empty, with the read and write indices set to 0.&lt;br /&gt;
The log is empty if the index of the next write is the same as the index of the next read. It does not affect the system status variable. It does not affect the context switch log.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * oceos_log_reset()&lt;br /&gt;
 *&lt;br /&gt;
 * Set all log entries to LOG_LOG_NOT_VALID_ENTRY and the log to empty, with the&lt;br /&gt;
 * read and write indices set to 0. and function called flag 0&lt;br /&gt;
 *&lt;br /&gt;
 * The log is empty if the index of the next write&lt;br /&gt;
 * is the same as the index of the next read.&lt;br /&gt;
 *&lt;br /&gt;
 * Does not affect the system status variable&lt;br /&gt;
 * Does not affect the context switch log&lt;br /&gt;
 *&lt;br /&gt;
 * N.B The fixed data area may no longer be writable&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_LOG_CORRUPT         System Log area corrupt; reset failed&lt;br /&gt;
 *          ERR_WRONG_PHASE             Log directive called in wrong phase; can be used after oceos_init() called&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to acquire log guard&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_log_reset(void);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
There are no input parameters to this function.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit  !! Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_LOG_CORRUPT         || System Log area corrupt; reset failed&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Log directive called in wrong phase; can be used after oceos_init() called&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to acquire log guard&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
// Clear down the system log&lt;br /&gt;
status = oceos_log_reset();&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_log_get_size()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''system_log.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the number of entries in the log according to the current values of the read and write indices.&lt;br /&gt;
The value will be zero if the current values of the read and write indices are the same. There may still be useful information in the log, e.g. after system reset, this can be accessed using oceos_log_get_indexed_entry().&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Return the number of entries in the log&lt;br /&gt;
 * according to the current values of the read and write indices.&lt;br /&gt;
 *&lt;br /&gt;
 * The value will be zero if the current values of the read and write indices&lt;br /&gt;
 * are the same.&lt;br /&gt;
 *&lt;br /&gt;
 * There may still be useful information in the log, e.g. after system reset,&lt;br /&gt;
 * this can be accessed using oceos_log_get_indexed_entry()&lt;br /&gt;
 *&lt;br /&gt;
 * @param l_size        pointer to log size holder&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_LOG_CORRUPT         System Log area corrupt;&lt;br /&gt;
 *          ERR_WRONG_PHASE             Log directive called in wrong phase; can be used after oceos_init() called&lt;br /&gt;
 *          ERR_LOG_DATA_PTR_BAD        Pointer to log size holder is NULL&lt;br /&gt;
 *          ERR_LOG_INDEX_WRONG         Read/write log index is wrong&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_log_get_size(&lt;br /&gt;
    U32_t *l_size&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| l_size|| U32_t pointer where size will be written.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit  !! Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_LOG_CORRUPT         || System Log area corrupt;&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Log directive called in wrong phase; can be used after oceos_init() called&lt;br /&gt;
|-&lt;br /&gt;
| ERR_LOG_DATA_PTR_BAD        || Pointer to log size holder is NULL&lt;br /&gt;
|-&lt;br /&gt;
| ERR_LOG_INDEX_WRONG         || Read/write log index is wrong&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, size;&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
// Clear down the system log&lt;br /&gt;
status = oceos_log_get_size(&amp;amp;size);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;System State Variable and System State Mask&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The System State variable provides a record of anomalies or problems detected by OCEOSmp's automatic consistency checks. An application handler for these can be set to be called automatically.&lt;br /&gt;
&lt;br /&gt;
An anomaly or problem results in a flag bit being set in the 32-bit word used to store the system state variable. The flags are identified below.&lt;br /&gt;
&lt;br /&gt;
All flags are reset to zero by oceos_init() when OCEOSmp is initialised, and may also be reset by the application using the directive provided.&lt;br /&gt;
&lt;br /&gt;
To provide a record across OCEOSmp restarts a copy is updated automatically whenever the state variable is updated. This is not cleared by oceos_init() but may be cleared by the application using a directive.&lt;br /&gt;
&lt;br /&gt;
Application software can define a problem handling function to be called automatically when specified system state flags are set. The flags are specified by setting the corresponding bits in the system state mask. The function and the state mask are defined in the system configuration.&lt;br /&gt;
&lt;br /&gt;
Changing a state flag from clear to set results in the function being called (if defined). Subsequent settings of that flag have no effect until after it has been cleared using the directive provided.&lt;br /&gt;
&lt;br /&gt;
N.B. In many cases when OCEOSmp sets a System State flag it also makes an entry in the system log that provides further information.&lt;br /&gt;
&lt;br /&gt;
SYSTEM STATE VARIABLE FLAGS&lt;br /&gt;
&lt;br /&gt;
These flags are updated by OCEOSmp using inclusive 'OR' when a consistency check detects a problem or anomaly. A copy of the system state variable is updated also and accumulates a record of flag settings that is preserved across restarts of OCEOSmp. OCEOSmp restarts reset the system state variable but not the copy.&lt;br /&gt;
&lt;br /&gt;
Resetting the state variables is the responsibility of the application (except for the state variable reset done when OCEOSmp is restarted).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''System Status Bits'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
#define  STATUS_NORMAL                    0u    // No flag set                              YES&lt;br /&gt;
#define  STATUS_INVALID          0xffffffffu    // System status is invalid                 YES BUT NO DETAIL!!!&lt;br /&gt;
&lt;br /&gt;
#define  STATUS_MASK_NORMAL      0xffffffffu    // Always call user def fn                  YES&lt;br /&gt;
&lt;br /&gt;
/* Task related problems */&lt;br /&gt;
#define  STATUS_DISABLED_TASK_START    0x1U    // An attempt to start a disabled task&lt;br /&gt;
#define  STATUS_TASK_JOB_LIMIT_OVER    0x2U    // An attempt to execute a task when its jobs limit is already reached.&lt;br /&gt;
#define  STATUS_JOB_OVER_TIME          0x4U    // Job time from creation to completion exceeds allowed maximum for task. YES&lt;br /&gt;
#define  STATUS_JOB_INTERVAL_SHORT     0x8U    // Minimum time between job creations is less than the allowed minimum for task&lt;br /&gt;
#define  STATUS_READYQ_FULL           0x10U    // Ready queue unable to accept job as result of being full&lt;br /&gt;
#define  STATUS_READYQ_NO_REMOVE      0x20U    // Remove job from ready queue failed&lt;br /&gt;
&lt;br /&gt;
/* Mutex related problems */&lt;br /&gt;
#define  STATUS_MUTEX_ALREADY_HELD    0x40U    // Mutex wait() when mutex already held&lt;br /&gt;
#define  STATUS_MUTEX_NOT_HELD        0x80U    // Mutex signal() when not already held&lt;br /&gt;
#define  STATUS_MUTEX_NOT_RETURNED   0x100U    // Mutex not returned before job terminates&lt;br /&gt;
#define  STATUS_MUTEX_NOT_NESTED     0x200U    // Use of multiple mutexes not nested&lt;br /&gt;
&lt;br /&gt;
/* Counting semaphore and data queue related problems */&lt;br /&gt;
#define  STATUS_SEMAPHORE_JOBS_FULL  0x400U    // Attempt to add job to semaphore pending list when list full&lt;br /&gt;
#define  STATUS_DATAQ_JOBS_FULL      0x800U    // Attempt to add job to data queue pending list when list full&lt;br /&gt;
#define  STATUS_DATAQ_FULL          0x1000U    // Data queue write when queue already full&lt;br /&gt;
&lt;br /&gt;
/* Timed actions related problems */&lt;br /&gt;
#define  STATUS_TIMED_JOBS_FULL     0x2000U    // Timed actions queue already full for timed task start&lt;br /&gt;
#define  STATUS_TIMED_OUTPUT_FULL   0x4000U    // Timed actions queue already full for timed output&lt;br /&gt;
#define  STATUS_TIMED_ACTION_LATE   0x8000U    // Timed action late                          YES&lt;br /&gt;
&lt;br /&gt;
/* Default trap handler should have been replaced&lt;br /&gt;
 * NOT USED AT THE MOMENT*/&lt;br /&gt;
#define  STATUS_SYSTEM_ERROR       0x10000U    // ERROR was handled by default trap handler  YES&lt;br /&gt;
&lt;br /&gt;
/* Flag to indicate problem with Stack Pointer&lt;br /&gt;
 * NOT USED AT THE MOMENT*/&lt;br /&gt;
#define  STATUS_SP_WARNING         0x20000U    // SP not in expected range&lt;br /&gt;
/* Log system error */&lt;br /&gt;
#define  STATUS_BAD_LOG            0x40000U    // System log problem&lt;br /&gt;
#define  STATUS_SPIN_FAILED        0x80000U    // Get SPIN lock failed&lt;br /&gt;
/* Not using next few bits */&lt;br /&gt;
&lt;br /&gt;
/* Will have to exit */&lt;br /&gt;
#define  STATUS_BAD_SENTINEL     0x40000000U    // Area sentinel corrupt&lt;br /&gt;
#define  STATUS_BAD_META_PTR     0x80000000U    // Null meta pointer&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_system_state_get()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''system_log.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns of the system state variable.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Returns the value of the system state variable&lt;br /&gt;
 *&lt;br /&gt;
 * @param state  pointer to state holder&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_LOG_DATA_PTR_BAD        Data holder pointer is null&lt;br /&gt;
 *          ERR_SYS_LOG_CORRUPT         LOG dynamic pointer is null&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_system_state_get(&lt;br /&gt;
    U32_t *state // pointer to state holder&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| state || U32_t pointer to state holder&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit  !! Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_LOG_DATA_PTR_BAD        || Data holder pointer is null&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_LOG_CORRUPT         || LOG dynamic pointer is null&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, state;&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
// Get the system state&lt;br /&gt;
status = oceos_system_state_get(&amp;amp;state);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_system_state_set()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''system_log.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function sets system state variable.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Sets system state variable&lt;br /&gt;
 *&lt;br /&gt;
 * @param new_state&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_LOG_CORRUPT         LOG dynamic pointer is null&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_system_state_set(&lt;br /&gt;
    U32_t new_state   // new value of system state variable&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| new_state || U32_t containing new system state&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit  !! Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_LOG_CORRUPT         || LOG dynamic pointer is null&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, new_state;&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
// Set new system state&lt;br /&gt;
status = oceos_system_state_set(new_state);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_system_state_copy_get()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''system_log.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the value of the system state copy variable.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Returns the value of the copy of system state variable&lt;br /&gt;
 *&lt;br /&gt;
 * @param state  pointer to state holder&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_LOG_DATA_PTR_BAD        Data holder pointer is null&lt;br /&gt;
 *          ERR_SYS_LOG_CORRUPT         LOG dynamic pointer is null&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_system_state_copy_get(&lt;br /&gt;
    U32_t *state // pointer to state copy holder&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| state || U32_t pointer to state copy holder&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit  !! Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_LOG_DATA_PTR_BAD        || Data holder pointer is null&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_LOG_CORRUPT         || LOG dynamic pointer is null&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, copy_state;&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
// Get the system state copy&lt;br /&gt;
status = oceos_system_state_copy_get(&amp;amp;copy_state);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_system_state_copy_set()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''system_log.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function loads a value to tha system state copy variable.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Sets system state copy variable&lt;br /&gt;
 *&lt;br /&gt;
 * @param new_state&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_LOG_CORRUPT         LOG dynamic pointer is null&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_system_state_copy_set(&lt;br /&gt;
    U32_t new_state   // new value of system state variable&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| new_state || U32_t containing new system state copy&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit  !! Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_LOG_CORRUPT         || LOG dynamic pointer is null&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, new_state;&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
// Set new system state copy&lt;br /&gt;
status = oceos_system_state_copy_set(new_state);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Timing directives ==&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;Introduction&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''SPARC'''&lt;br /&gt;
&lt;br /&gt;
In OCEOS system time is based on two chained 32-bit timers.&lt;br /&gt;
&lt;br /&gt;
No interrupts are involved, the current system time is obtained by reading the two timer counter registers (in an atomic way) and then inverting the&lt;br /&gt;
values since the timers count down.&lt;br /&gt;
&lt;br /&gt;
The scaler associated with the timers is configured based on the system clock frequency to decrement the low order timer every microsecond. This&lt;br /&gt;
decrements the high order timer when it rolls over, every 71.6 minutes approximately. The 64-bit time range is very long, over 584,000 years.&lt;br /&gt;
&lt;br /&gt;
'''ARM Cortex-M'''&lt;br /&gt;
&lt;br /&gt;
In OCEOS for ARM Cortex-M, system time is based on SysTick. The processor has a 24-bit system timer, SysTick, that counts down from the reload value to zero, reloads (wraps to) the value in the LOAD register on the next clock edge, then counts down on subsequent clocks.&lt;br /&gt;
&lt;br /&gt;
Note: When the processor is halted for debugging the counter does not decrement.&lt;br /&gt;
&lt;br /&gt;
OCEOS initializes the timer to be driven from MCK and counting down to zero asserts SysTick exception request.&lt;br /&gt;
OCEOS has 64 bit counter which is increased by 0xFFFFFF value every time timer reloads.&lt;br /&gt;
&lt;br /&gt;
'''RISC-V'''&lt;br /&gt;
&lt;br /&gt;
In OCEOS for RISC-V systems time is based internally on clock cycles.&lt;br /&gt;
The RISC-V processor typically has a 64 bit counter (typically mtime) that  updates automatically on each clock cycle. Each hart typically has its own comparison register (typically mtimecmp) that can be used to interrupt that hart when a certain cycle count has been exceeded.&lt;br /&gt;
If a particular RISC-V implementation provides a more restricted clock cycle count this will be used with appropriate modifications as clock cycles give the best timing precision available.&lt;br /&gt;
&lt;br /&gt;
Note: The application configuration provides the constant needed to allow microseconds (as used in OCEOS directives) be converted to clock cycles. Time is reported by OCEOSmp as the number of microseconds since OCEOS was initialized.&lt;br /&gt;
&lt;br /&gt;
A potential difficulty arises if the main system clock rate can change for power saving or other reasons, each system is probably different with regard to this. OCEOSmp can handle this, if needed.&lt;br /&gt;
&lt;br /&gt;
The units of OCEOS system time are microseconds on SPARC and ARM and on RISC-V the period of the clock cycle.&lt;br /&gt;
&lt;br /&gt;
The system time is reset to 0 by oceos_init()&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_time_sys_get64()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''oceos_timer.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the current system time as a 64-bit number.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
**&lt;br /&gt;
 * Get the current system time (64-bit)&lt;br /&gt;
 *&lt;br /&gt;
 * @return U64_t&lt;br /&gt;
 */&lt;br /&gt;
U64_t oceos_time_sys_get64(void);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There are no parameters to this function.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S64_t with the current system time.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S64_t now;&lt;br /&gt;
...&lt;br /&gt;
// Get the time&lt;br /&gt;
now = oceos_time_sys_get64();&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_time_sys_get32()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''oceos_timer.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the low 32 bits of the system time.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Get the current system time (low 32 bits of 64 bit value)&lt;br /&gt;
 *&lt;br /&gt;
 * @return U32_t&lt;br /&gt;
 */&lt;br /&gt;
U32_t oceos_time_sys_get32(void);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
There are no parameters to this function.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with the current system time.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t now;&lt;br /&gt;
...&lt;br /&gt;
// Get the time&lt;br /&gt;
now = oceos_time_sys_get32();&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:backup]]&lt;/div&gt;</summary>
		<author><name>Bkavanagh</name></author>
	</entry>
	<entry>
		<id>https://wiki.ocetechnology.com/mediawiki/index.php?title=OCEOSmp/directive_reference&amp;diff=1693</id>
		<title>OCEOSmp/directive reference</title>
		<link rel="alternate" type="text/html" href="https://wiki.ocetechnology.com/mediawiki/index.php?title=OCEOSmp/directive_reference&amp;diff=1693"/>
		<updated>2024-05-03T15:41:25Z</updated>

		<summary type="html">&lt;p&gt;Bkavanagh: /* This section is under construction */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Introduction =&lt;br /&gt;
&lt;br /&gt;
To be added&lt;br /&gt;
&lt;br /&gt;
= Directives =&lt;br /&gt;
&lt;br /&gt;
== Initialisation directives ==&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_init()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''initialisation.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Initialises OCEOS and  must be the first directive used.&lt;br /&gt;
&lt;br /&gt;
Initialises the OCEOS system meta data using the information supplied in the application configuration and prepares for creation of tasks etc.&lt;br /&gt;
&lt;br /&gt;
The values provided in the application configuration are checked as much as possible before being used.&lt;br /&gt;
&lt;br /&gt;
The system log also is created here.&lt;br /&gt;
&lt;br /&gt;
This function sets up sysMetaPtr and init_meta_ptr and must have completed successfully before tasks etc. can be created.&lt;br /&gt;
&lt;br /&gt;
It disables interrupts and leaves them disabled, they will be re-enabled to the previous level after all tasks etc. have been created and [[OCEOSmp/directive_reference#oceos_init_finish()|oceos_init_finish()]] has completed successfully.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Initialises OCEOS and  must be the first directive used.&lt;br /&gt;
 *&lt;br /&gt;
 * Initialises the OCEOS system meta data using the information supplied in&lt;br /&gt;
 * the application configuration and prepares for creation of tasks etc.&lt;br /&gt;
 *&lt;br /&gt;
 * The values provided in the application configuration are checked as much&lt;br /&gt;
 * as possible before being used.&lt;br /&gt;
 *&lt;br /&gt;
 * The system log also is created here.&lt;br /&gt;
 *&lt;br /&gt;
 * This function sets up sysMetaPtr and init_meta_ptr and must have completed&lt;br /&gt;
 * successfully before tasks etc. can be created.&lt;br /&gt;
 *&lt;br /&gt;
 * It disables interrupts and leaves them disabled, they will be re-enabled to&lt;br /&gt;
 * the previous level after all tasks etc. have been created and&lt;br /&gt;
 * oceos_init_finish() has completed successfully.&lt;br /&gt;
 *&lt;br /&gt;
 * @param app_config Pointer to configuration struct&lt;br /&gt;
 * @return SUCCESSFUL                        All OK&lt;br /&gt;
 *         WARN_LOG_SIZE_DEFAULT             Warning, log size is set to default value of 64 entries&lt;br /&gt;
 *         WARN_NO_ERROR_FUNCTION            Warning, user defined function for ERROR handling is not provided&lt;br /&gt;
 *         ERR_CPU_FIRST_CORE_INVALID        Start CPU not in a range of available cores for this target; or greater than end CPU&lt;br /&gt;
 *         ERR_CPU_LAST_CORE_INVALID         Last CPU not in a range of available cores for this target&lt;br /&gt;
 *         ERR_NOT_START_CPU_CORE            Executing oceos_init on wrong CPU&lt;br /&gt;
 *         ERR_STACK_START_MISALIGNED        Stack start address is not set by user misaligned&lt;br /&gt;
 *         ERR_STACK_PER_CORE_INVALID        Stack per CPU size is zero, or not 8byte aligned, or less then min require&lt;br /&gt;
 *         ERR_LOG_ADDR_MISALIGNED           Log start address is not 8 byte aligned&lt;br /&gt;
 *         ERR_FIX_ADDR_MISALIGNED           Fixed area start address is not 8 byte aligned&lt;br /&gt;
 *         ERR_DYN_ADDR_MISALIGNED           Dynamic area start address is not 8 byte aligned&lt;br /&gt;
 *         ERR_CPU_CORE_RANGE_WRONG          CPU cores in use exceed available CPUs on the SoC&lt;br /&gt;
 *         ERR_STACK_SPACE_WRONG             Current CPU SP is not within user provided stack range&lt;br /&gt;
 *         ERR_LOG_SIZE_INVALID              Log size outside expected range&lt;br /&gt;
 *         ERR_CS_LOG_SIZE_INVALID           Context switch log size invalid&lt;br /&gt;
 *         ERR_TASK_NUMBER_INVALID           Number of tasks invalid&lt;br /&gt;
 *         ERR_MUTEX_NUMBER_INVALID          Number of mutexes invalid&lt;br /&gt;
 *         ERR_RWMUTEX_NUMBER_INVALID        Number of rwmutexes invalid&lt;br /&gt;
 *         ERR_SEM_NUMBER_INVALID            Number of semaphores invalid&lt;br /&gt;
 *         ERR_DATAQ_NUMBER_INVALID          Number of datqs invalid&lt;br /&gt;
 *         ERR_TIMED_ACTIONS_NUMBER_INVALID  Number of timed actions invalid&lt;br /&gt;
 *         ERR_OVERLAP_STACK                 Overlap stack end address with (two overlap areas are set)&lt;br /&gt;
 *         ERR_OVERLAP_LOG                   Overlap log with (two overlap areas are set)&lt;br /&gt;
 *         ERR_OVERLAP_FIXED                 Overlap fixed area with (two overlap areas are set)&lt;br /&gt;
 *         ERR_OVERLAP_DYNAMIC               Overlap dynamic area with (two overlap areas are set)&lt;br /&gt;
 *         ERR_FIXED_MEMORY_FAILED           Fixed area memory write fail&lt;br /&gt;
 *         ERR_DYNAMIC_MEMORY_FAILED         Dynamic area memory write fail&lt;br /&gt;
 *         ERR_TIMER_ADDR_INVALID            Timer address not provided by user (null). SPARC only&lt;br /&gt;
 *         ERR_SYS_TIMER_INDEX_INVALID       System timer index of subtimer invalid; SPARC only; Subtimers start from index 1; Need index of subtimer plus one in front&lt;br /&gt;
 *         ERR_PERIPHERAL_CLOCK_INVALID      System peripheral code invalid&lt;br /&gt;
 *&lt;br /&gt;
 */&lt;br /&gt;
S32_t   oceos_init(&lt;br /&gt;
    const struct application_configuration app_config&lt;br /&gt;
);&lt;br /&gt;
 &amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| app_config || Pointer to configuration struct.  struct application_configuration defined in '''''basic_structs.h'''''&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| WARN_LOG_SIZE_DEFAULT             || Warning, log size is set to default value of 64 entries&lt;br /&gt;
|-&lt;br /&gt;
| WARN_NO_ERROR_FUNCTION            || Warning, user defined function for ERROR handling is not provided&lt;br /&gt;
|-&lt;br /&gt;
| ERR_CPU_FIRST_CORE_INVALID        || Start CPU not in a range of available cores for this target; or greater than end CPU&lt;br /&gt;
|-&lt;br /&gt;
| ERR_CPU_LAST_CORE_INVALID         || Last CPU not in a range of available cores for this target&lt;br /&gt;
|-&lt;br /&gt;
| ERR_NOT_START_CPU_CORE            || Executing oceos_init on wrong CPU&lt;br /&gt;
|-&lt;br /&gt;
| ERR_STACK_START_MISALIGNED        || Stack start address is not set by user misaligned&lt;br /&gt;
|-&lt;br /&gt;
| ERR_STACK_PER_CORE_INVALID        || Stack per CPU size is zero, or not 8byte aligned, or less then min require&lt;br /&gt;
|-&lt;br /&gt;
| ERR_LOG_ADDR_MISALIGNED           || Log start address is not 8 byte aligned&lt;br /&gt;
|-&lt;br /&gt;
| ERR_FIX_ADDR_MISALIGNED           || Fixed area start address is not 8 byte aligned&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DYN_ADDR_MISALIGNED           || Dynamic area start address is not 8 byte aligned&lt;br /&gt;
|-&lt;br /&gt;
| ERR_CPU_CORE_RANGE_WRONG          || CPU cores in use exceed available CPUs on the SoC&lt;br /&gt;
|-&lt;br /&gt;
| ERR_STACK_SPACE_WRONG             || Current CPU SP is not within user provided stack range&lt;br /&gt;
|-&lt;br /&gt;
| ERR_LOG_SIZE_INVALID              || Log size outside expected range&lt;br /&gt;
|-&lt;br /&gt;
| ERR_CS_LOG_SIZE_INVALID           || Context switch log size invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TASK_NUMBER_INVALID           || Number of tasks invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_MUTEX_NUMBER_INVALID          || Number of mutexes invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_RWMUTEX_NUMBER_INVALID        || Number of rwmutexes invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SEM_NUMBER_INVALID            || Number of semaphores invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DATAQ_NUMBER_INVALID          || Number of datqs invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TIMED_ACTIONS_NUMBER_INVALID  || Number of timed actions invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_OVERLAP_STACK                 || Overlap stack end address with (two overlap areas are set)&lt;br /&gt;
|-&lt;br /&gt;
| ERR_OVERLAP_LOG                   || Overlap log with (two overlap areas are set)&lt;br /&gt;
|-&lt;br /&gt;
| ERR_OVERLAP_FIXED                 || Overlap fixed area with (two overlap areas are set)&lt;br /&gt;
|-&lt;br /&gt;
| ERR_OVERLAP_DYNAMIC               || Overlap dynamic area with (two overlap areas are set)&lt;br /&gt;
|-&lt;br /&gt;
| ERR_FIXED_MEMORY_FAILED           || Fixed area memory write fail&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DYNAMIC_MEMORY_FAILED         || Dynamic area memory write fail&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TIMER_ADDR_INVALID            || Timer address not provided by user (null). SPARC only&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_TIMER_INDEX_INVALID       || System timer index of subtimer invalid; SPARC only; Subtimers start from index 1; Need index of subtimer plus one in front&lt;br /&gt;
|-&lt;br /&gt;
| ERR_PERIPHERAL_CLOCK_INVALID      || System peripheral code invalid&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
    /*&lt;br /&gt;
     * Create the application configuration structure&lt;br /&gt;
     */&lt;br /&gt;
    struct application_configuration           app_config = {0};&lt;br /&gt;
&lt;br /&gt;
    /*&lt;br /&gt;
     * Fill in the application parameters&lt;br /&gt;
     */&lt;br /&gt;
    app_config.log_address                   = (log_t)log_data;              // required&lt;br /&gt;
    app_config.fixed_data_address            = (adrs_t)fixed_data;            // required&lt;br /&gt;
    app_config.dynamic_data_address          = (adrs_t)dynamic_data;          // required&lt;br /&gt;
&lt;br /&gt;
    app_config.stack_start_address           = start_stack_array[OCEOS_START_CPU_INDEX];// OCEOSMP_STACK_START_ADDRESS;&lt;br /&gt;
    app_config.stack_size_per_cpu            = (U32_t)&amp;amp;__oceos_stack_size_per_cpu;  // OCEOSMP_STACK_LOW_BOUND_ADDRESS;&lt;br /&gt;
&lt;br /&gt;
    app_config.system_error_function         = oceosmp_on_error;               // NULL =&amp;gt; ignore&lt;br /&gt;
    app_config.log_full_function             = oceosmp_on_full_log;            // NULL =&amp;gt; ignore&lt;br /&gt;
&lt;br /&gt;
    // used in setting up system log and fixed data array&lt;br /&gt;
    app_config.log_number_of_entries         = NUMBER_OF_LOG_ENTRIES;          // 0 =&amp;gt; use default&lt;br /&gt;
&lt;br /&gt;
    app_config.number_of_tasks               = NUMBER_OF_TASKS;                // &amp;gt;= 1&lt;br /&gt;
&lt;br /&gt;
    app_config.number_of_mutexes             = NUMBER_OF_MUTEXES;&lt;br /&gt;
	app_config.number_of_rwmutexes			 = NUMBER_OF_RWMUTEXES;&lt;br /&gt;
    app_config.number_of_counting_semaphores = NUMBER_OF_SEMAPHORES;&lt;br /&gt;
    app_config.number_of_data_queues         = NUMBER_OF_DATAQS;&lt;br /&gt;
&lt;br /&gt;
    /**&lt;br /&gt;
     * FOR SPARC TARGET ONLY.&lt;br /&gt;
     */&lt;br /&gt;
    app_config.sys_time_timer_index          = SYS_TIME_TIMER_INDEX;           // 0 =&amp;gt; invalid index&lt;br /&gt;
    /**&lt;br /&gt;
     * FOR SPARC TARGET ONLY.&lt;br /&gt;
     * Not Used for ARM. Always Nested&lt;br /&gt;
     */&lt;br /&gt;
    app_config.interrupt_nesting_enabled     = TRUE;                           // TRUE =&amp;gt; single vector&lt;br /&gt;
    app_config.oceos_cpu_switch_int_number   = OCEOS_CPU_INTER_COM_INT_NUMBER; // User should provide SGI ID (0-15)&lt;br /&gt;
&lt;br /&gt;
    app_config.timed_actions_queue_size      = NUMBER_OF_ACTION_ENTRIES;&lt;br /&gt;
    app_config.CS_log_entries_base2          = CS_LOG_DEF_ENTRIES_BASE2;&lt;br /&gt;
    /**&lt;br /&gt;
     * Set starting index of CPU that will be used by OCEOSMP&lt;br /&gt;
     */&lt;br /&gt;
    app_config.oceos_cpu_start_index         = OCEOS_START_CPU_INDEX;&lt;br /&gt;
    /**&lt;br /&gt;
     * Set last index of CPU that will be used by OCEOSMP&lt;br /&gt;
     */&lt;br /&gt;
    app_config.oceos_cpu_last_index          = OCEOS_LAST_CPU_INDEX;&lt;br /&gt;
    /*&lt;br /&gt;
     * Set system/peripheral clock used to initialise system timer&lt;br /&gt;
     */&lt;br /&gt;
    app_config.soc_peripheral_clck           = BSP_SYSFREQ * 1000 * 1000;&lt;br /&gt;
&lt;br /&gt;
    // initialise OCEOSMP&lt;br /&gt;
    S32_t status;&lt;br /&gt;
    status = oceos_init(app_config);&lt;br /&gt;
    if (OCEOS_SUCCESS &amp;gt; status) {&lt;br /&gt;
      oceosmp_print(&amp;quot;\n oceos_init failure\n\r&amp;quot;);&lt;br /&gt;
      return 0;&lt;br /&gt;
    } else {&lt;br /&gt;
      return 1;&lt;br /&gt;
    }   // else&lt;br /&gt;
 &amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_init_finish()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''initialisation.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Finalizes the fixed data array after all tasks etc. have been created&lt;br /&gt;
&lt;br /&gt;
All information needed to start OCEOS can be found in the fixed data area&lt;br /&gt;
when oceos_init_finish() has completed.&lt;br /&gt;
&lt;br /&gt;
Once all tasks etc. have been created oceos_init_finish() checks the&lt;br /&gt;
accumulated information against the application configuration data&lt;br /&gt;
stored in the fixed meta structure.&lt;br /&gt;
&lt;br /&gt;
oceos_init_finish also calculates the size of the dynamic data area and&lt;br /&gt;
checks it does not overlap with the system stack, the system log, or the&lt;br /&gt;
fixed data, and if all ok sets up pointers to the various dynamic area&lt;br /&gt;
components in the fixed data.&lt;br /&gt;
&lt;br /&gt;
It then adds an XOR checksum to the fixed data area, and checks that this&lt;br /&gt;
is followed by FILLER, which it replaces with the end sentinel.&lt;br /&gt;
&lt;br /&gt;
On successful completion it restores the interrupt level to its value&lt;br /&gt;
before oceos_init() was called, otherwise interrupts remain disabled.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Finalizes the fixed data array after all tasks etc. have been created&lt;br /&gt;
 *&lt;br /&gt;
 * All information needed to start OCEOS can be found in the fixed data area&lt;br /&gt;
 * when oceos_init_finish() has completed.&lt;br /&gt;
 *&lt;br /&gt;
 * Once all tasks etc. have been created oceos_init_finish() checks the&lt;br /&gt;
 * accumulated information against the application configuration data&lt;br /&gt;
 * stored in the fixed meta structure.&lt;br /&gt;
 *&lt;br /&gt;
 * oceos_init_finish also calculates the size of the dynamic data area and&lt;br /&gt;
 * checks it does not overlap with the system stack, the system log, or the&lt;br /&gt;
 * fixed data, and if all ok sets up pointers to the various dynamic area&lt;br /&gt;
 * components in the fixed data.&lt;br /&gt;
 *&lt;br /&gt;
 * It then adds an XOR checksum to the fixed data area, and checks that this&lt;br /&gt;
 * is followed by FILLER, which it replaces with the end sentinel.&lt;br /&gt;
 *&lt;br /&gt;
 * On successful completion it restores the interrupt level to its value&lt;br /&gt;
 * before oceos_init() was called, otherwise interrupts remain disabled.&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS                             All OK&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT               System Meta data is NULL or corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT                 System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_CPU_CORE                  Executing directive on wrong CPU&lt;br /&gt;
 *          ERR_WRONG_PHASE                     Called before oceos_init()&lt;br /&gt;
 *          ERR_TASKS_INCOMPLETE                Created wrong number of tasks&lt;br /&gt;
 *          ERR_MUTEX_INCOMPLETE                Created wrong number of mutexes&lt;br /&gt;
 *          ERR_RWMUTEX_INCOMPLETE              Created wrong number of rwmutexes&lt;br /&gt;
 *          ERR_SEM_INCOMPLETE                  Created wrong number of semaphores&lt;br /&gt;
 *          ERR_DATAQ_INCOMPLETE                Created wrong number of dataqs&lt;br /&gt;
 *          ERR_TASK_MAX_ID_INVALID             Task's max id invalid&lt;br /&gt;
 *          ERR_MUTEX_MAX_ID_INVALID            Mutexe's max id invalid&lt;br /&gt;
 *          ERR_RWMUTEX_MAX_ID_INVALID          Rwmutexe's max id invalid&lt;br /&gt;
 *          ERR_SEM_MAX_ID_INVALID              Semaphore's max id invalid&lt;br /&gt;
 *          ERR_DATAQ_MAX_ID_INVALID            Dataq's max id invalid&lt;br /&gt;
 *          ERR_TOTAL_JOBS_NUMBER_WRONG         Wrong number of total jobs created&lt;br /&gt;
 *          ERR_ORDER_ARRAY_PTR_INVALID         Order array pointer is NULL or mis-aligned&lt;br /&gt;
 *          ERR_FIXED_AREA_TOO_SMALL            Not enough space for fixed data area&lt;br /&gt;
 */&lt;br /&gt;
S32_t   oceos_init_finish(void);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
There are no input parameters to this function.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit  || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT               || System Meta data is NULL or corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT                 || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_CPU_CORE                  || Executing directive on wrong CPU&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE                     || Called before oceos_init()&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TASKS_INCOMPLETE                || Created wrong number of tasks&lt;br /&gt;
|-&lt;br /&gt;
| ERR_MUTEX_INCOMPLETE                || Created wrong number of mutexes&lt;br /&gt;
|-&lt;br /&gt;
| ERR_RWMUTEX_INCOMPLETE              || Created wrong number of rwmutexes&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SEM_INCOMPLETE                  || Created wrong number of semaphores&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DATAQ_INCOMPLETE                || Created wrong number of dataqs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TASK_MAX_ID_INVALID             || Task's max id invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_MUTEX_MAX_ID_INVALID            || Mutexe's max id invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_RWMUTEX_MAX_ID_INVALID          || Rwmutexe's max id invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SEM_MAX_ID_INVALID              || Semaphore's max id invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DATAQ_MAX_ID_INVALID            || Dataq's max id invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TOTAL_JOBS_NUMBER_WRONG         || Wrong number of total jobs created&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ORDER_ARRAY_PTR_INVALID         || Order array pointer is NULL or mis-aligned&lt;br /&gt;
|-&lt;br /&gt;
| ERR_FIXED_AREA_TOO_SMALL            || Not enough space for fixed data area&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
    /*&lt;br /&gt;
     * Finish initialising OCEOS and setting up the fixed data&lt;br /&gt;
     */&lt;br /&gt;
    status = oceos_init_finish();&lt;br /&gt;
    if(OCEOS_SUCCESS &amp;gt; status){&lt;br /&gt;
        // LOG&lt;br /&gt;
      oceosmp_print(&amp;quot;\nAbandoning, problem ending OCEOS initialisation\n\r&amp;quot;);&lt;br /&gt;
        return -1;&lt;br /&gt;
    }   // if&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_start()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''initialisation.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Starts OCEOS scheduling.&amp;lt;br&amp;gt;&lt;br /&gt;
Create dynamic OCEOS structures and start scheduling.&amp;lt;br&amp;gt;&lt;br /&gt;
This function should only be called once and only after [[OCEOSmp/directive_reference#oceos_init()|oceos_init()]] and [[OCEOSmp/directive_reference#oceos_init_finish()|oceos_init_finish()]] have been called successfully.&amp;lt;br&amp;gt;&lt;br /&gt;
Normally this function does not return. &amp;lt;br&amp;gt;&lt;br /&gt;
If a problem is detected the function terminates and returns an appropriate DIRECTIVE_STATUS code, with interrupts disabled.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Starts OCEOS scheduling&lt;br /&gt;
 *&lt;br /&gt;
 * Create dynamic OCEOS structures and start scheduling&lt;br /&gt;
 *&lt;br /&gt;
 * This function should only be called once&lt;br /&gt;
 * and only after oceos_init()&lt;br /&gt;
 * and oceos_init_finish() have&lt;br /&gt;
 *  been called successfully.&lt;br /&gt;
 * Normally this function does not return.&lt;br /&gt;
 * If a problem is detected the function&lt;br /&gt;
 * terminates and returns an appropriate&lt;br /&gt;
 * DIRECTIVE_STATUS code, with interrupts disabled.&lt;br /&gt;
 *&lt;br /&gt;
 * @param fixed_array_ptr   Pointer to fixed data array&lt;br /&gt;
 * @param start_task        Task ID&lt;br /&gt;
 * @param data_ptr          Pointer to data to be passed to the task&lt;br /&gt;
 * @return  OCEOSMP_EXIT                        OCEOSMP return from scheduling and exit&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT               Fixed area pointer is null or bad sentinel&lt;br /&gt;
 *          ERR_FIXED_AREA_SIZE_WRONG           Fixed area size is zero&lt;br /&gt;
 *          ERR_FIXED_AREA_END_SENTINEL_BAD     Fixed data end sentinel corrupt&lt;br /&gt;
 *          ERR_FIXED_AREA_BAD_XOR              Fixed area bad checksum or checksum mis-match&lt;br /&gt;
 *          ERR_INIT_NOT_DONE                   oceos_start() called without initialisation&lt;br /&gt;
 *          ERR_DYN_AREA_PTR_BAD                Dynamic area pointer invalid in sysMetaPtr&lt;br /&gt;
 *          ERR_INT_HANDLER_BAD                 IRQ controller pointer provided by BCC is NULL;or OCEOS handler is not set&lt;br /&gt;
 *          ERR_DYN_JOB_PTR_BAD                 Job array pointer is NULL&lt;br /&gt;
 *          ERR_FIXED_TASK_PTR_BAD              Tasks array pointer is NULL&lt;br /&gt;
 *          ERR_JOB_COUNT_WRONG                 Total job count inconsistent&lt;br /&gt;
 *          ERR_DYN_MUTEX_PTR_BAD               Mutex dynamic pointer is NULL&lt;br /&gt;
 *          ERR_DYN_LOCK_PTR_BAD                Mutex lock array pointer is NULL&lt;br /&gt;
 *          ERR_DYN_RWMUTEX_PTR_BAD             Rwmutex dynamic pointer is NULL&lt;br /&gt;
 *          ERR_DYN_RWLOCK_PTR_BAD              Rwmutex lock array pointer is NULL&lt;br /&gt;
 *          ERR_FIXED_SEM_PTR_BAD               Semaphore fixed pointer is NULL&lt;br /&gt;
 *          ERR_DYN_SEM_PTR_BAD                 Semaphore dynamic pointer is NULL&lt;br /&gt;
 *          ERR_SEM_PEND_PTR_BAD                Semaphore pending queue pointer is NULL&lt;br /&gt;
 *          ERR_FIXED_DATAQ_PTR_BAD             Dataq fixed pointer is NULL&lt;br /&gt;
 *          ERR_DYN_DATAQ_PTR_BAD               Dataq dynamic pointer is NULL&lt;br /&gt;
 *          ERR_DATAQ_PEND_PTR_BAD              Dataq pending queue pointer is NULL&lt;br /&gt;
 *          ERR_DATAQ_DATA_PTR_BAD              Dataq data pointer is NULL&lt;br /&gt;
 *          ERR_CPU_INT_NUMBER_INVALID          SPARC only.IRQ number for CPU inter-comunication invalid(zero or used by timer)&lt;br /&gt;
 *          ERR_REGISTER_CPU_IRQ_FAILED         SPARC only. Failed to set CPU IRQ handler in BCC&lt;br /&gt;
 *          ERR_CPU_STACK_INVALID               Current CPU stack not within specified range&lt;br /&gt;
 *          ERR_CPU_PRIORITY_STACK_INVALID      Per CPU priority stack invalid&lt;br /&gt;
 *          ERR_LOG_AREA_END_SENTINEL_BAD       Log area end sentinel override&lt;br /&gt;
 *          ERR_TA_CONFIG_PTR_BAD               SPARC only; Timed action configuration data pointer is NULL&lt;br /&gt;
 *          ERR_TA_TIMER_INDEX_INVALID          SPARC only; Timed action sub-timer index in timer unit is invalid&lt;br /&gt;
 *          ERR_TA_IRQ_NUMBER_INVALID           SPARC only; Timer action timer IRQ number is invalid&lt;br /&gt;
 *          ERR_TA_BCC_IRQ_REGISTER_FAILED      SPARC only; Timed action timer IRQ handler failed to register&lt;br /&gt;
 */&lt;br /&gt;
S32_t   oceos_start(&lt;br /&gt;
    const U32_t * const fixed_array_ptr,// pointer to fixed data array&lt;br /&gt;
    const U32_t start_task,             // taskID&lt;br /&gt;
    void * const data_ptr               // pointer to data to be passed to task&lt;br /&gt;
);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| fixed_array_ptr || Pointer to fixed data array&lt;br /&gt;
|-&lt;br /&gt;
| start_task      || Task ID&lt;br /&gt;
|-&lt;br /&gt;
| data_ptr        || Pointer to data to be passed to the task&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit  || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT               || Fixed area pointer is null or bad sentinel&lt;br /&gt;
|-&lt;br /&gt;
| ERR_FIXED_AREA_SIZE_WRONG           || Fixed area size is zero&lt;br /&gt;
|-&lt;br /&gt;
| ERR_FIXED_AREA_END_SENTINEL_BAD     || Fixed data end sentinel corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_FIXED_AREA_BAD_XOR              || Fixed area bad checksum or checksum mis-match&lt;br /&gt;
|-&lt;br /&gt;
| ERR_INIT_NOT_DONE                   || oceos_start() called without initialisation&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DYN_AREA_PTR_BAD                || Dynamic area pointer invalid in sysMetaPtr&lt;br /&gt;
|-&lt;br /&gt;
| ERR_INT_HANDLER_BAD                 || IRQ controller pointer provided by BCC is NULL;or OCEOS handler is not set&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DYN_JOB_PTR_BAD                 || Job array pointer is NULL&lt;br /&gt;
|-&lt;br /&gt;
| ERR_FIXED_TASK_PTR_BAD              || Tasks array pointer is NULL&lt;br /&gt;
|-&lt;br /&gt;
| ERR_JOB_COUNT_WRONG                 || Total job count inconsistent&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DYN_MUTEX_PTR_BAD               || Mutex dynamic pointer is NULL&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DYN_LOCK_PTR_BAD                || Mutex lock array pointer is NULL&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DYN_RWMUTEX_PTR_BAD             || Rwmutex dynamic pointer is NULL&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DYN_RWLOCK_PTR_BAD              || Rwmutex lock array pointer is NULL&lt;br /&gt;
|-&lt;br /&gt;
| ERR_FIXED_SEM_PTR_BAD               || Semaphore fixed pointer is NULL&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DYN_SEM_PTR_BAD                 || Semaphore dynamic pointer is NULL&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SEM_PEND_PTR_BAD                || Semaphore pending queue pointer is NULL&lt;br /&gt;
|-&lt;br /&gt;
| ERR_FIXED_DATAQ_PTR_BAD             || Dataq fixed pointer is NULL&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DYN_DATAQ_PTR_BAD               || Dataq dynamic pointer is NULL&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DATAQ_PEND_PTR_BAD              || Dataq pending queue pointer is NULL&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DATAQ_DATA_PTR_BAD              || Dataq data pointer is NULL&lt;br /&gt;
|-&lt;br /&gt;
| ERR_CPU_INT_NUMBER_INVALID          || SPARC only.IRQ number for CPU inter-comunication invalid(zero or used by timer)&lt;br /&gt;
|-&lt;br /&gt;
| ERR_REGISTER_CPU_IRQ_FAILED         || SPARC only. Failed to set CPU IRQ handler in BCC&lt;br /&gt;
|-&lt;br /&gt;
| ERR_CPU_STACK_INVALID               || Current CPU stack not within specified range&lt;br /&gt;
|-&lt;br /&gt;
| ERR_CPU_PRIORITY_STACK_INVALID      || Per CPU priority stack invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_LOG_AREA_END_SENTINEL_BAD       || Log area end sentinel override&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_CONFIG_PTR_BAD               || SPARC only; Timed action configuration data pointer is NULL&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_TIMER_INDEX_INVALID          || SPARC only; Timed action sub-timer index in timer unit is invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_IRQ_NUMBER_INVALID           || SPARC only; Timer action timer IRQ number is invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_BCC_IRQ_REGISTER_FAILED      || SPARC only; Timed action timer IRQ handler failed to register&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/* Sample Task names - all here start with t_ to help avoid name confusion */&lt;br /&gt;
enum TASK_NAME{&lt;br /&gt;
    t_tom,                      // will have task ID 0&lt;br /&gt;
    t_dick,                     // will have task ID 1&lt;br /&gt;
};&lt;br /&gt;
extern U32_t fixed_data[];&lt;br /&gt;
...&lt;br /&gt;
S32_t status;&lt;br /&gt;
&lt;br /&gt;
status = oceos_start(fixed_data, t_tom, NULL);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_exit()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''initialisation.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Ends scheduling and exit from [[OCEOSmp/directive_reference#oceos_start()|oceos_start()]].&lt;br /&gt;
No task can be started after this.&amp;lt;br&amp;gt;&lt;br /&gt;
OCEOS will exit when the current job ends.&amp;lt;br&amp;gt;&lt;br /&gt;
An idle task in an endless loop should check that scheduling is enabled.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Ends scheduling and exit from oceos_start.&lt;br /&gt;
 * No task can be started after this.&lt;br /&gt;
 * OCEOS will exit when the current job ends.&lt;br /&gt;
 * An idle task in an endless loop should check that scheduling is enabled.&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Called before scheduling started&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_exit(void);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
There are no input parameters to this function.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit  || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Called before scheduling started&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
// Exit OCEOS&lt;br /&gt;
oceos_exit();&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_CPU_sleep()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''initialisation.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
 Puts CPU in sleep mode.&amp;lt;br&amp;gt;&lt;br /&gt;
 User must to be sure that interrupts are enabled.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Puts CPU in sleep mode.&lt;br /&gt;
 * User must to be sure that interrupts are enabled.&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_CPU_sleep(void);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
There are no input parameters to this function.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
// Put CPU to sleep&lt;br /&gt;
oceos_CPU_sleep();&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceosmp_cpu_disable()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''initialisation.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function ends execution of all tasks running on particular CPU and removes the CPU from scheduling.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Ends execution of all tasks running on particular CPU and removes this CPU from scheduling.&lt;br /&gt;
 * @param cpu_id&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              CPU ID outside allowed range 0 to 254&lt;br /&gt;
 *          ERR_ID_WRONG                CPU ID &amp;gt;= number of available CPUs&lt;br /&gt;
 *          ERR_CPU_ALREADY_DISABLED    CPU already disabled&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceosmp_cpu_disable(&lt;br /&gt;
    U32_t cpu_id&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| cpu_id || ID of CPU core to be disabled.&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit  || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || CPU ID outside allowed range 0 to 254&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || CPU ID &amp;gt;= number of available CPUs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_CPU_ALREADY_DISABLED    || CPU already disabled&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, faulty_cpu;&lt;br /&gt;
...&lt;br /&gt;
// Disable faulty CPU core&lt;br /&gt;
status = oceosmp_cpu_disable(faulty_cpu));&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceosmp_cpu_enable()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''initialisation.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function adds a disabled CPU core to the OCEOSmp scheduler. It should only be called after scheduling has started&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 *  Adds disabled CPU to OCEOSmp scheduler&lt;br /&gt;
 *&lt;br /&gt;
 *  N.B. This function should only be called after scheduling has started&lt;br /&gt;
 *&lt;br /&gt;
 * @param cpu_id&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              CPU ID outside allowed range 0 to 254&lt;br /&gt;
 *          ERR_ID_WRONG                CPU ID &amp;gt;= number of available CPUs; or the same as currently running&lt;br /&gt;
 *          ERR_CPU_ALREADY_ENABLED     CPU already enabled&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceosmp_cpu_enable(&lt;br /&gt;
    U32_t cpu_id&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| cpu_id || ID of CPU core to be enabled.&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit  || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || CPU ID outside allowed range 0 to 254&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || CPU ID &amp;gt;= number of available CPUs; or the same as currently running&lt;br /&gt;
|-&lt;br /&gt;
| ERR_CPU_ALREADY_ENABLED     || CPU already enabled&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, good_cpu;&lt;br /&gt;
...&lt;br /&gt;
// Enable CPU core&lt;br /&gt;
status = oceosmp_cpu_enable(good_cpu));&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceosmp_cpu_terminate()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''initialisation.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function removes a CPU core from the OCEOSmp scheduler and marks it so it cannot be restarted. It puts CPU to sleep with interrupts disabled. It should only be called after scheduling has started.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 *  Removes CPU from OCEOSMP scheduler and terminates, cannot be restarted.&lt;br /&gt;
 *  Puts CPU to sleep with interrupts disabled&lt;br /&gt;
 *&lt;br /&gt;
 *  N.B. This function should only be called after scheduling has started&lt;br /&gt;
 *  Steps:&lt;br /&gt;
 *     1. Set terminate flag on this CPU;&lt;br /&gt;
 *     2. Trigger software interrupt to transfer execution to IRQ handler;&lt;br /&gt;
 *     3. Check flag and if set =&amp;gt; put CPU to sleep in while loop with interrupts disabled;&lt;br /&gt;
 *     4. Set MAX priority on this CPU priority stack;&lt;br /&gt;
 *     5. Remove CPU from scheduling;&lt;br /&gt;
 *     6. Clean up all the tasks by calling task terminate function and free up all the&lt;br /&gt;
 *        preempted jobs by this CPU;&lt;br /&gt;
 *&lt;br /&gt;
 * @param cpu_id&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              CPU ID outside allowed range 0 to 254&lt;br /&gt;
 *          ERR_ID_WRONG                CPU ID &amp;gt;= number of available CPUs; or the same as currently running&lt;br /&gt;
 *          ERR_CPU_ALREADY_TERMINATED  CPU already terminated&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceosmp_cpu_terminate(&lt;br /&gt;
    U32_t cpu_id&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| cpu_id || ID of CPU core to be terminated.&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit  || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || CPU ID outside allowed range 0 to 254&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || CPU ID &amp;gt;= number of available CPUs; or the same as currently running&lt;br /&gt;
|-&lt;br /&gt;
| ERR_CPU_ALREADY_TERMINATED  || CPU already terminated&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, faulty_cpu;&lt;br /&gt;
...&lt;br /&gt;
// Terminate CPU core&lt;br /&gt;
status = oceosmp_cpu_terminate(faulty_cpu));&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;Task directives&amp;lt;/span&amp;gt;==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ API Functions&lt;br /&gt;
|-&lt;br /&gt;
| Directive                                                                     || Description                          || main || task || IRQ handler&lt;br /&gt;
|-&lt;br /&gt;
| [[OCEOSmp/directive reference#oceos_task_create()| oceos_task_create()]]             || Create Task                        || *    ||      || &lt;br /&gt;
|-&lt;br /&gt;
| [[OCEOSmp/directive reference#oceos_task_start()| oceos_task_start()]]               || Start Task                         ||      ||  *   || *&lt;br /&gt;
|-&lt;br /&gt;
| [[OCEOSmp/directive reference#oceos_task_timed_start()| oceos_task_timed_start()]]   || Schedule a task to start execution at a given system time||      ||  *   || *&lt;br /&gt;
|-&lt;br /&gt;
| [[OCEOSmp/directive reference#oceos_task_disable()| oceos_task_disable()]]           || Disable Task                       ||      ||  *   || *&lt;br /&gt;
|-&lt;br /&gt;
| [[OCEOSmp/directive reference#oceos_task_enable()| oceos_task_enable()]]             || Enable Task                        ||      ||  *   || *&lt;br /&gt;
|-&lt;br /&gt;
| [[OCEOSmp/directive reference#oceos_task_self()| oceos_task_self()]]                 || Returns the task ID of the currently executing task ||    ||  *   || *&lt;br /&gt;
|-&lt;br /&gt;
| [[OCEOSmp/directive reference#oceos_task_get_priority()| oceos_task_get_priority()]] || Get priority of a task             ||      ||  *   || *&lt;br /&gt;
|-&lt;br /&gt;
| [[OCEOSmp/directive reference#oceos_task_get_status()| oceos_task_get_status()]]     || Get status of a task               ||      ||  *   || *&lt;br /&gt;
|-&lt;br /&gt;
| [[OCEOSmp/directive reference#oceos_task_kill()| oceos_task_kill()]]                 || Directive to terminate current task||      ||  *   || *&lt;br /&gt;
|-&lt;br /&gt;
| [[OCEOSmp/directive reference#oceos_task_get_info()| oceos_task_get_info()]]         || Get task information               ||      ||  *   || *&lt;br /&gt;
|-&lt;br /&gt;
| [[OCEOSmp/directive reference#oceosmp_task_kill()| oceosmp_task_kill()]]                 || Directive to terminate current task||      ||  *   || *&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;Task data structures&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''tasks.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The following data structures are used by some of the task directives.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Data structures'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * A pointer to this structure is passed to oceos_task_create().&lt;br /&gt;
 * The structure is first initialised according to a tasks's parameters,&lt;br /&gt;
 * and is not used again after the task is created and may then be discarded.&lt;br /&gt;
 */&lt;br /&gt;
struct task_descriptor {&lt;br /&gt;
&lt;br /&gt;
	void (*function_start)(void*);	// name of task start function&lt;br /&gt;
	void (*function_end)(void*);	// optional, NULL or task end function&lt;br /&gt;
&lt;br /&gt;
	U32_t task_id;					// 0 to 254, usually an enum&lt;br /&gt;
	U32_t task_jobs_max;			// 1 to 15, max concurrent 'jobs'&lt;br /&gt;
	U32_t task_priority;			// 1 (highest) to 254 (lowest)&lt;br /&gt;
	U32_t task_threshold;			// &amp;gt;=1, &amp;lt;= task_priority (higher or same priority)&lt;br /&gt;
	U32_t task_turned_on_initially;	// 0: disabled initially, else enabled&lt;br /&gt;
&lt;br /&gt;
	U32_t time_deadline_microsecs;	// start request to finish, 0 to ignore&lt;br /&gt;
	U32_t time_min_interval_microsecs;	// between start requests, 0 to ignore&lt;br /&gt;
&lt;br /&gt;
	U32_t uses_cpu_affinity;		// 0: not restricted, else core restricted&lt;br /&gt;
	U32_t uses_cpu_affinity_core_id;// core ID to which restricted if affinity used&lt;br /&gt;
}__attribute__ ((aligned (8)));&lt;br /&gt;
&lt;br /&gt;
/**&lt;br /&gt;
 * Task info used with oceos_task_get_info&lt;br /&gt;
 */&lt;br /&gt;
struct task_info {&lt;br /&gt;
  U64_t           time_max_delay;               // maximum time job is waiting on ready queue before becoming active&lt;br /&gt;
  U64_t           time_max_finish;              // maximum time to finish job execution after starting&lt;br /&gt;
  U64_t           time_max_exec;                // maximum time spent executing&lt;br /&gt;
  U64_t           time_total_exec;              // total CPU time used by this task&lt;br /&gt;
  U64_t           time_min_gap_starts;          // minimum time between job creations, can be reset&lt;br /&gt;
  U64_t           time_min_gap_finish_start;    // minimum time between job ending and new job creation, can be reset&lt;br /&gt;
&lt;br /&gt;
  U64_t           time_last_start;              // time of most recent job creation&lt;br /&gt;
  U64_t           time_last_finish;             // time of most recent job finish&lt;br /&gt;
&lt;br /&gt;
  unsigned int    jobs_current_max  :16;        // maximum number of current jobs for this task, no roll over, can be reset&lt;br /&gt;
  unsigned int    jobs_total        :16;        // number of times this task was started, no roll-over, can be reset&lt;br /&gt;
  U32_t           jobs_current;                 // Number of task instances currently in use by oceos&lt;br /&gt;
&lt;br /&gt;
  U32_t           preempt_max;                  // maximum times any job was pre-empted, no roll-over, can be reset&lt;br /&gt;
}__attribute__ ((aligned (8)));&lt;br /&gt;
&lt;br /&gt;
/* A task's status is returned as below if queried */&lt;br /&gt;
enum TASK_STATUS {&lt;br /&gt;
    TASK_DISABLED,      // cannot be scheduled, and no current jobs&lt;br /&gt;
    TASK_ENABLED,       // can be scheduled, but no current jobs&lt;br /&gt;
    TASK_INVALID,       // task does not exist&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_task_create()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''tasks.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Create a task.&lt;br /&gt;
Can only be use before OCEOS starts. Stores the task information in the OCEOS fixed data area.&lt;br /&gt;
This directive populates the data structures for a task. It should be called after [[OCEOSmp/directive_reference#oceos_init()|oceos_init()]] and before [[OCEOSmp/directive_reference#oceos_init_finish()|oceos_init_finish()]].&amp;lt;br&amp;gt;&lt;br /&gt;
It must be called for each task otherwise [[OCEOSmp/directive_reference#oceos_start()|oceos_start()]] will return an error.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Create a task using a task descriptor structure&lt;br /&gt;
 *&lt;br /&gt;
 * Can only be used in Initialisation Phase.&lt;br /&gt;
 *&lt;br /&gt;
 * A task has twelve constant parameters set when the task is created.&lt;br /&gt;
 * Rather than setting a list of these parameters the named fields of a&lt;br /&gt;
 * task_descriptor structure are set and a pointer to it passed here.&lt;br /&gt;
 *&lt;br /&gt;
 * The task_descriptor structure fields are described above.&lt;br /&gt;
 * Once the task has been created the structure can be discarded.&lt;br /&gt;
 *&lt;br /&gt;
 * To create a task:&lt;br /&gt;
 *		set up a task_descriptor structure,&lt;br /&gt;
 *		set its fields to the parameter values for the task,&lt;br /&gt;
 *		pass a pointer to the structure to this directive.&lt;br /&gt;
 *&lt;br /&gt;
 * The structure is checked for validity by oceos_task_create and its&lt;br /&gt;
 * information used to set the task details in the OCEOS fixed data area.&lt;br /&gt;
 *&lt;br /&gt;
 * @param  struct task_descriptor *	fields give task characteristics&lt;br /&gt;
 *&lt;br /&gt;
 * @return OCEOS_SUCCESS            No errors or warnings&lt;br /&gt;
 *         WARN_NO_END_FUNCTION     Warning, no end task function specified&lt;br /&gt;
 *&lt;br /&gt;
 *         ERR_SYS_FIXED_CORRUPT    System Fixed area corrupt&lt;br /&gt;
 *         ERR_WRONG_CPU_CORE       Executing directive on wrong CPU&lt;br /&gt;
 *         ERR_WRONG_PHASE          Called before oceos_init() is done&lt;br /&gt;
 *         ERR_TOO_MANY             MAX number of tasks already created&lt;br /&gt;
 *         ERR_ID_INVALID           Task ID outside allowed range 0 to 254&lt;br /&gt;
 *         ERR_ID_WRONG             Task ID outside &amp;gt;= number of tasks&lt;br /&gt;
 *         ERR_T_ALREADY_ALLOCATED  Task ID already in use&lt;br /&gt;
 *         ERR_T_PRIORITY_INVALID   Task priority outside allowed range 1 to 254&lt;br /&gt;
 *         ERR_THRESHOLD_INVALID    Task threshold outside range 1 to 254&lt;br /&gt;
 *         ERR_THRESHOLD_WRONG      Task threshold  higher priority than task priority&lt;br /&gt;
 *         ERR_JOBS_MAX_INVALID     Job number outside range 1 to 15&lt;br /&gt;
 *         ERR_JOBS_TOO_MANY        System capacity exceeded&lt;br /&gt;
 *         ERR_AFFINITY_WRONG       CPU core specified is outside chosen range&lt;br /&gt;
 *         ERR_START_FUNCTION_BAD   Task start function address either NULL or misaligned&lt;br /&gt;
 */&lt;br /&gt;
S32_t   oceos_task_create(&lt;br /&gt;
    const struct task_descriptor * const task_description_ptr&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter           || Description&lt;br /&gt;
|-&lt;br /&gt;
|struct task_descriptor * || Pointer to task descriptor which contains task attributes&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit     || Description&lt;br /&gt;
|-&lt;br /&gt;
|WARN_NO_END_FUNCTION     || Warning, no end task function specified&lt;br /&gt;
|-&lt;br /&gt;
|ERR_SYS_FIXED_CORRUPT    || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
|ERR_WRONG_CPU_CORE       || Executing directive on wrong CPU&lt;br /&gt;
|-&lt;br /&gt;
|ERR_WRONG_PHASE          || Called before oceos_init() is done&lt;br /&gt;
|-&lt;br /&gt;
|ERR_TOO_MANY             || MAX number of tasks already created&lt;br /&gt;
|-&lt;br /&gt;
|ERR_ID_INVALID           || Task ID outside allowed range 0 to 254&lt;br /&gt;
|-&lt;br /&gt;
|ERR_ID_WRONG             || Task ID outside &amp;gt;= number of tasks&lt;br /&gt;
|-&lt;br /&gt;
|ERR_T_ALREADY_ALLOCATED  || Task ID already in use&lt;br /&gt;
|-&lt;br /&gt;
|ERR_T_PRIORITY_INVALID   || Task priority outside allowed range 1 to 254&lt;br /&gt;
|-&lt;br /&gt;
|ERR_THRESHOLD_INVALID    || Task threshold outside range 1 to 254&lt;br /&gt;
|-&lt;br /&gt;
|ERR_THRESHOLD_WRONG      || Task threshold  higher priority than task priority&lt;br /&gt;
|-&lt;br /&gt;
|ERR_JOBS_MAX_INVALID     || Job number outside range 1 to 15&lt;br /&gt;
|-&lt;br /&gt;
|ERR_JOBS_TOO_MANY        || System capacity exceeded&lt;br /&gt;
|-&lt;br /&gt;
|ERR_AFFINITY_WRONG       || CPU core specified is outside chosen range&lt;br /&gt;
|-&lt;br /&gt;
|ERR_START_FUNCTION_BAD   || Task start function address either NULL or misaligned&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
/* Sample Task names - all here start with t_ to help avoid name confusion */&lt;br /&gt;
enum TASK_NAME{&lt;br /&gt;
      t_0,&lt;br /&gt;
      t_1,&lt;br /&gt;
      t_2&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
/*&lt;br /&gt;
 * APPLICATION FUNCTION DECLARATIONS&lt;br /&gt;
 */&lt;br /&gt;
void fun0(void *);&lt;br /&gt;
void fun1(void *);&lt;br /&gt;
void fun2(void *);&lt;br /&gt;
void end_function(void *);&lt;br /&gt;
&lt;br /&gt;
const struct task_descriptor tasks_data[NUMBER_OF_TASKS] = {&lt;br /&gt;
    {fun0, end_function, t_0, 2, 10, 8, TASK_ENABLED, 0, 0, 0, 0},&lt;br /&gt;
    {fun1, end_function, t_1, 2, 10, 8, TASK_ENABLED, 0, 0, 0, 0},&lt;br /&gt;
    {fun2, end_function, t_2, 2, 10, 8, TASK_ENABLED, 0, 0, 0, 0}&lt;br /&gt;
}; &lt;br /&gt;
&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
    // create tasks (names are defined in the application header)&lt;br /&gt;
    for (i=0; i&amp;lt;NUMBER_OF_TASKS; i++){&lt;br /&gt;
        if ( oceos_task_create(&amp;amp;tasks_data[i]) != OCEOS_SUCCESS ){&lt;br /&gt;
        	oceosmp_print(&amp;quot;\nFailed to create task\n\r&amp;quot;);&lt;br /&gt;
        	return -i;&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_task_start()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''tasks.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function starts an instance of a task. An instance of a task is called a job in OCEOS terminology.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 *  Starting a task involves three main stages&lt;br /&gt;
 *      1 setting up a job&lt;br /&gt;
 *          finding a free job entry if available&lt;br /&gt;
 *          setting up this entry including passing it the data void *&lt;br /&gt;
 *&lt;br /&gt;
 *      2 placing the job on readyQ&lt;br /&gt;
 *&lt;br /&gt;
 *      3 doing a context switch&lt;br /&gt;
 * This function should only be called after OCEOS is initialised&lt;br /&gt;
 *       and the dynamic task and job structures set up&lt;br /&gt;
 *&lt;br /&gt;
 *  When used from an interrupt handler,&lt;br /&gt;
 *  the context switch is only done&lt;br /&gt;
 *  after all nested interrupts have unwound&lt;br /&gt;
 *&lt;br /&gt;
 * @param task_id Task ID must be in range 0 to 254&lt;br /&gt;
 * @param ptr     Pointer to task data&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT    System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT      System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE          Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID           Task ID is invalid&lt;br /&gt;
 *          ERR_ID_WRONG             Task ID is wrong&lt;br /&gt;
 *          ERR_START_TASK_DISABLED  Starting task is disabled&lt;br /&gt;
 *          ERR_TOO_MANY             There is no free job&lt;br /&gt;
 *          ERR_SYS_BUSY             Failed to grab the lock&lt;br /&gt;
 */&lt;br /&gt;
S32_t   oceos_task_start(&lt;br /&gt;
    const U32_t task_id, // task ID, must be in range 0 to 254&lt;br /&gt;
    void * const ptr    // pointer to data&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| task_id || U32_t with Task ID in range 0 to 254.&lt;br /&gt;
|-&lt;br /&gt;
| ptr    || void * pointer to task data&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit  || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT    || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT      || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE          || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID           || Task ID is invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG             || Task ID is wrong&lt;br /&gt;
|-&lt;br /&gt;
| ERR_START_TASK_DISABLED  || Starting task is disabled&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TOO_MANY             || There is no free job&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY             || Failed to grab the lock&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
void *ptr;&lt;br /&gt;
...&lt;br /&gt;
// Start instance of task T_1 passing pointer ptr&lt;br /&gt;
status = oceos_task_start(t_1,ptr);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_task_timed_start()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''tasks.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function schedules a task to start execution at a given system time.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 *  Schedule a task to start execution at a given system time&lt;br /&gt;
 *&lt;br /&gt;
 *  The before and after offsets define a window around the selected time&lt;br /&gt;
 *  in which the task may be started.&lt;br /&gt;
 *&lt;br /&gt;
 *  If the current system time is before the start window a job is created&lt;br /&gt;
 *  and a corresponding action put on the timed action queue.&lt;br /&gt;
 *&lt;br /&gt;
 *  If the current system time is within the time window for starting the task,&lt;br /&gt;
 *  it is started immediately.&lt;br /&gt;
 *&lt;br /&gt;
 *  If the current system time is after the window, an error is reported.&lt;br /&gt;
 *&lt;br /&gt;
 *  Times are in microseconds.&lt;br /&gt;
 *&lt;br /&gt;
 *  This function should only be called after OCEOS is initialised&lt;br /&gt;
 *  and the dynamic task and job structures set up&lt;br /&gt;
 *&lt;br /&gt;
 * @param taskID        Task ID must be in range 0 to 254&lt;br /&gt;
 * @param ptr           Pointer to data&lt;br /&gt;
 * @param start_time    System time at which job should start&lt;br /&gt;
 * @param before        Forward tolerance for time&lt;br /&gt;
 * @param after         Backward tolerance for time&lt;br /&gt;
 * @param return_job_id Return job_id to the user, to remove this job from timed action if needed&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              Task ID invalid&lt;br /&gt;
 *          ERR_ID_WRONG                Task ID is wrong&lt;br /&gt;
 *          ERR_TA_NOT_INIT             Timed action inialisation is not done and tried to be used&lt;br /&gt;
 *          ERR_START_TASK_DISABLED     Starting task is disabled&lt;br /&gt;
 *          ERR_TOO_MANY                There is no free job&lt;br /&gt;
 *          ERR_TOO_LATE                Starting task is too late(out of time frame)&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to grab the lock&lt;br /&gt;
 *          ERR_TA_Q_FULL               Timed action queue is full&lt;br /&gt;
 *          ERR_TA_START_FAILED         Timed action execute failed; See log&lt;br /&gt;
 */&lt;br /&gt;
S32_t   oceos_task_timed_start(&lt;br /&gt;
    const U32_t task_id,     // task ID, must be in range 0 to 254&lt;br /&gt;
    void * const ptr,        // pointer to data&lt;br /&gt;
    const U64_t start_time,  // system time at which job should start&lt;br /&gt;
    const U32_t before,      // forward tolerance for time&lt;br /&gt;
    const U32_t after,       // backward tolerance for time&lt;br /&gt;
    U32_t * return_job_id    // return job_id to the user, to remove this job from timed action if needed&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| taskID        || U32_t task ID must be in range 0 to 254&lt;br /&gt;
|-&lt;br /&gt;
| ptr           || void * pointer to data&lt;br /&gt;
|-&lt;br /&gt;
| start_time    || U64_t system time at which job should start&lt;br /&gt;
|-&lt;br /&gt;
| before        || U32_t forward tolerance for time&lt;br /&gt;
|-&lt;br /&gt;
| after         || U32_t backward tolerance for time&lt;br /&gt;
|-&lt;br /&gt;
| return_job_id || U32_t return job_id to the user, to remove this job from timed action if needed&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit  || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || Task ID invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || Task ID is wrong&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_NOT_INIT             || Timed action inialisation is not done and tried to be used&lt;br /&gt;
|-&lt;br /&gt;
| ERR_START_TASK_DISABLED     || Starting task is disabled&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TOO_MANY                || There is no free job&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TOO_LATE                || Starting task is too late(out of time frame)&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to grab the lock&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_Q_FULL               || Timed action queue is full&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_START_FAILED         || Timed action execute failed; See log&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
U32_t job_id;&lt;br /&gt;
U64_t cur_sys_time;&lt;br /&gt;
...&lt;br /&gt;
  cur_sys_time = oceos_time_sys_get64();&lt;br /&gt;
&lt;br /&gt;
  // Start task 10,000 microseconds (us) from now and advise if started more than 1,000 us before or 2,000 us after.&lt;br /&gt;
  status = oceos_task_timed_start(t_2, ptr, cur_sys_time + 10000, 1000, 2000, &amp;amp;job_id);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_task_disable()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''initialisation.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function disables a task and removes any current pending jobs from the readyQ.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 *  Disable a task and remove any current pending jobs on readyQ.&lt;br /&gt;
 *&lt;br /&gt;
 *  A disabled task's jobs  will not be put into execution nor put on readyQ.&lt;br /&gt;
 *&lt;br /&gt;
 *  Note that where execution of a task has already commenced,&lt;br /&gt;
 *  disabling the task will not prevent it from completing.&lt;br /&gt;
 *&lt;br /&gt;
 *  This function should only be called after OCEOS is initialised&lt;br /&gt;
 *  and the dynamic task and job structures set up&lt;br /&gt;
 *&lt;br /&gt;
 * @param taskID  Task ID must be in range 0 to 254&lt;br /&gt;
 * @return: OCEOS_SUCCESS&lt;br /&gt;
 *          WARN_ALREADY_DISABLED        Task already disabled&lt;br /&gt;
 *          WARN_SEM_PEND_REMOVE_FAILED  Failed to remove job from semaphore pending queue&lt;br /&gt;
 *          WARN_DQ_PEND_REMOVE_FAILED   Failed to remove job from dataq pending queue&lt;br /&gt;
 *&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT        System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT          System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE              Directive was called before OCEOS init is finished&lt;br /&gt;
 *          ERR_ID_INVALID               Task ID is invalid&lt;br /&gt;
 *          ERR_ID_WRONG                 Task ID is wrong&lt;br /&gt;
 *          ERR_SYS_BUSY                 Failed to grab the lock&lt;br /&gt;
 */&lt;br /&gt;
S32_t   oceos_task_disable(&lt;br /&gt;
    const U32_t task_id // task ID, must be in range 0 to 254&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| taskID || U32_t task ID must be in range 0 to 254&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit  || Description&lt;br /&gt;
|-&lt;br /&gt;
| WARN_ALREADY_DISABLED        || Task already disabled&lt;br /&gt;
|-&lt;br /&gt;
| WARN_SEM_PEND_REMOVE_FAILED  || Failed to remove job from semaphore pending queue&lt;br /&gt;
|-&lt;br /&gt;
| WARN_DQ_PEND_REMOVE_FAILED   || Failed to remove job from dataq pending queue&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT        || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT          || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE              || Directive was called before OCEOS init is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID               || Task ID is invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                 || Task ID is wrong&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                 || Failed to grab the lock&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Disable task t_1&lt;br /&gt;
status = oceos_task_disable(t_1);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_task_enable()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''tasks.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function enables a task. Only enabled tasks may be started.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 *  Enable a task - only enabled tasks are placed on readyQ or started.&lt;br /&gt;
 *&lt;br /&gt;
 *  This function should only be called after OCEOS is initialised&lt;br /&gt;
 *  and the dynamic task and job structures set up&lt;br /&gt;
 *&lt;br /&gt;
 * @param taskID   Task ID must be in range 0 to 254&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          WARN_ALREADY_ENABLED     Task already enabled&lt;br /&gt;
 *&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT    System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT      System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE          Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID           Task ID is invalid&lt;br /&gt;
 *          ERR_ID_WRONG             Task ID is wrong&lt;br /&gt;
 *          ERR_SYS_BUSY             Failed to grab the lock&lt;br /&gt;
 */&lt;br /&gt;
S32_t   oceos_task_enable(&lt;br /&gt;
    const U32_t task_id // task ID, must be in range 0 to 254&lt;br /&gt;
);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| taskID  || U32_t task ID must be in range 0 to 254&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit  || Description&lt;br /&gt;
|-&lt;br /&gt;
| WARN_ALREADY_ENABLED     || Task already enabled&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT    || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT      || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE          || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID           || Task ID is invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG             || Task ID is wrong&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY             || Failed to grab the lock&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Enable task t_2&lt;br /&gt;
status = oceos_task_enable(t_2);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_task_self()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''tasks.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the task number of the currently running task on the calling CPU.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Get currently running task on calling CPU&lt;br /&gt;
 *&lt;br /&gt;
 * @param t_id  Task ID holder&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT        System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT          System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE              Directive was called before OCEOS init is finished&lt;br /&gt;
 *          ERR_CPU_DYN_PTR_BAD          CPU dynamic area pointer corrupt&lt;br /&gt;
 */&lt;br /&gt;
S32_t  oceos_task_self(&lt;br /&gt;
    U32_t *t_id&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| t_id || S32_t * pointer to variable where task ID will be written.&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit  || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT        || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT          || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE              || Directive was called before OCEOS init is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_CPU_DYN_PTR_BAD          || CPU dynamic area pointer corrupt&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, task_running;&lt;br /&gt;
...&lt;br /&gt;
// Return task ID that's running on this core&lt;br /&gt;
status = oceos_task_self(&amp;amp;task_running);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_task_get_priority()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''tasks.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the priority of the task ID passed to it.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Get priority of the task&lt;br /&gt;
 *&lt;br /&gt;
 * @param taskID        ID of task, must be in range 0 to 254&lt;br /&gt;
 * @param t_priority    Pointer to task priority holder&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT        System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT          System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE              Directive was called before OCEOS init is finished&lt;br /&gt;
 *          ERR_ID_INVALID               Task ID is invalid&lt;br /&gt;
 *          ERR_ID_WRONG                 Task ID is wrong&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_task_get_priority(&lt;br /&gt;
    const U32_t task_id, // task ID, must be in range 0 to 254&lt;br /&gt;
    U32_t *t_priority   // Pointer to task priority holder&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| task_id || S32_t task ID of task whose priority is required&lt;br /&gt;
|-&lt;br /&gt;
| t_priority || S32_t * pointer to variable where priority will be written&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit  || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT        || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT          || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE              || Directive was called before OCEOS init is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID               || Task ID is invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                 || Task ID is wrong&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
U32_t t_priority;&lt;br /&gt;
...&lt;br /&gt;
// Return the priority of task ID t_4 &lt;br /&gt;
status = oceos_task_get_priority(t_4, &amp;amp;t_priority);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_task_get_status()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''tasks.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the status of the task ID passed to it.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Get status of the task;&lt;br /&gt;
 * if OK t_status holds enum TASK_STATUS&lt;br /&gt;
 *&lt;br /&gt;
 * @param taskID    ID of task, must be in range 0 to 254&lt;br /&gt;
 * @param t_status  enum TASK_STATUS holder&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT        System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT          System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE              Directive was called before OCEOS init is finished&lt;br /&gt;
 *          ERR_ID_INVALID               Task ID is invalid&lt;br /&gt;
 *          ERR_ID_WRONG                 Task ID is wrong&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_task_get_status(&lt;br /&gt;
    const U32_t task_id,&lt;br /&gt;
    U32_t *t_status&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| task_id || S32_t task ID of task whose priority is required&lt;br /&gt;
|-&lt;br /&gt;
| t_status || S32_t * pointer to variable where status will be written&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit  || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT        || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT          || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE              || Directive was called before OCEOS init is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID               || Task ID is invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                 || Task ID is wrong&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
U32_t t_status;&lt;br /&gt;
...&lt;br /&gt;
// Return the status of task ID t_4 &lt;br /&gt;
status = oceos_task_get_status(t_4, &amp;amp;t_status);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_task_get_info()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''tasks.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the task information for the specified task.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Get task information for task with ID.&lt;br /&gt;
 *&lt;br /&gt;
 * User must pass pointer to struct task_info in order to retrieve data.&lt;br /&gt;
 *&lt;br /&gt;
 * @param task_id  Task ID&lt;br /&gt;
 * @param info     Pointer to struct task_info&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT    System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT      System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE          Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID           Task ID invalid&lt;br /&gt;
 *          ERR_ID_WRONG             Task ID wrong&lt;br /&gt;
 *          ERR_TASK_INFO_PTR_BAD    Task info pointer provided by user is NULL&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_task_get_info (&lt;br /&gt;
    const U32_t task_id,   // Task ID&lt;br /&gt;
    struct task_info *info // Pointer to struct task_info&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| task_id || ID of task for which information is required&lt;br /&gt;
|-&lt;br /&gt;
| task_info || struct task_info * pointer to the structure where task information is to be written&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit  || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT    || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT      || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE          || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID           || Task ID invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG             || Task ID wrong&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TASK_INFO_PTR_BAD    || Task info pointer provided by user is NULL&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
struct task_info info;&lt;br /&gt;
...&lt;br /&gt;
// Get information for task T3&lt;br /&gt;
status = oceos_task_get_info(t_3, &amp;amp;info);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceosmp_task_kill()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''tasks.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function kills the specified task running on the specified CPU.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 *  Function to kill currently running task on CPU;&lt;br /&gt;
 *  Can be used:&lt;br /&gt;
 *      From Mode_SVC  =&amp;gt; normal running mode for application&lt;br /&gt;
 *          If nesting level is zero and Mode_SVC&lt;br /&gt;
 *      From Mode_IRQ  =&amp;gt; from IRQ handler&lt;br /&gt;
 *          If nesting level is not zero, set flag to call this function within IRQ handler&lt;br /&gt;
 *      From Exception =&amp;gt; Mode_ABT and Mode_UND&lt;br /&gt;
 *          If nesting level is zero and NOT Mode_SVC, it is exception;&lt;br /&gt;
 *              Disable IRQs on current CPU;&lt;br /&gt;
 *              Set kill current task flag to TRUE;&lt;br /&gt;
 *              Issue SGI on current CPU, will be interrupted on return from Exception and&lt;br /&gt;
 *              this function will be called within IRQ handler&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT    System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT      System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE          Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_CPU_DYN_PTR_BAD      CPU dynamic area pointer corrupt&lt;br /&gt;
 *          ERR_ID_INVALID           Task ID invalid&lt;br /&gt;
 *          ERR_ID_WRONG             Task ID wrong&lt;br /&gt;
 *          ERR_CPU_ID_WRONG         CPU ID wrong&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceosmp_task_kill(&lt;br /&gt;
    U32_t task_id,&lt;br /&gt;
    U32_t cpu_id&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| task_id  || U32_t task ID to be killed (must be in range 0 to 254)&lt;br /&gt;
|-&lt;br /&gt;
| cpu_id  || U32_t CPU ID where task_id is to be killed&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT    || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT      || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE          || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_CPU_DYN_PTR_BAD      || CPU dynamic area pointer corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID           || Task ID invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG             || Task ID wrong&lt;br /&gt;
|-&lt;br /&gt;
| ERR_CPU_ID_WRONG         || CPU ID wrong&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Kill task t_2 on CPU cpu_1&lt;br /&gt;
status = oceosmp_task_kill(t_2, cpu_1);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;Mutex directives&amp;lt;/span&amp;gt;==&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_mutex_create()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''mutex.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function creates a mutex of specified ID with a specified priority ceiling.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Creates a mutex with priority ceiling&lt;br /&gt;
 *&lt;br /&gt;
 * NOTE: This function should only be called after OCEOSmp is initialised with&lt;br /&gt;
 *  oceos_init() and before initialisation ends with oceos_init_finish()&lt;br /&gt;
 *  and scheduling starts with oceos_start()&lt;br /&gt;
 *&lt;br /&gt;
 * @param mutex_id  mutex ID value 0 to 62&lt;br /&gt;
 * @param priority  mutex priority ceiling 1 to 254 (high to low task priority)&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_WRONG_CPU_CORE          Executing directive on wrong CPU&lt;br /&gt;
 *          ERR_WRONG_PHASE             Called before oceos_init() is done&lt;br /&gt;
 *          ERR_TOO_MANY                MAX number of MUTEXs already created&lt;br /&gt;
 *          ERR_ID_INVALID              MUTEX ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                MUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
 *          ERR_MX_ALREADY_ALLOCATED    MUTEX ID already used&lt;br /&gt;
 *          ERR_MX_PRIORITY_WRONG       MUTEX priority ceiling outside allowed range 1 to 254&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_mutex_create(&lt;br /&gt;
    const U32_t mutex_id,  // mutex ID, must be in range 0 to 62&lt;br /&gt;
    const U8_t  priority  // mutex priority ceiling&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| mutex_id  || u32_t mutex ID to be created (value 0 to 62).&lt;br /&gt;
|-&lt;br /&gt;
| priority_ceiling ||  U32_t mutex priority ceiling 1 to 254 (high to low task priority)&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_CPU_CORE          || Executing directive on wrong CPU&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Called before oceos_init() is done&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TOO_MANY                || MAX number of MUTEXs already created&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || MUTEX ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || MUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_MX_ALREADY_ALLOCATED    || MUTEX ID already used&lt;br /&gt;
|-&lt;br /&gt;
| ERR_MX_PRIORITY_WRONG       || MUTEX priority ceiling outside allowed range 1 to 254&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Create mutex with ID print_mutex and priority ceiling of 5&lt;br /&gt;
status = oceos_mutex_create(print_mutex, 5);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_mutex_wait()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''mutex.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function makes the task wait until the specified mutex is available.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
 /*&lt;br /&gt;
  * Wait on mutex with ID.&lt;br /&gt;
  * If task succeeds in grabbing mutex, system level priority rises to&lt;br /&gt;
  * priority of this mutex, so tasks with lower or equal priority will&lt;br /&gt;
  * not be able to start till mutex is released.&lt;br /&gt;
  *&lt;br /&gt;
  * This should only be called after OCEOSmp scheduling has started.&lt;br /&gt;
  *&lt;br /&gt;
  * @param mutex_id     const U32_t  : value 0 to 62&lt;br /&gt;
  *&lt;br /&gt;
  * @return  OCEOS_SUCCESS&lt;br /&gt;
  *          WARN_MX_INCORRECT_ORDER     MUTEX acquired in incorrect order&lt;br /&gt;
  *&lt;br /&gt;
  *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
  *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
  *          ERR_WRONG_PHASE             Directive was called before OCEOSmp initialisation is finished&lt;br /&gt;
  *          ERR_ID_INVALID              MUTEX ID outside allowed range 0 to 62&lt;br /&gt;
  *           ERR_ID_WRONG                MUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
  *          ERR_MX_CEILING_BAD          MUTEX ceiling not lower priority than job priority&lt;br /&gt;
  *          ERR_MX_ALREADY_HELD         MUTEX already held by this job&lt;br /&gt;
  *          ERR_SYS_BUSY                Failed to grab context switch guard&lt;br /&gt;
  */&lt;br /&gt;
S32_t oceos_mutex_wait(&lt;br /&gt;
    const U32_t  mutex_id      // mutex ID, must be in range 0 to 62&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| mutex_id  || u32_t mutex ID to be waited on (value 0 to 62).&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| WARN_MX_INCORRECT_ORDER     || MUTEX acquired in incorrect order&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOSmp initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || MUTEX ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || MUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_MX_CEILING_BAD          || MUTEX ceiling not lower priority than job priority&lt;br /&gt;
|-&lt;br /&gt;
| ERR_MX_ALREADY_HELD         || MUTEX already held by this job&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to grab context switch guard&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Wait on mutex m_2&lt;br /&gt;
status = oceos_mutex_wait(m_2);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_mutex_signal()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''mutex.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function signals the specified mutex.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Signal a mutex with ID&lt;br /&gt;
 *&lt;br /&gt;
 * N.B. :&lt;br /&gt;
 *      This function should not be called from an interrupt handler&lt;br /&gt;
 *      This should only be called after OCEOSmp scheduling has started.&lt;br /&gt;
 *&lt;br /&gt;
 * @param mutex_id     const U32_t  : value 0 to 62&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          WARN_MX_ALREADY_FREE        MUTEX is free already&lt;br /&gt;
 *          WARN_MX_NESTING_BAD         MUTEX nesting incorrect&lt;br /&gt;
 *&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOSmp initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              MUTEX ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                MUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
 *          ERR_MX_WRONG_JOB            MUTEX not held by this job&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to grab context switch guard&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_mutex_signal(&lt;br /&gt;
    const U32_t  mutex_id     // mutex ID, must be in range 0 to 62&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| mutex_id  || u32_t mutex ID to be signalled (value 0 to 62).&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| WARN_MX_ALREADY_FREE        || MUTEX is free already&lt;br /&gt;
|-&lt;br /&gt;
| WARN_MX_NESTING_BAD         || MUTEX nesting incorrect&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOSmp initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || MUTEX ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || MUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_MX_WRONG_JOB            || MUTEX not held by this job&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to grab context switch guard&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Signal mutex m_2&lt;br /&gt;
status = oceos_mutex_signal(m_2);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_mutex_get_value()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''mutex.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the value of the specified mutex.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Get current value of mutex with ID&lt;br /&gt;
 *&lt;br /&gt;
 * @param mutex_id      const U32_t  : value 0 to 62&lt;br /&gt;
 * @param m_value       pointer to MUTEX value holder&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOSmp initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              MUTEX ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                MUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
 *          ERR_MX_DATA_PTR_BAD         Pointer to MUTEX value return holder is null&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_mutex_get_value(&lt;br /&gt;
    const U32_t  mutex_id,      // mutex ID, must be in range 0 to 62&lt;br /&gt;
    U32_t *m_value              // Pointer to MUTEX value holder&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| mutex_id  || u32_t mutex ID to be signalled (value 0 to 62)&lt;br /&gt;
|-&lt;br /&gt;
| m_value  || u32_t * pointer where mutex value is to be written&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOSmp initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || MUTEX ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || MUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_MX_DATA_PTR_BAD         || Pointer to MUTEX value return holder is null&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
U32_t value;&lt;br /&gt;
...&lt;br /&gt;
// Get value of mutex m_2&lt;br /&gt;
status = oceos_mutex_get_value(m_2, &amp;amp;value);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;Read/write mutex directives&amp;lt;/span&amp;gt;==&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;Read/write mutex overview&amp;lt;/span&amp;gt;===&lt;br /&gt;
&lt;br /&gt;
Contents:&lt;br /&gt;
&lt;br /&gt;
 1.  Read/Write Mutex features&lt;br /&gt;
 2.  Read/Write Mutex data structures&lt;br /&gt;
 3.  Read/Write Mutex constants&lt;br /&gt;
 4.  Read/Write Mutex manager Directives&lt;br /&gt;
&lt;br /&gt;
==== Read/Write Mutex Features ====&lt;br /&gt;
&lt;br /&gt;
Read/Write Mutexes (rwmutexes) can be held for 'read' at the same time&lt;br /&gt;
by multiple jobs on different CPUs, but once held for 'write' by any job&lt;br /&gt;
cannot be obtained for 'read' or for 'write' by another job until released.&lt;br /&gt;
&lt;br /&gt;
They can be used to allow data be read simultaneously by multiple jobs when&lt;br /&gt;
the data is not being updated while ensuring that no updating can take&lt;br /&gt;
place while any job is reading the data.&lt;br /&gt;
&lt;br /&gt;
Pending write requests take precedence over pending read requests and are&lt;br /&gt;
done on a first come, first served basis. Once any job on a CPU has a&lt;br /&gt;
rwmutex for 'read' no other job on that CPU can acquire it so as to avoid&lt;br /&gt;
potential problems and minimise delays in servicing write requests by other&lt;br /&gt;
CPUs.&lt;br /&gt;
&lt;br /&gt;
While any job holds a rwmutex for reading any job on another CPU can also&lt;br /&gt;
acquire it for reading. Other jobs on the same CPU that may attempt to&lt;br /&gt;
acquire the rwmutex are delayed in starting until return of the rwmutex.&lt;br /&gt;
No job can acquire the rwmutex for writing until all read acquisitions&lt;br /&gt;
have been returned.&lt;br /&gt;
&lt;br /&gt;
No job will acquire a rwmutex for reading if any job is trying to acquire&lt;br /&gt;
it for writing, giving write precedence over read. Multiple write requests&lt;br /&gt;
waiting for existing read acquisitions to complete are serviced in the&lt;br /&gt;
order in which they were made when the current read acquisitions complete.&lt;br /&gt;
&lt;br /&gt;
If a task waits on a rwmutex that it already holds a system log entry is&lt;br /&gt;
made (LOG_RWMUTEX_ALREADY_HELD) and an INTERNAL_ERROR status code returned.&lt;br /&gt;
&lt;br /&gt;
If a task attempts to release a rwmutex it does not hold a system log entry&lt;br /&gt;
is made (LOG_RWMUTEX_ALREADY_FREE) and an INTERNAL_ERROR status code returned.&lt;br /&gt;
&lt;br /&gt;
If a job holds more than one rwmutex at the same time these must be&lt;br /&gt;
acquired and released in a nested manner&lt;br /&gt;
(e.g. wait 1, wait 2, wait 3, signal 3, signal 2, signal 1).&lt;br /&gt;
&lt;br /&gt;
If a task exits while holding one or more rwmutexes these are returned and&lt;br /&gt;
a system log entry made (LOG_RWMUTEX_NOT_RETURNED).&lt;br /&gt;
&lt;br /&gt;
==== Read/Write Mutex data structures ====&lt;br /&gt;
&lt;br /&gt;
In OCEOSmp each rwmutex has a priority ceiling, the priority of the highest&lt;br /&gt;
priority task that acquires the rwmutex for read or for write.&lt;br /&gt;
OCEOSmp uses this to ensure that once a job on a particular CPU has the&lt;br /&gt;
rwmutex for reading or for writing no other job on that CPU can be started&lt;br /&gt;
that might try to obtain that rwmutex.&lt;br /&gt;
&lt;br /&gt;
The priority ceiling of a rwmutex is specified when the rwmutex is created&lt;br /&gt;
and does not change subsequently. Priority ceilings are stored in the&lt;br /&gt;
fixed data area as an array U8_t rwmutexCeilings[] indexed by mutex ID.&lt;br /&gt;
This array is extended to be a whole number of 32-bit words.&lt;br /&gt;
&lt;br /&gt;
A rwmutex has a unique rwmutex ID, an unsigned integer usually defined in&lt;br /&gt;
the application header file as an enum RWMUTEX_NAME{} thus allowing a&lt;br /&gt;
user-friendly name be associated with each rwmutex ID.&lt;br /&gt;
&lt;br /&gt;
Using an enum is strongly recommended as it allows a user-friendly name be&lt;br /&gt;
associated with each ID, and helps ensure IDs are contiguous from 0.&lt;br /&gt;
&lt;br /&gt;
These rwmutex IDs are used as indices into both fixed and dynamic data&lt;br /&gt;
arrays and must cover the range 0 to ((number of rwmutexes) -1). Using&lt;br /&gt;
enum RWMUTEX_NAME{} automatically assigns names to IDs 0, 1, 2...&lt;br /&gt;
&lt;br /&gt;
Read write mutex dynamic data such as the current write requests and&lt;br /&gt;
current read count are stored in the dynamic data area in an array of&lt;br /&gt;
struct rwmutex_dyn_block also indexed by the rwmutex ID.&lt;br /&gt;
&lt;br /&gt;
A further dynamic area array of guard_t is used in providing mutual&lt;br /&gt;
exclusion when updating the rwmutex dynamic data.&lt;br /&gt;
&lt;br /&gt;
==== Read/Write Mutex constants ====&lt;br /&gt;
&lt;br /&gt;
In OCEOSmp there can be a maximum of 63 rwmutexes,&lt;br /&gt;
with IDs from 0 to 62 (the value 63 is used as an invalid ID).&lt;br /&gt;
&lt;br /&gt;
The rwmutexes can be created in any order, but OCEOSmp will return an error&lt;br /&gt;
and fail to start if the resulting IDs fail to be contiguous from 0 as IDs&lt;br /&gt;
are used by OCEOS as indices into arrays.&lt;br /&gt;
&lt;br /&gt;
Each rwmutex has a priority ceiling, the priority of the highest priority&lt;br /&gt;
task that uses the rwmutex for reading or for writing. This is specified&lt;br /&gt;
when the rwmutex is created, does not change subsequently, and must be in&lt;br /&gt;
the range 1 (TASK_MAX_PRIORITY) to 254 (TASK_MIN_PRIORITY).&lt;br /&gt;
The application developer must ensure that the correct rwmutex ceiling&lt;br /&gt;
is used. OCEOSmp will detect an attempt to acquire a rwmutex by a task&lt;br /&gt;
with higher priority than that rwmutex's priority ceiling, make a&lt;br /&gt;
system log entry (LOG_RWMUTEX_BAD_CEILING) and return an INTERNAL_ERROR&lt;br /&gt;
status code.&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_rwmutex_create()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''rwmutex.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function ees a read/write mutex.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Creates a Read/Write Mutex (RWMUTEX)&lt;br /&gt;
 *&lt;br /&gt;
 * This function should only be called after OCEOSmp is initialised with&lt;br /&gt;
 * oceos_init() and before initialisation ends with oceos_init_finish()&lt;br /&gt;
 * and scheduling starts with oceos_start()&lt;br /&gt;
 *&lt;br /&gt;
 * @param rwm_id    Read/Write RWMUTEX ID, must be in range 0 to 62&lt;br /&gt;
 * @param priority  Priority ceiling of highest priority task that uses the RWMUTEX&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_WRONG_CPU_CORE          Executing directive on wrong CPU&lt;br /&gt;
 *          ERR_WRONG_PHASE             Called before oceos_init() is done&lt;br /&gt;
 *          ERR_TOO_MANY                MAX number of RWMUTEXs already created&lt;br /&gt;
 *          ERR_ID_INVALID              RWMUTEX ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                RWMUTEX ID &amp;gt;= number of RWMUTEXs&lt;br /&gt;
 *          ERR_RWMX_ALREADY_ALLOCATED  RWMUTEX ID already used&lt;br /&gt;
 *          ERR_RWMX_PRIORITY_WRONG     RWMUTEX priority ceiling outside allowed range 1 to 254&lt;br /&gt;
 */&lt;br /&gt;
S32_t   oceos_rwmutex_create(&lt;br /&gt;
    const U32_t rwm_id,   // RWMUTEX ID, must be in range 0 to max rwm&lt;br /&gt;
    const U8_t priority   // RWMUTEX priority ceiling&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| rwm_id || Read/Write RWMUTEX ID, must be in range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| priority || Priority ceiling of highest priority task that uses the RWMUTEX&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_CPU_CORE          || Executing directive on wrong CPU&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Called before oceos_init() is done&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TOO_MANY                || MAX number of RWMUTEXs already created&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || RWMUTEX ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || RWMUTEX ID &amp;gt;= number of RWMUTEXs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_RWMX_ALREADY_ALLOCATED  || RWMUTEX ID already used&lt;br /&gt;
|-&lt;br /&gt;
| ERR_RWMX_PRIORITY_WRONG     || RWMUTEX priority ceiling outside allowed range 1 to 254&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Create read/write mutex with ID rwm_2 and priority ceiling of 100 &lt;br /&gt;
status = oceos_rwmutex_create(rwm_1, 100);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_rwmutex_read_wait()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''rwmutex.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function acquires a read/write mutex for read. If successful, jobs on other CPUs can also acquire it for read, but no job will be able to acquire it for write while any read is under way. If job already holds RWMUTEX for read or for write the appropriate status code is returned, a system log entry made, and the job continues. It will not succeed while any job is waiting to obtain RWMUTEX for write, and will loop waiting for all pending writes on this RWMUTEX to complete.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Read wait on RWMUTEX.&lt;br /&gt;
 *&lt;br /&gt;
 * If successful jobs on other CPUs can also acquire it for read, but no job&lt;br /&gt;
 * will be able to acquire it for write while any read is under way.&lt;br /&gt;
 * If job already holds RWMUTEX for read or for write appropriate status code&lt;br /&gt;
 * is returned, a system log entry made, and the job continues.&lt;br /&gt;
 * Will not succeed while any job is waiting to obtain RWMUTEX for write,&lt;br /&gt;
 * will loop waiting for all pending writes on this RWMUTEX to complete.&lt;br /&gt;
 *&lt;br /&gt;
 * This should only be called after OCEOS scheduling has started.&lt;br /&gt;
 *&lt;br /&gt;
 * N.B.	The returned status code must be checked and appropriate action&lt;br /&gt;
 * 		taken.&lt;br /&gt;
 *&lt;br /&gt;
 * @param rwm_id    const U32_t  : value 0 to 62&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          WARN_RWMX_NOT_HIGHEST       Already holds a RWMUTEX higher in the RWMUTEX order&lt;br /&gt;
 *                                      (there then may be a risk of deadlock)&lt;br /&gt;
 *&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              RWMUTEX ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                RWMUTEX ID &amp;gt;= number of RWMUTEXs&lt;br /&gt;
 *          ERR_RWMX_CEILING_BAD        RWMUTEX ceiling not lower priority than job priority&lt;br /&gt;
 *          ERR_RWMX_ALREADY_HELD       RWMUTEX already held by this job&lt;br /&gt;
 *          ERR_RWMX_CPU_STACK_FULL     CPU priority ceiling stack full&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_rwmutex_read_wait(&lt;br /&gt;
    const U32_t rwm_id  // RWMUTEX ID, must be in range 0 to 62&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| rwm_id || U32_t rwmutex to be acquired for read (value 0 to 62)&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| WARN_RWMX_NOT_HIGHEST       || Already holds a RWMUTEX higher in the RWMUTEX order (deadlock risk)&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || RWMUTEX ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || RWMUTEX ID &amp;gt;= number of RWMUTEXs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_RWMX_CEILING_BAD        || RWMUTEX ceiling not lower priority than job priority&lt;br /&gt;
|-&lt;br /&gt;
| ERR_RWMX_ALREADY_HELD       || RWMUTEX already held by this job&lt;br /&gt;
|-&lt;br /&gt;
| ERR_RWMX_CPU_STACK_FULL     || CPU priority ceiling stack full&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Acquire read/write mutex rwm_1 for read&lt;br /&gt;
status = oceos_rwmutex_read_wait(rwm_1);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_rwmutex_write_wait()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''rwmutex.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function acquires the specified read/write mutex for write.&lt;br /&gt;
If successful, no other job can also obtain it for reading or for writing. Will not succeed while any other job has acquired RWMUTEX for write,&lt;br /&gt;
or any jobs have obtained RWMUTEX for read. Will then loop until the RWMUTEX is released and for its turn in the sequence of jobs that have tried to acquire the RWMUTEX for writing. If already holds the RWMUTEX for writing or reading an appropriate status code is returned, a system log entry made, and the job continues. While there are any outstanding attempts to obtain the RWMUTEX for write no job will be able to acquire it for reading.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Write wait on RWMUTEX.&lt;br /&gt;
 *&lt;br /&gt;
 * If successful no other job can also obtain it for reading or for writing.&lt;br /&gt;
 * Will not succeed while any other job has acquired RWMUTEX for write,&lt;br /&gt;
 * or any jobs have obtained RWMUTEX for read. Will then loop until the&lt;br /&gt;
 * RWMUTEX is released and for its turn in the sequence of jobs that have&lt;br /&gt;
 * tried to acquire the RWMUTEX for writing.&lt;br /&gt;
 * If already holds the RWMUTEX for writing or reading an appropriate status&lt;br /&gt;
 * code is returned, a system log entry made, and the job continues.&lt;br /&gt;
 * While there are any outstanding attempts to obtain the RWMUTEX for write&lt;br /&gt;
 * no job will be able to acquire it for reading.&lt;br /&gt;
 *&lt;br /&gt;
 * This should only be called after OCEOS scheduling has started.&lt;br /&gt;
 *&lt;br /&gt;
 * N.B.	The returned status code must be checked and appropriate action&lt;br /&gt;
 * 		taken.&lt;br /&gt;
 *&lt;br /&gt;
 * @param rwm_id     const U32_t  : value 0 to 62&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          WARN_RWMX_NOT_HIGHEST       Already holds a RWMUTEX higher in the RWMUTEX order&lt;br /&gt;
 *                                      (there then may be a risk of deadlock)&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              RWMUTEX ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                RWMUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
 *          ERR_RWMX_CEILING_BAD        RWMUTEX ceiling not lower priority than job priority&lt;br /&gt;
 *          ERR_RWMX_ALREADY_HELD       RWMUTEX already held by this job&lt;br /&gt;
 *          ERR_RWMX_CPU_STACK_FULL     CPU priority ceiling stack full&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_rwmutex_write_wait(&lt;br /&gt;
    const U32_t rwm_id  // RWMUTEX ID, must be in range 0 to 62&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| rwm_id || U32_t rwmutex to be acquired for write(value 0 to 62)&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| WARN_RWMX_NOT_HIGHEST       || Already holds a RWMUTEX higher in the RWMUTEX order (deadlock risk)&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || RWMUTEX ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || RWMUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_RWMX_CEILING_BAD        || RWMUTEX ceiling not lower priority than job priority&lt;br /&gt;
|-&lt;br /&gt;
| ERR_RWMX_ALREADY_HELD       || RWMUTEX already held by this job&lt;br /&gt;
|-&lt;br /&gt;
| ERR_RWMX_CPU_STACK_FULL     || CPU priority ceiling stack full&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Acquire read/write mutex rwm_1 for write&lt;br /&gt;
status = oceos_rwmutex_read_wait(rwm_1);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_rwmutex_signal()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''rwmutex.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function signals the specified read/write mutex.&lt;br /&gt;
It frees the RWMUTEX for use by other jobs, irrespective of whether the RWMUTEX is held for reading or for writing. If the RWMUTEX is not held by the job then it returns an appropriate status code. It does not take into account how many times a job has obtained the RWMUTEX for read or for write.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Signal a RWMUTEX&lt;br /&gt;
 *&lt;br /&gt;
 * Frees the RWMUTEX for use by other jobs, irrespective of whether&lt;br /&gt;
 * RWMUTEX is held for reading or for writing.&lt;br /&gt;
 * if the RWMUTEX is not held by the job returns an appropriate status code.&lt;br /&gt;
 * Does not take into account how many times a job has obtained the RWMUTEX&lt;br /&gt;
 * for read or for write.&lt;br /&gt;
 *&lt;br /&gt;
 * This should only be called after OCEOS scheduling has started.&lt;br /&gt;
 *&lt;br /&gt;
 * N.B. The returned status code must be checked and appropriate action taken.&lt;br /&gt;
 *&lt;br /&gt;
 * @param rwm_id    const U32_t  : value 0 to 62&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          WARN_RWMX_ALREADY_FREE      RWMUTEX is free already&lt;br /&gt;
 *&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              RWMUTEX ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                RWMUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
 *          ERR_RWMX_CEILING_BAD        RWMUTEX ceiling not lower priority than job priority&lt;br /&gt;
 *          ERR_RWMX_CPU_STACK_EMPTY    CPU priority ceiling stack empty&lt;br /&gt;
 *          ERR_RWMX_CEILING_INVALID    CPU current priority ceiling on the priority stack is invalid&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_rwmutex_signal(&lt;br /&gt;
    const U32_t rwm_id // RWMUTEX ID, must be in range 0 to 62&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| rwm_id || U32_t rwmutex to be signaled(value 0 to 62)&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| WARN_RWMX_ALREADY_FREE      || RWMUTEX is free already&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || RWMUTEX ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || RWMUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_RWMX_CEILING_BAD        || RWMUTEX ceiling not lower priority than job priority&lt;br /&gt;
|-&lt;br /&gt;
| ERR_RWMX_CPU_STACK_EMPTY    || CPU priority ceiling stack empty&lt;br /&gt;
|-&lt;br /&gt;
| ERR_RWMX_CEILING_INVALID    || CPU current priority ceiling on the priority stack is invalid&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Signal read/write mutex number rwm_4&lt;br /&gt;
status = oceos_rwmutex_signal(rwm_4);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_rwmutex_check_status()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''rwmutex.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function checks the status of a read/write mutex. The possible states are free, in-use for read, and in-use for write.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Check whether RWMUTEX is free&lt;br /&gt;
 *&lt;br /&gt;
 * @param rwm_id        must be in range 0 to 62&lt;br /&gt;
 * @param m_status      pointer to RWMUTEX status holder;&lt;br /&gt;
 *                      if return code OCEOS_SUCCESS RWMUTEX status:&lt;br /&gt;
 *                          0 =&amp;gt; Free for use&lt;br /&gt;
 *                          1 =&amp;gt; In use for read&lt;br /&gt;
 *                          2 =&amp;gt; In use for write&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              RWMUTEX ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                RWMUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
 *          ERR_RWMX_DATA_PTR_BAD       Pointer to RWMUTEX status return holder is null&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_rwmutex_check_status(&lt;br /&gt;
    const U32_t rwm_id, // RWMUTEX ID, must be in range 0 to 62&lt;br /&gt;
    U32_t *m_status&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| rwm_id || read/write mutex number in range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| m_status || U32_t pointer to RWMUTEX status holder (0 = free, 1 = in-use for read, 2 = in-use for write &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || RWMUTEX ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || RWMUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_RWMX_DATA_PTR_BAD       || Pointer to RWMUTEX status return holder is null&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, rwm_status;&lt;br /&gt;
...&lt;br /&gt;
// Check the status of read/write mutex rwm_2&lt;br /&gt;
status = oceos_rwmutex_check_status(rwm_2, &amp;amp;rwm_status);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_rwmutex_reading_count()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''rwmutex.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the current number of jobs holding a specified read/write mutex for read.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 *&lt;br /&gt;
 * Get current number of jobs holding RWMUTEX for read&lt;br /&gt;
 *&lt;br /&gt;
 * @param rwm_id    must be in range 0 to 62&lt;br /&gt;
 * @param m_count   pointer to RWMUTEX count holder&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              RWMUTEX ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                RWMUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
 *          ERR_RWMX_DATA_PTR_BAD       Pointer to RWMUTEX count return holder is null&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_rwmutex_reading_count(&lt;br /&gt;
    const U32_t rwm_id, // RWMUTEX ID, must be in range 0 to 62&lt;br /&gt;
    U32_t *m_count&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| rwm_id || U32 value of read/write mutex (in range 0 to 62)&lt;br /&gt;
|-&lt;br /&gt;
| m_count || U32_t pointer to read/write mutex count holder&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || RWMUTEX ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || RWMUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_RWMX_DATA_PTR_BAD       || Pointer to RWMUTEX count return holder is null&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, rwm_count;&lt;br /&gt;
...&lt;br /&gt;
// Get the number of jobs holding the read/write mutex rwm_2 for read&lt;br /&gt;
status = oceos_rwmutex_reading_count(rwm_2, &amp;amp;rwm_count);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_rwmutex_write_reqs_count()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''header.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the current number of write requests for the specified read/write mutex .&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Get current RWMUTEX write requests count&lt;br /&gt;
 *&lt;br /&gt;
 * @param rwm_id    must be in range 0 to 62&lt;br /&gt;
 * @param m_count   pointer to RWMUTEX count holder&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              RWMUTEX ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                RWMUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
 *          ERR_RWMX_DATA_PTR_BAD       Pointer to RWMUTEX count return holder is null&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_rwmutex_write_reqs_count(&lt;br /&gt;
    const U32_t rwm_id, // RWMUTEX ID, must be in range 0 to 62&lt;br /&gt;
    U32_t *m_count&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| rwm_id || U32_t value of read/write mutex (must be in range 0 to 62)&lt;br /&gt;
|-&lt;br /&gt;
| m_count || U32_t pointer to read/write mutex count holder&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || RWMUTEX ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || RWMUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_RWMX_DATA_PTR_BAD       || Pointer to RWMUTEX count return holder is null&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, rwm_count;&lt;br /&gt;
...&lt;br /&gt;
// Get the count of cuurent write requests for read/write mutex rwm_1&lt;br /&gt;
status = oceos_rwmutex_write_reqs_count(rwm_1, &amp;amp;rwm_count);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_rwmutex_writes_pending_count()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''rwmutex.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the current number of pending writes for the specified read/write mutex.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Get current RWMUTEX writes pending count&lt;br /&gt;
 *&lt;br /&gt;
 * @param rwm_id    must be in range 0 to 62&lt;br /&gt;
 * @param m_count   pointer to RWMUTEX count holder&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              RWMUTEX ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                RWMUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
 *          ERR_RWMX_DATA_PTR_BAD       Pointer to RWMUTEX pending count return holder is null&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_rwmutex_writes_pending_count(&lt;br /&gt;
    const U32_t rwm_id, // RWMUTEX ID, must be in range 0 to 62&lt;br /&gt;
    U32_t *m_count&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| rwm_id || U32_t value of read/write mutex (must be in range 0 to 62)&lt;br /&gt;
|-&lt;br /&gt;
| m_count || U32_t pointer to read/write mutex count holder&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || RWMUTEX ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || RWMUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_RWMX_DATA_PTR_BAD       || Pointer to RWMUTEX count return holder is null&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, rwm_count;&lt;br /&gt;
...&lt;br /&gt;
// Get the count of cuurent write requests for read/write mutex rwm_1&lt;br /&gt;
status = oceos_rwmutex_writes_pending_count(rwm_1, &amp;amp;rwm_count);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_rwmutex_holding()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''header.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the read/write mutexes currently held by this instance of this task (job).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Get RWMUTEXs currently held by this instance of the task (job)&lt;br /&gt;
 *&lt;br /&gt;
 * @param m_data    U64_t pointer, each bit indicating RWMUTEX held by current task&lt;br /&gt;
 *                          0 =&amp;gt; Not held by job&lt;br /&gt;
 *                          1 =&amp;gt; Held by job&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_RWMX_DATA_PTR_BAD       Pointer to RWMUTEX status return holder is null&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_rwmutex_holding(&lt;br /&gt;
    U64_t *m_data&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| m_data || U64_t pointer, each bit indicating RWMUTEX held by current task, 0 =&amp;gt; not held, 1 =&amp;gt; held &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_RWMX_DATA_PTR_BAD       || Pointer to RWMUTEX status return holder is null&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
U64_t rwm_held;&lt;br /&gt;
...&lt;br /&gt;
// Which read/write mutexes does this job hold&lt;br /&gt;
status = oceos_rwmutex_holding(&amp;amp;rwm_held);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Semaphores directives ==&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_sem_create()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''semaphore.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function creates a semaphore.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Create a counting semaphore&lt;br /&gt;
 *&lt;br /&gt;
 * @param sem_id            SEMAPHORE ID (from 0 to 62)&lt;br /&gt;
 * @param max_permits       number of max permits allowed for this SEMAPHORE, 1 to 4095&lt;br /&gt;
 * @param count_permits     starting number of permits available 0 to 4095&lt;br /&gt;
 * @param pending_q_size    MAX Number of tasks on SEMAPHORE pending queue 1 to 253&lt;br /&gt;
 * @param use_timeout       if TRUE, directive oceos_sem_wait_restart_timeout can be used&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_WRONG_CPU_CORE          Executing directive on wrong CPU&lt;br /&gt;
 *          ERR_WRONG_PHASE             Called before oceos_init() is done&lt;br /&gt;
 *          ERR_TOO_MANY                MAX number of SEMAPHOREs already created&lt;br /&gt;
 *          ERR_ID_INVALID              SEMAPHORE ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                SEMAPHORE ID &amp;gt;= number of SEMAPHOREs&lt;br /&gt;
 *          ERR_SM_ALREADY_ALLOCATED    SEMAPHORE ID already used&lt;br /&gt;
 *          ERR_SM_MAX_PERMIT_WRONG     MAX permits outside allowed range 1 to 4095&lt;br /&gt;
 *          ERR_SM_COUNT_PERMIT_WRONG   Count permits outside allowed range 0 to 4095&lt;br /&gt;
 *          ERR_SM_COUNT_PERMIT_INVALID Count permits is greater than MAX permits for this SEMAPHORE&lt;br /&gt;
 *          ERR_SM_PENQ_SIZE_WRONG      SEMAPHORE pending queue size outside allowed range 1 to 253&lt;br /&gt;
 *          ERR_SM_TA_MAX_NUM_REACHED   Number of timed actions exceeds MAX allowed 255,&lt;br /&gt;
 *                                      each task on SEMAPHORE pending queue is timed action&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_sem_create(&lt;br /&gt;
    sem_t sem_id,         // counting semaphore ID (MAX 63)&lt;br /&gt;
    U16_t max_permits,    // max number of permits (MAX 4095)&lt;br /&gt;
    U16_t count_permits,  // initial number of permits (MAX 4095)&lt;br /&gt;
    U8_t  pending_q_size, // max number of pending queue jobs (MAX 253)&lt;br /&gt;
    BOOLE_t use_timeout   // whether timeout is used in oceos_sem_wait_restart_timeout&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| sem_id || Semaphore ID to be created (from 0 to 62)&lt;br /&gt;
|-&lt;br /&gt;
| max_permits || number of max permits allowed for this semaphore, 1 to 4095&lt;br /&gt;
|-&lt;br /&gt;
| count_permits || starting number of permits available 0 to 4095&lt;br /&gt;
|-&lt;br /&gt;
| pending_q_size || Maximum Number of tasks on SEMAPHORE pending queue 1 to 253&lt;br /&gt;
|-&lt;br /&gt;
| use_timeout || if TRUE, directive oceos_sem_wait_restart_timeout can be used&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_CPU_CORE          || Executing directive on wrong CPU&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Called before oceos_init() is done&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TOO_MANY                || MAX number of SEMAPHOREs already created&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || SEMAPHORE ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || SEMAPHORE ID &amp;gt;= number of SEMAPHOREs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SM_ALREADY_ALLOCATED    || SEMAPHORE ID already used&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SM_MAX_PERMIT_WRONG     || MAX permits outside allowed range 1 to 4095&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SM_COUNT_PERMIT_WRONG   || Count permits outside allowed range 0 to 4095&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SM_COUNT_PERMIT_INVALID || Count permits is greater than MAX permits for this SEMAPHORE&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SM_PENQ_SIZE_WRONG      || SEMAPHORE pending queue size outside allowed range 1 to 253&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SM_TA_MAX_NUM_REACHED   || Number of timed actions exceeds MAX allowed 255&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, param;&lt;br /&gt;
...&lt;br /&gt;
// Create semaphore called s_audi with max permits of 1000, starting permits of zero, max of 10 tasks on pending queue, and no timeouts &lt;br /&gt;
status = oceos_sem_create(s_audi, 1000, 0, 10, FALSE);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_sem_signal()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''semaphore.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function signals a semaphore, increments its count and transfers pending jobs to the ready queue.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Signals a semaphore, increments and transfers pending jobs to ready queue&lt;br /&gt;
 *&lt;br /&gt;
 * @param sem_id counting SEM ID&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          WARN_JOB_NOT_GUARDED&lt;br /&gt;
 *&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              SEM ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                SEM ID &amp;gt;= number of SEMs&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to grab SEM guard&lt;br /&gt;
 *          ERR_TOO_MANY                SEM max permits count already reached&lt;br /&gt;
 *          ERR_SM_JOB_ID_WRONG         Job ID of the task on SEM pending queue is wrong&lt;br /&gt;
 *          ERR_TA_NOT_FOUND            Timed action index to be removed for job not found&lt;br /&gt;
 *          ERR_TA_START_FAILED         Timed action re-start failed after job remove from timed action queue&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_sem_signal(&lt;br /&gt;
    sem_t sem_id // counting SEM ID&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| sem_id || U32_t value of semaphore to be signalled (incremented)&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| WARN_JOB_NOT_GUARDED        || job not guarded, application should check system log&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || SEM ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || SEM ID &amp;gt;= number of SEMs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to grab SEM guard&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TOO_MANY                || SEM max permits count already reached&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SM_JOB_ID_WRONG         || Job ID of the task on SEM pending queue is wrong&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_NOT_FOUND            || Timed action index to be removed for job not found&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_START_FAILED         || Timed action re-start failed after job remove from timed action queue&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Signal s_audi semaphore (increment its count)&lt;br /&gt;
status = oceos_sem_signal(s_audi);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_sem_wait_continue()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''semaphore.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function decrements the available permits of a sempahore otherwise returns an unsuccessful status code.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Wait on semaphore,&lt;br /&gt;
 * decrement the number of available permits for semaphore,&lt;br /&gt;
 * if no permits continue and task should handle unsuccessful result&lt;br /&gt;
 *&lt;br /&gt;
 * @param sem_id SEM ID&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              SEM ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                SEM ID &amp;gt;= number of SEMs&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to grab SEM guard&lt;br /&gt;
 *          ERR_SM_NOT_AVAILABLE        No more permits available for this SEM&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_sem_wait_continue(&lt;br /&gt;
    sem_t sem_id // counting SEM ID&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| sem_id || U32_t value of semaphore to be decremented&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || SEM ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || SEM ID &amp;gt;= number of SEMs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to grab SEM guard&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SM_NOT_AVAILABLE        || No more permits available for this SEM&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Decrement available permits on semaphore s_1&lt;br /&gt;
status = oceos_sem_wait_continue(s_1);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_sem_wait_restart()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''semaphore.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function decrements the available permits of a sempahore and if none available, the job is put on the pending queue.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Waits on semaphore,&lt;br /&gt;
 * if fail, put job on pending queue and exit task&lt;br /&gt;
 *&lt;br /&gt;
 * @param sem_id SEM ID&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              SEM ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                SEM ID &amp;gt;= number of SEMs&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to grab SEM guard&lt;br /&gt;
 *          ERR_SM_J_START_FROM_TIMOUT  Task started from timeout already, SEM no permits available second time&lt;br /&gt;
 *          ERR_FAILED                  Should never return this&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_sem_wait_restart(&lt;br /&gt;
    sem_t sem_id  // counting SEM ID&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| sem_id || U32_t value of semaphore to be decremented&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || SEM ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || SEM ID &amp;gt;= number of SEMs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to grab SEM guard&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SM_J_START_FROM_TIMOUT  || Task started from timeout already, SEM no permits available second time&lt;br /&gt;
|-&lt;br /&gt;
| ERR_FAILED                  || Should never return this&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Decrement available permits on semaphore s_1 otherwise job is put on pending queue&lt;br /&gt;
status = oceos_sem_wait_restart(s_1);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_sem_wait_restart_timeout()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''semaphore.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function decrements the available permits of a sempahore and if none available, the job is put on the pending queue with a timeout enabled. The job is restarted either when a permit is available to be decremented or when the timeout has expired. In order to use this directive, semaphore must be created with flag use_timeout is set to TRUE.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Waits on semaphore,&lt;br /&gt;
 * if fail, put job on pending queue with optional timeout.&lt;br /&gt;
 * In order to use this directive, semaphore must be created with&lt;br /&gt;
 * flag use_timeout is set to TRUE&lt;br /&gt;
 *&lt;br /&gt;
 * @param sem_id         SEM ID&lt;br /&gt;
 * @param U64_t timeout  Restart time if no permits, 0 =&amp;gt; ignore&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_TA_NOT_INIT             Timed action intialisation is not done and tried to be used; or SEM created without timeouts&lt;br /&gt;
 *          ERR_ID_INVALID              SEM ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                SEM ID &amp;gt;= number of SEMs&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to grab SEM guard&lt;br /&gt;
 *          ERR_SM_J_START_FROM_TIMOUT  Task started from timeout already, SEM no permits available second time&lt;br /&gt;
 *          ERR_TOO_MANY                SEM pending queue is full&lt;br /&gt;
 *          ERR_FAILED                  Should never return this&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_sem_wait_restart_timeout(&lt;br /&gt;
    sem_t sem_id, // counting SEM ID&lt;br /&gt;
    U64_t timeout // timeout, restart time if no permits, 0 =&amp;gt; ignore&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| sem_id || U32_t value of semaphore to be decremented&lt;br /&gt;
|-&lt;br /&gt;
| timeout | U64_t timeout in time units. A value of 0 causes timeout to be ignored.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_NOT_INIT             || Timed action intialisation is not done and tried to be used; or SEM created without&lt;br /&gt;
timeouts&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || SEM ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || SEM ID &amp;gt;= number of SEMs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to grab SEM guard&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SM_J_START_FROM_TIMOUT  || Task started from timeout already, SEM no permits available second time&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TOO_MANY                || SEM pending queue is full&lt;br /&gt;
|-&lt;br /&gt;
| ERR_FAILED                  || Should never return this&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Decrement available permits on semaphore s_1 otherwise job is put on pending queue with timeout of 10,000 time units (usually usecs)&lt;br /&gt;
status = oceos_sem_wait_restart_timeout(s_1);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_sem_get_value()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''semaphore.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the number of available permits for the specified semaphore.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Returns number of available permits&lt;br /&gt;
 * for SEM ID&lt;br /&gt;
 *&lt;br /&gt;
 * @param sem_id        SEM id&lt;br /&gt;
 * @param s_permits     pointer to permits count holder&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              SEM ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                SEM ID &amp;gt;= number of SEMs&lt;br /&gt;
 *          ERR_SM_DATA_BAD             Data holder pointer is null&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_sem_get_value(&lt;br /&gt;
    sem_t sem_id,    // counting SEM ID&lt;br /&gt;
    U32_t *s_permits // pointer to permits count holder&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| sem_id || U32_t value of semaphore whose permit count is required&lt;br /&gt;
|-&lt;br /&gt;
| s_permits || U32_t pointer to permits count holder&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || SEM ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || SEM ID &amp;gt;= number of SEMs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SM_DATA_BAD             || Data holder pointer is null&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, permit_count;&lt;br /&gt;
...&lt;br /&gt;
// Get the available permits for semaphore s_1&lt;br /&gt;
status = oceos_sem_get_value(s_1, &amp;amp;permit_count);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_sem_penq_get_size()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''semaphore.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the number of jobs on the specified semaphore pending queue.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Returns number of jobs on semaphore pending queue&lt;br /&gt;
 * for semaphore ID&lt;br /&gt;
 *&lt;br /&gt;
 * @param sem_id    SEM id&lt;br /&gt;
 * @param s_size    pointer to pending queue size holder&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              SEM ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                SEM ID &amp;gt;= number of SEMs&lt;br /&gt;
 *          ERR_SM_DATA_BAD             Data holder pointer is null&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_sem_penq_get_size(&lt;br /&gt;
    sem_t sem_id,   // counting SEM ID&lt;br /&gt;
    U32_t *s_size   // pointer to pending queue size holder&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| sem_id || U32_t value of semaphore whose permit count is required&lt;br /&gt;
|-&lt;br /&gt;
| s_size || U32_t pointer to pending queue jobs count holder&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || SEM ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || SEM ID &amp;gt;= number of SEMs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SM_DATA_BAD             || Data holder pointer is null&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, job_count;&lt;br /&gt;
...&lt;br /&gt;
// Get the available permits for semaphore s_1&lt;br /&gt;
status = oceos_sem_penq_get_size(s_1, &amp;amp;job_count);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_sem_reset()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''semaphore.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function restores the permits to the original semaphore initial value and removes any jobs from the pending queue.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Restore permits to original value and&lt;br /&gt;
 * remove jobs from pending queue&lt;br /&gt;
 *&lt;br /&gt;
 * @param sem_id    SEM ID&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              SEM ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                SEM ID &amp;gt;= number of SEMs&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to grab SEM guard&lt;br /&gt;
 *          ERR_SM_JOB_ID_WRONG         Job ID of the task on SEM pending queue is wrong&lt;br /&gt;
 *          ERR_TA_NOT_FOUND            Timed action index to be removed for job not found&lt;br /&gt;
 *          ERR_TA_START_FAILED         Timed action re-start failed after job remove from timed action queue&lt;br /&gt;
 */&lt;br /&gt;
S32_t   oceos_sem_reset(&lt;br /&gt;
    sem_t sem_id   // counting SEM ID&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| sem_id || U32_t value of semaphore to be reset&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || SEM ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || SEM ID &amp;gt;= number of SEMs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to grab SEM guard&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SM_JOB_ID_WRONG         || Job ID of the task on SEM pending queue is wrong&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_NOT_FOUND            || Timed action index to be removed for job not found&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_START_FAILED         || Timed action re-start failed after job remove from timed action queue&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Reset semaphore s_1&lt;br /&gt;
status = oceos_sem_reset(s_1);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Data Queues ==&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_dataq_create()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''dataq.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function creates a data queue with the specified characteristics.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Create data queue&lt;br /&gt;
 * If use_timeout = TRUE, timed actions must be initialised&lt;br /&gt;
 *&lt;br /&gt;
 * @param dataq_id      data queue ID&lt;br /&gt;
 * @param dataq_size    data queue size&lt;br /&gt;
 * @param pen_q_size    pending jobs queue size&lt;br /&gt;
 * @param roll_over     whether to roll over when full&lt;br /&gt;
 * @param use_timeout   if TRUE, directive oceos_dataq_read_restart_timeout can be used&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_WRONG_CPU_CORE          Executing directive on wrong CPU&lt;br /&gt;
 *          ERR_WRONG_PHASE             Called before oceos_init() is done&lt;br /&gt;
 *          ERR_TOO_MANY                MAX number of DATAQs already created&lt;br /&gt;
 *          ERR_ID_INVALID              DATAQ ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                DATAQ ID &amp;gt;= number of DATAQs&lt;br /&gt;
 *          ERR_DQ_ALREADY_ALLOCATED    DATAQ ID already used&lt;br /&gt;
 *          ERR_DQ_SIZE_WRONG           DATAQ size outside allowed range 1 to 255&lt;br /&gt;
 *          ERR_DQ_PENQ_SIZE_WRONG      DATAQ pending queue size outside allowed range 1 to 253&lt;br /&gt;
 *          ERR_DQ_TA_MAX_NUM_REACHED   Number of timed actions exceeds MAX allowed 255,&lt;br /&gt;
 *                                      each task on DATAQ pending queue is timed action&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_dataq_create(&lt;br /&gt;
                         dataq_t dataq_id,    // data queue ID&lt;br /&gt;
                         U16_t dataq_size,    // data queue size&lt;br /&gt;
                         U16_t pen_q_size,    // pending jobs queue size&lt;br /&gt;
                         BOOLE_t roll_over,   // whether to roll over when full&lt;br /&gt;
                         BOOLE_t use_timeout  // whether timeout is used oceos_dataq_read_restart_timeout&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| dataq_id ||   dataq_t data queue ID (number between 0 and 62)&lt;br /&gt;
|-&lt;br /&gt;
| dataq_size ||   data queue size (max number of pointers than can be added to the queue)&lt;br /&gt;
|-&lt;br /&gt;
| pen_q_size ||   pending jobs queue size&lt;br /&gt;
|-&lt;br /&gt;
| roll_over ||    whether to roll over when full (0 =&amp;gt; disabled, 1 =&amp;gt; enabled)&lt;br /&gt;
|-&lt;br /&gt;
| use_timeout ||  if TRUE, directive oceos_dataq_read_restart_timeout can be used&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_CPU_CORE          || Executing directive on wrong CPU&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Called before oceos_init() is done&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TOO_MANY                || MAX number of DATAQs already created&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || DATAQ ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || DATAQ ID &amp;gt;= number of DATAQs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DQ_ALREADY_ALLOCATED    || DATAQ ID already used&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DQ_SIZE_WRONG           || DATAQ size outside allowed range 1 to 255&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DQ_PENQ_SIZE_WRONG      || DATAQ pending queue size outside allowed range 1 to 253&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DQ_TA_MAX_NUM_REACHED   || Number of timed actions exceeds MAX allowed 255, each task on DATAQ pending queue is timed action&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Create data queue d_3 with size 20, max pending jobs of 10, rollover enabled, timeouts disabled &lt;br /&gt;
status = oceos_dataq_create(d_3, 20, 10, 1, 0));&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_dataq_write()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''dataq.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function puts a non-null pointer on the specified data queue.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Puts pointer to the data on data queue.&lt;br /&gt;
 * Pointer to the data must not be NULL&lt;br /&gt;
 *&lt;br /&gt;
 * @param dataq_t dataq_id Data queue ID&lt;br /&gt;
 * @param void* data       Non-null pointer to data&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          WARN_DQ_NOW_FULL            Warning, DATAQ is full now&lt;br /&gt;
 *          WARN_JOB_NOT_GUARDED&lt;br /&gt;
 *&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              DATAQ ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                DATAQ ID &amp;gt;= number of DATAQs&lt;br /&gt;
 *          ERR_DQ_DATA_BAD             Data pointer is null&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to acquire guard&lt;br /&gt;
 *          ERR_TOO_MANY                DATAQ is full&lt;br /&gt;
 *          ERR_DQ_JOB_ID_WRONG         Job ID of the task on pending queue is wrong&lt;br /&gt;
 *          ERR_TA_NOT_FOUND            Timed action index to be removed for job not found&lt;br /&gt;
 *          ERR_TA_START_FAILED         Timed action re-start failed after job remove from timed action queue&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_dataq_write(&lt;br /&gt;
    dataq_t dataq_id, // data queue ID&lt;br /&gt;
    void *data        // non-null pointer to data&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| dataq_id || dataq_t with value of Data queue ID&lt;br /&gt;
|-&lt;br /&gt;
| ptr || void* pointer to application data (non-null pointer)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| WARN_DQ_NOW_FULL            || Warning, DATAQ is full now&lt;br /&gt;
|-&lt;br /&gt;
| WARN_JOB_NOT_GUARDED        || &lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || DATAQ ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || DATAQ ID &amp;gt;= number of DATAQs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DQ_DATA_BAD             || Data pointer is null&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to acquire guard&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TOO_MANY                || DATAQ is full&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DQ_JOB_ID_WRONG         || Job ID of the task on pending queue is wrong&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_NOT_FOUND            || Timed action index to be removed for job not found&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_START_FAILED         || Timed action re-start failed after job remove from timed action queue&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
char[100] message_in;&lt;br /&gt;
...&lt;br /&gt;
// Put pointer to message_in on data queue s_2 &lt;br /&gt;
status = oceos_dataq_write(s_2, (void *)message_in);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_dataq_read_continue()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''dataq.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns a pointer from the specified data queue.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Read data queue&lt;br /&gt;
 *&lt;br /&gt;
 * @param dataq_t dataq_id  Data queue ID&lt;br /&gt;
 * @param void*   data      Pointer to data&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              DATAQ ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                DATAQ ID &amp;gt;= number of DATAQs&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to acquire guard&lt;br /&gt;
 *          ERR_DQ_EMPTY                DATAQ empty(count zero)&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_dataq_read_continue(&lt;br /&gt;
    dataq_t dataq_id, // data queue ID&lt;br /&gt;
    void* *data        // return data&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Descriptionn&lt;br /&gt;
|-&lt;br /&gt;
| dataq_id || dataq_t with value of Data queue ID&lt;br /&gt;
|-&lt;br /&gt;
| ptr || void* pointer to store returned data queue pointer removed from the queue&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || DATAQ ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || DATAQ ID &amp;gt;= number of DATAQs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to acquire guard&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DQ_EMPTY                || DATAQ empty(count zero)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
char *data_ptr;&lt;br /&gt;
...&lt;br /&gt;
// Read pointer from data queue s_2 &lt;br /&gt;
status = oceos_dataq_read_continue(s_2, (void *)data_ptr);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_dataq_read_restart()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''dataq.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns a pointer from the specified data queue. If the queue is empty, the job is added top the dataq pending queue. The job will be restarted when data is available. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Read data queue next item.&lt;br /&gt;
 * If dataq is empty, task is put on pending Q for dataq and&lt;br /&gt;
 * restarted by oceos_dataq_write&lt;br /&gt;
 *&lt;br /&gt;
 * @param dataq_id Data queue ID&lt;br /&gt;
 * @param data     Pointer to return data&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              DATAQ ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                DATAQ ID &amp;gt;= number of DATAQs&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to acquire guard&lt;br /&gt;
 *          ERR_DQ_J_START_FROM_TIMOUT  Job started from timeout already, DATAQ empty second time&lt;br /&gt;
 *          ERR_FAILED                  Should never return this&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_dataq_read_restart(&lt;br /&gt;
    dataq_t dataq_id,    // data queue ID&lt;br /&gt;
    void* *data           // pointer to return data&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| dataq_id || dataq_t with value of Data queue ID&lt;br /&gt;
|-&lt;br /&gt;
| ptr || void* pointer to store returned data queue pointer removed from the queue&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || DATAQ ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || DATAQ ID &amp;gt;= number of DATAQs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to acquire guard&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DQ_J_START_FROM_TIMOUT  || Job started from timeout already, DATAQ empty second time&lt;br /&gt;
|-&lt;br /&gt;
| ERR_FAILED                  || Should never return this&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
char *data_ptr;&lt;br /&gt;
...&lt;br /&gt;
// Read pointer from data queue s_2 with restart when data is available&lt;br /&gt;
status = oceos_dataq_read_restart(s_2, (void *)data_ptr);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_dataq_read_restart_timeout()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''dataq.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns a pointer from the specified data queue. If the queue is empty, the job is added top the dataq pending queue. The job will be restarted either when data is available or the timeout has expired. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Read data queue next item.&lt;br /&gt;
 * If dataq is empty, task is put on pending Q for dataq and&lt;br /&gt;
 * restarted by oceos_dataq_write or by timeout if timeout != 0&lt;br /&gt;
 * In order to use this feature timed actions must be configured and&lt;br /&gt;
 * dataq created with use timeout set to true&lt;br /&gt;
 *&lt;br /&gt;
 * @param dataq_id          Data queue ID&lt;br /&gt;
 * @param data              Pointer to return data&lt;br /&gt;
 * @param timeout           Timeout, restart time if no entry, 0 =&amp;gt; ignore&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_TA_NOT_INIT             Timed action intialisation is not done and tried to be used; or DATAQ created without timeouts&lt;br /&gt;
 *          ERR_ID_INVALID              DATAQ ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                DATAQ ID &amp;gt;= number of DATAQs&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to acquire guard&lt;br /&gt;
 *          ERR_DQ_EMPTY                DATAQ empty(count zero)&lt;br /&gt;
 *          ERR_DQ_J_START_FROM_TIMOUT  Job started from timeout already, DATAQ empty second time&lt;br /&gt;
 *          ERR_TOO_MANY                DATAQ pending queue is full&lt;br /&gt;
 *          ERR_FAILED                  Should never return this&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_dataq_read_restart_timeout(&lt;br /&gt;
    dataq_t dataq_id,   // data queue ID&lt;br /&gt;
    void* *data,         // Pointer to return data&lt;br /&gt;
    U64_t timeout       // timeout, restart time if no entry, 0 =&amp;gt; ignore&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| dataq_id || dataq_t with value of Data queue ID&lt;br /&gt;
|-&lt;br /&gt;
| ptr || void* pointer to store returned data queue pointer removed from the queue&lt;br /&gt;
|-&lt;br /&gt;
| timeout || U64_t containing timeout value, restart time if no entry, 0 =&amp;gt; ignore&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_NOT_INIT             || Timed action intialisation is not done and tried to be used; or DATAQ created without timeouts&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || DATAQ ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || DATAQ ID &amp;gt;= number of DATAQs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to acquire guard&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DQ_EMPTY                || DATAQ empty(count zero)&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DQ_J_START_FROM_TIMOUT  || Job started from timeout already, DATAQ empty second time&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TOO_MANY                || DATAQ pending queue is full&lt;br /&gt;
|-&lt;br /&gt;
| ERR_FAILED                  || Should never return this&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
char *data_ptr;&lt;br /&gt;
...&lt;br /&gt;
// Read pointer from data queue s_2 with timeout after 10,000 time units if no data is available&lt;br /&gt;
status = oceos_dataq_read_restart_timeout(s_2, (void *)data_ptr, 10000ull);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_dataq_get_size()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''dataq.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the number of items on the specified data queue.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Returns number of items on the data queue with ID&lt;br /&gt;
 *&lt;br /&gt;
 * @param dataq_id   DATAQ Id&lt;br /&gt;
 * @param d_size     Pointer to size holder&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              DATAQ ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                DATAQ ID &amp;gt;= number of DATAQs&lt;br /&gt;
 *          ERR_DQ_DATA_BAD             DATAQ size holder pointer is null&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_dataq_get_size(&lt;br /&gt;
    dataq_t dataq_id,   // data queue ID&lt;br /&gt;
    U32_t *d_size&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| dataq_id ||  dataq_t with the ID of the data queue (value between 0 and 62)&lt;br /&gt;
|-&lt;br /&gt;
| d_size || U32_t *d_size pointer to the variable to store the size&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || DATAQ ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || DATAQ ID &amp;gt;= number of DATAQs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DQ_DATA_BAD             || DATAQ size holder pointer is null&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, d_size;&lt;br /&gt;
...&lt;br /&gt;
// Get the number of entries on data queue d_0&lt;br /&gt;
status = oceos_dataq_get_size(d_0, &amp;amp;d_size);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_dataq_penq_get_size()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''dataq.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns number of jobs on the specified data queue pending job's queue.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Returns number of jobs on the dataq pending job's queue&lt;br /&gt;
 *&lt;br /&gt;
 * @param dataq_id  DATAQ Id&lt;br /&gt;
 * @param d_size    Pointer to pending queue size holder&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              DATAQ ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                DATAQ ID &amp;gt;= number of DATAQs&lt;br /&gt;
 *          ERR_DQ_DATA_BAD             DATAQ pending size holder pointer is null&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_dataq_penq_get_size(&lt;br /&gt;
    dataq_t dataq_id,&lt;br /&gt;
    U32_t *d_size&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| dataq_id ||  dataq_t with the ID of the data queue (value between 0 and 62)&lt;br /&gt;
|-&lt;br /&gt;
| d_jobs || U32_t *d_jobs pointer to the variable to store the number of jobs on the pending queue&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || DATAQ ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || DATAQ ID &amp;gt;= number of DATAQs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DQ_DATA_BAD             || DATAQ pending size holder pointer is null&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, d_jobs;&lt;br /&gt;
...&lt;br /&gt;
// Get the number of jobs the the pending jubs queue for data queue d_1&lt;br /&gt;
status = oceos_dataq_penq_get_size(d_1, &amp;amp;d_jobs);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_dataq_clear()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''dataq.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function clears the specified data queue including pending jobs for that queue.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Clears data queue and&lt;br /&gt;
 * frees tasks on pending queue&lt;br /&gt;
 *&lt;br /&gt;
 * @param dataq_t dataq_id Data queue ID&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              DATAQ ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                DATAQ ID &amp;gt;= number of DATAQs&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to acquire guard&lt;br /&gt;
 *          ERR_DQ_JOB_ID_WRONG         Job ID of the task on DATAQ pending queue is wrong&lt;br /&gt;
 *          ERR_TA_NOT_FOUND            Timed action index to be removed for job not found&lt;br /&gt;
 *          ERR_TA_START_FAILED         Timed action re-start failed after job remove from timed action queue&lt;br /&gt;
 */&lt;br /&gt;
S32_t  oceos_dataq_clear(&lt;br /&gt;
    dataq_t dataq_id    // data queue ID&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| dataq_id ||  dataq_t with the ID of the data queue to be cleared (value between 0 and 62)&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || DATAQ ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || DATAQ ID &amp;gt;= number of DATAQs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to acquire guard&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DQ_JOB_ID_WRONG         || Job ID of the task on DATAQ pending queue is wrong&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_NOT_FOUND            || Timed action index to be removed for job not found&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_START_FAILED         || Timed action re-start failed after job remove from timed action queue&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Clear data queue d_1&lt;br /&gt;
status = oceos_dataq_penq_get_size(d_1);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Timed Actions ==&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_timed_output_add()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''timed_action.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function adds a timed action to the timed action queue. It writes a value to an address at a specified system time. An optional mask can be applied so that only those bits are changed.&lt;br /&gt;
The action types are WRITE_ACTION, RMW_ACTION. WRITE_ACTION writes the value to the address. RMW_ACTION reads the values at the address and modifies the bits specified by the mask and value.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Add output action to timed actions queue :&lt;br /&gt;
 *  1. Create timed output action&lt;br /&gt;
 *  2. Stop timer&lt;br /&gt;
 *  3. Add action to action_array&lt;br /&gt;
 *  4. Start timer or execute if time is right&lt;br /&gt;
 *&lt;br /&gt;
 * Returns timed action ID that can be used later to remove&lt;br /&gt;
 * if need by oceos_timed_output_remove&lt;br /&gt;
 *&lt;br /&gt;
 * @param enum ACTION_TYPE action_type  Action type&lt;br /&gt;
 * @param U64_t act_time                System time at which action should be done&lt;br /&gt;
 * @param U32_t before_time             Forward tolerance for time&lt;br /&gt;
 * @param U32_t after_time              Backward tolerance for time&lt;br /&gt;
 * @param adrs_t address                Output address&lt;br /&gt;
 * @param U32_t value                   Output value&lt;br /&gt;
 * @param U32_t mask                    Output mask&lt;br /&gt;
 * @param U32_ *ta_index                Pointer to store timed action index&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_TA_NOT_INIT             Timed action inialisation is not done and tried to be used&lt;br /&gt;
 *          ERR_TA_PTR_BAD              Timed action pointer is null&lt;br /&gt;
 *          ERR_TA_TYPE_WRONG           Timed action type is wrong&lt;br /&gt;
 *          ERR_TOO_LATE                Timed action time is too late&lt;br /&gt;
 *          ERR_SYS_BUSY                Timed action guard failed to acquire&lt;br /&gt;
 *          ERR_TA_Q_FULL               Timed action queue is full&lt;br /&gt;
 *          ERR_TA_START_FAILED         Timed action execute failed; See log&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_timed_output_add(&lt;br /&gt;
    const enum ACTION_TYPE action_type,// Action type&lt;br /&gt;
    U64_t act_time,                    // system time at which action should be done&lt;br /&gt;
    U32_t before_time,                 // forward tolerance for time&lt;br /&gt;
    U32_t after_time,                  // backward tolerance for time&lt;br /&gt;
    const adrs_t address,              // output address&lt;br /&gt;
    const U32_t value,                 // output value&lt;br /&gt;
    const U32_t mask,                  // output mask&lt;br /&gt;
    U32_t *ta_index                    // Pointer to store timed action index&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| enum ACTION_TYPE action_type  || Action type&lt;br /&gt;
|-&lt;br /&gt;
| U64_t act_time                || System time at which action should be done&lt;br /&gt;
|-&lt;br /&gt;
| U32_t before_time             || Forward tolerance for time&lt;br /&gt;
|-&lt;br /&gt;
| U32_t after_time              || Backward tolerance for time&lt;br /&gt;
|-&lt;br /&gt;
| adrs_t address                || Output address&lt;br /&gt;
|-&lt;br /&gt;
| U32_t value                   || Output value&lt;br /&gt;
|-&lt;br /&gt;
| U32_t mask                    || Output mask&lt;br /&gt;
|-&lt;br /&gt;
| U32_ *ta_index                || Pointer to store timed action index&lt;br /&gt;
|-&lt;br /&gt;
| param || parameter to function&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_NOT_INIT             || Timed action inialisation is not done and tried to be used&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_PTR_BAD              || Timed action pointer is null&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_TYPE_WRONG           || Timed action type is wrong&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TOO_LATE                || Timed action time is too late&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Timed action guard failed to acquire&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_Q_FULL               || Timed action queue is full&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_START_FAILED         || Timed action execute failed; See log&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
#define OUTPUT_TIMED_VAL    0xDEADBEEF&lt;br /&gt;
#define OUTPUT_TIMED_MASK   0x1000001&lt;br /&gt;
#define OUTPUT_TIME         0xfffff&lt;br /&gt;
#define OUTPUT_TIME_FW      0x1000&lt;br /&gt;
#define OUTPUT_TIME_BW      0x1000&lt;br /&gt;
&lt;br /&gt;
static U32_t test_data[16] = { 0 };&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Write OUTPUT_TIMED_VAL to test_data[0] at 0xfffff time units from now with a tolerance of 0x1000 before and after the specified time   &lt;br /&gt;
status = oceos_timed_output_add(&lt;br /&gt;
                                       WRITE_ACTION,&lt;br /&gt;
                                       OUTPUT_TIME,&lt;br /&gt;
                                       OUTPUT_TIME_FW,&lt;br /&gt;
                                       OUTPUT_TIME_BW,&lt;br /&gt;
                                       (adrs_t) &amp;amp;test_data[0],&lt;br /&gt;
                                       OUTPUT_TIMED_VAL,&lt;br /&gt;
                                       0,&lt;br /&gt;
                                       &amp;amp;timed_action_index));&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_timed_jobs_number()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''timed_action.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the number of jobs on the timed actions queue.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Get number of Jobs (request to start the task) waiting on timed action queue.&lt;br /&gt;
 * These jobs are added by oceos_task_timed_start() or&lt;br /&gt;
 * oceos_dataq_read_restart_timeout when data is not available (NULL) or&lt;br /&gt;
 * oceos_sem_wait_restart_timeout when counting semaphore is 0&lt;br /&gt;
 *&lt;br /&gt;
 * @param total_jobs    Pointer to store total jobs number waiting on timed action Q&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_TA_NOT_INIT             Timed action inialisation is not done and tried to be used&lt;br /&gt;
 *          ERR_TA_PTR_BAD              Timed action pointer is null&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_timed_jobs_number(U32_t *total_jobs);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| total_jobs || s32_t pointer to store total jobs number waiting on timed action Q&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_NOT_INIT             || Timed action inialisation is not done and tried to be used&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_PTR_BAD              || Timed action pointer is null&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, no_of_jobs;&lt;br /&gt;
...&lt;br /&gt;
// Get the number of jobs on the timed actions queue&lt;br /&gt;
status = oceos_timed_jobs_number(&amp;amp;no_of_jobs);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_timed_jobs_remove()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''timed_action.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function removes the specified timed action from the queue.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Remove job from timed action queue&lt;br /&gt;
 * When task started using oceos_task_timed_start(),&lt;br /&gt;
 * this directive requires pointer to store ID&lt;br /&gt;
 * of job that put on the timed action queue.&lt;br /&gt;
 * This job can be removed later using this directive and stored job ID.&lt;br /&gt;
 *&lt;br /&gt;
 * @param U32_t job_id  Job ID&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_TA_NOT_INIT             Timed action intialisation is not done and tried to be used&lt;br /&gt;
 *          ERR_TA_PTR_BAD              Timed action pointer corrupt&lt;br /&gt;
 *          ERR_ID_WRONG                Job ID is wrong&lt;br /&gt;
 *          ERR_TA_NOT_FOUND            Timed action ID not found for action with job_id or removed already&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to acquire timed action guard&lt;br /&gt;
 *          WARN_TA_Q_EMPTY             Timed action queue is empty&lt;br /&gt;
 *          ERR_TA_START_FAILED         Timed action execute failed; See log&lt;br /&gt;
 */&lt;br /&gt;
S32_t   oceos_timed_jobs_remove(&lt;br /&gt;
    U32_t job_id                             // Job ID&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| job_id || U32_t Job ID to be removed from the timed actions queue&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_NOT_INIT             || Timed action intialisation is not done and tried to be used&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_PTR_BAD              || Timed action pointer corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || Job ID is wrong&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_NOT_FOUND            || Timed action ID not found for action with job_id or removed already&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to acquire timed action guard&lt;br /&gt;
|-&lt;br /&gt;
| WARN_TA_Q_EMPTY             || Timed action queue is empty&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_START_FAILED         || Timed action execute failed; See log&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, job_id;&lt;br /&gt;
...&lt;br /&gt;
// Remove job_id from the timed actions queue&lt;br /&gt;
status = oceos_timed_jobs_remove(job_id);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_timed_jobs_reset()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''timed_action.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function removes all jobs from timed actions queue.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Remove all jobs (requests to start a task) from timed actions queue&lt;br /&gt;
 * These jobs were added by oceos_task_timed_start() or&lt;br /&gt;
 * oceos_dataq_read_restart_timeout when data is not available (NULL) or&lt;br /&gt;
 * oceos_sem_wait_restart_timeout when counting semaphore is 0&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_TA_NOT_INIT             Timed action intialisation is not done and tried to be used&lt;br /&gt;
 *          ERR_TA_PTR_BAD              Timed action pointer is null&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to acquire timed action guard&lt;br /&gt;
 *          WARN_TA_Q_EMPTY             Timed action queue is empty&lt;br /&gt;
 *          ERR_TA_NOT_FOUND            Timed action index not found&lt;br /&gt;
 *          ERR_TA_START_FAILED         Timed action execute failed; See log&lt;br /&gt;
 */&lt;br /&gt;
S32_t   oceos_timed_jobs_reset(void);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
There are no input parameters to this function&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_NOT_INIT             || Timed action intialisation is not done and tried to be used&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_PTR_BAD              || Timed action pointer is null&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to acquire timed action guard&lt;br /&gt;
|-&lt;br /&gt;
| WARN_TA_Q_EMPTY             || Timed action queue is empty&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_NOT_FOUND            || Timed action index not found&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_START_FAILED         || Timed action execute failed; See log&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Remove all jobs from the timed actions queue&lt;br /&gt;
status = oceos_timed_jobs_reset(job_id);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_timed_output_remove()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''timed_action.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function removes the specified timed output action from timed actions queue.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Remove timed output action from timed actions queue.&lt;br /&gt;
 * When action is created, action index should be stored&lt;br /&gt;
 * to remove if need&lt;br /&gt;
 *&lt;br /&gt;
 * @param action_index&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_TA_NOT_INIT             Timed action intialisation is not done and tried to be used&lt;br /&gt;
 *          ERR_TA_PTR_BAD              Timed action pointer is null&lt;br /&gt;
 *          ERR_ID_WRONG                Timed action id is wrong&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to acquire timed action guard&lt;br /&gt;
 *          ERR_TA_NOT_FOUND            Timed action index not found&lt;br /&gt;
 *          ERR_TA_START_FAILED         Timed action execute failed&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_timed_output_remove(&lt;br /&gt;
    const U8_t  action_index    // Index in action array, returned when action was created&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| action_index|| S32_t specifying the timed output action index returned when the timed output was added.&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| Error bit  || Description&lt;br /&gt;
|&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_NOT_INIT             || Timed action intialisation is not done and tried to be used&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_PTR_BAD              || Timed action pointer is null&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || Timed action id is wrong&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to acquire timed action guard&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_NOT_FOUND            || Timed action index not found&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_START_FAILED         || Timed action execute failed&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
U8_t action_index;&lt;br /&gt;
...&lt;br /&gt;
// Remove timed output with specified action_index&lt;br /&gt;
status = oceos_timed_output_remove(action_index);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_timed_output_reset()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''timed_action.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function removes all timed output actions from timed actions queue.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Remove all timed output actions from timed actions queue&lt;br /&gt;
 * These timed output actions were created by oceos_timed_output_add&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_TA_NOT_INIT             Timed action intialisation is not done and tried to be used&lt;br /&gt;
 *          ERR_TA_PTR_BAD              Timed action pointer is null&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to acquire timed action guard&lt;br /&gt;
 *          WARN_TA_Q_EMPTY             Timed action queue is empty&lt;br /&gt;
 *          ERR_TA_NOT_FOUND            Timed action index not found&lt;br /&gt;
 *          ERR_TA_START_FAILED         Timed action execute failed; See log&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_timed_output_reset(void);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
There are no input parameters to this function. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| Error bit  || Description&lt;br /&gt;
|&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_NOT_INIT             || Timed action intialisation is not done and tried to be used&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_PTR_BAD              || Timed action pointer is null&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to acquire timed action guard&lt;br /&gt;
|-&lt;br /&gt;
| WARN_TA_Q_EMPTY             || Timed action queue is empty&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_NOT_FOUND            || Timed action index not found&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_START_FAILED         || Timed action execute failed; See log&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Remove all timed outputs from the timed actions queue&lt;br /&gt;
status = oceos_timed_output_reset();&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Logging directives ==&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;Introduction&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Log Area Features  (for details of other areas see oceos_areas.h)&lt;br /&gt;
&lt;br /&gt;
The system log area holds the system log and the records of the present and previous values of the system state variable.&lt;br /&gt;
&lt;br /&gt;
It is set up initially as an array of 32-bit words that starts at a 32-bit aligned address provided by the application developer.&lt;br /&gt;
&lt;br /&gt;
It is recommended that this address be in non-volatile RAM memory if this is available to allow information be preserved across power-up cycles.&lt;br /&gt;
&lt;br /&gt;
OCEOS preserves log area information across resets as far as possible.&lt;br /&gt;
&lt;br /&gt;
The system log itself is a circular buffer of struct log entry. Older entries are overwritten by new entries once all entries are in use.&lt;br /&gt;
&lt;br /&gt;
The application developer can specify a function to be called when 3/4 of log entries are in use. This function is called again only after 3/4 of log entries have been read and the log has again become 3/4 full.&lt;br /&gt;
&lt;br /&gt;
The read and write indices are stored in the log area and if equal indicate that the log is empty.&lt;br /&gt;
&lt;br /&gt;
As with other OCEOS data areas, the log area starts with a header&lt;br /&gt;
*a 32-bit word holding a constant OCEOS_VERSION&lt;br /&gt;
*a 32-bit word holding the log area size in 32-bit words&lt;br /&gt;
*a 32-bit word, the system status variable&lt;br /&gt;
*a 32-bit word, the system status mask&lt;br /&gt;
*a 32-bit word, the accumulated system status&lt;br /&gt;
*a 32-bit word, the previous system status mask&lt;br /&gt;
*a 32-bit word, the log control, that gives whether the log full function was called&lt;br /&gt;
*the read index&lt;br /&gt;
*the write index&lt;br /&gt;
*an array of struct log_entry making up the system log itself&lt;br /&gt;
*ending with a 32-bit constant END_SENTINEL&lt;br /&gt;
&lt;br /&gt;
The system fixed meta structure at sysMetaPtr provides&lt;br /&gt;
&lt;br /&gt;
*system_log_ptr      the start address of the log area&lt;br /&gt;
*logEntries          the number of log entries&lt;br /&gt;
*logCreated          flag indicating log was created successfully&lt;br /&gt;
*logFullFunction     user defined function, called when the log becomes 3/4 full (or NULL if not used)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Log Entry Types and Structure'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/*****************************************************************************&lt;br /&gt;
 * LOG ENTRY TYPES&lt;br /&gt;
 *&lt;br /&gt;
 * A log entry type is an 8-bit number.&lt;br /&gt;
 * Values from 0 to 127 can be defined by the application.&lt;br /&gt;
 * Values from 128 to 255 are used by OCEOS as below.&lt;br /&gt;
 *&lt;br /&gt;
 *&lt;br /&gt;
 * NOTE: Add new log types at the end for backward compatibility&lt;br /&gt;
 */&lt;br /&gt;
enum LOG_ENTRY_TYPE{&lt;br /&gt;
  LOG_SYS_OK = 0x80U,&lt;br /&gt;
  LOG_OCEOS_ABORT,				// when exiting from oceos_start&lt;br /&gt;
  LOG_LOG_NOT_VALID_ENTRY,		// used to initialise log and when log empty&lt;br /&gt;
  LOG_INIT_TASK_START_FAIL,		// initial task passed to oceos_start failed&lt;br /&gt;
  LOG_DEADLINE_MISSED,			// task deadline missed&lt;br /&gt;
  LOG_JOB_NOT_ACTIVE,			// cpu_terminate but job not active, absurd&lt;br /&gt;
  LOG_JOB_NOT_FREE,				// job guarded but not free&lt;br /&gt;
  LOG_JOBS_INC_FAILED, 			// pending jobs increment failed&lt;br /&gt;
  LOG_JOB_NOT_GUARDED,			// paranoia&lt;br /&gt;
  LOG_CS_LOG_SPIN_FAIL,			// oceos_CPU_sleep, trying to update CS log&lt;br /&gt;
  LOG_MUTEX_ALREADY_HELD,		// oceos_mutex_wait, code returned, not needed&lt;br /&gt;
  LOG_MUTEX_INCORRECT_ORDER,	// oceos_mutex_wait&lt;br /&gt;
  LOG_MUTEX_EXIT_HOLDING,		// task exits holding one or more mutexes&lt;br /&gt;
  LOG_MUTEX_EXIT_NONE,			// __oceos_tasks_remove_mutexes called but no mutex held&lt;br /&gt;
  LOG_SEMAPHORE_PENDING_REMOVE_FAIL,	// timed_action.c&lt;br /&gt;
  LOG_SEMAPHORE_PENDING_QUEUE_FULL,		// __oceos_semaphore_add_pend&lt;br /&gt;
  LOG_SEMAPHORE_SPIN_FAILED,			// trying to access semaphore&lt;br /&gt;
  LOG_DATAQ_PENDING_QUEUE_FULL,&lt;br /&gt;
  LOG_DATAQ_PENDING_REMOVE_FAIL,&lt;br /&gt;
  LOG_DATAQ_SPIN_FAILED,&lt;br /&gt;
  LOG_TIMED_ACTION_TIMER_NULL,&lt;br /&gt;
  LOG_TIMED_ACTION_INVALID,&lt;br /&gt;
  LOG_TIMED_ACTION_BAD_INDEX,&lt;br /&gt;
  LOG_TIMED_ACTION_MISSED,&lt;br /&gt;
  LOG_TIMED_ACTION_Q_EMPTY,&lt;br /&gt;
  LOG_TIMED_ACTION_REMOVE_FAIL,&lt;br /&gt;
  LOG_TIMED_ACTION_BAD_JOB_ID,&lt;br /&gt;
  LOG_TIMED_Q_SPIN_FAIL,&lt;br /&gt;
  LOG_SYSTEM_ERROR,&lt;br /&gt;
  LOG_ATOMICINC_FAILED,&lt;br /&gt;
  LOG_PENDING_PRI_UPDATE_FAILED,&lt;br /&gt;
  LOG_KILL_TASK_INVALID_ID,      // Tried to kill task with invalid ID&lt;br /&gt;
  LOG_OCEOS_EXIT_REQUEST,         // oceos_exit command was called&lt;br /&gt;
  LOG_RWMUTEX_NOT_RETURNED,&lt;br /&gt;
  LOG_RWMUTEX_NOT_HIGHEST&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
/*****************************************************************************&lt;br /&gt;
 * Structures&lt;br /&gt;
 */&lt;br /&gt;
/**&lt;br /&gt;
 * Log entry structure&lt;br /&gt;
 */&lt;br /&gt;
struct log_entry{&lt;br /&gt;
  U64_t             time64;&lt;br /&gt;
&lt;br /&gt;
  unsigned int      entry_cpu          :8;&lt;br /&gt;
  unsigned int      entry_type         :8;&lt;br /&gt;
  unsigned int      entry_note         :16;	// not used at present&lt;br /&gt;
&lt;br /&gt;
  U32_t             entry_comment;&lt;br /&gt;
}__attribute__ ((aligned (8)));&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_log_add_entry()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''system_log.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function adds an entry to the log. The entry overwrites the oldest unread entry if the log is full.&lt;br /&gt;
Custom log entries can be added to enum LOG_ENTRY from 0 to 128.&lt;br /&gt;
The indices are incremented in a circular fashion. If the write index reaches the read_index the read index is moved on, as read and write indices equal would indicate an empty log.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Add an entry to the log.&lt;br /&gt;
 * this overwrites the oldest unread entry if the log is full.&lt;br /&gt;
 * Custom log entries can be added to enum LOG_ENTRY from 0 to 128&lt;br /&gt;
 *&lt;br /&gt;
 * N.B. The indices are incremented in a circular fashion.&lt;br /&gt;
 *      If the write index reaches the read_index the read index is moved on,&lt;br /&gt;
 *      as read and write indices equal would indicate an empty log.&lt;br /&gt;
 *&lt;br /&gt;
 * @param type  enum LOG_ENTRY_TYPE&lt;br /&gt;
 * @param info  extra information to be logged&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_LOG_CORRUPT         System Log area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Log directive called in wrong phase; can be used after oceos_init() called&lt;br /&gt;
 *          ERR_ID_INVALID              Log type invalid&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to acquire log guard&lt;br /&gt;
 *          ERR_LOG_INDEX_WRONG         Read/write log index is wrong&lt;br /&gt;
 */&lt;br /&gt;
S32_t   oceos_log_add_entry(&lt;br /&gt;
    enum LOG_ENTRY_TYPE type,   // 8 bits enum LOG_ENTRY_TYPE&lt;br /&gt;
    const U32_t        info     // information&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| enum LOG_ENTRY_TYPE || Log entry type (see previous section for a list)&lt;br /&gt;
|-&lt;br /&gt;
| info | U32_t with the log information&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit  !! Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_LOG_CORRUPT         || System Log area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Log directive called in wrong phase; can be used after oceos_init() called&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || Log type invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to acquire log guard&lt;br /&gt;
|-&lt;br /&gt;
| ERR_LOG_INDEX_WRONG         || Read/write log index is wrong&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, info;&lt;br /&gt;
...&lt;br /&gt;
// Log LOG_APP_COMMS__ERROR (defined in enum LOG_ENTRY_TYPE) and info with more details&lt;br /&gt;
status = oceos_log_add_entry(LOG_APP_COMMS__ERROR, info);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_log_get_indexed_entry()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''system_log.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the entry at the specified position in the log. The entry is not removed and the log and log indices are not changed.&lt;br /&gt;
One use of this function is to allow the log be examined after a reset.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Returns the entry at the specified position in the log.&lt;br /&gt;
 * The entry is not removed and the log and log indices are not changed.&lt;br /&gt;
 * (intended to allow the log be examined for example after reset)&lt;br /&gt;
 *&lt;br /&gt;
 * @param index         position in the log&lt;br /&gt;
 * @param outputPtr     pointer to return log entry&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_LOG_CORRUPT         System Log area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Log directive called in wrong phase; can be used after oceos_init() called&lt;br /&gt;
 *          ERR_LOG_INDEX_WRONG         Read log index is wrong&lt;br /&gt;
 *          ERR_LOG_DATA_PTR_BAD        Data holder pointer is null&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_log_get_indexed_entry(&lt;br /&gt;
    const unsigned int index,&lt;br /&gt;
    struct log_entry * const outputPtr&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| index || U32_t with position in the log&lt;br /&gt;
|-&lt;br /&gt;
| outputPtr || pointer to struct log_entry to hold the returned entry&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit  !! Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_LOG_CORRUPT         || System Log area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Log directive called in wrong phase; can be used after oceos_init() called&lt;br /&gt;
|-&lt;br /&gt;
| ERR_LOG_INDEX_WRONG         || Read log index is wrong&lt;br /&gt;
|-&lt;br /&gt;
| ERR_LOG_DATA_PTR_BAD        || Data holder pointer is null&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, index;&lt;br /&gt;
struct log_entry store_entry;&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
// Read log_entry at specified index into outputPtr&lt;br /&gt;
status = oceos_log_get_indexed_entry(index, &amp;amp;store_entry);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_log_remove_entry()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''system_log.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function reads and removes the oldest unread log entry. &lt;br /&gt;
If the log is not empty use the entry at the read index to update the value at the output pointer, returning OCEOS_SUCCESS.&lt;br /&gt;
If outputPtr is NULL, entry is removed but no returned.&lt;br /&gt;
If the log is empty, set the value at the output pointer to LOG_LOG_NOT_VALID_ENTRY and return ERR_LOG_EMPTY.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Read and remove the oldest unread log entry&lt;br /&gt;
 *&lt;br /&gt;
 * If the log is not empty use the entry at the read index to update the value&lt;br /&gt;
 * at the output pointer, returning OCEOS_SUCCESS.&lt;br /&gt;
 *&lt;br /&gt;
 * If outputPtr is NULL, entry is removed but no returned&lt;br /&gt;
 *&lt;br /&gt;
 * If the log is empty, set the value at the output pointer to LOG_LOG_NOT_VALID_ENTRY&lt;br /&gt;
 * and return ERR_LOG_EMPTY&lt;br /&gt;
 *&lt;br /&gt;
 * @param outputPtr   pointer to struct log_entry&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_LOG_CORRUPT         System Log area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Log directive called in wrong phase; can be used after oceos_init() called&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to acquire log guard&lt;br /&gt;
 *          ERR_LOG_INDEX_WRONG         Read/write log index is wrong&lt;br /&gt;
 *          ERR_LOG_EMPTY               Log is empty&lt;br /&gt;
 */&lt;br /&gt;
S32_t   oceos_log_remove_entry(&lt;br /&gt;
    struct log_entry * const outputPtr&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| outputPtr || pointer to struct log_entry&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit  !! Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_LOG_CORRUPT         || System Log area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Log directive called in wrong phase; can be used after oceos_init() called&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to acquire log guard&lt;br /&gt;
|-&lt;br /&gt;
| ERR_LOG_INDEX_WRONG         || Read/write log index is wrong&lt;br /&gt;
|-&lt;br /&gt;
| ERR_LOG_EMPTY               || Log is empty&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
struct log_entry *outputPtr;&lt;br /&gt;
...&lt;br /&gt;
// Read log_entry into outputPtr and remove the oldest unread log entry&lt;br /&gt;
status = oceos_log_remove_entry(outputPtr);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_log_reset()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''system_log.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function sets all log entries to LOG_LOG_NOT_VALID_ENTRY and the log to empty, with the read and write indices set to 0.&lt;br /&gt;
The log is empty if the index of the next write is the same as the index of the next read. It does not affect the system status variable. It does not affect the context switch log.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * oceos_log_reset()&lt;br /&gt;
 *&lt;br /&gt;
 * Set all log entries to LOG_LOG_NOT_VALID_ENTRY and the log to empty, with the&lt;br /&gt;
 * read and write indices set to 0. and function called flag 0&lt;br /&gt;
 *&lt;br /&gt;
 * The log is empty if the index of the next write&lt;br /&gt;
 * is the same as the index of the next read.&lt;br /&gt;
 *&lt;br /&gt;
 * Does not affect the system status variable&lt;br /&gt;
 * Does not affect the context switch log&lt;br /&gt;
 *&lt;br /&gt;
 * N.B The fixed data area may no longer be writable&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_LOG_CORRUPT         System Log area corrupt; reset failed&lt;br /&gt;
 *          ERR_WRONG_PHASE             Log directive called in wrong phase; can be used after oceos_init() called&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to acquire log guard&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_log_reset(void);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
There are no input parameters to this function.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit  !! Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_LOG_CORRUPT         || System Log area corrupt; reset failed&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Log directive called in wrong phase; can be used after oceos_init() called&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to acquire log guard&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
// Clear down the system log&lt;br /&gt;
status = oceos_log_reset();&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_log_get_size()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''system_log.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the number of entries in the log according to the current values of the read and write indices.&lt;br /&gt;
The value will be zero if the current values of the read and write indices are the same. There may still be useful information in the log, e.g. after system reset, this can be accessed using oceos_log_get_indexed_entry().&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Return the number of entries in the log&lt;br /&gt;
 * according to the current values of the read and write indices.&lt;br /&gt;
 *&lt;br /&gt;
 * The value will be zero if the current values of the read and write indices&lt;br /&gt;
 * are the same.&lt;br /&gt;
 *&lt;br /&gt;
 * There may still be useful information in the log, e.g. after system reset,&lt;br /&gt;
 * this can be accessed using oceos_log_get_indexed_entry()&lt;br /&gt;
 *&lt;br /&gt;
 * @param l_size        pointer to log size holder&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_LOG_CORRUPT         System Log area corrupt;&lt;br /&gt;
 *          ERR_WRONG_PHASE             Log directive called in wrong phase; can be used after oceos_init() called&lt;br /&gt;
 *          ERR_LOG_DATA_PTR_BAD        Pointer to log size holder is NULL&lt;br /&gt;
 *          ERR_LOG_INDEX_WRONG         Read/write log index is wrong&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_log_get_size(&lt;br /&gt;
    U32_t *l_size&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| l_size|| U32_t pointer where size will be written.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit  !! Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_LOG_CORRUPT         || System Log area corrupt;&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Log directive called in wrong phase; can be used after oceos_init() called&lt;br /&gt;
|-&lt;br /&gt;
| ERR_LOG_DATA_PTR_BAD        || Pointer to log size holder is NULL&lt;br /&gt;
|-&lt;br /&gt;
| ERR_LOG_INDEX_WRONG         || Read/write log index is wrong&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, size;&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
// Clear down the system log&lt;br /&gt;
status = oceos_log_get_size(&amp;amp;size);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;System State Variable and System State Mask&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The System State variable provides a record of anomalies or problems detected by OCEOSmp's automatic consistency checks. An application handler for these can be set to be called automatically.&lt;br /&gt;
&lt;br /&gt;
An anomaly or problem results in a flag bit being set in the 32-bit word used to store the system state variable. The flags are identified below.&lt;br /&gt;
&lt;br /&gt;
All flags are reset to zero by oceos_init() when OCEOSmp is initialised, and may also be reset by the application using the directive provided.&lt;br /&gt;
&lt;br /&gt;
To provide a record across OCEOSmp restarts a copy is updated automatically whenever the state variable is updated. This is not cleared by oceos_init() but may be cleared by the application using a directive.&lt;br /&gt;
&lt;br /&gt;
Application software can define a problem handling function to be called automatically when specified system state flags are set. The flags are specified by setting the corresponding bits in the system state mask. The function and the state mask are defined in the system configuration.&lt;br /&gt;
&lt;br /&gt;
Changing a state flag from clear to set results in the function being called (if defined). Subsequent settings of that flag have no effect until after it has been cleared using the directive provided.&lt;br /&gt;
&lt;br /&gt;
N.B. In many cases when OCEOSmp sets a System State flag it also makes an entry in the system log that provides further information.&lt;br /&gt;
&lt;br /&gt;
SYSTEM STATE VARIABLE FLAGS&lt;br /&gt;
&lt;br /&gt;
These flags are updated by OCEOSmp using inclusive 'OR' when a consistency check detects a problem or anomaly. A copy of the system state variable is updated also and accumulates a record of flag settings that is preserved across restarts of OCEOSmp. OCEOSmp restarts reset the system state variable but not the copy.&lt;br /&gt;
&lt;br /&gt;
Resetting the state variables is the responsibility of the application (except for the state variable reset done when OCEOSmp is restarted).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''System Status Bits'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
#define  STATUS_NORMAL                    0u    // No flag set                              YES&lt;br /&gt;
#define  STATUS_INVALID          0xffffffffu    // System status is invalid                 YES BUT NO DETAIL!!!&lt;br /&gt;
&lt;br /&gt;
#define  STATUS_MASK_NORMAL      0xffffffffu    // Always call user def fn                  YES&lt;br /&gt;
&lt;br /&gt;
/* Task related problems */&lt;br /&gt;
#define  STATUS_DISABLED_TASK_START    0x1U    // An attempt to start a disabled task&lt;br /&gt;
#define  STATUS_TASK_JOB_LIMIT_OVER    0x2U    // An attempt to execute a task when its jobs limit is already reached.&lt;br /&gt;
#define  STATUS_JOB_OVER_TIME          0x4U    // Job time from creation to completion exceeds allowed maximum for task. YES&lt;br /&gt;
#define  STATUS_JOB_INTERVAL_SHORT     0x8U    // Minimum time between job creations is less than the allowed minimum for task&lt;br /&gt;
#define  STATUS_READYQ_FULL           0x10U    // Ready queue unable to accept job as result of being full&lt;br /&gt;
#define  STATUS_READYQ_NO_REMOVE      0x20U    // Remove job from ready queue failed&lt;br /&gt;
&lt;br /&gt;
/* Mutex related problems */&lt;br /&gt;
#define  STATUS_MUTEX_ALREADY_HELD    0x40U    // Mutex wait() when mutex already held&lt;br /&gt;
#define  STATUS_MUTEX_NOT_HELD        0x80U    // Mutex signal() when not already held&lt;br /&gt;
#define  STATUS_MUTEX_NOT_RETURNED   0x100U    // Mutex not returned before job terminates&lt;br /&gt;
#define  STATUS_MUTEX_NOT_NESTED     0x200U    // Use of multiple mutexes not nested&lt;br /&gt;
&lt;br /&gt;
/* Counting semaphore and data queue related problems */&lt;br /&gt;
#define  STATUS_SEMAPHORE_JOBS_FULL  0x400U    // Attempt to add job to semaphore pending list when list full&lt;br /&gt;
#define  STATUS_DATAQ_JOBS_FULL      0x800U    // Attempt to add job to data queue pending list when list full&lt;br /&gt;
#define  STATUS_DATAQ_FULL          0x1000U    // Data queue write when queue already full&lt;br /&gt;
&lt;br /&gt;
/* Timed actions related problems */&lt;br /&gt;
#define  STATUS_TIMED_JOBS_FULL     0x2000U    // Timed actions queue already full for timed task start&lt;br /&gt;
#define  STATUS_TIMED_OUTPUT_FULL   0x4000U    // Timed actions queue already full for timed output&lt;br /&gt;
#define  STATUS_TIMED_ACTION_LATE   0x8000U    // Timed action late                          YES&lt;br /&gt;
&lt;br /&gt;
/* Default trap handler should have been replaced&lt;br /&gt;
 * NOT USED AT THE MOMENT*/&lt;br /&gt;
#define  STATUS_SYSTEM_ERROR       0x10000U    // ERROR was handled by default trap handler  YES&lt;br /&gt;
&lt;br /&gt;
/* Flag to indicate problem with Stack Pointer&lt;br /&gt;
 * NOT USED AT THE MOMENT*/&lt;br /&gt;
#define  STATUS_SP_WARNING         0x20000U    // SP not in expected range&lt;br /&gt;
/* Log system error */&lt;br /&gt;
#define  STATUS_BAD_LOG            0x40000U    // System log problem&lt;br /&gt;
#define  STATUS_SPIN_FAILED        0x80000U    // Get SPIN lock failed&lt;br /&gt;
/* Not using next few bits */&lt;br /&gt;
&lt;br /&gt;
/* Will have to exit */&lt;br /&gt;
#define  STATUS_BAD_SENTINEL     0x40000000U    // Area sentinel corrupt&lt;br /&gt;
#define  STATUS_BAD_META_PTR     0x80000000U    // Null meta pointer&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_system_state_get()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''system_log.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns of the system state variable.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Returns the value of the system state variable&lt;br /&gt;
 *&lt;br /&gt;
 * @param state  pointer to state holder&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_LOG_DATA_PTR_BAD        Data holder pointer is null&lt;br /&gt;
 *          ERR_SYS_LOG_CORRUPT         LOG dynamic pointer is null&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_system_state_get(&lt;br /&gt;
    U32_t *state // pointer to state holder&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| state || U32_t pointer to state holder&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit  !! Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_LOG_DATA_PTR_BAD        || Data holder pointer is null&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_LOG_CORRUPT         || LOG dynamic pointer is null&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, state;&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
// Get the system state&lt;br /&gt;
status = oceos_system_state_get(&amp;amp;state);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_system_state_set()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''system_log.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function sets system state variable.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Sets system state variable&lt;br /&gt;
 *&lt;br /&gt;
 * @param new_state&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_LOG_CORRUPT         LOG dynamic pointer is null&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_system_state_set(&lt;br /&gt;
    U32_t new_state   // new value of system state variable&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| new_state || U32_t containing new system state&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit  !! Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_LOG_CORRUPT         || LOG dynamic pointer is null&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, new_state;&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
// Set new system state&lt;br /&gt;
status = oceos_system_state_set(new_state);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_system_state_copy_get()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''system_log.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the value of the system state copy variable.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Returns the value of the copy of system state variable&lt;br /&gt;
 *&lt;br /&gt;
 * @param state  pointer to state holder&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_LOG_DATA_PTR_BAD        Data holder pointer is null&lt;br /&gt;
 *          ERR_SYS_LOG_CORRUPT         LOG dynamic pointer is null&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_system_state_copy_get(&lt;br /&gt;
    U32_t *state // pointer to state copy holder&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| state || U32_t pointer to state copy holder&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit  !! Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_LOG_DATA_PTR_BAD        || Data holder pointer is null&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_LOG_CORRUPT         || LOG dynamic pointer is null&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, copy_state;&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
// Get the system state copy&lt;br /&gt;
status = oceos_system_state_copy_get(&amp;amp;copy_state);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_system_state_copy_set()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''system_log.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function loads a value to tha system state copy variable.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Sets system state copy variable&lt;br /&gt;
 *&lt;br /&gt;
 * @param new_state&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_LOG_CORRUPT         LOG dynamic pointer is null&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_system_state_copy_set(&lt;br /&gt;
    U32_t new_state   // new value of system state variable&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| new_state || U32_t containing new system state copy&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit  !! Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_LOG_CORRUPT         || LOG dynamic pointer is null&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, new_state;&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
// Set new system state copy&lt;br /&gt;
status = oceos_system_state_copy_set(new_state);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Timing directives ==&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;Introduction&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
SPARC:&lt;br /&gt;
&lt;br /&gt;
In OCEOS system time is based on two chained 32-bit timers.&lt;br /&gt;
&lt;br /&gt;
No interrupts are involved, the current system time is obtained by reading the two timer counter registers (in an atomic way) and then inverting the&lt;br /&gt;
values since the timers count down.&lt;br /&gt;
&lt;br /&gt;
The scaler associated with the timers is configured based on the system clock frequency to decrement the low order timer every microsecond. This&lt;br /&gt;
decrements the high order timer when it rolls over, every 71.6 minutes approximately. The 64-bit time range is very long, over 584,000 years.&lt;br /&gt;
&lt;br /&gt;
ARM Cortex-M:&lt;br /&gt;
&lt;br /&gt;
In OCEOS for ARM Cortex-M, system time is based on SysTick. The processor has a 24-bit system timer, SysTick, that counts down from the reload value to zero, reloads (wraps to) the value in the LOAD register on the next clock edge, then counts down on subsequent clocks.&lt;br /&gt;
&lt;br /&gt;
Note: When the processor is halted for debugging the counter does not decrement.&lt;br /&gt;
&lt;br /&gt;
OCEOS initializes the timer to be driven from MCK and counting down to zero asserts SysTick exception request.&lt;br /&gt;
OCEOS has 64 bit counter which is increased by 0xFFFFFF value every time timer reloads.&lt;br /&gt;
&lt;br /&gt;
RISC-V:&lt;br /&gt;
&lt;br /&gt;
TBD&lt;br /&gt;
&lt;br /&gt;
The units of OCEOS system time are microseconds on SPARC and ARM and on RISC-V the period of the clock cycle.&lt;br /&gt;
&lt;br /&gt;
The system time is reset to 0 by oceos_init()&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_time_sys_get64()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''oceos_timer.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the current system time as a 64-bit number.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
**&lt;br /&gt;
 * Get the current system time (64-bit)&lt;br /&gt;
 *&lt;br /&gt;
 * @return U64_t&lt;br /&gt;
 */&lt;br /&gt;
U64_t oceos_time_sys_get64(void);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There are no parameters to this function.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S64_t with the current system time.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S64_t now;&lt;br /&gt;
...&lt;br /&gt;
// Get the time&lt;br /&gt;
now = oceos_time_sys_get64();&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_time_sys_get32()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''oceos_timer.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the low 32 bits of the system time.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Get the current system time (low 32 bits of 64 bit value)&lt;br /&gt;
 *&lt;br /&gt;
 * @return U32_t&lt;br /&gt;
 */&lt;br /&gt;
U32_t oceos_time_sys_get32(void);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
There are no parameters to this function.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with the current system time.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t now;&lt;br /&gt;
...&lt;br /&gt;
// Get the time&lt;br /&gt;
now = oceos_time_sys_get32();&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:backup]]&lt;/div&gt;</summary>
		<author><name>Bkavanagh</name></author>
	</entry>
	<entry>
		<id>https://wiki.ocetechnology.com/mediawiki/index.php?title=MediaWiki:Sidebar&amp;diff=1692</id>
		<title>MediaWiki:Sidebar</title>
		<link rel="alternate" type="text/html" href="https://wiki.ocetechnology.com/mediawiki/index.php?title=MediaWiki:Sidebar&amp;diff=1692"/>
		<updated>2024-05-03T15:40:27Z</updated>

		<summary type="html">&lt;p&gt;Bkavanagh: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
* navigation&lt;br /&gt;
** Main Page|OCE wiki&lt;br /&gt;
*  DMON&lt;br /&gt;
** DMON install &amp;amp; use|DMON install &amp;amp; use&lt;br /&gt;
** DMON facilities|DMON facilities&lt;br /&gt;
** DMON commands|DMON commands&lt;br /&gt;
** DMON SOC support|DMON SOC support&lt;br /&gt;
** DMON Eclipse debug|DMON Eclipse debug&lt;br /&gt;
** DMON OCEOS Support|DMON OCEOS Support&lt;br /&gt;
** DMON Troubleshooting|DMON Troubleshooting&lt;br /&gt;
* OCEOS&lt;br /&gt;
** OCEOS/oceos_introduction|Introduction&lt;br /&gt;
** OCEOS/oceos_kernel|Kernel&lt;br /&gt;
** OCEOS/oceos_inter-task_communication|Inter-task Communication&lt;br /&gt;
** OCEOS/oceos_timed_actions|Timed Actions&lt;br /&gt;
** OCEOS/oceos_logging|Logging&lt;br /&gt;
** OCEOS/oceos_fdir|FDIR&lt;br /&gt;
** OCEOS/oceos_protection|Protection (GR716)&lt;br /&gt;
** OCEOS/oceos_debugging|Debugging&lt;br /&gt;
** OCEOS/oceos_profiling|Profiling&lt;br /&gt;
** OCEOS/oceos_use|Installation&lt;br /&gt;
* OCEOSmp&lt;br /&gt;
**OCEOSmp/introduction|Introduction&lt;br /&gt;
**OCEOSmp/notes|Application Notes&lt;br /&gt;
**OCEOSmp/directive_reference|Directive Reference&lt;br /&gt;
**OCEOSmp/blank|Blank Section&lt;/div&gt;</summary>
		<author><name>Bkavanagh</name></author>
	</entry>
	<entry>
		<id>https://wiki.ocetechnology.com/mediawiki/index.php?title=OCEOSmp/notes&amp;diff=1691</id>
		<title>OCEOSmp/notes</title>
		<link rel="alternate" type="text/html" href="https://wiki.ocetechnology.com/mediawiki/index.php?title=OCEOSmp/notes&amp;diff=1691"/>
		<updated>2024-05-03T15:28:36Z</updated>

		<summary type="html">&lt;p&gt;Bkavanagh: /* Associated directives */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= &amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;'''When things go wrong'''&amp;lt;/span&amp;gt; =&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Prof. M. Ryan'''&lt;br /&gt;
&lt;br /&gt;
Things can go wrong even when software is bug free.&lt;br /&gt;
&lt;br /&gt;
Misunderstandings may have led to an inadequate design, real world circumstances may conspire to cause performance problems, radiation or other factors may cause hardware failures, and in general things can always go wrong.&lt;br /&gt;
&lt;br /&gt;
Murphy’s Law then applies, and while the system is in use it is important that system behaviour can be monitored, deviations from expectations noticed, checks made, corrections done, and recovery steps taken if needed.&lt;br /&gt;
&lt;br /&gt;
OCEOSmp has been designed with Murphy’s Law in mind and facilitates such actions in a number of ways.&lt;br /&gt;
&lt;br /&gt;
# Servant not Master&lt;br /&gt;
# White Box not Black Box&lt;br /&gt;
# Directive warning and error status codes&lt;br /&gt;
# Automatic integrity checks&lt;br /&gt;
# System Log&lt;br /&gt;
# System state variable&lt;br /&gt;
# System Policing and Problem Anticipation&lt;br /&gt;
# Problem Detection and Handling&lt;br /&gt;
# Precautions and Correction&lt;br /&gt;
&lt;br /&gt;
== Servant not Master ==&lt;br /&gt;
&lt;br /&gt;
[[File:MasterNotSlave.png|400px]]&lt;br /&gt;
&lt;br /&gt;
Many operating systems begin execution directly after the boot sequence and control all subsequent execution of the application software (ASW). Should something go wrong it can be difficult to assess what has occurred and find appropriate corrective action, particularly if the operating system itself has been involved.&lt;br /&gt;
&lt;br /&gt;
With OCEOSmp the ASW begins execution before the operating system and only starts OCEOSmp at some point after entering main().&lt;br /&gt;
&lt;br /&gt;
Before doing so the ASW should check the circumstances that lead to main() being entered. If due to a system restart then the data accumulated by OCEOSmp in the previous run is still available in its fixed, dynamic, and log data areas for analysis or download to find the cause (assuming power has been maintained or non-volatile memory is used for those areas).&lt;br /&gt;
&lt;br /&gt;
The ASW can then make appropriate modifications, and continue as usual to set up EDAC, set up memory protection, initialise and check CPU cores and peripherals, and once all seems correct proceed to start or restart OCEOSmp.&lt;br /&gt;
&lt;br /&gt;
Once scheduling begins OCEOSmp returns to main() only if a fatal error is detected or if it is instructed to do so by an ASW task. Should this occur all the data accumulated is available for analysis or download by ASW main() code, which can restart scheduling by calling oceos_start().&lt;br /&gt;
 &lt;br /&gt;
Most problems can be dealt with by tasks set up to do so under the control of OCEOSmp, but sufficiently serious ones may cause a system reset (e.g. a watchdog timer running out) or cause OCEOSmp to exit (e.g. corruption of critical data), in both cases with the previous state available for analysis if power is maintained or if non-volatile memory is used.&lt;br /&gt;
&lt;br /&gt;
In main() the ASW takes five principal steps in starting OCEOSmp:&lt;br /&gt;
&lt;br /&gt;
# check whether the entry to main() is due to a restart (e.g. by checking if the OCEOSmp data area sentinels are already in place) and if so use the data areas to determine the cause and make whatever modifications to the system are appropriate.   &lt;br /&gt;
# use oceos_init() with the ASW configuration to set up the log area and prepare the fixed data area to hold various addresses, the number of CPU cores, tasks, mutexes, etc.&lt;br /&gt;
# use various OCEOSmp create functions to create tasks, mutexs etc.&lt;br /&gt;
# use oceos_init_finish() to check that the declared numbers of tasks etc. have been created, finish setting up the fixed data area, and set its checksum.&lt;br /&gt;
&lt;br /&gt;
At this point the fixed data area with fixed information about addresses, cores, tasks, mutexes, data queues etc. has been set up, and need not be set up again if not corrupted. The checksum allows the &lt;br /&gt;
area be checked at any time to ensure it has not been changed. Memory protection if available can make the fixed area read-only and make the stack addresses for each core restricted to being written &lt;br /&gt;
only by that core. &lt;br /&gt;
&lt;br /&gt;
Scheduling can begin.&lt;br /&gt;
&lt;br /&gt;
# &amp;lt;li value=&amp;quot;5&amp;quot;&amp;gt;use oceos_start() to initialise the dynamic data area and begins scheduling. This function usually does not return to main() but may do so if a major problem is detected.&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As scheduling progresses the ASW can use the system log to record events and monitor performance. The log is also used by OCEOSmp to record problems, and OCEOSmp may also make a system state entry and trigger an ASW problem handling function.&lt;br /&gt;
&lt;br /&gt;
If a problem is sufficiently serious OCEOSmp may exit automatically or may be requested to do so by an ASW task, execution then returns to main() at the point after the call to oceos_start() with all performance, log, stack and other data available for analysis or download.&lt;br /&gt;
 &lt;br /&gt;
The ASW main() code can then determine the reason for the unexpected return, take appropriate corrective action, and resume scheduling by calling oceos_start() or modify various settings and start over with oceos_init().&lt;br /&gt;
&lt;br /&gt;
The ASW uses OCEOSmp and remains the master, rather than the reverse.&lt;br /&gt;
&lt;br /&gt;
== White Box not Black Box ==&lt;br /&gt;
&lt;br /&gt;
[[File:WhiteboxNotBlackbox.png|800px]]&lt;br /&gt;
&lt;br /&gt;
The data used by OCEOSmp is stored in statically allocated memory in three data areas and in an overall stack area. These usually are specified by the ASW as arrays of 32-bit words and can be examined by the ASW at any time.&lt;br /&gt;
&lt;br /&gt;
The data includes actual and expected task maximum and minimum execution times, activities on CPU cores, and other records of what has been happening. These records can be readily examined by the ASW while scheduling is under way and after OCEOSmp exits should this occur.&lt;br /&gt;
&lt;br /&gt;
OCEOSmp configures each data area to begin with a 32-bit sentinel followed by its size measured in 32-bit words, then the corresponding data, and finally a 32-bit sentinel. In the case of the fixed data area a 32-bit XOR checksum is located before the end sentinel.&lt;br /&gt;
&lt;br /&gt;
The size of each data area and the layout of the data within it depends on the application configuration, but are clearly specified with the location of each data item identified.&lt;br /&gt;
&lt;br /&gt;
Whenever an OCEOSmp directive is used a quick check is made that sentinels have not been breached. The ASW itself can check the fixed area checksum at any time (this is not done automatically for reasons of efficiency).&lt;br /&gt;
&lt;br /&gt;
The Log Area is initialized by oceos_init() and contains the system log and system state variable and if used the optional context switch log. Directives are provided to access and update these. The size of the area depends on the number of entries specified for the two logs in the system configuration. Log contents are preserved across system reset and across power failures if stored in non-volatile memory. &lt;br /&gt;
&lt;br /&gt;
The Fixed Data Area is completed by oceos_init_finish() and contains all the constants of the system, such as the addresses of data areas and stacks, the identity of the CPU core that OCEOSmp is to use on startup, the number of cores, tasks etc., the priorities and other attributes of tasks etc. &lt;br /&gt;
&lt;br /&gt;
The Dynamic Data area is created and initialized by oceos_start() and contains the information collected as oceosmp schedules tasks and as mutexes, counting semaphores,  etc. are used. This information is available for inspection by the ASW if OCEOSmp exits, and is only overwritten if the ASW again calls oceos_start().&lt;br /&gt;
&lt;br /&gt;
In OCEOSmp each CPU core has a system stack, a stack for each thread is not required. The stack size per CPU core and the location of the overall top of stack is specified in the application configuration and the overall stack space is statically allocated.&lt;br /&gt;
&lt;br /&gt;
Before scheduling begins OCEOSmp initialises each core’s stack with a filler. This is overwritten as the stack is used and by checking how much memory at the top and bottom of each stack still contains the filler it is possible to determine at any point how close the system has come to a stack overrun.&lt;br /&gt;
&lt;br /&gt;
The white box approach of making all records and the system stacks readily accessible while scheduling is taking place and should OCEOSmp exit facilitates checking that the system is performing as expected and determining the causes of any problems that may occur.&lt;br /&gt;
&lt;br /&gt;
== Directive warning and error status codes ==&lt;br /&gt;
&lt;br /&gt;
[[File:WarningErrorIcon.png|400px]]&lt;br /&gt;
&lt;br /&gt;
The ASW uses OCEOSmp by calling its directives, and is responsible for checking the returned directive status code. (OCEOSmp is a statically linked library, only those components related to the directives used by the ASW are linked into the final executable.)&lt;br /&gt;
&lt;br /&gt;
The system time directives oceos_time_sys_get64() and oceos_time_sys_get32() directly return the requested system time as 64-bit or 32-bit unsigned integers.&lt;br /&gt;
&lt;br /&gt;
Other directives return a 32-bit signed integer status code.&lt;br /&gt;
&lt;br /&gt;
This should always be checked when a directive is used.&lt;br /&gt;
&lt;br /&gt;
The status code indicates ERROR, SUCCESS, or WARNING.&lt;br /&gt;
&lt;br /&gt;
* A negative value indicates that the directive has not executed and gives the reasons&lt;br /&gt;
* A zero value indicates successful execution as expected&lt;br /&gt;
* A non-zero positive value indicates that the directive executed but with warnings&lt;br /&gt;
&lt;br /&gt;
Certain bits in the status code have the same meaning for all directives.&lt;br /&gt;
&lt;br /&gt;
Other bits have meanings that depend on the directive in use.&lt;br /&gt;
&lt;br /&gt;
These meanings are given in the header files associated with each directive as constants that can be compared with the status code to determine the types of errors or warnings involved.&lt;br /&gt;
&lt;br /&gt;
Errors typically involve an incorrect parameter to a directive, or an attempt to use a resource that is not available such as writing to a data queue that is already full.&lt;br /&gt;
&lt;br /&gt;
Warnings typically indicate that the directive has succeeded but that a danger has been created as when a task acquires multiple mutual exclusion semaphores out of order, or that a resource is now fully in use as when a write makes a data queue full.&lt;br /&gt;
&lt;br /&gt;
The task that used the directive and checked the returned status has full access to the data areas and stack areas in deciding the action to take, which may involve making a system log entry, starting a problem handling task, or in the worst case exiting from OCEOSmp and returning to main().&lt;br /&gt;
&lt;br /&gt;
In many situations the returned status code is the only indicator that is needed of directive success or failure. The ASW can then make a system log entry (automatically timestamped by OCEOSmp) for recording or performance analysis purposes if desired.&lt;br /&gt;
&lt;br /&gt;
In some situations OCEOSmp will make a system log entry automatically and may also update the system state variable, resulting in an ASW defined problem handling function being called if the corresponding flag has been set by the ASW in the system action flags.&lt;br /&gt;
&lt;br /&gt;
OCEOSmp may also automatically make a system log entry or take other actions when problems arise later, as when a task completion deadline is missed or a mutex is not returned.&lt;br /&gt;
&lt;br /&gt;
Irrespective of whatever other precautions may be taken, the first line of defence in using a directive is to check the returned status code.&lt;br /&gt;
&lt;br /&gt;
== Automatic integrity tests ==&lt;br /&gt;
&lt;br /&gt;
[[File:Automation.jpg|600px]]&lt;br /&gt;
&lt;br /&gt;
These are done automatically by OCEOSmp when a directive is used or an event occurs.&lt;br /&gt;
&lt;br /&gt;
They include checking that OCEOSmp data area sentinels are intact, and in the event of corruption may result in an exit from OCEOSmp and return to main().&lt;br /&gt;
&lt;br /&gt;
Directive parameters and the current system phase also are automatically checked when a directive is used, together with the availability of any required resources.&lt;br /&gt;
&lt;br /&gt;
Problems detected immediately when a directive is used result in an appropriate status code being returned to the ASW task that called the directive.&lt;br /&gt;
&lt;br /&gt;
Some problems, such as a task missing a deadline, do not occur immediately when a directive is used but only as scheduling proceeds. Such problems are checked for automatically by OCEOSmp.&lt;br /&gt;
&lt;br /&gt;
Checks include task completion times vs. deadlines, task start requests intervals vs. expected maxima and minima, mutual exclusion semaphore not being released before task completion, time taken to obtain spinlocks longer than expected (an indicator of system loading), and other problems. &lt;br /&gt;
&lt;br /&gt;
If a check fails in most cases a system log entry is made and the system state variable may be updated, possibly resulting in an ASW defined problem handler being called. In extreme cases OCEOSmp may exit and return to main().&lt;br /&gt;
&lt;br /&gt;
Overall the automatic integrity tests carried out by OCEOSmp itself include:&lt;br /&gt;
# System meta pointer intact&lt;br /&gt;
# Data area sentinel/s intact&lt;br /&gt;
# Task deadline not missed&lt;br /&gt;
# Task start request gap too short&lt;br /&gt;
# Task start request gap too long&lt;br /&gt;
# …&lt;br /&gt;
&lt;br /&gt;
It should be noted that these checks detect that a problem has happened. To anticipate problems and perhaps avoid them further checks can and should be done by the ASW as part of system policing.&lt;br /&gt;
&lt;br /&gt;
== System Log ==&lt;br /&gt;
&lt;br /&gt;
[[File:Logging.png|600px]]&lt;br /&gt;
&lt;br /&gt;
=== Purpose ===&lt;br /&gt;
&lt;br /&gt;
# Provide application software with the ability to make time stamped records of events for use in application performance monitoring and in application debugging&lt;br /&gt;
# Provide OCEOSmp with the ability to record anomalies should these be detected.&lt;br /&gt;
&lt;br /&gt;
=== Structure ===&lt;br /&gt;
&lt;br /&gt;
# &amp;lt;li value=&amp;quot;3&amp;quot;&amp;gt;A circular buffer with a fixed size that is set in the application configuration&amp;lt;/li&amp;gt; &lt;br /&gt;
# Size from 16 to 1024 entries, default 64 if size not specified&lt;br /&gt;
# If the application defines oceosmp_on_full_log(void *) this is called automatically when the buffer becomes ¾ full, allowing log entries that might otherwise be overwritten be archived. The automatic call will reoccur only after the buffer becomes ¾ empty.&lt;br /&gt;
# Two indices determine the next log entry position to be read from or written to. On system reset these are left unchanged if valid so as to postpone recent entries being overwritten.&lt;br /&gt;
# Log entries are left unchanged until a system log write causes the current entry at the write index be overwritten. Reading the log returns the earliest entry not read so far. Directives are provided to allow any log entry be read and to reset the log indices.&lt;br /&gt;
&lt;br /&gt;
=== Storage ===&lt;br /&gt;
&lt;br /&gt;
#  &amp;lt;li value=&amp;quot;8&amp;quot;&amp;gt;Stored statically in the oceosmp_log_area, which also contains the next-read and next-write buffer indices and the system state related variables.&amp;lt;/li&amp;gt;&lt;br /&gt;
# The log size and the oceosmp_on_full() function declaration are stored in the oceosmp_fixed_area, as also are the  log area addresses.&lt;br /&gt;
&lt;br /&gt;
==== Log entry format (from system_log.h) ====&lt;br /&gt;
&lt;br /&gt;
 Struct log_entry{&lt;br /&gt;
  	U64_t time64;&lt;br /&gt;
  	unsigned int current_cpu_id :8;&lt;br /&gt;
  	unsigned int entry_type :8;&lt;br /&gt;
  	U32_t entry_comment;&lt;br /&gt;
 } __attribute__ ((aligned (8));&lt;br /&gt;
&lt;br /&gt;
# &amp;lt;li value=&amp;quot;10&amp;quot;&amp;gt;When a log entry is made, time64 and current_cpu_id are set automatically by OCEOSmp.&amp;lt;/li&amp;gt;&lt;br /&gt;
# The entry type is an enum defined by the application, with a subset of enum values reserved for use by OCEOSmp. The reserved enum values are specified in system_log.h.&lt;br /&gt;
# The ''entry_comment'' allows noting further information on the current situation&lt;br /&gt;
&lt;br /&gt;
==== Associated directives (from system_log.h) ====&lt;br /&gt;
# &amp;lt;li value=&amp;quot;13&amp;quot;&amp;gt;Add log entry&amp;lt;/li&amp;gt;&lt;br /&gt;
 S32_t 	oceos_log_add_entry(&lt;br /&gt;
 	 	enum LOG_ENTRY_TYPE type, // 8 bit enum LOG_ENTRY_TYPE&lt;br /&gt;
 	 	const U32_t info 		// further information&lt;br /&gt;
 );&lt;br /&gt;
&lt;br /&gt;
This adds an entry, overwriting the currently oldest entry.&lt;br /&gt;
&lt;br /&gt;
# &amp;lt;li value=&amp;quot;14&amp;quot;&amp;gt;Remove log entry&amp;lt;/li&amp;gt;&lt;br /&gt;
 S32_t oceos_log_remove_entry(&lt;br /&gt;
  		struct log_entry * const outputPtr&lt;br /&gt;
 );&lt;br /&gt;
&lt;br /&gt;
This returns the oldest unread entry to outputPtr and updates the buffer indices&lt;br /&gt;
&lt;br /&gt;
# &amp;lt;li value=&amp;quot;15&amp;quot;&amp;gt;Other log directives are detailed in system_log.h&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Usage by OCEOSmp itself&lt;br /&gt;
&lt;br /&gt;
# &amp;lt;li value=&amp;quot;14&amp;quot;&amp;gt;OCEOSmp only uses the system log for problems that do not arise directly when a directive is used (problems that arise directly are described in the returned directive status code).&amp;lt;/li&amp;gt;&lt;br /&gt;
# Such problems fall into a number of categories&lt;br /&gt;
## System corruption is detected and/or oceos_exit is called a&lt;br /&gt;
## Excessive delays in obtaining system spin locks perhaps due to system overloading&lt;br /&gt;
## A timed action misses its specified time&lt;br /&gt;
## A task misses its deadlines&lt;br /&gt;
## Task start requests occur more frequently than expected&lt;br /&gt;
## A task exits without returning a mutex or read-write mutex that it holds&lt;br /&gt;
## Nested mutexes or read-write mutexes not returned in correct order&lt;br /&gt;
## Counts already at max or min&lt;br /&gt;
# In many cases when OCEOSmp makes a system log entry it also updates the system state variable. This is updated using ‘OR’ and so provides a long term record that a problem has occurred even if a log entry is overwritten. In addition, if the update corresponds to an application defined action mask and an application problem handling function is defined this is called automatically.&lt;br /&gt;
&lt;br /&gt;
== System State Variable ==&lt;br /&gt;
&lt;br /&gt;
[[File:SystemState.png|400px]]&lt;br /&gt;
&lt;br /&gt;
=== Purpose ===&lt;br /&gt;
&lt;br /&gt;
To record that certain conditions have occurred and to allow the ASW specify which conditions should cause an ASW defined problem handling function be triggered automatically when the state variable is updated due to these conditions.&lt;br /&gt;
&lt;br /&gt;
=== Structure ===&lt;br /&gt;
Four 32-bit words each containing 32 flags, some available for use by the ASW, some reserved for use by OCEOSmp&lt;br /&gt;
# system state variable		individual bits are set by ASW or by OCEOSmp &lt;br /&gt;
# accumulated system state	updated when system state flags are set &lt;br /&gt;
# action mask			set by ASW in application configuration &lt;br /&gt;
# action mask previous		previous value of action mask if changed by ASW&lt;br /&gt;
&lt;br /&gt;
=== Usage ===&lt;br /&gt;
# &amp;lt;li value=&amp;quot;5&amp;quot;&amp;gt;the system state variable is updated using inclusive ‘OR’ to set the desired flag&amp;lt;/li&amp;gt;&lt;br /&gt;
# the accumulated system state flag is set when the corresponding system state flag is set&lt;br /&gt;
# on reset the system state variable is cleared to 0, all flags clear&lt;br /&gt;
# the accumulated system state variable is reset only by the ASW&lt;br /&gt;
# the action mask is set by the ASW, and causes an ASW defined problem handler to be called when a state flag is updated to 1 that corresponds to a set action mask flag. &lt;br /&gt;
&lt;br /&gt;
Whenever a system state variable flag is set during scheduling (using inclusive ‘OR’) the corresponding accumulated state flag is also set. Accumulated state flags are not affected when a system state flag is cleared to 0, whether by the ASW or on system reset. They can be cleared only directly by the ASW. They keep a record of events across system reset if memory is preserved.&lt;br /&gt;
&lt;br /&gt;
The action mask is specified in the application configuration, which then should also declare a problem handling function. The mask may be altered by the ASW during scheduling.&lt;br /&gt;
&lt;br /&gt;
The ASW problem handling function is called automatically by OCEOSmp as a result of setting a previously clear system state flag that corresponds to a flag that is set in the action mask. The system state flag is set before the function is called. If the system state flag is not reset by the ASW problem handler or otherwise then further settings of that system state flag will not cause the function to be called again.&lt;br /&gt;
&lt;br /&gt;
The ASW can use a system call to modify the action mask at any time, when this is done the previous value of the action mask is stored.&lt;br /&gt;
&lt;br /&gt;
The flags corresponding to the high sixteen bits of the system state variable are reserved for use by OCEOSmp:&lt;br /&gt;
&lt;br /&gt;
These primarily refer to problems that are not immediate consequences of the use of a directive (these are indicated in the returned error or warning status code), but that may occur subsequently during scheduling:&lt;br /&gt;
# &amp;lt;li value=&amp;quot;16&amp;quot;&amp;gt;reserved&amp;lt;/li&amp;gt;	&lt;br /&gt;
# reserved&lt;br /&gt;
# reserved&lt;br /&gt;
# reserved&lt;br /&gt;
# reserved&lt;br /&gt;
# Attempt to start pending task that has been disabled while pending.&lt;br /&gt;
# Time from task start request to job completion exceeds task deadline.&lt;br /&gt;
# Time between task start requests less than specified minimum for task&lt;br /&gt;
# Time between task start requests greater than specified maximum for task&lt;br /&gt;
# Missed latest time for transfer of job from timed action queue to scheduler.&lt;br /&gt;
# Missed latest time for performance of timed output.&lt;br /&gt;
# Mutex not returned before job terminates.&lt;br /&gt;
# Read/Write mutex not returned before job termination.&lt;br /&gt;
# System busy warning&lt;br /&gt;
# Data area sentinels corrupted.&lt;br /&gt;
# System meta pointer corrupted&lt;br /&gt;
&lt;br /&gt;
== System Policing and Problem Anticipation ==&lt;br /&gt;
&lt;br /&gt;
All design involves assumptions, and ‘System Policing’ refers to checking how close these come to being violated as the system operates, and to taking precautions if needed.&lt;br /&gt;
&lt;br /&gt;
The white box design of OCEOSmp facilitates this, with records kept automatically of task timing performances and other parameters that are accessible by the ASW at any time, including after OCEOSmp exits should this occur.&lt;br /&gt;
&lt;br /&gt;
These records can answer questions such as ‘what is the longest time this task took to execute’, ‘what is the shortest time between requests to start this task’, ‘what is the longest time between requests to start this task’, and many others, including stack usage.&lt;br /&gt;
&lt;br /&gt;
By checking such data the ASW can notice that behaviour is not as expected and that something is going wrong, allowing ‘Problem Anticipation’ and an issue being dealt with before it causes serious difficulties.&lt;br /&gt;
&lt;br /&gt;
The ASW might do this by having an external policing function running on a core not in use by OCEOSmp that periodically checks that things are as expected, or by having a policing task that is scheduled by OCEOSmp.&lt;br /&gt;
&lt;br /&gt;
With all the data stored statically in the ‘Log Area’, ‘Fixed Data Area’ and ‘Dynamic Data Area’ arrays by the ASW it is straightforward to retrieve it.&lt;br /&gt;
&lt;br /&gt;
OCEOSmp only requires one system stack per CPU core rather than one stack per thread. Each stack is initialised to a known value, making it straightforward to determine the greatest extent to which each stack has been used.&lt;br /&gt;
&lt;br /&gt;
If suspicious activity is detected, the ASW can for example disable a task or take a CPU core out of use or disable a peripheral or take other corrective action.&lt;br /&gt;
&lt;br /&gt;
It can also make a historical record of bad behaviour by adding an entry to the System Log and by updating a flag in the System State variable, When the System Log becomes ¾ full an ASW function if defined is called that can archive the System Log, and a shadow copy of the System State variable is automatically maintained that is only reset by the ASW itself.&lt;br /&gt;
&lt;br /&gt;
When multiple mutual exclusion semaphores are used by tasks the OCEOSmp design excludes the possibility of unbounded priority inversion and no check for this is needed.&lt;br /&gt;
&lt;br /&gt;
On multi-core systems deadlocks can occur but only if tasks fail to acquire mutual exclusion semaphores in a consistent order corresponding to their identity numbers. A warning status code is then returned although as yet no deadlock has occurred.&lt;br /&gt;
&lt;br /&gt;
The ASW can include a policing function that checks the execution times of tasks (in OCEOSmp tasks on other CPU cores spin waiting to acquire mutexes), and the time when a task start request was issued, allowing detection of deadlocks, livelocks, and task starvation.&lt;br /&gt;
&lt;br /&gt;
It should be noted that OCEOSmp itself may detect an anomaly and automatically make an entry in the System Log and may also update the System State variable, perhaps resulting in an ASW defined problem handling function being called, but this only happens after a problem has occurred and been detected. &lt;br /&gt;
&lt;br /&gt;
== Problem Detection and Handling ==&lt;br /&gt;
&lt;br /&gt;
[[File:PoliceJoke.png|600px]]&lt;br /&gt;
&lt;br /&gt;
This relates to what happens after a problem has occurred and been detected, as distinct from System Policing and Problem Anticipation which aims to forestall problems.&lt;br /&gt;
&lt;br /&gt;
The integrity tests carried out automatically by OCEOSmp check for a number of problems. Some are detected directly when an OCEOSmp directive is used, others when an event occurs such as a job completing execution, others when some internal operation of OCEOSmp does not proceed as expected. &lt;br /&gt;
&lt;br /&gt;
Problems that arise directly from the use or misuse of a directive are identified in the returned status code, and the ASW can then decide the appropriate action.&lt;br /&gt;
&lt;br /&gt;
If appropriate the ASW can disable or terminate tasks and take CPU cores out of use without disrupting scheduling, and can read and update the system log and system state variable. In an extreme case the ASW can end scheduling and return to main().&lt;br /&gt;
&lt;br /&gt;
# Typical directive problems&lt;br /&gt;
## Current phase doesn’t allow this directive&lt;br /&gt;
## Invalid parameters supplied&lt;br /&gt;
## Time for timed action already passed&lt;br /&gt;
## Write fail, data queue full&lt;br /&gt;
## Write succeeded, data queue now full (warning) &lt;br /&gt;
## Mutexes or rwmutexes acquired in an incorrect order (warning)&lt;br /&gt;
&lt;br /&gt;
Other problems may be identified automatically be OCEOSmp after a directive has been used or when an event occurs, or during internal OCEOSmp operations&lt;br /&gt;
Such problems include:&lt;br /&gt;
# &amp;lt;li value=&amp;quot;2&amp;quot;&amp;gt;Unexpected patterns of events&amp;lt;/li&amp;gt;&lt;br /&gt;
## Task misses a deadline&lt;br /&gt;
## Task start requests occur more frequently than expected&lt;br /&gt;
## Task start requests occur less frequently than expected&lt;br /&gt;
## Task disabled after being put on a pending queue&lt;br /&gt;
## Spin locks not being available in a reasonable time&lt;br /&gt;
## Action time missed&lt;br /&gt;
## Pending queues being full&lt;br /&gt;
&lt;br /&gt;
These problems typically cause a system log entry to be made, may update the system state variable and may result in an ASW defined problem handling function being called. This has full access to the performance records and can enable or disable tasks and take CPU cores out of use or restore them to use without disrupting scheduling, and can exit from OCEOSmp if appropriate.&lt;br /&gt;
&lt;br /&gt;
Other problems that may be automatically detected by OCEOSmp include&lt;br /&gt;
# &amp;lt;li value=&amp;quot;3&amp;quot;&amp;gt;Corruption of critical data&amp;lt;/li&amp;gt;&lt;br /&gt;
## Perhaps due to hardware failures&lt;br /&gt;
## Perhaps by application software malfunctioning and overwriting data&lt;br /&gt;
## Perhaps by a bug in OCEOSmp&lt;br /&gt;
&lt;br /&gt;
These problems typically result in exit from OCEOSmp and return to main() at the point immediately after oceos_start() was used. The system state variable and system log may also be updated.&lt;br /&gt;
&lt;br /&gt;
It should be noted that the checks made by OCEOSmp only occur as a result of it being notified of some change in the state of the system, as when a directive is used or a job terminates or an interrupt occurs. It is recommended that these be added to by taking appropriate precautions.&lt;br /&gt;
&lt;br /&gt;
== Precautions and Correction ==&lt;br /&gt;
&lt;br /&gt;
[[File:Precaution.png|600px]]&lt;br /&gt;
&lt;br /&gt;
A primary precaution is policing. As described above this typically involves assigning a CPU core to check the activities of the system, or perhaps assigning a task to that purpose. Anticipation and prevention are better than detection.&lt;br /&gt;
&lt;br /&gt;
Further precautions are also possible, depending on the hardware available in the system. These can detect or perhaps even prevent various malfunctions. &lt;br /&gt;
&lt;br /&gt;
=== Hardware Malfunctions ===&lt;br /&gt;
These can be caused by radiation or other external factors, or simply by parts of the system wearing out.&lt;br /&gt;
&lt;br /&gt;
They fall into three main categories, memory hardware malfunctions, CPU core malfunctions, and peripheral or connected device malfunctions.&lt;br /&gt;
&lt;br /&gt;
==== Memory hardware malfunctions ====&lt;br /&gt;
&lt;br /&gt;
These typically result in one or more bits in a memory location being set to incorrect values.&lt;br /&gt;
&lt;br /&gt;
If the error involve no more than a certain number of bits (BCH 1, RS fixed &amp;gt; 1) then EDAC allows a memory location containing such errors be read correctly despite the error.&lt;br /&gt;
&lt;br /&gt;
While the value read is correct the error remains in the location until the correct value is written back. This should be done before a further bit becomes corrupted, perhaps making the error un-correctable. In some systems this write back is done automatically. &lt;br /&gt;
&lt;br /&gt;
Long intervals can occur between uses of a memory location making ‘memory scrubbing’ necessary. This cycles through all memory locations, reading and writing back if needed, doing so often enough to make it very unlikely that an un-correctable number of erroneous bits will accumulate in any location.&lt;br /&gt;
&lt;br /&gt;
Usually a hardware ‘memory scrubber‘ is available that can be configured to do this at a certain rate for a certain range of addresses.&lt;br /&gt;
&lt;br /&gt;
Memory read errors can still occur however. A combination of bit errors can defeat EDAC error detection and lead to an incorrect value being read. Usually however such un-correctable errors are detected by EDAC causing it to raise an exception. The corresponding handler must then take appropriate action, which may include terminating OCEOSmp.&lt;br /&gt;
&lt;br /&gt;
Precautions: Before starting OCEOSmp &lt;br /&gt;
# The handler for EDAC detected un-correctable errors should be put in place&lt;br /&gt;
# The memory should be initialized&lt;br /&gt;
# The EDAC system configured and put into operation&lt;br /&gt;
# The EDAC memory scrubber hardware configured and put into operation&lt;br /&gt;
&lt;br /&gt;
Once this has been done and OCEOSmp started&lt;br /&gt;
# &amp;lt;li value=&amp;quot;5&amp;quot;&amp;gt;The EDAC exception handler can &amp;lt;/li&amp;gt;	&lt;br /&gt;
## Update the system log&lt;br /&gt;
## Update the system state variable&lt;br /&gt;
## Start a problem handling task&lt;br /&gt;
## If necessary call oceos_exit() to return to main()&lt;br /&gt;
&lt;br /&gt;
==== Computer core hardware malfunctions ====&lt;br /&gt;
&lt;br /&gt;
Cores may use triple modular redundancy and other techniques to reduce the effects of transient errors, but nevertheless can become faulty. If this is detected in a multi-core system OCEOSmp allows the faulty core be taken out of use without scheduling being disrupted.&lt;br /&gt;
&lt;br /&gt;
Detecting that a core has become faulty can be done using computational tasks for which the results including timings are known. Before such tests are used however a malfunction may have led to an erroneous result being used. &lt;br /&gt;
&lt;br /&gt;
To avoid this when result accuracy is critical and immediately needed it is possible in OCEOSmp to have multiple CPU cores carry out the same computation at the same time (within a few clock cycles). &lt;br /&gt;
&lt;br /&gt;
The results can then be compared and the majority agreed value used. A core that was at fault can be tested and taken out of use if the problem is judged not to be transient.&lt;br /&gt;
&lt;br /&gt;
Precaution: Check periodically that cores carry out a computational test correctly.&lt;br /&gt;
# &amp;lt;li value=&amp;quot;6&amp;quot;&amp;gt;oceosmp_cpu_disable() will take the specified CPU core out of use, put it to sleep, and cause the termination functions of any jobs executing on the core be executed on a different core.&amp;lt;/li&amp;gt; &lt;br /&gt;
# oceosmp_cpu_enable() will make the specified CPU core available for use&lt;br /&gt;
&lt;br /&gt;
These directives can also be used to manage the number of active cores for power saving or other purposes. Scheduling is not disrupted as long as a functioning core remains.&lt;br /&gt;
&lt;br /&gt;
==== Peripheral Hardware Malfunctions ====&lt;br /&gt;
&lt;br /&gt;
These can arise due to a fault in the peripheral unit itself, or due to problems in an external system for which the peripheral is an interface.&lt;br /&gt;
&lt;br /&gt;
Before starting OCEOSmp the ASW should carry out appropriate checks of all peripheral units, and should ensure that such checks can be carried out if necessary by tasks after scheduling has begun.&lt;br /&gt;
&lt;br /&gt;
Faults in external systems for which a peripheral unit is an interface tend to either&lt;br /&gt;
# cause no messages to be sent to the interface&lt;br /&gt;
# cause messages to be sent too frequently&lt;br /&gt;
&lt;br /&gt;
In most cases when a peripheral receives an external message it causes an interrupt which then causes a request to start a task.&lt;br /&gt;
&lt;br /&gt;
If the interval between such task start requests is longer than expected this may indicate that the peripheral device has become faulty and is no longer operational.&lt;br /&gt;
&lt;br /&gt;
If the interval between such task start requests is shorter than expected it may indicate the frequency of external events exceeding expectations or some fault in the peripheral device.&lt;br /&gt;
&lt;br /&gt;
In both cases on starting the task OCEOSmp automatically checks the interval since the last task start request and if this is less than the expected minimum or greater than the expected maximum will make a system log entry and set the corresponding flag in the system state variable. If the ASW has set the corresponding system state action flag and defined a problem handling function this will result in the ASW problem handling function being called.&lt;br /&gt;
 &lt;br /&gt;
Precautions: &lt;br /&gt;
	In the ASW configuration structure passed to oceos_init() the ASW set the desired flags in the problem action mask and define a problem handling function.   &lt;br /&gt;
&lt;br /&gt;
=== Software Malfunctions ===&lt;br /&gt;
&lt;br /&gt;
Certain types of software errors can cause problems for the system as a whole.&lt;br /&gt;
&lt;br /&gt;
OCEOSmp automatically checks for some of these, others are best checked for by the ASW itself, perhaps as part of system policing.&lt;br /&gt;
&lt;br /&gt;
In addition to policing, various precautions can be taken against these problems, including making use of any memory protection hardware available and using a system watchdog timer.&lt;br /&gt;
&lt;br /&gt;
==== Invalid memory overwriting ====&lt;br /&gt;
&lt;br /&gt;
Application software may inadvertently overwrite memory areas used by OCEOSmp.&lt;br /&gt;
&lt;br /&gt;
The three memory areas used by OCEOSmp are each protected at their ends by constant sentinels. Each time a directive is used or job terminates OCEOSmp checks these sentinels to ensure that the areas involved have not been encroached upon. If so OCEOSmp will exit.&lt;br /&gt;
&lt;br /&gt;
In addition to its sentinels the fixed data area has an XOR checksum which allows any alteration be detected. This is not checked automatically by OCEOSmp for reasons of efficiency, but can be checked at any time by ASW policing software.&lt;br /&gt;
&lt;br /&gt;
Prevention is better than detection and if a system has a memory protection unit this should be configured to make the fixed area read-only. Any attempt to write this area will then typically cause the protection unit to raise an exception.&lt;br /&gt;
&lt;br /&gt;
Each CPU core has its own system stack. These form part of a contiguous block of statically allocated memory, and a software error may result in the code running on a core overrunning that core’s stack and attempting to use the stack memory of another core.&lt;br /&gt;
&lt;br /&gt;
This can be detected in policing by checking that filler still remains at the top and bottom of each core’s stack, and this can be checked at any time by ASW policing software, but prevention is better than detection.&lt;br /&gt;
 &lt;br /&gt;
Precautions: Any hardware memory protection present should be used on completion of oceos_init_finish() and before oceos_start() to provide these features.&lt;br /&gt;
# Read only (the fixed data area)&lt;br /&gt;
# Writeable only by a specific computer core (for each core’s stack)&lt;br /&gt;
 &lt;br /&gt;
Invalid attempts to use a memory location typically give rise to an exception and an appropriate handler must be in place.&lt;br /&gt;
&lt;br /&gt;
==== Invalid use of Mutual Exclusion Semaphores (Mutexes) or of Read-Write Mutexes ====&lt;br /&gt;
&lt;br /&gt;
In general the time for which the ASW holds a mutex or read-write mutex should be as short as possible.&lt;br /&gt;
&lt;br /&gt;
This time can be estimated at compile time and the estimates taken into account in determining whether a set of tasks can be scheduled so that tasks always meet their deadlines.&lt;br /&gt;
&lt;br /&gt;
Such estimates however can be made wrong by events that occur during scheduling if appropriate precautions are not taken.&lt;br /&gt;
&lt;br /&gt;
One possible problem, unbounded priority inversion, arises when a job holding a mutex is pre-empted by a higher priority task that does not use the mutex, causing any even higher priority task that uses the mutex to wait indefinitely for the low priority job to resume and release the mutex. In OCEOSmp unbounded priority inversion cannot occur. &lt;br /&gt;
&lt;br /&gt;
Another problem, deadlock, can arise when two or more jobs each acquire more than one mutex. A job while holding a mutex may then attempt to acquire a different mutex currently held by some other job. If that other job (without releasing the mutex it holds) attempts to acquire the mutex held by the first job neither job can make progress, the jobs are deadlocked.&lt;br /&gt;
&lt;br /&gt;
These problems are addressed by the design of OCEOSmp.&lt;br /&gt;
&lt;br /&gt;
In OCEOSmp each mutex or read-write mutex has a priority ceiling giving the priority of the highest priority task that uses it. This constant is determined at compile time and set for each mutex when it is created.&lt;br /&gt;
&lt;br /&gt;
In scheduling, once a job running on a CPU core holds one or more mutexes or read-write mutexes only tasks with higher priority than the highest ceiling are allowed to pre-empt the job and start running on that core.&lt;br /&gt;
&lt;br /&gt;
As a result unbounded priority inversion cannot occur, and on single core systems deadlocks also are not possible.&lt;br /&gt;
&lt;br /&gt;
On multi-core systems jobs can spin waiting to acquire a mutex held by a job running on a different core and deadlock becomes possible.&lt;br /&gt;
&lt;br /&gt;
In OCEOSmp mutexes and read-write mutexes are assigned a sequential order as they are created. Deadlocks then cannot occur if jobs always respect this order in acquiring mutexes, never attempting to acquire a mutex or read-write mutex if already holding one that is higher in the order.&lt;br /&gt;
&lt;br /&gt;
OCEOSmp does not prevent jobs from acquiring multiple mutexes in an out of order manner but returns a warning directive status code to the job indicating that deadlock is possible and makes a log entry and updates the system state variable, perhaps causing an ASW defined problem handling function to be called.&lt;br /&gt;
&lt;br /&gt;
When a job simultaneously holds multiple mutexes or read-write mutexes it should acquire and return these in a LIFO manner, e.g. waitA, waitB, waitC…..signalC, signalB, signalA. Failure to do so may affect task scheduling temporarily and will result in a warning directive status code, a log entry, and an update of the system state variable.&lt;br /&gt;
&lt;br /&gt;
Other errors in using mutexes such as failure to release a mutex before a job ends or attempting to release a mutex that is not held give rise to an appropriate directive status codes, a log entry, and a system state variable updates.&lt;br /&gt;
&lt;br /&gt;
Precautions: &lt;br /&gt;
# Ensure at compile time that when a task acquires multiple mutexes or read-write mutexes it always does so in the correct order.&lt;br /&gt;
# Ensure at compile time that when a job releases multiple mutexes or read-write mutexes it always does so in the reverse order to that in which they were acquired&lt;br /&gt;
&lt;br /&gt;
==== Deadlocks, Livelocks and Task Starvation ====&lt;br /&gt;
&lt;br /&gt;
Deadlocks arise primarily due to misuse of mutual exclusion semaphores or read write mutual exclusion semaphores, as described above.&lt;br /&gt;
&lt;br /&gt;
Livelocks, where tasks interact in a way that results in each task having to return to some earlier point with no or very little overall progress, can arise in a number of ways including from attempts to resolve a deadlock so that the tasks involved can proceed.&lt;br /&gt;
&lt;br /&gt;
Task starvation arises when a task is ready to start, but CPU time is not allocated to it within a reasonable time. In OCEOSmp this will occur for a low priority task if higher priority tasks are always ready to run and require all the available CPU cores. &lt;br /&gt;
&lt;br /&gt;
Task starvation, to at least some degree, can also occur for a high priority task if the resources required to allow it pre-empt a lower priority task are not available on the CPU core involved, as for example when the remaining system stack for that core is below the level needed for pre-emption.&lt;br /&gt;
&lt;br /&gt;
All three of these problems result in a task or tasks taking longer to complete than should be the case. This can be detected in two main ways&lt;br /&gt;
# By a policing task that periodically checks each task record in the dynamic area to determine the maximum time between a request to start it and task completion. &lt;br /&gt;
# By watchdog timer hardware that typically is reset periodically by the lowest priority task and which will cause a hardware system reset if its pre-set time elapses before it is reset. On re-entry to main() the ASW can check to determine if this has occurred before restarting OCEOSmp.&lt;br /&gt;
&lt;br /&gt;
Precautions&lt;br /&gt;
# &amp;lt;li value=&amp;quot;3&amp;quot;&amp;gt;ensure each CPU core has adequate system stack so that a lower priority task running on the core can always be pre-empted by a higher priority task. The amount required can be calculated from the number of different priority levels in use.&amp;lt;/li&amp;gt;&lt;br /&gt;
# if watchdog timer hardware is available set up a low priority task to periodically reset it. The ASW should check on entry to main() whether this was due to a watchdog timeout and if so use the OCEOSmp data to determine the cause and appropriate remedial action before restarting OCEOSmp.&lt;br /&gt;
# set up a policing task that checks the execution times of current tasks and detects when this is too long. This task can call an ASW defined problem handling function that can determine how best to deal with the situation, perhaps calling the termination functions of some currently executing tasks, disabling some tasks or changing interrupt intervals.&lt;br /&gt;
# If necessary reserve certain CPU cores to use only by higher priority tasks, perhaps ensuring that there is always at least one CPU core ready to be used immediately by such tasks.&lt;br /&gt;
&lt;br /&gt;
== Summary ==&lt;br /&gt;
&lt;br /&gt;
[[File:MurphysLaw.png|400px]]&lt;br /&gt;
&lt;br /&gt;
Murphy’s Law, ‘if things can go wrong they will’, has had a significant impact on the design of OCEOSmp. &lt;br /&gt;
&lt;br /&gt;
An older maxim ‘the wise man avoids evil by anticipating it’ (Publilius Cyrus) has also had an impact. Software can go wrong without prior indication of stress but it may be possible to notice that all is not well before disaster strikes. Avoidance is better than detection.&lt;br /&gt;
&lt;br /&gt;
These ideas have led to OCEOSmp having features that allow fault anticipation, detection, isolation and recovery, with a white box approach that simplifies system policing and checking behaviour against expectations and with memory statically allocated.&lt;br /&gt;
&lt;br /&gt;
When a problem is found OCEOSmp can take CPU cores out of use or kill or disable tasks without disrupting scheduling, or in severe cases exit and return to the ASW main() with all data still accessible for analysis or download, and with the ASW able to make changes and restart OCEOSmp if desired.&lt;br /&gt;
&lt;br /&gt;
These features help ensure that OCEOSmp is suitable for use in safety critical or other systems that require the highest reliability.&lt;br /&gt;
&lt;br /&gt;
Even where it is hoped that nothing can possibly go wrong….&lt;br /&gt;
&lt;br /&gt;
= &amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;'''System Log'''&amp;lt;/span&amp;gt; =&lt;br /&gt;
&lt;br /&gt;
== Purpose ==&lt;br /&gt;
#Provide application software with the ability to make time stamped records of events for use in application performance monitoring and in application debugging&lt;br /&gt;
#Provide OCEOSmp with the ability to record internal anomalies should these be detected.&lt;br /&gt;
&lt;br /&gt;
== Structure ==&lt;br /&gt;
#A circular buffer with a fixed size that is set in the application configuration&lt;br /&gt;
#Size from 16 to 1024 entries, default 64 if not specified&lt;br /&gt;
#If the application defines oceosmp_on_full_log(void *) this is called automatically when the buffer becomes ¾ full, allowing log entries that might otherwise be overwritten be stored. The automatic call will reoccur only after the buffer becomes ¾ empty.&lt;br /&gt;
#On system reset log entries are not overwritten and buffer indices are reset so as to postpone recent entries being overwritten and allow review of events prior to the reset.&lt;br /&gt;
&lt;br /&gt;
== Storage ==&lt;br /&gt;
#Stored statically in the oceosmp_log_area, which also contains the next-read and next-write buffer indices and the system state related variables.&lt;br /&gt;
#The log size and the oceosmp_on_full() function declaration are stored in the oceosmp_fixed_area, as also are the  log area addresses.&lt;br /&gt;
#Log entry format (from system_log.h): &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
Struct log_entry{&lt;br /&gt;
 	U64_t		time64;&lt;br /&gt;
 	unsigned int       current_cpu_id		:8;&lt;br /&gt;
 	unsigned int	entry_type		:8;&lt;br /&gt;
 	U32_t		entry_comment;&lt;br /&gt;
} __attribute__ ((aligned (8));&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt; &lt;br /&gt;
# &amp;lt;li value=&amp;quot;4&amp;quot;&amp;gt;When a log entry is made, time64 and current_cpu_id are set automatically by OCEOSmp.&amp;lt;/li&amp;gt;&lt;br /&gt;
#The entry type is an enum defined by the application, with a subset of enum values reserved for use by OCEOSmp. The reserved enum values are specified in system_log.h.&lt;br /&gt;
#The entry_comment allows noting further information on the current situation&lt;br /&gt;
&lt;br /&gt;
== Associated directives ==&lt;br /&gt;
#Add Log Entry&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t 	oceos_log_add_entry(&lt;br /&gt;
 	 	enum LOG_ENTRY_TYPE type, // 8 bit enum LOG_ENTRY_TYPE&lt;br /&gt;
 	 	const U32_t info 		// further information&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt; &lt;br /&gt;
This adds an entry, overwriting the currently oldest entry.&lt;br /&gt;
&lt;br /&gt;
# &amp;lt;li value=&amp;quot;2&amp;quot;&amp;gt;Remove Log Entry&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t oceos_log_remove_entry(&lt;br /&gt;
 		struct log_entry * const outputPtr&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This returns the oldest unread entry to outputPtr and updates the buffer indices&lt;br /&gt;
&lt;br /&gt;
# &amp;lt;li value=&amp;quot;3&amp;quot;&amp;gt;Other directives are detailed in system_log.h&amp;lt;/li&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
== Usage by OCEOSmp itself ==&lt;br /&gt;
#OCEOSmp only uses the system log for problems that do not arise directly when a directive is used (problems that arise directly are described in the returned directive status code).&lt;br /&gt;
#Such problems fall into a number of categories&lt;br /&gt;
## System corruption is detected and/or oceos_exit is called a&lt;br /&gt;
## Excessive delays in obtaining system spin locks perhaps due to system overloading&lt;br /&gt;
## A timed action misses its specified time&lt;br /&gt;
## A task misses its deadlines&lt;br /&gt;
## Task start requests occur more frequently than expected&lt;br /&gt;
## A task exits without returning a mutex or read-write mutex that it holds&lt;br /&gt;
## Nested mutexes or read-write mutexes not returned in correct order&lt;br /&gt;
## Counts already at max or min&lt;br /&gt;
#In many cases when OCEOSmp makes a system log entry it also updates the system state variable. This is updated using ‘OR’ and so provides a long term record that a problem has occurred even if a log entry is overwritten. In addition, if the update corresponds to an application defined action mask an application defined problem handling function may be called which can if desired read the system log.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:backup]]&lt;/div&gt;</summary>
		<author><name>Bkavanagh</name></author>
	</entry>
	<entry>
		<id>https://wiki.ocetechnology.com/mediawiki/index.php?title=OCEOSmp/notes&amp;diff=1690</id>
		<title>OCEOSmp/notes</title>
		<link rel="alternate" type="text/html" href="https://wiki.ocetechnology.com/mediawiki/index.php?title=OCEOSmp/notes&amp;diff=1690"/>
		<updated>2024-05-03T15:27:59Z</updated>

		<summary type="html">&lt;p&gt;Bkavanagh: /* Associated directives */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= &amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;'''When things go wrong'''&amp;lt;/span&amp;gt; =&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Prof. M. Ryan'''&lt;br /&gt;
&lt;br /&gt;
Things can go wrong even when software is bug free.&lt;br /&gt;
&lt;br /&gt;
Misunderstandings may have led to an inadequate design, real world circumstances may conspire to cause performance problems, radiation or other factors may cause hardware failures, and in general things can always go wrong.&lt;br /&gt;
&lt;br /&gt;
Murphy’s Law then applies, and while the system is in use it is important that system behaviour can be monitored, deviations from expectations noticed, checks made, corrections done, and recovery steps taken if needed.&lt;br /&gt;
&lt;br /&gt;
OCEOSmp has been designed with Murphy’s Law in mind and facilitates such actions in a number of ways.&lt;br /&gt;
&lt;br /&gt;
# Servant not Master&lt;br /&gt;
# White Box not Black Box&lt;br /&gt;
# Directive warning and error status codes&lt;br /&gt;
# Automatic integrity checks&lt;br /&gt;
# System Log&lt;br /&gt;
# System state variable&lt;br /&gt;
# System Policing and Problem Anticipation&lt;br /&gt;
# Problem Detection and Handling&lt;br /&gt;
# Precautions and Correction&lt;br /&gt;
&lt;br /&gt;
== Servant not Master ==&lt;br /&gt;
&lt;br /&gt;
[[File:MasterNotSlave.png|400px]]&lt;br /&gt;
&lt;br /&gt;
Many operating systems begin execution directly after the boot sequence and control all subsequent execution of the application software (ASW). Should something go wrong it can be difficult to assess what has occurred and find appropriate corrective action, particularly if the operating system itself has been involved.&lt;br /&gt;
&lt;br /&gt;
With OCEOSmp the ASW begins execution before the operating system and only starts OCEOSmp at some point after entering main().&lt;br /&gt;
&lt;br /&gt;
Before doing so the ASW should check the circumstances that lead to main() being entered. If due to a system restart then the data accumulated by OCEOSmp in the previous run is still available in its fixed, dynamic, and log data areas for analysis or download to find the cause (assuming power has been maintained or non-volatile memory is used for those areas).&lt;br /&gt;
&lt;br /&gt;
The ASW can then make appropriate modifications, and continue as usual to set up EDAC, set up memory protection, initialise and check CPU cores and peripherals, and once all seems correct proceed to start or restart OCEOSmp.&lt;br /&gt;
&lt;br /&gt;
Once scheduling begins OCEOSmp returns to main() only if a fatal error is detected or if it is instructed to do so by an ASW task. Should this occur all the data accumulated is available for analysis or download by ASW main() code, which can restart scheduling by calling oceos_start().&lt;br /&gt;
 &lt;br /&gt;
Most problems can be dealt with by tasks set up to do so under the control of OCEOSmp, but sufficiently serious ones may cause a system reset (e.g. a watchdog timer running out) or cause OCEOSmp to exit (e.g. corruption of critical data), in both cases with the previous state available for analysis if power is maintained or if non-volatile memory is used.&lt;br /&gt;
&lt;br /&gt;
In main() the ASW takes five principal steps in starting OCEOSmp:&lt;br /&gt;
&lt;br /&gt;
# check whether the entry to main() is due to a restart (e.g. by checking if the OCEOSmp data area sentinels are already in place) and if so use the data areas to determine the cause and make whatever modifications to the system are appropriate.   &lt;br /&gt;
# use oceos_init() with the ASW configuration to set up the log area and prepare the fixed data area to hold various addresses, the number of CPU cores, tasks, mutexes, etc.&lt;br /&gt;
# use various OCEOSmp create functions to create tasks, mutexs etc.&lt;br /&gt;
# use oceos_init_finish() to check that the declared numbers of tasks etc. have been created, finish setting up the fixed data area, and set its checksum.&lt;br /&gt;
&lt;br /&gt;
At this point the fixed data area with fixed information about addresses, cores, tasks, mutexes, data queues etc. has been set up, and need not be set up again if not corrupted. The checksum allows the &lt;br /&gt;
area be checked at any time to ensure it has not been changed. Memory protection if available can make the fixed area read-only and make the stack addresses for each core restricted to being written &lt;br /&gt;
only by that core. &lt;br /&gt;
&lt;br /&gt;
Scheduling can begin.&lt;br /&gt;
&lt;br /&gt;
# &amp;lt;li value=&amp;quot;5&amp;quot;&amp;gt;use oceos_start() to initialise the dynamic data area and begins scheduling. This function usually does not return to main() but may do so if a major problem is detected.&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As scheduling progresses the ASW can use the system log to record events and monitor performance. The log is also used by OCEOSmp to record problems, and OCEOSmp may also make a system state entry and trigger an ASW problem handling function.&lt;br /&gt;
&lt;br /&gt;
If a problem is sufficiently serious OCEOSmp may exit automatically or may be requested to do so by an ASW task, execution then returns to main() at the point after the call to oceos_start() with all performance, log, stack and other data available for analysis or download.&lt;br /&gt;
 &lt;br /&gt;
The ASW main() code can then determine the reason for the unexpected return, take appropriate corrective action, and resume scheduling by calling oceos_start() or modify various settings and start over with oceos_init().&lt;br /&gt;
&lt;br /&gt;
The ASW uses OCEOSmp and remains the master, rather than the reverse.&lt;br /&gt;
&lt;br /&gt;
== White Box not Black Box ==&lt;br /&gt;
&lt;br /&gt;
[[File:WhiteboxNotBlackbox.png|800px]]&lt;br /&gt;
&lt;br /&gt;
The data used by OCEOSmp is stored in statically allocated memory in three data areas and in an overall stack area. These usually are specified by the ASW as arrays of 32-bit words and can be examined by the ASW at any time.&lt;br /&gt;
&lt;br /&gt;
The data includes actual and expected task maximum and minimum execution times, activities on CPU cores, and other records of what has been happening. These records can be readily examined by the ASW while scheduling is under way and after OCEOSmp exits should this occur.&lt;br /&gt;
&lt;br /&gt;
OCEOSmp configures each data area to begin with a 32-bit sentinel followed by its size measured in 32-bit words, then the corresponding data, and finally a 32-bit sentinel. In the case of the fixed data area a 32-bit XOR checksum is located before the end sentinel.&lt;br /&gt;
&lt;br /&gt;
The size of each data area and the layout of the data within it depends on the application configuration, but are clearly specified with the location of each data item identified.&lt;br /&gt;
&lt;br /&gt;
Whenever an OCEOSmp directive is used a quick check is made that sentinels have not been breached. The ASW itself can check the fixed area checksum at any time (this is not done automatically for reasons of efficiency).&lt;br /&gt;
&lt;br /&gt;
The Log Area is initialized by oceos_init() and contains the system log and system state variable and if used the optional context switch log. Directives are provided to access and update these. The size of the area depends on the number of entries specified for the two logs in the system configuration. Log contents are preserved across system reset and across power failures if stored in non-volatile memory. &lt;br /&gt;
&lt;br /&gt;
The Fixed Data Area is completed by oceos_init_finish() and contains all the constants of the system, such as the addresses of data areas and stacks, the identity of the CPU core that OCEOSmp is to use on startup, the number of cores, tasks etc., the priorities and other attributes of tasks etc. &lt;br /&gt;
&lt;br /&gt;
The Dynamic Data area is created and initialized by oceos_start() and contains the information collected as oceosmp schedules tasks and as mutexes, counting semaphores,  etc. are used. This information is available for inspection by the ASW if OCEOSmp exits, and is only overwritten if the ASW again calls oceos_start().&lt;br /&gt;
&lt;br /&gt;
In OCEOSmp each CPU core has a system stack, a stack for each thread is not required. The stack size per CPU core and the location of the overall top of stack is specified in the application configuration and the overall stack space is statically allocated.&lt;br /&gt;
&lt;br /&gt;
Before scheduling begins OCEOSmp initialises each core’s stack with a filler. This is overwritten as the stack is used and by checking how much memory at the top and bottom of each stack still contains the filler it is possible to determine at any point how close the system has come to a stack overrun.&lt;br /&gt;
&lt;br /&gt;
The white box approach of making all records and the system stacks readily accessible while scheduling is taking place and should OCEOSmp exit facilitates checking that the system is performing as expected and determining the causes of any problems that may occur.&lt;br /&gt;
&lt;br /&gt;
== Directive warning and error status codes ==&lt;br /&gt;
&lt;br /&gt;
[[File:WarningErrorIcon.png|400px]]&lt;br /&gt;
&lt;br /&gt;
The ASW uses OCEOSmp by calling its directives, and is responsible for checking the returned directive status code. (OCEOSmp is a statically linked library, only those components related to the directives used by the ASW are linked into the final executable.)&lt;br /&gt;
&lt;br /&gt;
The system time directives oceos_time_sys_get64() and oceos_time_sys_get32() directly return the requested system time as 64-bit or 32-bit unsigned integers.&lt;br /&gt;
&lt;br /&gt;
Other directives return a 32-bit signed integer status code.&lt;br /&gt;
&lt;br /&gt;
This should always be checked when a directive is used.&lt;br /&gt;
&lt;br /&gt;
The status code indicates ERROR, SUCCESS, or WARNING.&lt;br /&gt;
&lt;br /&gt;
* A negative value indicates that the directive has not executed and gives the reasons&lt;br /&gt;
* A zero value indicates successful execution as expected&lt;br /&gt;
* A non-zero positive value indicates that the directive executed but with warnings&lt;br /&gt;
&lt;br /&gt;
Certain bits in the status code have the same meaning for all directives.&lt;br /&gt;
&lt;br /&gt;
Other bits have meanings that depend on the directive in use.&lt;br /&gt;
&lt;br /&gt;
These meanings are given in the header files associated with each directive as constants that can be compared with the status code to determine the types of errors or warnings involved.&lt;br /&gt;
&lt;br /&gt;
Errors typically involve an incorrect parameter to a directive, or an attempt to use a resource that is not available such as writing to a data queue that is already full.&lt;br /&gt;
&lt;br /&gt;
Warnings typically indicate that the directive has succeeded but that a danger has been created as when a task acquires multiple mutual exclusion semaphores out of order, or that a resource is now fully in use as when a write makes a data queue full.&lt;br /&gt;
&lt;br /&gt;
The task that used the directive and checked the returned status has full access to the data areas and stack areas in deciding the action to take, which may involve making a system log entry, starting a problem handling task, or in the worst case exiting from OCEOSmp and returning to main().&lt;br /&gt;
&lt;br /&gt;
In many situations the returned status code is the only indicator that is needed of directive success or failure. The ASW can then make a system log entry (automatically timestamped by OCEOSmp) for recording or performance analysis purposes if desired.&lt;br /&gt;
&lt;br /&gt;
In some situations OCEOSmp will make a system log entry automatically and may also update the system state variable, resulting in an ASW defined problem handling function being called if the corresponding flag has been set by the ASW in the system action flags.&lt;br /&gt;
&lt;br /&gt;
OCEOSmp may also automatically make a system log entry or take other actions when problems arise later, as when a task completion deadline is missed or a mutex is not returned.&lt;br /&gt;
&lt;br /&gt;
Irrespective of whatever other precautions may be taken, the first line of defence in using a directive is to check the returned status code.&lt;br /&gt;
&lt;br /&gt;
== Automatic integrity tests ==&lt;br /&gt;
&lt;br /&gt;
[[File:Automation.jpg|600px]]&lt;br /&gt;
&lt;br /&gt;
These are done automatically by OCEOSmp when a directive is used or an event occurs.&lt;br /&gt;
&lt;br /&gt;
They include checking that OCEOSmp data area sentinels are intact, and in the event of corruption may result in an exit from OCEOSmp and return to main().&lt;br /&gt;
&lt;br /&gt;
Directive parameters and the current system phase also are automatically checked when a directive is used, together with the availability of any required resources.&lt;br /&gt;
&lt;br /&gt;
Problems detected immediately when a directive is used result in an appropriate status code being returned to the ASW task that called the directive.&lt;br /&gt;
&lt;br /&gt;
Some problems, such as a task missing a deadline, do not occur immediately when a directive is used but only as scheduling proceeds. Such problems are checked for automatically by OCEOSmp.&lt;br /&gt;
&lt;br /&gt;
Checks include task completion times vs. deadlines, task start requests intervals vs. expected maxima and minima, mutual exclusion semaphore not being released before task completion, time taken to obtain spinlocks longer than expected (an indicator of system loading), and other problems. &lt;br /&gt;
&lt;br /&gt;
If a check fails in most cases a system log entry is made and the system state variable may be updated, possibly resulting in an ASW defined problem handler being called. In extreme cases OCEOSmp may exit and return to main().&lt;br /&gt;
&lt;br /&gt;
Overall the automatic integrity tests carried out by OCEOSmp itself include:&lt;br /&gt;
# System meta pointer intact&lt;br /&gt;
# Data area sentinel/s intact&lt;br /&gt;
# Task deadline not missed&lt;br /&gt;
# Task start request gap too short&lt;br /&gt;
# Task start request gap too long&lt;br /&gt;
# …&lt;br /&gt;
&lt;br /&gt;
It should be noted that these checks detect that a problem has happened. To anticipate problems and perhaps avoid them further checks can and should be done by the ASW as part of system policing.&lt;br /&gt;
&lt;br /&gt;
== System Log ==&lt;br /&gt;
&lt;br /&gt;
[[File:Logging.png|600px]]&lt;br /&gt;
&lt;br /&gt;
=== Purpose ===&lt;br /&gt;
&lt;br /&gt;
# Provide application software with the ability to make time stamped records of events for use in application performance monitoring and in application debugging&lt;br /&gt;
# Provide OCEOSmp with the ability to record anomalies should these be detected.&lt;br /&gt;
&lt;br /&gt;
=== Structure ===&lt;br /&gt;
&lt;br /&gt;
# &amp;lt;li value=&amp;quot;3&amp;quot;&amp;gt;A circular buffer with a fixed size that is set in the application configuration&amp;lt;/li&amp;gt; &lt;br /&gt;
# Size from 16 to 1024 entries, default 64 if size not specified&lt;br /&gt;
# If the application defines oceosmp_on_full_log(void *) this is called automatically when the buffer becomes ¾ full, allowing log entries that might otherwise be overwritten be archived. The automatic call will reoccur only after the buffer becomes ¾ empty.&lt;br /&gt;
# Two indices determine the next log entry position to be read from or written to. On system reset these are left unchanged if valid so as to postpone recent entries being overwritten.&lt;br /&gt;
# Log entries are left unchanged until a system log write causes the current entry at the write index be overwritten. Reading the log returns the earliest entry not read so far. Directives are provided to allow any log entry be read and to reset the log indices.&lt;br /&gt;
&lt;br /&gt;
=== Storage ===&lt;br /&gt;
&lt;br /&gt;
#  &amp;lt;li value=&amp;quot;8&amp;quot;&amp;gt;Stored statically in the oceosmp_log_area, which also contains the next-read and next-write buffer indices and the system state related variables.&amp;lt;/li&amp;gt;&lt;br /&gt;
# The log size and the oceosmp_on_full() function declaration are stored in the oceosmp_fixed_area, as also are the  log area addresses.&lt;br /&gt;
&lt;br /&gt;
==== Log entry format (from system_log.h) ====&lt;br /&gt;
&lt;br /&gt;
 Struct log_entry{&lt;br /&gt;
  	U64_t time64;&lt;br /&gt;
  	unsigned int current_cpu_id :8;&lt;br /&gt;
  	unsigned int entry_type :8;&lt;br /&gt;
  	U32_t entry_comment;&lt;br /&gt;
 } __attribute__ ((aligned (8));&lt;br /&gt;
&lt;br /&gt;
# &amp;lt;li value=&amp;quot;10&amp;quot;&amp;gt;When a log entry is made, time64 and current_cpu_id are set automatically by OCEOSmp.&amp;lt;/li&amp;gt;&lt;br /&gt;
# The entry type is an enum defined by the application, with a subset of enum values reserved for use by OCEOSmp. The reserved enum values are specified in system_log.h.&lt;br /&gt;
# The ''entry_comment'' allows noting further information on the current situation&lt;br /&gt;
&lt;br /&gt;
==== Associated directives (from system_log.h) ====&lt;br /&gt;
# &amp;lt;li value=&amp;quot;13&amp;quot;&amp;gt;Add log entry&amp;lt;/li&amp;gt;&lt;br /&gt;
 S32_t 	oceos_log_add_entry(&lt;br /&gt;
 	 	enum LOG_ENTRY_TYPE type, // 8 bit enum LOG_ENTRY_TYPE&lt;br /&gt;
 	 	const U32_t info 		// further information&lt;br /&gt;
 );&lt;br /&gt;
&lt;br /&gt;
This adds an entry, overwriting the currently oldest entry.&lt;br /&gt;
&lt;br /&gt;
# &amp;lt;li value=&amp;quot;14&amp;quot;&amp;gt;Remove log entry&amp;lt;/li&amp;gt;&lt;br /&gt;
 S32_t oceos_log_remove_entry(&lt;br /&gt;
  		struct log_entry * const outputPtr&lt;br /&gt;
 );&lt;br /&gt;
&lt;br /&gt;
This returns the oldest unread entry to outputPtr and updates the buffer indices&lt;br /&gt;
&lt;br /&gt;
# &amp;lt;li value=&amp;quot;15&amp;quot;&amp;gt;Other log directives are detailed in system_log.h&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Usage by OCEOSmp itself&lt;br /&gt;
&lt;br /&gt;
# &amp;lt;li value=&amp;quot;14&amp;quot;&amp;gt;OCEOSmp only uses the system log for problems that do not arise directly when a directive is used (problems that arise directly are described in the returned directive status code).&amp;lt;/li&amp;gt;&lt;br /&gt;
# Such problems fall into a number of categories&lt;br /&gt;
## System corruption is detected and/or oceos_exit is called a&lt;br /&gt;
## Excessive delays in obtaining system spin locks perhaps due to system overloading&lt;br /&gt;
## A timed action misses its specified time&lt;br /&gt;
## A task misses its deadlines&lt;br /&gt;
## Task start requests occur more frequently than expected&lt;br /&gt;
## A task exits without returning a mutex or read-write mutex that it holds&lt;br /&gt;
## Nested mutexes or read-write mutexes not returned in correct order&lt;br /&gt;
## Counts already at max or min&lt;br /&gt;
# In many cases when OCEOSmp makes a system log entry it also updates the system state variable. This is updated using ‘OR’ and so provides a long term record that a problem has occurred even if a log entry is overwritten. In addition, if the update corresponds to an application defined action mask and an application problem handling function is defined this is called automatically.&lt;br /&gt;
&lt;br /&gt;
== System State Variable ==&lt;br /&gt;
&lt;br /&gt;
[[File:SystemState.png|400px]]&lt;br /&gt;
&lt;br /&gt;
=== Purpose ===&lt;br /&gt;
&lt;br /&gt;
To record that certain conditions have occurred and to allow the ASW specify which conditions should cause an ASW defined problem handling function be triggered automatically when the state variable is updated due to these conditions.&lt;br /&gt;
&lt;br /&gt;
=== Structure ===&lt;br /&gt;
Four 32-bit words each containing 32 flags, some available for use by the ASW, some reserved for use by OCEOSmp&lt;br /&gt;
# system state variable		individual bits are set by ASW or by OCEOSmp &lt;br /&gt;
# accumulated system state	updated when system state flags are set &lt;br /&gt;
# action mask			set by ASW in application configuration &lt;br /&gt;
# action mask previous		previous value of action mask if changed by ASW&lt;br /&gt;
&lt;br /&gt;
=== Usage ===&lt;br /&gt;
# &amp;lt;li value=&amp;quot;5&amp;quot;&amp;gt;the system state variable is updated using inclusive ‘OR’ to set the desired flag&amp;lt;/li&amp;gt;&lt;br /&gt;
# the accumulated system state flag is set when the corresponding system state flag is set&lt;br /&gt;
# on reset the system state variable is cleared to 0, all flags clear&lt;br /&gt;
# the accumulated system state variable is reset only by the ASW&lt;br /&gt;
# the action mask is set by the ASW, and causes an ASW defined problem handler to be called when a state flag is updated to 1 that corresponds to a set action mask flag. &lt;br /&gt;
&lt;br /&gt;
Whenever a system state variable flag is set during scheduling (using inclusive ‘OR’) the corresponding accumulated state flag is also set. Accumulated state flags are not affected when a system state flag is cleared to 0, whether by the ASW or on system reset. They can be cleared only directly by the ASW. They keep a record of events across system reset if memory is preserved.&lt;br /&gt;
&lt;br /&gt;
The action mask is specified in the application configuration, which then should also declare a problem handling function. The mask may be altered by the ASW during scheduling.&lt;br /&gt;
&lt;br /&gt;
The ASW problem handling function is called automatically by OCEOSmp as a result of setting a previously clear system state flag that corresponds to a flag that is set in the action mask. The system state flag is set before the function is called. If the system state flag is not reset by the ASW problem handler or otherwise then further settings of that system state flag will not cause the function to be called again.&lt;br /&gt;
&lt;br /&gt;
The ASW can use a system call to modify the action mask at any time, when this is done the previous value of the action mask is stored.&lt;br /&gt;
&lt;br /&gt;
The flags corresponding to the high sixteen bits of the system state variable are reserved for use by OCEOSmp:&lt;br /&gt;
&lt;br /&gt;
These primarily refer to problems that are not immediate consequences of the use of a directive (these are indicated in the returned error or warning status code), but that may occur subsequently during scheduling:&lt;br /&gt;
# &amp;lt;li value=&amp;quot;16&amp;quot;&amp;gt;reserved&amp;lt;/li&amp;gt;	&lt;br /&gt;
# reserved&lt;br /&gt;
# reserved&lt;br /&gt;
# reserved&lt;br /&gt;
# reserved&lt;br /&gt;
# Attempt to start pending task that has been disabled while pending.&lt;br /&gt;
# Time from task start request to job completion exceeds task deadline.&lt;br /&gt;
# Time between task start requests less than specified minimum for task&lt;br /&gt;
# Time between task start requests greater than specified maximum for task&lt;br /&gt;
# Missed latest time for transfer of job from timed action queue to scheduler.&lt;br /&gt;
# Missed latest time for performance of timed output.&lt;br /&gt;
# Mutex not returned before job terminates.&lt;br /&gt;
# Read/Write mutex not returned before job termination.&lt;br /&gt;
# System busy warning&lt;br /&gt;
# Data area sentinels corrupted.&lt;br /&gt;
# System meta pointer corrupted&lt;br /&gt;
&lt;br /&gt;
== System Policing and Problem Anticipation ==&lt;br /&gt;
&lt;br /&gt;
All design involves assumptions, and ‘System Policing’ refers to checking how close these come to being violated as the system operates, and to taking precautions if needed.&lt;br /&gt;
&lt;br /&gt;
The white box design of OCEOSmp facilitates this, with records kept automatically of task timing performances and other parameters that are accessible by the ASW at any time, including after OCEOSmp exits should this occur.&lt;br /&gt;
&lt;br /&gt;
These records can answer questions such as ‘what is the longest time this task took to execute’, ‘what is the shortest time between requests to start this task’, ‘what is the longest time between requests to start this task’, and many others, including stack usage.&lt;br /&gt;
&lt;br /&gt;
By checking such data the ASW can notice that behaviour is not as expected and that something is going wrong, allowing ‘Problem Anticipation’ and an issue being dealt with before it causes serious difficulties.&lt;br /&gt;
&lt;br /&gt;
The ASW might do this by having an external policing function running on a core not in use by OCEOSmp that periodically checks that things are as expected, or by having a policing task that is scheduled by OCEOSmp.&lt;br /&gt;
&lt;br /&gt;
With all the data stored statically in the ‘Log Area’, ‘Fixed Data Area’ and ‘Dynamic Data Area’ arrays by the ASW it is straightforward to retrieve it.&lt;br /&gt;
&lt;br /&gt;
OCEOSmp only requires one system stack per CPU core rather than one stack per thread. Each stack is initialised to a known value, making it straightforward to determine the greatest extent to which each stack has been used.&lt;br /&gt;
&lt;br /&gt;
If suspicious activity is detected, the ASW can for example disable a task or take a CPU core out of use or disable a peripheral or take other corrective action.&lt;br /&gt;
&lt;br /&gt;
It can also make a historical record of bad behaviour by adding an entry to the System Log and by updating a flag in the System State variable, When the System Log becomes ¾ full an ASW function if defined is called that can archive the System Log, and a shadow copy of the System State variable is automatically maintained that is only reset by the ASW itself.&lt;br /&gt;
&lt;br /&gt;
When multiple mutual exclusion semaphores are used by tasks the OCEOSmp design excludes the possibility of unbounded priority inversion and no check for this is needed.&lt;br /&gt;
&lt;br /&gt;
On multi-core systems deadlocks can occur but only if tasks fail to acquire mutual exclusion semaphores in a consistent order corresponding to their identity numbers. A warning status code is then returned although as yet no deadlock has occurred.&lt;br /&gt;
&lt;br /&gt;
The ASW can include a policing function that checks the execution times of tasks (in OCEOSmp tasks on other CPU cores spin waiting to acquire mutexes), and the time when a task start request was issued, allowing detection of deadlocks, livelocks, and task starvation.&lt;br /&gt;
&lt;br /&gt;
It should be noted that OCEOSmp itself may detect an anomaly and automatically make an entry in the System Log and may also update the System State variable, perhaps resulting in an ASW defined problem handling function being called, but this only happens after a problem has occurred and been detected. &lt;br /&gt;
&lt;br /&gt;
== Problem Detection and Handling ==&lt;br /&gt;
&lt;br /&gt;
[[File:PoliceJoke.png|600px]]&lt;br /&gt;
&lt;br /&gt;
This relates to what happens after a problem has occurred and been detected, as distinct from System Policing and Problem Anticipation which aims to forestall problems.&lt;br /&gt;
&lt;br /&gt;
The integrity tests carried out automatically by OCEOSmp check for a number of problems. Some are detected directly when an OCEOSmp directive is used, others when an event occurs such as a job completing execution, others when some internal operation of OCEOSmp does not proceed as expected. &lt;br /&gt;
&lt;br /&gt;
Problems that arise directly from the use or misuse of a directive are identified in the returned status code, and the ASW can then decide the appropriate action.&lt;br /&gt;
&lt;br /&gt;
If appropriate the ASW can disable or terminate tasks and take CPU cores out of use without disrupting scheduling, and can read and update the system log and system state variable. In an extreme case the ASW can end scheduling and return to main().&lt;br /&gt;
&lt;br /&gt;
# Typical directive problems&lt;br /&gt;
## Current phase doesn’t allow this directive&lt;br /&gt;
## Invalid parameters supplied&lt;br /&gt;
## Time for timed action already passed&lt;br /&gt;
## Write fail, data queue full&lt;br /&gt;
## Write succeeded, data queue now full (warning) &lt;br /&gt;
## Mutexes or rwmutexes acquired in an incorrect order (warning)&lt;br /&gt;
&lt;br /&gt;
Other problems may be identified automatically be OCEOSmp after a directive has been used or when an event occurs, or during internal OCEOSmp operations&lt;br /&gt;
Such problems include:&lt;br /&gt;
# &amp;lt;li value=&amp;quot;2&amp;quot;&amp;gt;Unexpected patterns of events&amp;lt;/li&amp;gt;&lt;br /&gt;
## Task misses a deadline&lt;br /&gt;
## Task start requests occur more frequently than expected&lt;br /&gt;
## Task start requests occur less frequently than expected&lt;br /&gt;
## Task disabled after being put on a pending queue&lt;br /&gt;
## Spin locks not being available in a reasonable time&lt;br /&gt;
## Action time missed&lt;br /&gt;
## Pending queues being full&lt;br /&gt;
&lt;br /&gt;
These problems typically cause a system log entry to be made, may update the system state variable and may result in an ASW defined problem handling function being called. This has full access to the performance records and can enable or disable tasks and take CPU cores out of use or restore them to use without disrupting scheduling, and can exit from OCEOSmp if appropriate.&lt;br /&gt;
&lt;br /&gt;
Other problems that may be automatically detected by OCEOSmp include&lt;br /&gt;
# &amp;lt;li value=&amp;quot;3&amp;quot;&amp;gt;Corruption of critical data&amp;lt;/li&amp;gt;&lt;br /&gt;
## Perhaps due to hardware failures&lt;br /&gt;
## Perhaps by application software malfunctioning and overwriting data&lt;br /&gt;
## Perhaps by a bug in OCEOSmp&lt;br /&gt;
&lt;br /&gt;
These problems typically result in exit from OCEOSmp and return to main() at the point immediately after oceos_start() was used. The system state variable and system log may also be updated.&lt;br /&gt;
&lt;br /&gt;
It should be noted that the checks made by OCEOSmp only occur as a result of it being notified of some change in the state of the system, as when a directive is used or a job terminates or an interrupt occurs. It is recommended that these be added to by taking appropriate precautions.&lt;br /&gt;
&lt;br /&gt;
== Precautions and Correction ==&lt;br /&gt;
&lt;br /&gt;
[[File:Precaution.png|600px]]&lt;br /&gt;
&lt;br /&gt;
A primary precaution is policing. As described above this typically involves assigning a CPU core to check the activities of the system, or perhaps assigning a task to that purpose. Anticipation and prevention are better than detection.&lt;br /&gt;
&lt;br /&gt;
Further precautions are also possible, depending on the hardware available in the system. These can detect or perhaps even prevent various malfunctions. &lt;br /&gt;
&lt;br /&gt;
=== Hardware Malfunctions ===&lt;br /&gt;
These can be caused by radiation or other external factors, or simply by parts of the system wearing out.&lt;br /&gt;
&lt;br /&gt;
They fall into three main categories, memory hardware malfunctions, CPU core malfunctions, and peripheral or connected device malfunctions.&lt;br /&gt;
&lt;br /&gt;
==== Memory hardware malfunctions ====&lt;br /&gt;
&lt;br /&gt;
These typically result in one or more bits in a memory location being set to incorrect values.&lt;br /&gt;
&lt;br /&gt;
If the error involve no more than a certain number of bits (BCH 1, RS fixed &amp;gt; 1) then EDAC allows a memory location containing such errors be read correctly despite the error.&lt;br /&gt;
&lt;br /&gt;
While the value read is correct the error remains in the location until the correct value is written back. This should be done before a further bit becomes corrupted, perhaps making the error un-correctable. In some systems this write back is done automatically. &lt;br /&gt;
&lt;br /&gt;
Long intervals can occur between uses of a memory location making ‘memory scrubbing’ necessary. This cycles through all memory locations, reading and writing back if needed, doing so often enough to make it very unlikely that an un-correctable number of erroneous bits will accumulate in any location.&lt;br /&gt;
&lt;br /&gt;
Usually a hardware ‘memory scrubber‘ is available that can be configured to do this at a certain rate for a certain range of addresses.&lt;br /&gt;
&lt;br /&gt;
Memory read errors can still occur however. A combination of bit errors can defeat EDAC error detection and lead to an incorrect value being read. Usually however such un-correctable errors are detected by EDAC causing it to raise an exception. The corresponding handler must then take appropriate action, which may include terminating OCEOSmp.&lt;br /&gt;
&lt;br /&gt;
Precautions: Before starting OCEOSmp &lt;br /&gt;
# The handler for EDAC detected un-correctable errors should be put in place&lt;br /&gt;
# The memory should be initialized&lt;br /&gt;
# The EDAC system configured and put into operation&lt;br /&gt;
# The EDAC memory scrubber hardware configured and put into operation&lt;br /&gt;
&lt;br /&gt;
Once this has been done and OCEOSmp started&lt;br /&gt;
# &amp;lt;li value=&amp;quot;5&amp;quot;&amp;gt;The EDAC exception handler can &amp;lt;/li&amp;gt;	&lt;br /&gt;
## Update the system log&lt;br /&gt;
## Update the system state variable&lt;br /&gt;
## Start a problem handling task&lt;br /&gt;
## If necessary call oceos_exit() to return to main()&lt;br /&gt;
&lt;br /&gt;
==== Computer core hardware malfunctions ====&lt;br /&gt;
&lt;br /&gt;
Cores may use triple modular redundancy and other techniques to reduce the effects of transient errors, but nevertheless can become faulty. If this is detected in a multi-core system OCEOSmp allows the faulty core be taken out of use without scheduling being disrupted.&lt;br /&gt;
&lt;br /&gt;
Detecting that a core has become faulty can be done using computational tasks for which the results including timings are known. Before such tests are used however a malfunction may have led to an erroneous result being used. &lt;br /&gt;
&lt;br /&gt;
To avoid this when result accuracy is critical and immediately needed it is possible in OCEOSmp to have multiple CPU cores carry out the same computation at the same time (within a few clock cycles). &lt;br /&gt;
&lt;br /&gt;
The results can then be compared and the majority agreed value used. A core that was at fault can be tested and taken out of use if the problem is judged not to be transient.&lt;br /&gt;
&lt;br /&gt;
Precaution: Check periodically that cores carry out a computational test correctly.&lt;br /&gt;
# &amp;lt;li value=&amp;quot;6&amp;quot;&amp;gt;oceosmp_cpu_disable() will take the specified CPU core out of use, put it to sleep, and cause the termination functions of any jobs executing on the core be executed on a different core.&amp;lt;/li&amp;gt; &lt;br /&gt;
# oceosmp_cpu_enable() will make the specified CPU core available for use&lt;br /&gt;
&lt;br /&gt;
These directives can also be used to manage the number of active cores for power saving or other purposes. Scheduling is not disrupted as long as a functioning core remains.&lt;br /&gt;
&lt;br /&gt;
==== Peripheral Hardware Malfunctions ====&lt;br /&gt;
&lt;br /&gt;
These can arise due to a fault in the peripheral unit itself, or due to problems in an external system for which the peripheral is an interface.&lt;br /&gt;
&lt;br /&gt;
Before starting OCEOSmp the ASW should carry out appropriate checks of all peripheral units, and should ensure that such checks can be carried out if necessary by tasks after scheduling has begun.&lt;br /&gt;
&lt;br /&gt;
Faults in external systems for which a peripheral unit is an interface tend to either&lt;br /&gt;
# cause no messages to be sent to the interface&lt;br /&gt;
# cause messages to be sent too frequently&lt;br /&gt;
&lt;br /&gt;
In most cases when a peripheral receives an external message it causes an interrupt which then causes a request to start a task.&lt;br /&gt;
&lt;br /&gt;
If the interval between such task start requests is longer than expected this may indicate that the peripheral device has become faulty and is no longer operational.&lt;br /&gt;
&lt;br /&gt;
If the interval between such task start requests is shorter than expected it may indicate the frequency of external events exceeding expectations or some fault in the peripheral device.&lt;br /&gt;
&lt;br /&gt;
In both cases on starting the task OCEOSmp automatically checks the interval since the last task start request and if this is less than the expected minimum or greater than the expected maximum will make a system log entry and set the corresponding flag in the system state variable. If the ASW has set the corresponding system state action flag and defined a problem handling function this will result in the ASW problem handling function being called.&lt;br /&gt;
 &lt;br /&gt;
Precautions: &lt;br /&gt;
	In the ASW configuration structure passed to oceos_init() the ASW set the desired flags in the problem action mask and define a problem handling function.   &lt;br /&gt;
&lt;br /&gt;
=== Software Malfunctions ===&lt;br /&gt;
&lt;br /&gt;
Certain types of software errors can cause problems for the system as a whole.&lt;br /&gt;
&lt;br /&gt;
OCEOSmp automatically checks for some of these, others are best checked for by the ASW itself, perhaps as part of system policing.&lt;br /&gt;
&lt;br /&gt;
In addition to policing, various precautions can be taken against these problems, including making use of any memory protection hardware available and using a system watchdog timer.&lt;br /&gt;
&lt;br /&gt;
==== Invalid memory overwriting ====&lt;br /&gt;
&lt;br /&gt;
Application software may inadvertently overwrite memory areas used by OCEOSmp.&lt;br /&gt;
&lt;br /&gt;
The three memory areas used by OCEOSmp are each protected at their ends by constant sentinels. Each time a directive is used or job terminates OCEOSmp checks these sentinels to ensure that the areas involved have not been encroached upon. If so OCEOSmp will exit.&lt;br /&gt;
&lt;br /&gt;
In addition to its sentinels the fixed data area has an XOR checksum which allows any alteration be detected. This is not checked automatically by OCEOSmp for reasons of efficiency, but can be checked at any time by ASW policing software.&lt;br /&gt;
&lt;br /&gt;
Prevention is better than detection and if a system has a memory protection unit this should be configured to make the fixed area read-only. Any attempt to write this area will then typically cause the protection unit to raise an exception.&lt;br /&gt;
&lt;br /&gt;
Each CPU core has its own system stack. These form part of a contiguous block of statically allocated memory, and a software error may result in the code running on a core overrunning that core’s stack and attempting to use the stack memory of another core.&lt;br /&gt;
&lt;br /&gt;
This can be detected in policing by checking that filler still remains at the top and bottom of each core’s stack, and this can be checked at any time by ASW policing software, but prevention is better than detection.&lt;br /&gt;
 &lt;br /&gt;
Precautions: Any hardware memory protection present should be used on completion of oceos_init_finish() and before oceos_start() to provide these features.&lt;br /&gt;
# Read only (the fixed data area)&lt;br /&gt;
# Writeable only by a specific computer core (for each core’s stack)&lt;br /&gt;
 &lt;br /&gt;
Invalid attempts to use a memory location typically give rise to an exception and an appropriate handler must be in place.&lt;br /&gt;
&lt;br /&gt;
==== Invalid use of Mutual Exclusion Semaphores (Mutexes) or of Read-Write Mutexes ====&lt;br /&gt;
&lt;br /&gt;
In general the time for which the ASW holds a mutex or read-write mutex should be as short as possible.&lt;br /&gt;
&lt;br /&gt;
This time can be estimated at compile time and the estimates taken into account in determining whether a set of tasks can be scheduled so that tasks always meet their deadlines.&lt;br /&gt;
&lt;br /&gt;
Such estimates however can be made wrong by events that occur during scheduling if appropriate precautions are not taken.&lt;br /&gt;
&lt;br /&gt;
One possible problem, unbounded priority inversion, arises when a job holding a mutex is pre-empted by a higher priority task that does not use the mutex, causing any even higher priority task that uses the mutex to wait indefinitely for the low priority job to resume and release the mutex. In OCEOSmp unbounded priority inversion cannot occur. &lt;br /&gt;
&lt;br /&gt;
Another problem, deadlock, can arise when two or more jobs each acquire more than one mutex. A job while holding a mutex may then attempt to acquire a different mutex currently held by some other job. If that other job (without releasing the mutex it holds) attempts to acquire the mutex held by the first job neither job can make progress, the jobs are deadlocked.&lt;br /&gt;
&lt;br /&gt;
These problems are addressed by the design of OCEOSmp.&lt;br /&gt;
&lt;br /&gt;
In OCEOSmp each mutex or read-write mutex has a priority ceiling giving the priority of the highest priority task that uses it. This constant is determined at compile time and set for each mutex when it is created.&lt;br /&gt;
&lt;br /&gt;
In scheduling, once a job running on a CPU core holds one or more mutexes or read-write mutexes only tasks with higher priority than the highest ceiling are allowed to pre-empt the job and start running on that core.&lt;br /&gt;
&lt;br /&gt;
As a result unbounded priority inversion cannot occur, and on single core systems deadlocks also are not possible.&lt;br /&gt;
&lt;br /&gt;
On multi-core systems jobs can spin waiting to acquire a mutex held by a job running on a different core and deadlock becomes possible.&lt;br /&gt;
&lt;br /&gt;
In OCEOSmp mutexes and read-write mutexes are assigned a sequential order as they are created. Deadlocks then cannot occur if jobs always respect this order in acquiring mutexes, never attempting to acquire a mutex or read-write mutex if already holding one that is higher in the order.&lt;br /&gt;
&lt;br /&gt;
OCEOSmp does not prevent jobs from acquiring multiple mutexes in an out of order manner but returns a warning directive status code to the job indicating that deadlock is possible and makes a log entry and updates the system state variable, perhaps causing an ASW defined problem handling function to be called.&lt;br /&gt;
&lt;br /&gt;
When a job simultaneously holds multiple mutexes or read-write mutexes it should acquire and return these in a LIFO manner, e.g. waitA, waitB, waitC…..signalC, signalB, signalA. Failure to do so may affect task scheduling temporarily and will result in a warning directive status code, a log entry, and an update of the system state variable.&lt;br /&gt;
&lt;br /&gt;
Other errors in using mutexes such as failure to release a mutex before a job ends or attempting to release a mutex that is not held give rise to an appropriate directive status codes, a log entry, and a system state variable updates.&lt;br /&gt;
&lt;br /&gt;
Precautions: &lt;br /&gt;
# Ensure at compile time that when a task acquires multiple mutexes or read-write mutexes it always does so in the correct order.&lt;br /&gt;
# Ensure at compile time that when a job releases multiple mutexes or read-write mutexes it always does so in the reverse order to that in which they were acquired&lt;br /&gt;
&lt;br /&gt;
==== Deadlocks, Livelocks and Task Starvation ====&lt;br /&gt;
&lt;br /&gt;
Deadlocks arise primarily due to misuse of mutual exclusion semaphores or read write mutual exclusion semaphores, as described above.&lt;br /&gt;
&lt;br /&gt;
Livelocks, where tasks interact in a way that results in each task having to return to some earlier point with no or very little overall progress, can arise in a number of ways including from attempts to resolve a deadlock so that the tasks involved can proceed.&lt;br /&gt;
&lt;br /&gt;
Task starvation arises when a task is ready to start, but CPU time is not allocated to it within a reasonable time. In OCEOSmp this will occur for a low priority task if higher priority tasks are always ready to run and require all the available CPU cores. &lt;br /&gt;
&lt;br /&gt;
Task starvation, to at least some degree, can also occur for a high priority task if the resources required to allow it pre-empt a lower priority task are not available on the CPU core involved, as for example when the remaining system stack for that core is below the level needed for pre-emption.&lt;br /&gt;
&lt;br /&gt;
All three of these problems result in a task or tasks taking longer to complete than should be the case. This can be detected in two main ways&lt;br /&gt;
# By a policing task that periodically checks each task record in the dynamic area to determine the maximum time between a request to start it and task completion. &lt;br /&gt;
# By watchdog timer hardware that typically is reset periodically by the lowest priority task and which will cause a hardware system reset if its pre-set time elapses before it is reset. On re-entry to main() the ASW can check to determine if this has occurred before restarting OCEOSmp.&lt;br /&gt;
&lt;br /&gt;
Precautions&lt;br /&gt;
# &amp;lt;li value=&amp;quot;3&amp;quot;&amp;gt;ensure each CPU core has adequate system stack so that a lower priority task running on the core can always be pre-empted by a higher priority task. The amount required can be calculated from the number of different priority levels in use.&amp;lt;/li&amp;gt;&lt;br /&gt;
# if watchdog timer hardware is available set up a low priority task to periodically reset it. The ASW should check on entry to main() whether this was due to a watchdog timeout and if so use the OCEOSmp data to determine the cause and appropriate remedial action before restarting OCEOSmp.&lt;br /&gt;
# set up a policing task that checks the execution times of current tasks and detects when this is too long. This task can call an ASW defined problem handling function that can determine how best to deal with the situation, perhaps calling the termination functions of some currently executing tasks, disabling some tasks or changing interrupt intervals.&lt;br /&gt;
# If necessary reserve certain CPU cores to use only by higher priority tasks, perhaps ensuring that there is always at least one CPU core ready to be used immediately by such tasks.&lt;br /&gt;
&lt;br /&gt;
== Summary ==&lt;br /&gt;
&lt;br /&gt;
[[File:MurphysLaw.png|400px]]&lt;br /&gt;
&lt;br /&gt;
Murphy’s Law, ‘if things can go wrong they will’, has had a significant impact on the design of OCEOSmp. &lt;br /&gt;
&lt;br /&gt;
An older maxim ‘the wise man avoids evil by anticipating it’ (Publilius Cyrus) has also had an impact. Software can go wrong without prior indication of stress but it may be possible to notice that all is not well before disaster strikes. Avoidance is better than detection.&lt;br /&gt;
&lt;br /&gt;
These ideas have led to OCEOSmp having features that allow fault anticipation, detection, isolation and recovery, with a white box approach that simplifies system policing and checking behaviour against expectations and with memory statically allocated.&lt;br /&gt;
&lt;br /&gt;
When a problem is found OCEOSmp can take CPU cores out of use or kill or disable tasks without disrupting scheduling, or in severe cases exit and return to the ASW main() with all data still accessible for analysis or download, and with the ASW able to make changes and restart OCEOSmp if desired.&lt;br /&gt;
&lt;br /&gt;
These features help ensure that OCEOSmp is suitable for use in safety critical or other systems that require the highest reliability.&lt;br /&gt;
&lt;br /&gt;
Even where it is hoped that nothing can possibly go wrong….&lt;br /&gt;
&lt;br /&gt;
= &amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;'''System Log'''&amp;lt;/span&amp;gt; =&lt;br /&gt;
&lt;br /&gt;
== Purpose ==&lt;br /&gt;
#Provide application software with the ability to make time stamped records of events for use in application performance monitoring and in application debugging&lt;br /&gt;
#Provide OCEOSmp with the ability to record internal anomalies should these be detected.&lt;br /&gt;
&lt;br /&gt;
== Structure ==&lt;br /&gt;
#A circular buffer with a fixed size that is set in the application configuration&lt;br /&gt;
#Size from 16 to 1024 entries, default 64 if not specified&lt;br /&gt;
#If the application defines oceosmp_on_full_log(void *) this is called automatically when the buffer becomes ¾ full, allowing log entries that might otherwise be overwritten be stored. The automatic call will reoccur only after the buffer becomes ¾ empty.&lt;br /&gt;
#On system reset log entries are not overwritten and buffer indices are reset so as to postpone recent entries being overwritten and allow review of events prior to the reset.&lt;br /&gt;
&lt;br /&gt;
== Storage ==&lt;br /&gt;
#Stored statically in the oceosmp_log_area, which also contains the next-read and next-write buffer indices and the system state related variables.&lt;br /&gt;
#The log size and the oceosmp_on_full() function declaration are stored in the oceosmp_fixed_area, as also are the  log area addresses.&lt;br /&gt;
#Log entry format (from system_log.h): &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
Struct log_entry{&lt;br /&gt;
 	U64_t		time64;&lt;br /&gt;
 	unsigned int       current_cpu_id		:8;&lt;br /&gt;
 	unsigned int	entry_type		:8;&lt;br /&gt;
 	U32_t		entry_comment;&lt;br /&gt;
} __attribute__ ((aligned (8));&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt; &lt;br /&gt;
# &amp;lt;li value=&amp;quot;4&amp;quot;&amp;gt;When a log entry is made, time64 and current_cpu_id are set automatically by OCEOSmp.&amp;lt;/li&amp;gt;&lt;br /&gt;
#The entry type is an enum defined by the application, with a subset of enum values reserved for use by OCEOSmp. The reserved enum values are specified in system_log.h.&lt;br /&gt;
#The entry_comment allows noting further information on the current situation&lt;br /&gt;
&lt;br /&gt;
== Associated directives ==&lt;br /&gt;
#Add Log Entry&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t 	oceos_log_add_entry(&lt;br /&gt;
 	 	enum LOG_ENTRY_TYPE type, // 8 bit enum LOG_ENTRY_TYPE&lt;br /&gt;
 	 	const U32_t info 		// further information&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt; &lt;br /&gt;
This adds an entry, overwriting the currently oldest entry.&lt;br /&gt;
&lt;br /&gt;
# &amp;lt;li value=&amp;quot;2&amp;quot;&amp;gt;Remove Log Entry&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t oceos_log_remove_entry(&lt;br /&gt;
 		struct log_entry * const outputPtr&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This returns the oldest unread entry to outputPtr and updates the buffer indices&lt;br /&gt;
&lt;br /&gt;
#Other directives are detailed in system_log.h&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
== Usage by OCEOSmp itself ==&lt;br /&gt;
#OCEOSmp only uses the system log for problems that do not arise directly when a directive is used (problems that arise directly are described in the returned directive status code).&lt;br /&gt;
#Such problems fall into a number of categories&lt;br /&gt;
## System corruption is detected and/or oceos_exit is called a&lt;br /&gt;
## Excessive delays in obtaining system spin locks perhaps due to system overloading&lt;br /&gt;
## A timed action misses its specified time&lt;br /&gt;
## A task misses its deadlines&lt;br /&gt;
## Task start requests occur more frequently than expected&lt;br /&gt;
## A task exits without returning a mutex or read-write mutex that it holds&lt;br /&gt;
## Nested mutexes or read-write mutexes not returned in correct order&lt;br /&gt;
## Counts already at max or min&lt;br /&gt;
#In many cases when OCEOSmp makes a system log entry it also updates the system state variable. This is updated using ‘OR’ and so provides a long term record that a problem has occurred even if a log entry is overwritten. In addition, if the update corresponds to an application defined action mask an application defined problem handling function may be called which can if desired read the system log.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:backup]]&lt;/div&gt;</summary>
		<author><name>Bkavanagh</name></author>
	</entry>
	<entry>
		<id>https://wiki.ocetechnology.com/mediawiki/index.php?title=OCEOSmp/notes&amp;diff=1689</id>
		<title>OCEOSmp/notes</title>
		<link rel="alternate" type="text/html" href="https://wiki.ocetechnology.com/mediawiki/index.php?title=OCEOSmp/notes&amp;diff=1689"/>
		<updated>2024-05-03T15:27:12Z</updated>

		<summary type="html">&lt;p&gt;Bkavanagh: /* Associated directives */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= &amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;'''When things go wrong'''&amp;lt;/span&amp;gt; =&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Prof. M. Ryan'''&lt;br /&gt;
&lt;br /&gt;
Things can go wrong even when software is bug free.&lt;br /&gt;
&lt;br /&gt;
Misunderstandings may have led to an inadequate design, real world circumstances may conspire to cause performance problems, radiation or other factors may cause hardware failures, and in general things can always go wrong.&lt;br /&gt;
&lt;br /&gt;
Murphy’s Law then applies, and while the system is in use it is important that system behaviour can be monitored, deviations from expectations noticed, checks made, corrections done, and recovery steps taken if needed.&lt;br /&gt;
&lt;br /&gt;
OCEOSmp has been designed with Murphy’s Law in mind and facilitates such actions in a number of ways.&lt;br /&gt;
&lt;br /&gt;
# Servant not Master&lt;br /&gt;
# White Box not Black Box&lt;br /&gt;
# Directive warning and error status codes&lt;br /&gt;
# Automatic integrity checks&lt;br /&gt;
# System Log&lt;br /&gt;
# System state variable&lt;br /&gt;
# System Policing and Problem Anticipation&lt;br /&gt;
# Problem Detection and Handling&lt;br /&gt;
# Precautions and Correction&lt;br /&gt;
&lt;br /&gt;
== Servant not Master ==&lt;br /&gt;
&lt;br /&gt;
[[File:MasterNotSlave.png|400px]]&lt;br /&gt;
&lt;br /&gt;
Many operating systems begin execution directly after the boot sequence and control all subsequent execution of the application software (ASW). Should something go wrong it can be difficult to assess what has occurred and find appropriate corrective action, particularly if the operating system itself has been involved.&lt;br /&gt;
&lt;br /&gt;
With OCEOSmp the ASW begins execution before the operating system and only starts OCEOSmp at some point after entering main().&lt;br /&gt;
&lt;br /&gt;
Before doing so the ASW should check the circumstances that lead to main() being entered. If due to a system restart then the data accumulated by OCEOSmp in the previous run is still available in its fixed, dynamic, and log data areas for analysis or download to find the cause (assuming power has been maintained or non-volatile memory is used for those areas).&lt;br /&gt;
&lt;br /&gt;
The ASW can then make appropriate modifications, and continue as usual to set up EDAC, set up memory protection, initialise and check CPU cores and peripherals, and once all seems correct proceed to start or restart OCEOSmp.&lt;br /&gt;
&lt;br /&gt;
Once scheduling begins OCEOSmp returns to main() only if a fatal error is detected or if it is instructed to do so by an ASW task. Should this occur all the data accumulated is available for analysis or download by ASW main() code, which can restart scheduling by calling oceos_start().&lt;br /&gt;
 &lt;br /&gt;
Most problems can be dealt with by tasks set up to do so under the control of OCEOSmp, but sufficiently serious ones may cause a system reset (e.g. a watchdog timer running out) or cause OCEOSmp to exit (e.g. corruption of critical data), in both cases with the previous state available for analysis if power is maintained or if non-volatile memory is used.&lt;br /&gt;
&lt;br /&gt;
In main() the ASW takes five principal steps in starting OCEOSmp:&lt;br /&gt;
&lt;br /&gt;
# check whether the entry to main() is due to a restart (e.g. by checking if the OCEOSmp data area sentinels are already in place) and if so use the data areas to determine the cause and make whatever modifications to the system are appropriate.   &lt;br /&gt;
# use oceos_init() with the ASW configuration to set up the log area and prepare the fixed data area to hold various addresses, the number of CPU cores, tasks, mutexes, etc.&lt;br /&gt;
# use various OCEOSmp create functions to create tasks, mutexs etc.&lt;br /&gt;
# use oceos_init_finish() to check that the declared numbers of tasks etc. have been created, finish setting up the fixed data area, and set its checksum.&lt;br /&gt;
&lt;br /&gt;
At this point the fixed data area with fixed information about addresses, cores, tasks, mutexes, data queues etc. has been set up, and need not be set up again if not corrupted. The checksum allows the &lt;br /&gt;
area be checked at any time to ensure it has not been changed. Memory protection if available can make the fixed area read-only and make the stack addresses for each core restricted to being written &lt;br /&gt;
only by that core. &lt;br /&gt;
&lt;br /&gt;
Scheduling can begin.&lt;br /&gt;
&lt;br /&gt;
# &amp;lt;li value=&amp;quot;5&amp;quot;&amp;gt;use oceos_start() to initialise the dynamic data area and begins scheduling. This function usually does not return to main() but may do so if a major problem is detected.&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As scheduling progresses the ASW can use the system log to record events and monitor performance. The log is also used by OCEOSmp to record problems, and OCEOSmp may also make a system state entry and trigger an ASW problem handling function.&lt;br /&gt;
&lt;br /&gt;
If a problem is sufficiently serious OCEOSmp may exit automatically or may be requested to do so by an ASW task, execution then returns to main() at the point after the call to oceos_start() with all performance, log, stack and other data available for analysis or download.&lt;br /&gt;
 &lt;br /&gt;
The ASW main() code can then determine the reason for the unexpected return, take appropriate corrective action, and resume scheduling by calling oceos_start() or modify various settings and start over with oceos_init().&lt;br /&gt;
&lt;br /&gt;
The ASW uses OCEOSmp and remains the master, rather than the reverse.&lt;br /&gt;
&lt;br /&gt;
== White Box not Black Box ==&lt;br /&gt;
&lt;br /&gt;
[[File:WhiteboxNotBlackbox.png|800px]]&lt;br /&gt;
&lt;br /&gt;
The data used by OCEOSmp is stored in statically allocated memory in three data areas and in an overall stack area. These usually are specified by the ASW as arrays of 32-bit words and can be examined by the ASW at any time.&lt;br /&gt;
&lt;br /&gt;
The data includes actual and expected task maximum and minimum execution times, activities on CPU cores, and other records of what has been happening. These records can be readily examined by the ASW while scheduling is under way and after OCEOSmp exits should this occur.&lt;br /&gt;
&lt;br /&gt;
OCEOSmp configures each data area to begin with a 32-bit sentinel followed by its size measured in 32-bit words, then the corresponding data, and finally a 32-bit sentinel. In the case of the fixed data area a 32-bit XOR checksum is located before the end sentinel.&lt;br /&gt;
&lt;br /&gt;
The size of each data area and the layout of the data within it depends on the application configuration, but are clearly specified with the location of each data item identified.&lt;br /&gt;
&lt;br /&gt;
Whenever an OCEOSmp directive is used a quick check is made that sentinels have not been breached. The ASW itself can check the fixed area checksum at any time (this is not done automatically for reasons of efficiency).&lt;br /&gt;
&lt;br /&gt;
The Log Area is initialized by oceos_init() and contains the system log and system state variable and if used the optional context switch log. Directives are provided to access and update these. The size of the area depends on the number of entries specified for the two logs in the system configuration. Log contents are preserved across system reset and across power failures if stored in non-volatile memory. &lt;br /&gt;
&lt;br /&gt;
The Fixed Data Area is completed by oceos_init_finish() and contains all the constants of the system, such as the addresses of data areas and stacks, the identity of the CPU core that OCEOSmp is to use on startup, the number of cores, tasks etc., the priorities and other attributes of tasks etc. &lt;br /&gt;
&lt;br /&gt;
The Dynamic Data area is created and initialized by oceos_start() and contains the information collected as oceosmp schedules tasks and as mutexes, counting semaphores,  etc. are used. This information is available for inspection by the ASW if OCEOSmp exits, and is only overwritten if the ASW again calls oceos_start().&lt;br /&gt;
&lt;br /&gt;
In OCEOSmp each CPU core has a system stack, a stack for each thread is not required. The stack size per CPU core and the location of the overall top of stack is specified in the application configuration and the overall stack space is statically allocated.&lt;br /&gt;
&lt;br /&gt;
Before scheduling begins OCEOSmp initialises each core’s stack with a filler. This is overwritten as the stack is used and by checking how much memory at the top and bottom of each stack still contains the filler it is possible to determine at any point how close the system has come to a stack overrun.&lt;br /&gt;
&lt;br /&gt;
The white box approach of making all records and the system stacks readily accessible while scheduling is taking place and should OCEOSmp exit facilitates checking that the system is performing as expected and determining the causes of any problems that may occur.&lt;br /&gt;
&lt;br /&gt;
== Directive warning and error status codes ==&lt;br /&gt;
&lt;br /&gt;
[[File:WarningErrorIcon.png|400px]]&lt;br /&gt;
&lt;br /&gt;
The ASW uses OCEOSmp by calling its directives, and is responsible for checking the returned directive status code. (OCEOSmp is a statically linked library, only those components related to the directives used by the ASW are linked into the final executable.)&lt;br /&gt;
&lt;br /&gt;
The system time directives oceos_time_sys_get64() and oceos_time_sys_get32() directly return the requested system time as 64-bit or 32-bit unsigned integers.&lt;br /&gt;
&lt;br /&gt;
Other directives return a 32-bit signed integer status code.&lt;br /&gt;
&lt;br /&gt;
This should always be checked when a directive is used.&lt;br /&gt;
&lt;br /&gt;
The status code indicates ERROR, SUCCESS, or WARNING.&lt;br /&gt;
&lt;br /&gt;
* A negative value indicates that the directive has not executed and gives the reasons&lt;br /&gt;
* A zero value indicates successful execution as expected&lt;br /&gt;
* A non-zero positive value indicates that the directive executed but with warnings&lt;br /&gt;
&lt;br /&gt;
Certain bits in the status code have the same meaning for all directives.&lt;br /&gt;
&lt;br /&gt;
Other bits have meanings that depend on the directive in use.&lt;br /&gt;
&lt;br /&gt;
These meanings are given in the header files associated with each directive as constants that can be compared with the status code to determine the types of errors or warnings involved.&lt;br /&gt;
&lt;br /&gt;
Errors typically involve an incorrect parameter to a directive, or an attempt to use a resource that is not available such as writing to a data queue that is already full.&lt;br /&gt;
&lt;br /&gt;
Warnings typically indicate that the directive has succeeded but that a danger has been created as when a task acquires multiple mutual exclusion semaphores out of order, or that a resource is now fully in use as when a write makes a data queue full.&lt;br /&gt;
&lt;br /&gt;
The task that used the directive and checked the returned status has full access to the data areas and stack areas in deciding the action to take, which may involve making a system log entry, starting a problem handling task, or in the worst case exiting from OCEOSmp and returning to main().&lt;br /&gt;
&lt;br /&gt;
In many situations the returned status code is the only indicator that is needed of directive success or failure. The ASW can then make a system log entry (automatically timestamped by OCEOSmp) for recording or performance analysis purposes if desired.&lt;br /&gt;
&lt;br /&gt;
In some situations OCEOSmp will make a system log entry automatically and may also update the system state variable, resulting in an ASW defined problem handling function being called if the corresponding flag has been set by the ASW in the system action flags.&lt;br /&gt;
&lt;br /&gt;
OCEOSmp may also automatically make a system log entry or take other actions when problems arise later, as when a task completion deadline is missed or a mutex is not returned.&lt;br /&gt;
&lt;br /&gt;
Irrespective of whatever other precautions may be taken, the first line of defence in using a directive is to check the returned status code.&lt;br /&gt;
&lt;br /&gt;
== Automatic integrity tests ==&lt;br /&gt;
&lt;br /&gt;
[[File:Automation.jpg|600px]]&lt;br /&gt;
&lt;br /&gt;
These are done automatically by OCEOSmp when a directive is used or an event occurs.&lt;br /&gt;
&lt;br /&gt;
They include checking that OCEOSmp data area sentinels are intact, and in the event of corruption may result in an exit from OCEOSmp and return to main().&lt;br /&gt;
&lt;br /&gt;
Directive parameters and the current system phase also are automatically checked when a directive is used, together with the availability of any required resources.&lt;br /&gt;
&lt;br /&gt;
Problems detected immediately when a directive is used result in an appropriate status code being returned to the ASW task that called the directive.&lt;br /&gt;
&lt;br /&gt;
Some problems, such as a task missing a deadline, do not occur immediately when a directive is used but only as scheduling proceeds. Such problems are checked for automatically by OCEOSmp.&lt;br /&gt;
&lt;br /&gt;
Checks include task completion times vs. deadlines, task start requests intervals vs. expected maxima and minima, mutual exclusion semaphore not being released before task completion, time taken to obtain spinlocks longer than expected (an indicator of system loading), and other problems. &lt;br /&gt;
&lt;br /&gt;
If a check fails in most cases a system log entry is made and the system state variable may be updated, possibly resulting in an ASW defined problem handler being called. In extreme cases OCEOSmp may exit and return to main().&lt;br /&gt;
&lt;br /&gt;
Overall the automatic integrity tests carried out by OCEOSmp itself include:&lt;br /&gt;
# System meta pointer intact&lt;br /&gt;
# Data area sentinel/s intact&lt;br /&gt;
# Task deadline not missed&lt;br /&gt;
# Task start request gap too short&lt;br /&gt;
# Task start request gap too long&lt;br /&gt;
# …&lt;br /&gt;
&lt;br /&gt;
It should be noted that these checks detect that a problem has happened. To anticipate problems and perhaps avoid them further checks can and should be done by the ASW as part of system policing.&lt;br /&gt;
&lt;br /&gt;
== System Log ==&lt;br /&gt;
&lt;br /&gt;
[[File:Logging.png|600px]]&lt;br /&gt;
&lt;br /&gt;
=== Purpose ===&lt;br /&gt;
&lt;br /&gt;
# Provide application software with the ability to make time stamped records of events for use in application performance monitoring and in application debugging&lt;br /&gt;
# Provide OCEOSmp with the ability to record anomalies should these be detected.&lt;br /&gt;
&lt;br /&gt;
=== Structure ===&lt;br /&gt;
&lt;br /&gt;
# &amp;lt;li value=&amp;quot;3&amp;quot;&amp;gt;A circular buffer with a fixed size that is set in the application configuration&amp;lt;/li&amp;gt; &lt;br /&gt;
# Size from 16 to 1024 entries, default 64 if size not specified&lt;br /&gt;
# If the application defines oceosmp_on_full_log(void *) this is called automatically when the buffer becomes ¾ full, allowing log entries that might otherwise be overwritten be archived. The automatic call will reoccur only after the buffer becomes ¾ empty.&lt;br /&gt;
# Two indices determine the next log entry position to be read from or written to. On system reset these are left unchanged if valid so as to postpone recent entries being overwritten.&lt;br /&gt;
# Log entries are left unchanged until a system log write causes the current entry at the write index be overwritten. Reading the log returns the earliest entry not read so far. Directives are provided to allow any log entry be read and to reset the log indices.&lt;br /&gt;
&lt;br /&gt;
=== Storage ===&lt;br /&gt;
&lt;br /&gt;
#  &amp;lt;li value=&amp;quot;8&amp;quot;&amp;gt;Stored statically in the oceosmp_log_area, which also contains the next-read and next-write buffer indices and the system state related variables.&amp;lt;/li&amp;gt;&lt;br /&gt;
# The log size and the oceosmp_on_full() function declaration are stored in the oceosmp_fixed_area, as also are the  log area addresses.&lt;br /&gt;
&lt;br /&gt;
==== Log entry format (from system_log.h) ====&lt;br /&gt;
&lt;br /&gt;
 Struct log_entry{&lt;br /&gt;
  	U64_t time64;&lt;br /&gt;
  	unsigned int current_cpu_id :8;&lt;br /&gt;
  	unsigned int entry_type :8;&lt;br /&gt;
  	U32_t entry_comment;&lt;br /&gt;
 } __attribute__ ((aligned (8));&lt;br /&gt;
&lt;br /&gt;
# &amp;lt;li value=&amp;quot;10&amp;quot;&amp;gt;When a log entry is made, time64 and current_cpu_id are set automatically by OCEOSmp.&amp;lt;/li&amp;gt;&lt;br /&gt;
# The entry type is an enum defined by the application, with a subset of enum values reserved for use by OCEOSmp. The reserved enum values are specified in system_log.h.&lt;br /&gt;
# The ''entry_comment'' allows noting further information on the current situation&lt;br /&gt;
&lt;br /&gt;
==== Associated directives (from system_log.h) ====&lt;br /&gt;
# &amp;lt;li value=&amp;quot;13&amp;quot;&amp;gt;Add log entry&amp;lt;/li&amp;gt;&lt;br /&gt;
 S32_t 	oceos_log_add_entry(&lt;br /&gt;
 	 	enum LOG_ENTRY_TYPE type, // 8 bit enum LOG_ENTRY_TYPE&lt;br /&gt;
 	 	const U32_t info 		// further information&lt;br /&gt;
 );&lt;br /&gt;
&lt;br /&gt;
This adds an entry, overwriting the currently oldest entry.&lt;br /&gt;
&lt;br /&gt;
# &amp;lt;li value=&amp;quot;14&amp;quot;&amp;gt;Remove log entry&amp;lt;/li&amp;gt;&lt;br /&gt;
 S32_t oceos_log_remove_entry(&lt;br /&gt;
  		struct log_entry * const outputPtr&lt;br /&gt;
 );&lt;br /&gt;
&lt;br /&gt;
This returns the oldest unread entry to outputPtr and updates the buffer indices&lt;br /&gt;
&lt;br /&gt;
# &amp;lt;li value=&amp;quot;15&amp;quot;&amp;gt;Other log directives are detailed in system_log.h&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Usage by OCEOSmp itself&lt;br /&gt;
&lt;br /&gt;
# &amp;lt;li value=&amp;quot;14&amp;quot;&amp;gt;OCEOSmp only uses the system log for problems that do not arise directly when a directive is used (problems that arise directly are described in the returned directive status code).&amp;lt;/li&amp;gt;&lt;br /&gt;
# Such problems fall into a number of categories&lt;br /&gt;
## System corruption is detected and/or oceos_exit is called a&lt;br /&gt;
## Excessive delays in obtaining system spin locks perhaps due to system overloading&lt;br /&gt;
## A timed action misses its specified time&lt;br /&gt;
## A task misses its deadlines&lt;br /&gt;
## Task start requests occur more frequently than expected&lt;br /&gt;
## A task exits without returning a mutex or read-write mutex that it holds&lt;br /&gt;
## Nested mutexes or read-write mutexes not returned in correct order&lt;br /&gt;
## Counts already at max or min&lt;br /&gt;
# In many cases when OCEOSmp makes a system log entry it also updates the system state variable. This is updated using ‘OR’ and so provides a long term record that a problem has occurred even if a log entry is overwritten. In addition, if the update corresponds to an application defined action mask and an application problem handling function is defined this is called automatically.&lt;br /&gt;
&lt;br /&gt;
== System State Variable ==&lt;br /&gt;
&lt;br /&gt;
[[File:SystemState.png|400px]]&lt;br /&gt;
&lt;br /&gt;
=== Purpose ===&lt;br /&gt;
&lt;br /&gt;
To record that certain conditions have occurred and to allow the ASW specify which conditions should cause an ASW defined problem handling function be triggered automatically when the state variable is updated due to these conditions.&lt;br /&gt;
&lt;br /&gt;
=== Structure ===&lt;br /&gt;
Four 32-bit words each containing 32 flags, some available for use by the ASW, some reserved for use by OCEOSmp&lt;br /&gt;
# system state variable		individual bits are set by ASW or by OCEOSmp &lt;br /&gt;
# accumulated system state	updated when system state flags are set &lt;br /&gt;
# action mask			set by ASW in application configuration &lt;br /&gt;
# action mask previous		previous value of action mask if changed by ASW&lt;br /&gt;
&lt;br /&gt;
=== Usage ===&lt;br /&gt;
# &amp;lt;li value=&amp;quot;5&amp;quot;&amp;gt;the system state variable is updated using inclusive ‘OR’ to set the desired flag&amp;lt;/li&amp;gt;&lt;br /&gt;
# the accumulated system state flag is set when the corresponding system state flag is set&lt;br /&gt;
# on reset the system state variable is cleared to 0, all flags clear&lt;br /&gt;
# the accumulated system state variable is reset only by the ASW&lt;br /&gt;
# the action mask is set by the ASW, and causes an ASW defined problem handler to be called when a state flag is updated to 1 that corresponds to a set action mask flag. &lt;br /&gt;
&lt;br /&gt;
Whenever a system state variable flag is set during scheduling (using inclusive ‘OR’) the corresponding accumulated state flag is also set. Accumulated state flags are not affected when a system state flag is cleared to 0, whether by the ASW or on system reset. They can be cleared only directly by the ASW. They keep a record of events across system reset if memory is preserved.&lt;br /&gt;
&lt;br /&gt;
The action mask is specified in the application configuration, which then should also declare a problem handling function. The mask may be altered by the ASW during scheduling.&lt;br /&gt;
&lt;br /&gt;
The ASW problem handling function is called automatically by OCEOSmp as a result of setting a previously clear system state flag that corresponds to a flag that is set in the action mask. The system state flag is set before the function is called. If the system state flag is not reset by the ASW problem handler or otherwise then further settings of that system state flag will not cause the function to be called again.&lt;br /&gt;
&lt;br /&gt;
The ASW can use a system call to modify the action mask at any time, when this is done the previous value of the action mask is stored.&lt;br /&gt;
&lt;br /&gt;
The flags corresponding to the high sixteen bits of the system state variable are reserved for use by OCEOSmp:&lt;br /&gt;
&lt;br /&gt;
These primarily refer to problems that are not immediate consequences of the use of a directive (these are indicated in the returned error or warning status code), but that may occur subsequently during scheduling:&lt;br /&gt;
# &amp;lt;li value=&amp;quot;16&amp;quot;&amp;gt;reserved&amp;lt;/li&amp;gt;	&lt;br /&gt;
# reserved&lt;br /&gt;
# reserved&lt;br /&gt;
# reserved&lt;br /&gt;
# reserved&lt;br /&gt;
# Attempt to start pending task that has been disabled while pending.&lt;br /&gt;
# Time from task start request to job completion exceeds task deadline.&lt;br /&gt;
# Time between task start requests less than specified minimum for task&lt;br /&gt;
# Time between task start requests greater than specified maximum for task&lt;br /&gt;
# Missed latest time for transfer of job from timed action queue to scheduler.&lt;br /&gt;
# Missed latest time for performance of timed output.&lt;br /&gt;
# Mutex not returned before job terminates.&lt;br /&gt;
# Read/Write mutex not returned before job termination.&lt;br /&gt;
# System busy warning&lt;br /&gt;
# Data area sentinels corrupted.&lt;br /&gt;
# System meta pointer corrupted&lt;br /&gt;
&lt;br /&gt;
== System Policing and Problem Anticipation ==&lt;br /&gt;
&lt;br /&gt;
All design involves assumptions, and ‘System Policing’ refers to checking how close these come to being violated as the system operates, and to taking precautions if needed.&lt;br /&gt;
&lt;br /&gt;
The white box design of OCEOSmp facilitates this, with records kept automatically of task timing performances and other parameters that are accessible by the ASW at any time, including after OCEOSmp exits should this occur.&lt;br /&gt;
&lt;br /&gt;
These records can answer questions such as ‘what is the longest time this task took to execute’, ‘what is the shortest time between requests to start this task’, ‘what is the longest time between requests to start this task’, and many others, including stack usage.&lt;br /&gt;
&lt;br /&gt;
By checking such data the ASW can notice that behaviour is not as expected and that something is going wrong, allowing ‘Problem Anticipation’ and an issue being dealt with before it causes serious difficulties.&lt;br /&gt;
&lt;br /&gt;
The ASW might do this by having an external policing function running on a core not in use by OCEOSmp that periodically checks that things are as expected, or by having a policing task that is scheduled by OCEOSmp.&lt;br /&gt;
&lt;br /&gt;
With all the data stored statically in the ‘Log Area’, ‘Fixed Data Area’ and ‘Dynamic Data Area’ arrays by the ASW it is straightforward to retrieve it.&lt;br /&gt;
&lt;br /&gt;
OCEOSmp only requires one system stack per CPU core rather than one stack per thread. Each stack is initialised to a known value, making it straightforward to determine the greatest extent to which each stack has been used.&lt;br /&gt;
&lt;br /&gt;
If suspicious activity is detected, the ASW can for example disable a task or take a CPU core out of use or disable a peripheral or take other corrective action.&lt;br /&gt;
&lt;br /&gt;
It can also make a historical record of bad behaviour by adding an entry to the System Log and by updating a flag in the System State variable, When the System Log becomes ¾ full an ASW function if defined is called that can archive the System Log, and a shadow copy of the System State variable is automatically maintained that is only reset by the ASW itself.&lt;br /&gt;
&lt;br /&gt;
When multiple mutual exclusion semaphores are used by tasks the OCEOSmp design excludes the possibility of unbounded priority inversion and no check for this is needed.&lt;br /&gt;
&lt;br /&gt;
On multi-core systems deadlocks can occur but only if tasks fail to acquire mutual exclusion semaphores in a consistent order corresponding to their identity numbers. A warning status code is then returned although as yet no deadlock has occurred.&lt;br /&gt;
&lt;br /&gt;
The ASW can include a policing function that checks the execution times of tasks (in OCEOSmp tasks on other CPU cores spin waiting to acquire mutexes), and the time when a task start request was issued, allowing detection of deadlocks, livelocks, and task starvation.&lt;br /&gt;
&lt;br /&gt;
It should be noted that OCEOSmp itself may detect an anomaly and automatically make an entry in the System Log and may also update the System State variable, perhaps resulting in an ASW defined problem handling function being called, but this only happens after a problem has occurred and been detected. &lt;br /&gt;
&lt;br /&gt;
== Problem Detection and Handling ==&lt;br /&gt;
&lt;br /&gt;
[[File:PoliceJoke.png|600px]]&lt;br /&gt;
&lt;br /&gt;
This relates to what happens after a problem has occurred and been detected, as distinct from System Policing and Problem Anticipation which aims to forestall problems.&lt;br /&gt;
&lt;br /&gt;
The integrity tests carried out automatically by OCEOSmp check for a number of problems. Some are detected directly when an OCEOSmp directive is used, others when an event occurs such as a job completing execution, others when some internal operation of OCEOSmp does not proceed as expected. &lt;br /&gt;
&lt;br /&gt;
Problems that arise directly from the use or misuse of a directive are identified in the returned status code, and the ASW can then decide the appropriate action.&lt;br /&gt;
&lt;br /&gt;
If appropriate the ASW can disable or terminate tasks and take CPU cores out of use without disrupting scheduling, and can read and update the system log and system state variable. In an extreme case the ASW can end scheduling and return to main().&lt;br /&gt;
&lt;br /&gt;
# Typical directive problems&lt;br /&gt;
## Current phase doesn’t allow this directive&lt;br /&gt;
## Invalid parameters supplied&lt;br /&gt;
## Time for timed action already passed&lt;br /&gt;
## Write fail, data queue full&lt;br /&gt;
## Write succeeded, data queue now full (warning) &lt;br /&gt;
## Mutexes or rwmutexes acquired in an incorrect order (warning)&lt;br /&gt;
&lt;br /&gt;
Other problems may be identified automatically be OCEOSmp after a directive has been used or when an event occurs, or during internal OCEOSmp operations&lt;br /&gt;
Such problems include:&lt;br /&gt;
# &amp;lt;li value=&amp;quot;2&amp;quot;&amp;gt;Unexpected patterns of events&amp;lt;/li&amp;gt;&lt;br /&gt;
## Task misses a deadline&lt;br /&gt;
## Task start requests occur more frequently than expected&lt;br /&gt;
## Task start requests occur less frequently than expected&lt;br /&gt;
## Task disabled after being put on a pending queue&lt;br /&gt;
## Spin locks not being available in a reasonable time&lt;br /&gt;
## Action time missed&lt;br /&gt;
## Pending queues being full&lt;br /&gt;
&lt;br /&gt;
These problems typically cause a system log entry to be made, may update the system state variable and may result in an ASW defined problem handling function being called. This has full access to the performance records and can enable or disable tasks and take CPU cores out of use or restore them to use without disrupting scheduling, and can exit from OCEOSmp if appropriate.&lt;br /&gt;
&lt;br /&gt;
Other problems that may be automatically detected by OCEOSmp include&lt;br /&gt;
# &amp;lt;li value=&amp;quot;3&amp;quot;&amp;gt;Corruption of critical data&amp;lt;/li&amp;gt;&lt;br /&gt;
## Perhaps due to hardware failures&lt;br /&gt;
## Perhaps by application software malfunctioning and overwriting data&lt;br /&gt;
## Perhaps by a bug in OCEOSmp&lt;br /&gt;
&lt;br /&gt;
These problems typically result in exit from OCEOSmp and return to main() at the point immediately after oceos_start() was used. The system state variable and system log may also be updated.&lt;br /&gt;
&lt;br /&gt;
It should be noted that the checks made by OCEOSmp only occur as a result of it being notified of some change in the state of the system, as when a directive is used or a job terminates or an interrupt occurs. It is recommended that these be added to by taking appropriate precautions.&lt;br /&gt;
&lt;br /&gt;
== Precautions and Correction ==&lt;br /&gt;
&lt;br /&gt;
[[File:Precaution.png|600px]]&lt;br /&gt;
&lt;br /&gt;
A primary precaution is policing. As described above this typically involves assigning a CPU core to check the activities of the system, or perhaps assigning a task to that purpose. Anticipation and prevention are better than detection.&lt;br /&gt;
&lt;br /&gt;
Further precautions are also possible, depending on the hardware available in the system. These can detect or perhaps even prevent various malfunctions. &lt;br /&gt;
&lt;br /&gt;
=== Hardware Malfunctions ===&lt;br /&gt;
These can be caused by radiation or other external factors, or simply by parts of the system wearing out.&lt;br /&gt;
&lt;br /&gt;
They fall into three main categories, memory hardware malfunctions, CPU core malfunctions, and peripheral or connected device malfunctions.&lt;br /&gt;
&lt;br /&gt;
==== Memory hardware malfunctions ====&lt;br /&gt;
&lt;br /&gt;
These typically result in one or more bits in a memory location being set to incorrect values.&lt;br /&gt;
&lt;br /&gt;
If the error involve no more than a certain number of bits (BCH 1, RS fixed &amp;gt; 1) then EDAC allows a memory location containing such errors be read correctly despite the error.&lt;br /&gt;
&lt;br /&gt;
While the value read is correct the error remains in the location until the correct value is written back. This should be done before a further bit becomes corrupted, perhaps making the error un-correctable. In some systems this write back is done automatically. &lt;br /&gt;
&lt;br /&gt;
Long intervals can occur between uses of a memory location making ‘memory scrubbing’ necessary. This cycles through all memory locations, reading and writing back if needed, doing so often enough to make it very unlikely that an un-correctable number of erroneous bits will accumulate in any location.&lt;br /&gt;
&lt;br /&gt;
Usually a hardware ‘memory scrubber‘ is available that can be configured to do this at a certain rate for a certain range of addresses.&lt;br /&gt;
&lt;br /&gt;
Memory read errors can still occur however. A combination of bit errors can defeat EDAC error detection and lead to an incorrect value being read. Usually however such un-correctable errors are detected by EDAC causing it to raise an exception. The corresponding handler must then take appropriate action, which may include terminating OCEOSmp.&lt;br /&gt;
&lt;br /&gt;
Precautions: Before starting OCEOSmp &lt;br /&gt;
# The handler for EDAC detected un-correctable errors should be put in place&lt;br /&gt;
# The memory should be initialized&lt;br /&gt;
# The EDAC system configured and put into operation&lt;br /&gt;
# The EDAC memory scrubber hardware configured and put into operation&lt;br /&gt;
&lt;br /&gt;
Once this has been done and OCEOSmp started&lt;br /&gt;
# &amp;lt;li value=&amp;quot;5&amp;quot;&amp;gt;The EDAC exception handler can &amp;lt;/li&amp;gt;	&lt;br /&gt;
## Update the system log&lt;br /&gt;
## Update the system state variable&lt;br /&gt;
## Start a problem handling task&lt;br /&gt;
## If necessary call oceos_exit() to return to main()&lt;br /&gt;
&lt;br /&gt;
==== Computer core hardware malfunctions ====&lt;br /&gt;
&lt;br /&gt;
Cores may use triple modular redundancy and other techniques to reduce the effects of transient errors, but nevertheless can become faulty. If this is detected in a multi-core system OCEOSmp allows the faulty core be taken out of use without scheduling being disrupted.&lt;br /&gt;
&lt;br /&gt;
Detecting that a core has become faulty can be done using computational tasks for which the results including timings are known. Before such tests are used however a malfunction may have led to an erroneous result being used. &lt;br /&gt;
&lt;br /&gt;
To avoid this when result accuracy is critical and immediately needed it is possible in OCEOSmp to have multiple CPU cores carry out the same computation at the same time (within a few clock cycles). &lt;br /&gt;
&lt;br /&gt;
The results can then be compared and the majority agreed value used. A core that was at fault can be tested and taken out of use if the problem is judged not to be transient.&lt;br /&gt;
&lt;br /&gt;
Precaution: Check periodically that cores carry out a computational test correctly.&lt;br /&gt;
# &amp;lt;li value=&amp;quot;6&amp;quot;&amp;gt;oceosmp_cpu_disable() will take the specified CPU core out of use, put it to sleep, and cause the termination functions of any jobs executing on the core be executed on a different core.&amp;lt;/li&amp;gt; &lt;br /&gt;
# oceosmp_cpu_enable() will make the specified CPU core available for use&lt;br /&gt;
&lt;br /&gt;
These directives can also be used to manage the number of active cores for power saving or other purposes. Scheduling is not disrupted as long as a functioning core remains.&lt;br /&gt;
&lt;br /&gt;
==== Peripheral Hardware Malfunctions ====&lt;br /&gt;
&lt;br /&gt;
These can arise due to a fault in the peripheral unit itself, or due to problems in an external system for which the peripheral is an interface.&lt;br /&gt;
&lt;br /&gt;
Before starting OCEOSmp the ASW should carry out appropriate checks of all peripheral units, and should ensure that such checks can be carried out if necessary by tasks after scheduling has begun.&lt;br /&gt;
&lt;br /&gt;
Faults in external systems for which a peripheral unit is an interface tend to either&lt;br /&gt;
# cause no messages to be sent to the interface&lt;br /&gt;
# cause messages to be sent too frequently&lt;br /&gt;
&lt;br /&gt;
In most cases when a peripheral receives an external message it causes an interrupt which then causes a request to start a task.&lt;br /&gt;
&lt;br /&gt;
If the interval between such task start requests is longer than expected this may indicate that the peripheral device has become faulty and is no longer operational.&lt;br /&gt;
&lt;br /&gt;
If the interval between such task start requests is shorter than expected it may indicate the frequency of external events exceeding expectations or some fault in the peripheral device.&lt;br /&gt;
&lt;br /&gt;
In both cases on starting the task OCEOSmp automatically checks the interval since the last task start request and if this is less than the expected minimum or greater than the expected maximum will make a system log entry and set the corresponding flag in the system state variable. If the ASW has set the corresponding system state action flag and defined a problem handling function this will result in the ASW problem handling function being called.&lt;br /&gt;
 &lt;br /&gt;
Precautions: &lt;br /&gt;
	In the ASW configuration structure passed to oceos_init() the ASW set the desired flags in the problem action mask and define a problem handling function.   &lt;br /&gt;
&lt;br /&gt;
=== Software Malfunctions ===&lt;br /&gt;
&lt;br /&gt;
Certain types of software errors can cause problems for the system as a whole.&lt;br /&gt;
&lt;br /&gt;
OCEOSmp automatically checks for some of these, others are best checked for by the ASW itself, perhaps as part of system policing.&lt;br /&gt;
&lt;br /&gt;
In addition to policing, various precautions can be taken against these problems, including making use of any memory protection hardware available and using a system watchdog timer.&lt;br /&gt;
&lt;br /&gt;
==== Invalid memory overwriting ====&lt;br /&gt;
&lt;br /&gt;
Application software may inadvertently overwrite memory areas used by OCEOSmp.&lt;br /&gt;
&lt;br /&gt;
The three memory areas used by OCEOSmp are each protected at their ends by constant sentinels. Each time a directive is used or job terminates OCEOSmp checks these sentinels to ensure that the areas involved have not been encroached upon. If so OCEOSmp will exit.&lt;br /&gt;
&lt;br /&gt;
In addition to its sentinels the fixed data area has an XOR checksum which allows any alteration be detected. This is not checked automatically by OCEOSmp for reasons of efficiency, but can be checked at any time by ASW policing software.&lt;br /&gt;
&lt;br /&gt;
Prevention is better than detection and if a system has a memory protection unit this should be configured to make the fixed area read-only. Any attempt to write this area will then typically cause the protection unit to raise an exception.&lt;br /&gt;
&lt;br /&gt;
Each CPU core has its own system stack. These form part of a contiguous block of statically allocated memory, and a software error may result in the code running on a core overrunning that core’s stack and attempting to use the stack memory of another core.&lt;br /&gt;
&lt;br /&gt;
This can be detected in policing by checking that filler still remains at the top and bottom of each core’s stack, and this can be checked at any time by ASW policing software, but prevention is better than detection.&lt;br /&gt;
 &lt;br /&gt;
Precautions: Any hardware memory protection present should be used on completion of oceos_init_finish() and before oceos_start() to provide these features.&lt;br /&gt;
# Read only (the fixed data area)&lt;br /&gt;
# Writeable only by a specific computer core (for each core’s stack)&lt;br /&gt;
 &lt;br /&gt;
Invalid attempts to use a memory location typically give rise to an exception and an appropriate handler must be in place.&lt;br /&gt;
&lt;br /&gt;
==== Invalid use of Mutual Exclusion Semaphores (Mutexes) or of Read-Write Mutexes ====&lt;br /&gt;
&lt;br /&gt;
In general the time for which the ASW holds a mutex or read-write mutex should be as short as possible.&lt;br /&gt;
&lt;br /&gt;
This time can be estimated at compile time and the estimates taken into account in determining whether a set of tasks can be scheduled so that tasks always meet their deadlines.&lt;br /&gt;
&lt;br /&gt;
Such estimates however can be made wrong by events that occur during scheduling if appropriate precautions are not taken.&lt;br /&gt;
&lt;br /&gt;
One possible problem, unbounded priority inversion, arises when a job holding a mutex is pre-empted by a higher priority task that does not use the mutex, causing any even higher priority task that uses the mutex to wait indefinitely for the low priority job to resume and release the mutex. In OCEOSmp unbounded priority inversion cannot occur. &lt;br /&gt;
&lt;br /&gt;
Another problem, deadlock, can arise when two or more jobs each acquire more than one mutex. A job while holding a mutex may then attempt to acquire a different mutex currently held by some other job. If that other job (without releasing the mutex it holds) attempts to acquire the mutex held by the first job neither job can make progress, the jobs are deadlocked.&lt;br /&gt;
&lt;br /&gt;
These problems are addressed by the design of OCEOSmp.&lt;br /&gt;
&lt;br /&gt;
In OCEOSmp each mutex or read-write mutex has a priority ceiling giving the priority of the highest priority task that uses it. This constant is determined at compile time and set for each mutex when it is created.&lt;br /&gt;
&lt;br /&gt;
In scheduling, once a job running on a CPU core holds one or more mutexes or read-write mutexes only tasks with higher priority than the highest ceiling are allowed to pre-empt the job and start running on that core.&lt;br /&gt;
&lt;br /&gt;
As a result unbounded priority inversion cannot occur, and on single core systems deadlocks also are not possible.&lt;br /&gt;
&lt;br /&gt;
On multi-core systems jobs can spin waiting to acquire a mutex held by a job running on a different core and deadlock becomes possible.&lt;br /&gt;
&lt;br /&gt;
In OCEOSmp mutexes and read-write mutexes are assigned a sequential order as they are created. Deadlocks then cannot occur if jobs always respect this order in acquiring mutexes, never attempting to acquire a mutex or read-write mutex if already holding one that is higher in the order.&lt;br /&gt;
&lt;br /&gt;
OCEOSmp does not prevent jobs from acquiring multiple mutexes in an out of order manner but returns a warning directive status code to the job indicating that deadlock is possible and makes a log entry and updates the system state variable, perhaps causing an ASW defined problem handling function to be called.&lt;br /&gt;
&lt;br /&gt;
When a job simultaneously holds multiple mutexes or read-write mutexes it should acquire and return these in a LIFO manner, e.g. waitA, waitB, waitC…..signalC, signalB, signalA. Failure to do so may affect task scheduling temporarily and will result in a warning directive status code, a log entry, and an update of the system state variable.&lt;br /&gt;
&lt;br /&gt;
Other errors in using mutexes such as failure to release a mutex before a job ends or attempting to release a mutex that is not held give rise to an appropriate directive status codes, a log entry, and a system state variable updates.&lt;br /&gt;
&lt;br /&gt;
Precautions: &lt;br /&gt;
# Ensure at compile time that when a task acquires multiple mutexes or read-write mutexes it always does so in the correct order.&lt;br /&gt;
# Ensure at compile time that when a job releases multiple mutexes or read-write mutexes it always does so in the reverse order to that in which they were acquired&lt;br /&gt;
&lt;br /&gt;
==== Deadlocks, Livelocks and Task Starvation ====&lt;br /&gt;
&lt;br /&gt;
Deadlocks arise primarily due to misuse of mutual exclusion semaphores or read write mutual exclusion semaphores, as described above.&lt;br /&gt;
&lt;br /&gt;
Livelocks, where tasks interact in a way that results in each task having to return to some earlier point with no or very little overall progress, can arise in a number of ways including from attempts to resolve a deadlock so that the tasks involved can proceed.&lt;br /&gt;
&lt;br /&gt;
Task starvation arises when a task is ready to start, but CPU time is not allocated to it within a reasonable time. In OCEOSmp this will occur for a low priority task if higher priority tasks are always ready to run and require all the available CPU cores. &lt;br /&gt;
&lt;br /&gt;
Task starvation, to at least some degree, can also occur for a high priority task if the resources required to allow it pre-empt a lower priority task are not available on the CPU core involved, as for example when the remaining system stack for that core is below the level needed for pre-emption.&lt;br /&gt;
&lt;br /&gt;
All three of these problems result in a task or tasks taking longer to complete than should be the case. This can be detected in two main ways&lt;br /&gt;
# By a policing task that periodically checks each task record in the dynamic area to determine the maximum time between a request to start it and task completion. &lt;br /&gt;
# By watchdog timer hardware that typically is reset periodically by the lowest priority task and which will cause a hardware system reset if its pre-set time elapses before it is reset. On re-entry to main() the ASW can check to determine if this has occurred before restarting OCEOSmp.&lt;br /&gt;
&lt;br /&gt;
Precautions&lt;br /&gt;
# &amp;lt;li value=&amp;quot;3&amp;quot;&amp;gt;ensure each CPU core has adequate system stack so that a lower priority task running on the core can always be pre-empted by a higher priority task. The amount required can be calculated from the number of different priority levels in use.&amp;lt;/li&amp;gt;&lt;br /&gt;
# if watchdog timer hardware is available set up a low priority task to periodically reset it. The ASW should check on entry to main() whether this was due to a watchdog timeout and if so use the OCEOSmp data to determine the cause and appropriate remedial action before restarting OCEOSmp.&lt;br /&gt;
# set up a policing task that checks the execution times of current tasks and detects when this is too long. This task can call an ASW defined problem handling function that can determine how best to deal with the situation, perhaps calling the termination functions of some currently executing tasks, disabling some tasks or changing interrupt intervals.&lt;br /&gt;
# If necessary reserve certain CPU cores to use only by higher priority tasks, perhaps ensuring that there is always at least one CPU core ready to be used immediately by such tasks.&lt;br /&gt;
&lt;br /&gt;
== Summary ==&lt;br /&gt;
&lt;br /&gt;
[[File:MurphysLaw.png|400px]]&lt;br /&gt;
&lt;br /&gt;
Murphy’s Law, ‘if things can go wrong they will’, has had a significant impact on the design of OCEOSmp. &lt;br /&gt;
&lt;br /&gt;
An older maxim ‘the wise man avoids evil by anticipating it’ (Publilius Cyrus) has also had an impact. Software can go wrong without prior indication of stress but it may be possible to notice that all is not well before disaster strikes. Avoidance is better than detection.&lt;br /&gt;
&lt;br /&gt;
These ideas have led to OCEOSmp having features that allow fault anticipation, detection, isolation and recovery, with a white box approach that simplifies system policing and checking behaviour against expectations and with memory statically allocated.&lt;br /&gt;
&lt;br /&gt;
When a problem is found OCEOSmp can take CPU cores out of use or kill or disable tasks without disrupting scheduling, or in severe cases exit and return to the ASW main() with all data still accessible for analysis or download, and with the ASW able to make changes and restart OCEOSmp if desired.&lt;br /&gt;
&lt;br /&gt;
These features help ensure that OCEOSmp is suitable for use in safety critical or other systems that require the highest reliability.&lt;br /&gt;
&lt;br /&gt;
Even where it is hoped that nothing can possibly go wrong….&lt;br /&gt;
&lt;br /&gt;
= &amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;'''System Log'''&amp;lt;/span&amp;gt; =&lt;br /&gt;
&lt;br /&gt;
== Purpose ==&lt;br /&gt;
#Provide application software with the ability to make time stamped records of events for use in application performance monitoring and in application debugging&lt;br /&gt;
#Provide OCEOSmp with the ability to record internal anomalies should these be detected.&lt;br /&gt;
&lt;br /&gt;
== Structure ==&lt;br /&gt;
#A circular buffer with a fixed size that is set in the application configuration&lt;br /&gt;
#Size from 16 to 1024 entries, default 64 if not specified&lt;br /&gt;
#If the application defines oceosmp_on_full_log(void *) this is called automatically when the buffer becomes ¾ full, allowing log entries that might otherwise be overwritten be stored. The automatic call will reoccur only after the buffer becomes ¾ empty.&lt;br /&gt;
#On system reset log entries are not overwritten and buffer indices are reset so as to postpone recent entries being overwritten and allow review of events prior to the reset.&lt;br /&gt;
&lt;br /&gt;
== Storage ==&lt;br /&gt;
#Stored statically in the oceosmp_log_area, which also contains the next-read and next-write buffer indices and the system state related variables.&lt;br /&gt;
#The log size and the oceosmp_on_full() function declaration are stored in the oceosmp_fixed_area, as also are the  log area addresses.&lt;br /&gt;
#Log entry format (from system_log.h): &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
Struct log_entry{&lt;br /&gt;
 	U64_t		time64;&lt;br /&gt;
 	unsigned int       current_cpu_id		:8;&lt;br /&gt;
 	unsigned int	entry_type		:8;&lt;br /&gt;
 	U32_t		entry_comment;&lt;br /&gt;
} __attribute__ ((aligned (8));&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt; &lt;br /&gt;
# &amp;lt;li value=&amp;quot;4&amp;quot;&amp;gt;When a log entry is made, time64 and current_cpu_id are set automatically by OCEOSmp.&amp;lt;/li&amp;gt;&lt;br /&gt;
#The entry type is an enum defined by the application, with a subset of enum values reserved for use by OCEOSmp. The reserved enum values are specified in system_log.h.&lt;br /&gt;
#The entry_comment allows noting further information on the current situation&lt;br /&gt;
&lt;br /&gt;
== Associated directives ==&lt;br /&gt;
#Add Log Entry&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t 	oceos_log_add_entry(&lt;br /&gt;
 	 	enum LOG_ENTRY_TYPE type, // 8 bit enum LOG_ENTRY_TYPE&lt;br /&gt;
 	 	const U32_t info 		// further information&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt; &lt;br /&gt;
This adds an entry, overwriting the currently oldest entry.&lt;br /&gt;
&lt;br /&gt;
# &amp;lt;li value=&amp;quot;2&amp;quot;&amp;gt;Remove Log Entry&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t oceos_log_remove_entry(&lt;br /&gt;
 		struct log_entry * const outputPtr&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This returns the oldest unread entry to outputPtr and updates the buffer indices&lt;br /&gt;
&lt;br /&gt;
#Other directives are detailed in system_log.h&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
== Usage by OCEOSmp itself ==&lt;br /&gt;
#OCEOSmp only uses the system log for problems that do not arise directly when a directive is used (problems that arise directly are described in the returned directive status code).&lt;br /&gt;
#Such problems fall into a number of categories&lt;br /&gt;
## System corruption is detected and/or oceos_exit is called a&lt;br /&gt;
## Excessive delays in obtaining system spin locks perhaps due to system overloading&lt;br /&gt;
## A timed action misses its specified time&lt;br /&gt;
## A task misses its deadlines&lt;br /&gt;
## Task start requests occur more frequently than expected&lt;br /&gt;
## A task exits without returning a mutex or read-write mutex that it holds&lt;br /&gt;
## Nested mutexes or read-write mutexes not returned in correct order&lt;br /&gt;
## Counts already at max or min&lt;br /&gt;
#In many cases when OCEOSmp makes a system log entry it also updates the system state variable. This is updated using ‘OR’ and so provides a long term record that a problem has occurred even if a log entry is overwritten. In addition, if the update corresponds to an application defined action mask an application defined problem handling function may be called which can if desired read the system log.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:backup]]&lt;/div&gt;</summary>
		<author><name>Bkavanagh</name></author>
	</entry>
	<entry>
		<id>https://wiki.ocetechnology.com/mediawiki/index.php?title=OCEOSmp/notes&amp;diff=1688</id>
		<title>OCEOSmp/notes</title>
		<link rel="alternate" type="text/html" href="https://wiki.ocetechnology.com/mediawiki/index.php?title=OCEOSmp/notes&amp;diff=1688"/>
		<updated>2024-05-03T15:26:09Z</updated>

		<summary type="html">&lt;p&gt;Bkavanagh: /* Storage */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= &amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;'''When things go wrong'''&amp;lt;/span&amp;gt; =&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Prof. M. Ryan'''&lt;br /&gt;
&lt;br /&gt;
Things can go wrong even when software is bug free.&lt;br /&gt;
&lt;br /&gt;
Misunderstandings may have led to an inadequate design, real world circumstances may conspire to cause performance problems, radiation or other factors may cause hardware failures, and in general things can always go wrong.&lt;br /&gt;
&lt;br /&gt;
Murphy’s Law then applies, and while the system is in use it is important that system behaviour can be monitored, deviations from expectations noticed, checks made, corrections done, and recovery steps taken if needed.&lt;br /&gt;
&lt;br /&gt;
OCEOSmp has been designed with Murphy’s Law in mind and facilitates such actions in a number of ways.&lt;br /&gt;
&lt;br /&gt;
# Servant not Master&lt;br /&gt;
# White Box not Black Box&lt;br /&gt;
# Directive warning and error status codes&lt;br /&gt;
# Automatic integrity checks&lt;br /&gt;
# System Log&lt;br /&gt;
# System state variable&lt;br /&gt;
# System Policing and Problem Anticipation&lt;br /&gt;
# Problem Detection and Handling&lt;br /&gt;
# Precautions and Correction&lt;br /&gt;
&lt;br /&gt;
== Servant not Master ==&lt;br /&gt;
&lt;br /&gt;
[[File:MasterNotSlave.png|400px]]&lt;br /&gt;
&lt;br /&gt;
Many operating systems begin execution directly after the boot sequence and control all subsequent execution of the application software (ASW). Should something go wrong it can be difficult to assess what has occurred and find appropriate corrective action, particularly if the operating system itself has been involved.&lt;br /&gt;
&lt;br /&gt;
With OCEOSmp the ASW begins execution before the operating system and only starts OCEOSmp at some point after entering main().&lt;br /&gt;
&lt;br /&gt;
Before doing so the ASW should check the circumstances that lead to main() being entered. If due to a system restart then the data accumulated by OCEOSmp in the previous run is still available in its fixed, dynamic, and log data areas for analysis or download to find the cause (assuming power has been maintained or non-volatile memory is used for those areas).&lt;br /&gt;
&lt;br /&gt;
The ASW can then make appropriate modifications, and continue as usual to set up EDAC, set up memory protection, initialise and check CPU cores and peripherals, and once all seems correct proceed to start or restart OCEOSmp.&lt;br /&gt;
&lt;br /&gt;
Once scheduling begins OCEOSmp returns to main() only if a fatal error is detected or if it is instructed to do so by an ASW task. Should this occur all the data accumulated is available for analysis or download by ASW main() code, which can restart scheduling by calling oceos_start().&lt;br /&gt;
 &lt;br /&gt;
Most problems can be dealt with by tasks set up to do so under the control of OCEOSmp, but sufficiently serious ones may cause a system reset (e.g. a watchdog timer running out) or cause OCEOSmp to exit (e.g. corruption of critical data), in both cases with the previous state available for analysis if power is maintained or if non-volatile memory is used.&lt;br /&gt;
&lt;br /&gt;
In main() the ASW takes five principal steps in starting OCEOSmp:&lt;br /&gt;
&lt;br /&gt;
# check whether the entry to main() is due to a restart (e.g. by checking if the OCEOSmp data area sentinels are already in place) and if so use the data areas to determine the cause and make whatever modifications to the system are appropriate.   &lt;br /&gt;
# use oceos_init() with the ASW configuration to set up the log area and prepare the fixed data area to hold various addresses, the number of CPU cores, tasks, mutexes, etc.&lt;br /&gt;
# use various OCEOSmp create functions to create tasks, mutexs etc.&lt;br /&gt;
# use oceos_init_finish() to check that the declared numbers of tasks etc. have been created, finish setting up the fixed data area, and set its checksum.&lt;br /&gt;
&lt;br /&gt;
At this point the fixed data area with fixed information about addresses, cores, tasks, mutexes, data queues etc. has been set up, and need not be set up again if not corrupted. The checksum allows the &lt;br /&gt;
area be checked at any time to ensure it has not been changed. Memory protection if available can make the fixed area read-only and make the stack addresses for each core restricted to being written &lt;br /&gt;
only by that core. &lt;br /&gt;
&lt;br /&gt;
Scheduling can begin.&lt;br /&gt;
&lt;br /&gt;
# &amp;lt;li value=&amp;quot;5&amp;quot;&amp;gt;use oceos_start() to initialise the dynamic data area and begins scheduling. This function usually does not return to main() but may do so if a major problem is detected.&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As scheduling progresses the ASW can use the system log to record events and monitor performance. The log is also used by OCEOSmp to record problems, and OCEOSmp may also make a system state entry and trigger an ASW problem handling function.&lt;br /&gt;
&lt;br /&gt;
If a problem is sufficiently serious OCEOSmp may exit automatically or may be requested to do so by an ASW task, execution then returns to main() at the point after the call to oceos_start() with all performance, log, stack and other data available for analysis or download.&lt;br /&gt;
 &lt;br /&gt;
The ASW main() code can then determine the reason for the unexpected return, take appropriate corrective action, and resume scheduling by calling oceos_start() or modify various settings and start over with oceos_init().&lt;br /&gt;
&lt;br /&gt;
The ASW uses OCEOSmp and remains the master, rather than the reverse.&lt;br /&gt;
&lt;br /&gt;
== White Box not Black Box ==&lt;br /&gt;
&lt;br /&gt;
[[File:WhiteboxNotBlackbox.png|800px]]&lt;br /&gt;
&lt;br /&gt;
The data used by OCEOSmp is stored in statically allocated memory in three data areas and in an overall stack area. These usually are specified by the ASW as arrays of 32-bit words and can be examined by the ASW at any time.&lt;br /&gt;
&lt;br /&gt;
The data includes actual and expected task maximum and minimum execution times, activities on CPU cores, and other records of what has been happening. These records can be readily examined by the ASW while scheduling is under way and after OCEOSmp exits should this occur.&lt;br /&gt;
&lt;br /&gt;
OCEOSmp configures each data area to begin with a 32-bit sentinel followed by its size measured in 32-bit words, then the corresponding data, and finally a 32-bit sentinel. In the case of the fixed data area a 32-bit XOR checksum is located before the end sentinel.&lt;br /&gt;
&lt;br /&gt;
The size of each data area and the layout of the data within it depends on the application configuration, but are clearly specified with the location of each data item identified.&lt;br /&gt;
&lt;br /&gt;
Whenever an OCEOSmp directive is used a quick check is made that sentinels have not been breached. The ASW itself can check the fixed area checksum at any time (this is not done automatically for reasons of efficiency).&lt;br /&gt;
&lt;br /&gt;
The Log Area is initialized by oceos_init() and contains the system log and system state variable and if used the optional context switch log. Directives are provided to access and update these. The size of the area depends on the number of entries specified for the two logs in the system configuration. Log contents are preserved across system reset and across power failures if stored in non-volatile memory. &lt;br /&gt;
&lt;br /&gt;
The Fixed Data Area is completed by oceos_init_finish() and contains all the constants of the system, such as the addresses of data areas and stacks, the identity of the CPU core that OCEOSmp is to use on startup, the number of cores, tasks etc., the priorities and other attributes of tasks etc. &lt;br /&gt;
&lt;br /&gt;
The Dynamic Data area is created and initialized by oceos_start() and contains the information collected as oceosmp schedules tasks and as mutexes, counting semaphores,  etc. are used. This information is available for inspection by the ASW if OCEOSmp exits, and is only overwritten if the ASW again calls oceos_start().&lt;br /&gt;
&lt;br /&gt;
In OCEOSmp each CPU core has a system stack, a stack for each thread is not required. The stack size per CPU core and the location of the overall top of stack is specified in the application configuration and the overall stack space is statically allocated.&lt;br /&gt;
&lt;br /&gt;
Before scheduling begins OCEOSmp initialises each core’s stack with a filler. This is overwritten as the stack is used and by checking how much memory at the top and bottom of each stack still contains the filler it is possible to determine at any point how close the system has come to a stack overrun.&lt;br /&gt;
&lt;br /&gt;
The white box approach of making all records and the system stacks readily accessible while scheduling is taking place and should OCEOSmp exit facilitates checking that the system is performing as expected and determining the causes of any problems that may occur.&lt;br /&gt;
&lt;br /&gt;
== Directive warning and error status codes ==&lt;br /&gt;
&lt;br /&gt;
[[File:WarningErrorIcon.png|400px]]&lt;br /&gt;
&lt;br /&gt;
The ASW uses OCEOSmp by calling its directives, and is responsible for checking the returned directive status code. (OCEOSmp is a statically linked library, only those components related to the directives used by the ASW are linked into the final executable.)&lt;br /&gt;
&lt;br /&gt;
The system time directives oceos_time_sys_get64() and oceos_time_sys_get32() directly return the requested system time as 64-bit or 32-bit unsigned integers.&lt;br /&gt;
&lt;br /&gt;
Other directives return a 32-bit signed integer status code.&lt;br /&gt;
&lt;br /&gt;
This should always be checked when a directive is used.&lt;br /&gt;
&lt;br /&gt;
The status code indicates ERROR, SUCCESS, or WARNING.&lt;br /&gt;
&lt;br /&gt;
* A negative value indicates that the directive has not executed and gives the reasons&lt;br /&gt;
* A zero value indicates successful execution as expected&lt;br /&gt;
* A non-zero positive value indicates that the directive executed but with warnings&lt;br /&gt;
&lt;br /&gt;
Certain bits in the status code have the same meaning for all directives.&lt;br /&gt;
&lt;br /&gt;
Other bits have meanings that depend on the directive in use.&lt;br /&gt;
&lt;br /&gt;
These meanings are given in the header files associated with each directive as constants that can be compared with the status code to determine the types of errors or warnings involved.&lt;br /&gt;
&lt;br /&gt;
Errors typically involve an incorrect parameter to a directive, or an attempt to use a resource that is not available such as writing to a data queue that is already full.&lt;br /&gt;
&lt;br /&gt;
Warnings typically indicate that the directive has succeeded but that a danger has been created as when a task acquires multiple mutual exclusion semaphores out of order, or that a resource is now fully in use as when a write makes a data queue full.&lt;br /&gt;
&lt;br /&gt;
The task that used the directive and checked the returned status has full access to the data areas and stack areas in deciding the action to take, which may involve making a system log entry, starting a problem handling task, or in the worst case exiting from OCEOSmp and returning to main().&lt;br /&gt;
&lt;br /&gt;
In many situations the returned status code is the only indicator that is needed of directive success or failure. The ASW can then make a system log entry (automatically timestamped by OCEOSmp) for recording or performance analysis purposes if desired.&lt;br /&gt;
&lt;br /&gt;
In some situations OCEOSmp will make a system log entry automatically and may also update the system state variable, resulting in an ASW defined problem handling function being called if the corresponding flag has been set by the ASW in the system action flags.&lt;br /&gt;
&lt;br /&gt;
OCEOSmp may also automatically make a system log entry or take other actions when problems arise later, as when a task completion deadline is missed or a mutex is not returned.&lt;br /&gt;
&lt;br /&gt;
Irrespective of whatever other precautions may be taken, the first line of defence in using a directive is to check the returned status code.&lt;br /&gt;
&lt;br /&gt;
== Automatic integrity tests ==&lt;br /&gt;
&lt;br /&gt;
[[File:Automation.jpg|600px]]&lt;br /&gt;
&lt;br /&gt;
These are done automatically by OCEOSmp when a directive is used or an event occurs.&lt;br /&gt;
&lt;br /&gt;
They include checking that OCEOSmp data area sentinels are intact, and in the event of corruption may result in an exit from OCEOSmp and return to main().&lt;br /&gt;
&lt;br /&gt;
Directive parameters and the current system phase also are automatically checked when a directive is used, together with the availability of any required resources.&lt;br /&gt;
&lt;br /&gt;
Problems detected immediately when a directive is used result in an appropriate status code being returned to the ASW task that called the directive.&lt;br /&gt;
&lt;br /&gt;
Some problems, such as a task missing a deadline, do not occur immediately when a directive is used but only as scheduling proceeds. Such problems are checked for automatically by OCEOSmp.&lt;br /&gt;
&lt;br /&gt;
Checks include task completion times vs. deadlines, task start requests intervals vs. expected maxima and minima, mutual exclusion semaphore not being released before task completion, time taken to obtain spinlocks longer than expected (an indicator of system loading), and other problems. &lt;br /&gt;
&lt;br /&gt;
If a check fails in most cases a system log entry is made and the system state variable may be updated, possibly resulting in an ASW defined problem handler being called. In extreme cases OCEOSmp may exit and return to main().&lt;br /&gt;
&lt;br /&gt;
Overall the automatic integrity tests carried out by OCEOSmp itself include:&lt;br /&gt;
# System meta pointer intact&lt;br /&gt;
# Data area sentinel/s intact&lt;br /&gt;
# Task deadline not missed&lt;br /&gt;
# Task start request gap too short&lt;br /&gt;
# Task start request gap too long&lt;br /&gt;
# …&lt;br /&gt;
&lt;br /&gt;
It should be noted that these checks detect that a problem has happened. To anticipate problems and perhaps avoid them further checks can and should be done by the ASW as part of system policing.&lt;br /&gt;
&lt;br /&gt;
== System Log ==&lt;br /&gt;
&lt;br /&gt;
[[File:Logging.png|600px]]&lt;br /&gt;
&lt;br /&gt;
=== Purpose ===&lt;br /&gt;
&lt;br /&gt;
# Provide application software with the ability to make time stamped records of events for use in application performance monitoring and in application debugging&lt;br /&gt;
# Provide OCEOSmp with the ability to record anomalies should these be detected.&lt;br /&gt;
&lt;br /&gt;
=== Structure ===&lt;br /&gt;
&lt;br /&gt;
# &amp;lt;li value=&amp;quot;3&amp;quot;&amp;gt;A circular buffer with a fixed size that is set in the application configuration&amp;lt;/li&amp;gt; &lt;br /&gt;
# Size from 16 to 1024 entries, default 64 if size not specified&lt;br /&gt;
# If the application defines oceosmp_on_full_log(void *) this is called automatically when the buffer becomes ¾ full, allowing log entries that might otherwise be overwritten be archived. The automatic call will reoccur only after the buffer becomes ¾ empty.&lt;br /&gt;
# Two indices determine the next log entry position to be read from or written to. On system reset these are left unchanged if valid so as to postpone recent entries being overwritten.&lt;br /&gt;
# Log entries are left unchanged until a system log write causes the current entry at the write index be overwritten. Reading the log returns the earliest entry not read so far. Directives are provided to allow any log entry be read and to reset the log indices.&lt;br /&gt;
&lt;br /&gt;
=== Storage ===&lt;br /&gt;
&lt;br /&gt;
#  &amp;lt;li value=&amp;quot;8&amp;quot;&amp;gt;Stored statically in the oceosmp_log_area, which also contains the next-read and next-write buffer indices and the system state related variables.&amp;lt;/li&amp;gt;&lt;br /&gt;
# The log size and the oceosmp_on_full() function declaration are stored in the oceosmp_fixed_area, as also are the  log area addresses.&lt;br /&gt;
&lt;br /&gt;
==== Log entry format (from system_log.h) ====&lt;br /&gt;
&lt;br /&gt;
 Struct log_entry{&lt;br /&gt;
  	U64_t time64;&lt;br /&gt;
  	unsigned int current_cpu_id :8;&lt;br /&gt;
  	unsigned int entry_type :8;&lt;br /&gt;
  	U32_t entry_comment;&lt;br /&gt;
 } __attribute__ ((aligned (8));&lt;br /&gt;
&lt;br /&gt;
# &amp;lt;li value=&amp;quot;10&amp;quot;&amp;gt;When a log entry is made, time64 and current_cpu_id are set automatically by OCEOSmp.&amp;lt;/li&amp;gt;&lt;br /&gt;
# The entry type is an enum defined by the application, with a subset of enum values reserved for use by OCEOSmp. The reserved enum values are specified in system_log.h.&lt;br /&gt;
# The ''entry_comment'' allows noting further information on the current situation&lt;br /&gt;
&lt;br /&gt;
==== Associated directives (from system_log.h) ====&lt;br /&gt;
# &amp;lt;li value=&amp;quot;13&amp;quot;&amp;gt;Add log entry&amp;lt;/li&amp;gt;&lt;br /&gt;
 S32_t 	oceos_log_add_entry(&lt;br /&gt;
 	 	enum LOG_ENTRY_TYPE type, // 8 bit enum LOG_ENTRY_TYPE&lt;br /&gt;
 	 	const U32_t info 		// further information&lt;br /&gt;
 );&lt;br /&gt;
&lt;br /&gt;
This adds an entry, overwriting the currently oldest entry.&lt;br /&gt;
&lt;br /&gt;
# &amp;lt;li value=&amp;quot;14&amp;quot;&amp;gt;Remove log entry&amp;lt;/li&amp;gt;&lt;br /&gt;
 S32_t oceos_log_remove_entry(&lt;br /&gt;
  		struct log_entry * const outputPtr&lt;br /&gt;
 );&lt;br /&gt;
&lt;br /&gt;
This returns the oldest unread entry to outputPtr and updates the buffer indices&lt;br /&gt;
&lt;br /&gt;
# &amp;lt;li value=&amp;quot;15&amp;quot;&amp;gt;Other log directives are detailed in system_log.h&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Usage by OCEOSmp itself&lt;br /&gt;
&lt;br /&gt;
# &amp;lt;li value=&amp;quot;14&amp;quot;&amp;gt;OCEOSmp only uses the system log for problems that do not arise directly when a directive is used (problems that arise directly are described in the returned directive status code).&amp;lt;/li&amp;gt;&lt;br /&gt;
# Such problems fall into a number of categories&lt;br /&gt;
## System corruption is detected and/or oceos_exit is called a&lt;br /&gt;
## Excessive delays in obtaining system spin locks perhaps due to system overloading&lt;br /&gt;
## A timed action misses its specified time&lt;br /&gt;
## A task misses its deadlines&lt;br /&gt;
## Task start requests occur more frequently than expected&lt;br /&gt;
## A task exits without returning a mutex or read-write mutex that it holds&lt;br /&gt;
## Nested mutexes or read-write mutexes not returned in correct order&lt;br /&gt;
## Counts already at max or min&lt;br /&gt;
# In many cases when OCEOSmp makes a system log entry it also updates the system state variable. This is updated using ‘OR’ and so provides a long term record that a problem has occurred even if a log entry is overwritten. In addition, if the update corresponds to an application defined action mask and an application problem handling function is defined this is called automatically.&lt;br /&gt;
&lt;br /&gt;
== System State Variable ==&lt;br /&gt;
&lt;br /&gt;
[[File:SystemState.png|400px]]&lt;br /&gt;
&lt;br /&gt;
=== Purpose ===&lt;br /&gt;
&lt;br /&gt;
To record that certain conditions have occurred and to allow the ASW specify which conditions should cause an ASW defined problem handling function be triggered automatically when the state variable is updated due to these conditions.&lt;br /&gt;
&lt;br /&gt;
=== Structure ===&lt;br /&gt;
Four 32-bit words each containing 32 flags, some available for use by the ASW, some reserved for use by OCEOSmp&lt;br /&gt;
# system state variable		individual bits are set by ASW or by OCEOSmp &lt;br /&gt;
# accumulated system state	updated when system state flags are set &lt;br /&gt;
# action mask			set by ASW in application configuration &lt;br /&gt;
# action mask previous		previous value of action mask if changed by ASW&lt;br /&gt;
&lt;br /&gt;
=== Usage ===&lt;br /&gt;
# &amp;lt;li value=&amp;quot;5&amp;quot;&amp;gt;the system state variable is updated using inclusive ‘OR’ to set the desired flag&amp;lt;/li&amp;gt;&lt;br /&gt;
# the accumulated system state flag is set when the corresponding system state flag is set&lt;br /&gt;
# on reset the system state variable is cleared to 0, all flags clear&lt;br /&gt;
# the accumulated system state variable is reset only by the ASW&lt;br /&gt;
# the action mask is set by the ASW, and causes an ASW defined problem handler to be called when a state flag is updated to 1 that corresponds to a set action mask flag. &lt;br /&gt;
&lt;br /&gt;
Whenever a system state variable flag is set during scheduling (using inclusive ‘OR’) the corresponding accumulated state flag is also set. Accumulated state flags are not affected when a system state flag is cleared to 0, whether by the ASW or on system reset. They can be cleared only directly by the ASW. They keep a record of events across system reset if memory is preserved.&lt;br /&gt;
&lt;br /&gt;
The action mask is specified in the application configuration, which then should also declare a problem handling function. The mask may be altered by the ASW during scheduling.&lt;br /&gt;
&lt;br /&gt;
The ASW problem handling function is called automatically by OCEOSmp as a result of setting a previously clear system state flag that corresponds to a flag that is set in the action mask. The system state flag is set before the function is called. If the system state flag is not reset by the ASW problem handler or otherwise then further settings of that system state flag will not cause the function to be called again.&lt;br /&gt;
&lt;br /&gt;
The ASW can use a system call to modify the action mask at any time, when this is done the previous value of the action mask is stored.&lt;br /&gt;
&lt;br /&gt;
The flags corresponding to the high sixteen bits of the system state variable are reserved for use by OCEOSmp:&lt;br /&gt;
&lt;br /&gt;
These primarily refer to problems that are not immediate consequences of the use of a directive (these are indicated in the returned error or warning status code), but that may occur subsequently during scheduling:&lt;br /&gt;
# &amp;lt;li value=&amp;quot;16&amp;quot;&amp;gt;reserved&amp;lt;/li&amp;gt;	&lt;br /&gt;
# reserved&lt;br /&gt;
# reserved&lt;br /&gt;
# reserved&lt;br /&gt;
# reserved&lt;br /&gt;
# Attempt to start pending task that has been disabled while pending.&lt;br /&gt;
# Time from task start request to job completion exceeds task deadline.&lt;br /&gt;
# Time between task start requests less than specified minimum for task&lt;br /&gt;
# Time between task start requests greater than specified maximum for task&lt;br /&gt;
# Missed latest time for transfer of job from timed action queue to scheduler.&lt;br /&gt;
# Missed latest time for performance of timed output.&lt;br /&gt;
# Mutex not returned before job terminates.&lt;br /&gt;
# Read/Write mutex not returned before job termination.&lt;br /&gt;
# System busy warning&lt;br /&gt;
# Data area sentinels corrupted.&lt;br /&gt;
# System meta pointer corrupted&lt;br /&gt;
&lt;br /&gt;
== System Policing and Problem Anticipation ==&lt;br /&gt;
&lt;br /&gt;
All design involves assumptions, and ‘System Policing’ refers to checking how close these come to being violated as the system operates, and to taking precautions if needed.&lt;br /&gt;
&lt;br /&gt;
The white box design of OCEOSmp facilitates this, with records kept automatically of task timing performances and other parameters that are accessible by the ASW at any time, including after OCEOSmp exits should this occur.&lt;br /&gt;
&lt;br /&gt;
These records can answer questions such as ‘what is the longest time this task took to execute’, ‘what is the shortest time between requests to start this task’, ‘what is the longest time between requests to start this task’, and many others, including stack usage.&lt;br /&gt;
&lt;br /&gt;
By checking such data the ASW can notice that behaviour is not as expected and that something is going wrong, allowing ‘Problem Anticipation’ and an issue being dealt with before it causes serious difficulties.&lt;br /&gt;
&lt;br /&gt;
The ASW might do this by having an external policing function running on a core not in use by OCEOSmp that periodically checks that things are as expected, or by having a policing task that is scheduled by OCEOSmp.&lt;br /&gt;
&lt;br /&gt;
With all the data stored statically in the ‘Log Area’, ‘Fixed Data Area’ and ‘Dynamic Data Area’ arrays by the ASW it is straightforward to retrieve it.&lt;br /&gt;
&lt;br /&gt;
OCEOSmp only requires one system stack per CPU core rather than one stack per thread. Each stack is initialised to a known value, making it straightforward to determine the greatest extent to which each stack has been used.&lt;br /&gt;
&lt;br /&gt;
If suspicious activity is detected, the ASW can for example disable a task or take a CPU core out of use or disable a peripheral or take other corrective action.&lt;br /&gt;
&lt;br /&gt;
It can also make a historical record of bad behaviour by adding an entry to the System Log and by updating a flag in the System State variable, When the System Log becomes ¾ full an ASW function if defined is called that can archive the System Log, and a shadow copy of the System State variable is automatically maintained that is only reset by the ASW itself.&lt;br /&gt;
&lt;br /&gt;
When multiple mutual exclusion semaphores are used by tasks the OCEOSmp design excludes the possibility of unbounded priority inversion and no check for this is needed.&lt;br /&gt;
&lt;br /&gt;
On multi-core systems deadlocks can occur but only if tasks fail to acquire mutual exclusion semaphores in a consistent order corresponding to their identity numbers. A warning status code is then returned although as yet no deadlock has occurred.&lt;br /&gt;
&lt;br /&gt;
The ASW can include a policing function that checks the execution times of tasks (in OCEOSmp tasks on other CPU cores spin waiting to acquire mutexes), and the time when a task start request was issued, allowing detection of deadlocks, livelocks, and task starvation.&lt;br /&gt;
&lt;br /&gt;
It should be noted that OCEOSmp itself may detect an anomaly and automatically make an entry in the System Log and may also update the System State variable, perhaps resulting in an ASW defined problem handling function being called, but this only happens after a problem has occurred and been detected. &lt;br /&gt;
&lt;br /&gt;
== Problem Detection and Handling ==&lt;br /&gt;
&lt;br /&gt;
[[File:PoliceJoke.png|600px]]&lt;br /&gt;
&lt;br /&gt;
This relates to what happens after a problem has occurred and been detected, as distinct from System Policing and Problem Anticipation which aims to forestall problems.&lt;br /&gt;
&lt;br /&gt;
The integrity tests carried out automatically by OCEOSmp check for a number of problems. Some are detected directly when an OCEOSmp directive is used, others when an event occurs such as a job completing execution, others when some internal operation of OCEOSmp does not proceed as expected. &lt;br /&gt;
&lt;br /&gt;
Problems that arise directly from the use or misuse of a directive are identified in the returned status code, and the ASW can then decide the appropriate action.&lt;br /&gt;
&lt;br /&gt;
If appropriate the ASW can disable or terminate tasks and take CPU cores out of use without disrupting scheduling, and can read and update the system log and system state variable. In an extreme case the ASW can end scheduling and return to main().&lt;br /&gt;
&lt;br /&gt;
# Typical directive problems&lt;br /&gt;
## Current phase doesn’t allow this directive&lt;br /&gt;
## Invalid parameters supplied&lt;br /&gt;
## Time for timed action already passed&lt;br /&gt;
## Write fail, data queue full&lt;br /&gt;
## Write succeeded, data queue now full (warning) &lt;br /&gt;
## Mutexes or rwmutexes acquired in an incorrect order (warning)&lt;br /&gt;
&lt;br /&gt;
Other problems may be identified automatically be OCEOSmp after a directive has been used or when an event occurs, or during internal OCEOSmp operations&lt;br /&gt;
Such problems include:&lt;br /&gt;
# &amp;lt;li value=&amp;quot;2&amp;quot;&amp;gt;Unexpected patterns of events&amp;lt;/li&amp;gt;&lt;br /&gt;
## Task misses a deadline&lt;br /&gt;
## Task start requests occur more frequently than expected&lt;br /&gt;
## Task start requests occur less frequently than expected&lt;br /&gt;
## Task disabled after being put on a pending queue&lt;br /&gt;
## Spin locks not being available in a reasonable time&lt;br /&gt;
## Action time missed&lt;br /&gt;
## Pending queues being full&lt;br /&gt;
&lt;br /&gt;
These problems typically cause a system log entry to be made, may update the system state variable and may result in an ASW defined problem handling function being called. This has full access to the performance records and can enable or disable tasks and take CPU cores out of use or restore them to use without disrupting scheduling, and can exit from OCEOSmp if appropriate.&lt;br /&gt;
&lt;br /&gt;
Other problems that may be automatically detected by OCEOSmp include&lt;br /&gt;
# &amp;lt;li value=&amp;quot;3&amp;quot;&amp;gt;Corruption of critical data&amp;lt;/li&amp;gt;&lt;br /&gt;
## Perhaps due to hardware failures&lt;br /&gt;
## Perhaps by application software malfunctioning and overwriting data&lt;br /&gt;
## Perhaps by a bug in OCEOSmp&lt;br /&gt;
&lt;br /&gt;
These problems typically result in exit from OCEOSmp and return to main() at the point immediately after oceos_start() was used. The system state variable and system log may also be updated.&lt;br /&gt;
&lt;br /&gt;
It should be noted that the checks made by OCEOSmp only occur as a result of it being notified of some change in the state of the system, as when a directive is used or a job terminates or an interrupt occurs. It is recommended that these be added to by taking appropriate precautions.&lt;br /&gt;
&lt;br /&gt;
== Precautions and Correction ==&lt;br /&gt;
&lt;br /&gt;
[[File:Precaution.png|600px]]&lt;br /&gt;
&lt;br /&gt;
A primary precaution is policing. As described above this typically involves assigning a CPU core to check the activities of the system, or perhaps assigning a task to that purpose. Anticipation and prevention are better than detection.&lt;br /&gt;
&lt;br /&gt;
Further precautions are also possible, depending on the hardware available in the system. These can detect or perhaps even prevent various malfunctions. &lt;br /&gt;
&lt;br /&gt;
=== Hardware Malfunctions ===&lt;br /&gt;
These can be caused by radiation or other external factors, or simply by parts of the system wearing out.&lt;br /&gt;
&lt;br /&gt;
They fall into three main categories, memory hardware malfunctions, CPU core malfunctions, and peripheral or connected device malfunctions.&lt;br /&gt;
&lt;br /&gt;
==== Memory hardware malfunctions ====&lt;br /&gt;
&lt;br /&gt;
These typically result in one or more bits in a memory location being set to incorrect values.&lt;br /&gt;
&lt;br /&gt;
If the error involve no more than a certain number of bits (BCH 1, RS fixed &amp;gt; 1) then EDAC allows a memory location containing such errors be read correctly despite the error.&lt;br /&gt;
&lt;br /&gt;
While the value read is correct the error remains in the location until the correct value is written back. This should be done before a further bit becomes corrupted, perhaps making the error un-correctable. In some systems this write back is done automatically. &lt;br /&gt;
&lt;br /&gt;
Long intervals can occur between uses of a memory location making ‘memory scrubbing’ necessary. This cycles through all memory locations, reading and writing back if needed, doing so often enough to make it very unlikely that an un-correctable number of erroneous bits will accumulate in any location.&lt;br /&gt;
&lt;br /&gt;
Usually a hardware ‘memory scrubber‘ is available that can be configured to do this at a certain rate for a certain range of addresses.&lt;br /&gt;
&lt;br /&gt;
Memory read errors can still occur however. A combination of bit errors can defeat EDAC error detection and lead to an incorrect value being read. Usually however such un-correctable errors are detected by EDAC causing it to raise an exception. The corresponding handler must then take appropriate action, which may include terminating OCEOSmp.&lt;br /&gt;
&lt;br /&gt;
Precautions: Before starting OCEOSmp &lt;br /&gt;
# The handler for EDAC detected un-correctable errors should be put in place&lt;br /&gt;
# The memory should be initialized&lt;br /&gt;
# The EDAC system configured and put into operation&lt;br /&gt;
# The EDAC memory scrubber hardware configured and put into operation&lt;br /&gt;
&lt;br /&gt;
Once this has been done and OCEOSmp started&lt;br /&gt;
# &amp;lt;li value=&amp;quot;5&amp;quot;&amp;gt;The EDAC exception handler can &amp;lt;/li&amp;gt;	&lt;br /&gt;
## Update the system log&lt;br /&gt;
## Update the system state variable&lt;br /&gt;
## Start a problem handling task&lt;br /&gt;
## If necessary call oceos_exit() to return to main()&lt;br /&gt;
&lt;br /&gt;
==== Computer core hardware malfunctions ====&lt;br /&gt;
&lt;br /&gt;
Cores may use triple modular redundancy and other techniques to reduce the effects of transient errors, but nevertheless can become faulty. If this is detected in a multi-core system OCEOSmp allows the faulty core be taken out of use without scheduling being disrupted.&lt;br /&gt;
&lt;br /&gt;
Detecting that a core has become faulty can be done using computational tasks for which the results including timings are known. Before such tests are used however a malfunction may have led to an erroneous result being used. &lt;br /&gt;
&lt;br /&gt;
To avoid this when result accuracy is critical and immediately needed it is possible in OCEOSmp to have multiple CPU cores carry out the same computation at the same time (within a few clock cycles). &lt;br /&gt;
&lt;br /&gt;
The results can then be compared and the majority agreed value used. A core that was at fault can be tested and taken out of use if the problem is judged not to be transient.&lt;br /&gt;
&lt;br /&gt;
Precaution: Check periodically that cores carry out a computational test correctly.&lt;br /&gt;
# &amp;lt;li value=&amp;quot;6&amp;quot;&amp;gt;oceosmp_cpu_disable() will take the specified CPU core out of use, put it to sleep, and cause the termination functions of any jobs executing on the core be executed on a different core.&amp;lt;/li&amp;gt; &lt;br /&gt;
# oceosmp_cpu_enable() will make the specified CPU core available for use&lt;br /&gt;
&lt;br /&gt;
These directives can also be used to manage the number of active cores for power saving or other purposes. Scheduling is not disrupted as long as a functioning core remains.&lt;br /&gt;
&lt;br /&gt;
==== Peripheral Hardware Malfunctions ====&lt;br /&gt;
&lt;br /&gt;
These can arise due to a fault in the peripheral unit itself, or due to problems in an external system for which the peripheral is an interface.&lt;br /&gt;
&lt;br /&gt;
Before starting OCEOSmp the ASW should carry out appropriate checks of all peripheral units, and should ensure that such checks can be carried out if necessary by tasks after scheduling has begun.&lt;br /&gt;
&lt;br /&gt;
Faults in external systems for which a peripheral unit is an interface tend to either&lt;br /&gt;
# cause no messages to be sent to the interface&lt;br /&gt;
# cause messages to be sent too frequently&lt;br /&gt;
&lt;br /&gt;
In most cases when a peripheral receives an external message it causes an interrupt which then causes a request to start a task.&lt;br /&gt;
&lt;br /&gt;
If the interval between such task start requests is longer than expected this may indicate that the peripheral device has become faulty and is no longer operational.&lt;br /&gt;
&lt;br /&gt;
If the interval between such task start requests is shorter than expected it may indicate the frequency of external events exceeding expectations or some fault in the peripheral device.&lt;br /&gt;
&lt;br /&gt;
In both cases on starting the task OCEOSmp automatically checks the interval since the last task start request and if this is less than the expected minimum or greater than the expected maximum will make a system log entry and set the corresponding flag in the system state variable. If the ASW has set the corresponding system state action flag and defined a problem handling function this will result in the ASW problem handling function being called.&lt;br /&gt;
 &lt;br /&gt;
Precautions: &lt;br /&gt;
	In the ASW configuration structure passed to oceos_init() the ASW set the desired flags in the problem action mask and define a problem handling function.   &lt;br /&gt;
&lt;br /&gt;
=== Software Malfunctions ===&lt;br /&gt;
&lt;br /&gt;
Certain types of software errors can cause problems for the system as a whole.&lt;br /&gt;
&lt;br /&gt;
OCEOSmp automatically checks for some of these, others are best checked for by the ASW itself, perhaps as part of system policing.&lt;br /&gt;
&lt;br /&gt;
In addition to policing, various precautions can be taken against these problems, including making use of any memory protection hardware available and using a system watchdog timer.&lt;br /&gt;
&lt;br /&gt;
==== Invalid memory overwriting ====&lt;br /&gt;
&lt;br /&gt;
Application software may inadvertently overwrite memory areas used by OCEOSmp.&lt;br /&gt;
&lt;br /&gt;
The three memory areas used by OCEOSmp are each protected at their ends by constant sentinels. Each time a directive is used or job terminates OCEOSmp checks these sentinels to ensure that the areas involved have not been encroached upon. If so OCEOSmp will exit.&lt;br /&gt;
&lt;br /&gt;
In addition to its sentinels the fixed data area has an XOR checksum which allows any alteration be detected. This is not checked automatically by OCEOSmp for reasons of efficiency, but can be checked at any time by ASW policing software.&lt;br /&gt;
&lt;br /&gt;
Prevention is better than detection and if a system has a memory protection unit this should be configured to make the fixed area read-only. Any attempt to write this area will then typically cause the protection unit to raise an exception.&lt;br /&gt;
&lt;br /&gt;
Each CPU core has its own system stack. These form part of a contiguous block of statically allocated memory, and a software error may result in the code running on a core overrunning that core’s stack and attempting to use the stack memory of another core.&lt;br /&gt;
&lt;br /&gt;
This can be detected in policing by checking that filler still remains at the top and bottom of each core’s stack, and this can be checked at any time by ASW policing software, but prevention is better than detection.&lt;br /&gt;
 &lt;br /&gt;
Precautions: Any hardware memory protection present should be used on completion of oceos_init_finish() and before oceos_start() to provide these features.&lt;br /&gt;
# Read only (the fixed data area)&lt;br /&gt;
# Writeable only by a specific computer core (for each core’s stack)&lt;br /&gt;
 &lt;br /&gt;
Invalid attempts to use a memory location typically give rise to an exception and an appropriate handler must be in place.&lt;br /&gt;
&lt;br /&gt;
==== Invalid use of Mutual Exclusion Semaphores (Mutexes) or of Read-Write Mutexes ====&lt;br /&gt;
&lt;br /&gt;
In general the time for which the ASW holds a mutex or read-write mutex should be as short as possible.&lt;br /&gt;
&lt;br /&gt;
This time can be estimated at compile time and the estimates taken into account in determining whether a set of tasks can be scheduled so that tasks always meet their deadlines.&lt;br /&gt;
&lt;br /&gt;
Such estimates however can be made wrong by events that occur during scheduling if appropriate precautions are not taken.&lt;br /&gt;
&lt;br /&gt;
One possible problem, unbounded priority inversion, arises when a job holding a mutex is pre-empted by a higher priority task that does not use the mutex, causing any even higher priority task that uses the mutex to wait indefinitely for the low priority job to resume and release the mutex. In OCEOSmp unbounded priority inversion cannot occur. &lt;br /&gt;
&lt;br /&gt;
Another problem, deadlock, can arise when two or more jobs each acquire more than one mutex. A job while holding a mutex may then attempt to acquire a different mutex currently held by some other job. If that other job (without releasing the mutex it holds) attempts to acquire the mutex held by the first job neither job can make progress, the jobs are deadlocked.&lt;br /&gt;
&lt;br /&gt;
These problems are addressed by the design of OCEOSmp.&lt;br /&gt;
&lt;br /&gt;
In OCEOSmp each mutex or read-write mutex has a priority ceiling giving the priority of the highest priority task that uses it. This constant is determined at compile time and set for each mutex when it is created.&lt;br /&gt;
&lt;br /&gt;
In scheduling, once a job running on a CPU core holds one or more mutexes or read-write mutexes only tasks with higher priority than the highest ceiling are allowed to pre-empt the job and start running on that core.&lt;br /&gt;
&lt;br /&gt;
As a result unbounded priority inversion cannot occur, and on single core systems deadlocks also are not possible.&lt;br /&gt;
&lt;br /&gt;
On multi-core systems jobs can spin waiting to acquire a mutex held by a job running on a different core and deadlock becomes possible.&lt;br /&gt;
&lt;br /&gt;
In OCEOSmp mutexes and read-write mutexes are assigned a sequential order as they are created. Deadlocks then cannot occur if jobs always respect this order in acquiring mutexes, never attempting to acquire a mutex or read-write mutex if already holding one that is higher in the order.&lt;br /&gt;
&lt;br /&gt;
OCEOSmp does not prevent jobs from acquiring multiple mutexes in an out of order manner but returns a warning directive status code to the job indicating that deadlock is possible and makes a log entry and updates the system state variable, perhaps causing an ASW defined problem handling function to be called.&lt;br /&gt;
&lt;br /&gt;
When a job simultaneously holds multiple mutexes or read-write mutexes it should acquire and return these in a LIFO manner, e.g. waitA, waitB, waitC…..signalC, signalB, signalA. Failure to do so may affect task scheduling temporarily and will result in a warning directive status code, a log entry, and an update of the system state variable.&lt;br /&gt;
&lt;br /&gt;
Other errors in using mutexes such as failure to release a mutex before a job ends or attempting to release a mutex that is not held give rise to an appropriate directive status codes, a log entry, and a system state variable updates.&lt;br /&gt;
&lt;br /&gt;
Precautions: &lt;br /&gt;
# Ensure at compile time that when a task acquires multiple mutexes or read-write mutexes it always does so in the correct order.&lt;br /&gt;
# Ensure at compile time that when a job releases multiple mutexes or read-write mutexes it always does so in the reverse order to that in which they were acquired&lt;br /&gt;
&lt;br /&gt;
==== Deadlocks, Livelocks and Task Starvation ====&lt;br /&gt;
&lt;br /&gt;
Deadlocks arise primarily due to misuse of mutual exclusion semaphores or read write mutual exclusion semaphores, as described above.&lt;br /&gt;
&lt;br /&gt;
Livelocks, where tasks interact in a way that results in each task having to return to some earlier point with no or very little overall progress, can arise in a number of ways including from attempts to resolve a deadlock so that the tasks involved can proceed.&lt;br /&gt;
&lt;br /&gt;
Task starvation arises when a task is ready to start, but CPU time is not allocated to it within a reasonable time. In OCEOSmp this will occur for a low priority task if higher priority tasks are always ready to run and require all the available CPU cores. &lt;br /&gt;
&lt;br /&gt;
Task starvation, to at least some degree, can also occur for a high priority task if the resources required to allow it pre-empt a lower priority task are not available on the CPU core involved, as for example when the remaining system stack for that core is below the level needed for pre-emption.&lt;br /&gt;
&lt;br /&gt;
All three of these problems result in a task or tasks taking longer to complete than should be the case. This can be detected in two main ways&lt;br /&gt;
# By a policing task that periodically checks each task record in the dynamic area to determine the maximum time between a request to start it and task completion. &lt;br /&gt;
# By watchdog timer hardware that typically is reset periodically by the lowest priority task and which will cause a hardware system reset if its pre-set time elapses before it is reset. On re-entry to main() the ASW can check to determine if this has occurred before restarting OCEOSmp.&lt;br /&gt;
&lt;br /&gt;
Precautions&lt;br /&gt;
# &amp;lt;li value=&amp;quot;3&amp;quot;&amp;gt;ensure each CPU core has adequate system stack so that a lower priority task running on the core can always be pre-empted by a higher priority task. The amount required can be calculated from the number of different priority levels in use.&amp;lt;/li&amp;gt;&lt;br /&gt;
# if watchdog timer hardware is available set up a low priority task to periodically reset it. The ASW should check on entry to main() whether this was due to a watchdog timeout and if so use the OCEOSmp data to determine the cause and appropriate remedial action before restarting OCEOSmp.&lt;br /&gt;
# set up a policing task that checks the execution times of current tasks and detects when this is too long. This task can call an ASW defined problem handling function that can determine how best to deal with the situation, perhaps calling the termination functions of some currently executing tasks, disabling some tasks or changing interrupt intervals.&lt;br /&gt;
# If necessary reserve certain CPU cores to use only by higher priority tasks, perhaps ensuring that there is always at least one CPU core ready to be used immediately by such tasks.&lt;br /&gt;
&lt;br /&gt;
== Summary ==&lt;br /&gt;
&lt;br /&gt;
[[File:MurphysLaw.png|400px]]&lt;br /&gt;
&lt;br /&gt;
Murphy’s Law, ‘if things can go wrong they will’, has had a significant impact on the design of OCEOSmp. &lt;br /&gt;
&lt;br /&gt;
An older maxim ‘the wise man avoids evil by anticipating it’ (Publilius Cyrus) has also had an impact. Software can go wrong without prior indication of stress but it may be possible to notice that all is not well before disaster strikes. Avoidance is better than detection.&lt;br /&gt;
&lt;br /&gt;
These ideas have led to OCEOSmp having features that allow fault anticipation, detection, isolation and recovery, with a white box approach that simplifies system policing and checking behaviour against expectations and with memory statically allocated.&lt;br /&gt;
&lt;br /&gt;
When a problem is found OCEOSmp can take CPU cores out of use or kill or disable tasks without disrupting scheduling, or in severe cases exit and return to the ASW main() with all data still accessible for analysis or download, and with the ASW able to make changes and restart OCEOSmp if desired.&lt;br /&gt;
&lt;br /&gt;
These features help ensure that OCEOSmp is suitable for use in safety critical or other systems that require the highest reliability.&lt;br /&gt;
&lt;br /&gt;
Even where it is hoped that nothing can possibly go wrong….&lt;br /&gt;
&lt;br /&gt;
= &amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;'''System Log'''&amp;lt;/span&amp;gt; =&lt;br /&gt;
&lt;br /&gt;
== Purpose ==&lt;br /&gt;
#Provide application software with the ability to make time stamped records of events for use in application performance monitoring and in application debugging&lt;br /&gt;
#Provide OCEOSmp with the ability to record internal anomalies should these be detected.&lt;br /&gt;
&lt;br /&gt;
== Structure ==&lt;br /&gt;
#A circular buffer with a fixed size that is set in the application configuration&lt;br /&gt;
#Size from 16 to 1024 entries, default 64 if not specified&lt;br /&gt;
#If the application defines oceosmp_on_full_log(void *) this is called automatically when the buffer becomes ¾ full, allowing log entries that might otherwise be overwritten be stored. The automatic call will reoccur only after the buffer becomes ¾ empty.&lt;br /&gt;
#On system reset log entries are not overwritten and buffer indices are reset so as to postpone recent entries being overwritten and allow review of events prior to the reset.&lt;br /&gt;
&lt;br /&gt;
== Storage ==&lt;br /&gt;
#Stored statically in the oceosmp_log_area, which also contains the next-read and next-write buffer indices and the system state related variables.&lt;br /&gt;
#The log size and the oceosmp_on_full() function declaration are stored in the oceosmp_fixed_area, as also are the  log area addresses.&lt;br /&gt;
#Log entry format (from system_log.h): &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
Struct log_entry{&lt;br /&gt;
 	U64_t		time64;&lt;br /&gt;
 	unsigned int       current_cpu_id		:8;&lt;br /&gt;
 	unsigned int	entry_type		:8;&lt;br /&gt;
 	U32_t		entry_comment;&lt;br /&gt;
} __attribute__ ((aligned (8));&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt; &lt;br /&gt;
# &amp;lt;li value=&amp;quot;4&amp;quot;&amp;gt;When a log entry is made, time64 and current_cpu_id are set automatically by OCEOSmp.&amp;lt;/li&amp;gt;&lt;br /&gt;
#The entry type is an enum defined by the application, with a subset of enum values reserved for use by OCEOSmp. The reserved enum values are specified in system_log.h.&lt;br /&gt;
#The entry_comment allows noting further information on the current situation&lt;br /&gt;
&lt;br /&gt;
== Associated directives ==&lt;br /&gt;
#Add Log Entry&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t 	oceos_log_add_entry(&lt;br /&gt;
 	 	enum LOG_ENTRY_TYPE type, // 8 bit enum LOG_ENTRY_TYPE&lt;br /&gt;
 	 	const U32_t info 		// further information&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt; &lt;br /&gt;
This adds an entry, overwriting the currently oldest entry.&lt;br /&gt;
&lt;br /&gt;
#Remove Log Entry&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t oceos_log_remove_entry(&lt;br /&gt;
 		struct log_entry * const outputPtr&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This returns the oldest unread entry to outputPtr and updates the buffer indices&lt;br /&gt;
&lt;br /&gt;
#Other directives are detailed in system_log.h&lt;br /&gt;
 &lt;br /&gt;
== Usage by OCEOSmp itself ==&lt;br /&gt;
#OCEOSmp only uses the system log for problems that do not arise directly when a directive is used (problems that arise directly are described in the returned directive status code).&lt;br /&gt;
#Such problems fall into a number of categories&lt;br /&gt;
## System corruption is detected and/or oceos_exit is called a&lt;br /&gt;
## Excessive delays in obtaining system spin locks perhaps due to system overloading&lt;br /&gt;
## A timed action misses its specified time&lt;br /&gt;
## A task misses its deadlines&lt;br /&gt;
## Task start requests occur more frequently than expected&lt;br /&gt;
## A task exits without returning a mutex or read-write mutex that it holds&lt;br /&gt;
## Nested mutexes or read-write mutexes not returned in correct order&lt;br /&gt;
## Counts already at max or min&lt;br /&gt;
#In many cases when OCEOSmp makes a system log entry it also updates the system state variable. This is updated using ‘OR’ and so provides a long term record that a problem has occurred even if a log entry is overwritten. In addition, if the update corresponds to an application defined action mask an application defined problem handling function may be called which can if desired read the system log.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:backup]]&lt;/div&gt;</summary>
		<author><name>Bkavanagh</name></author>
	</entry>
	<entry>
		<id>https://wiki.ocetechnology.com/mediawiki/index.php?title=OCEOSmp/notes&amp;diff=1687</id>
		<title>OCEOSmp/notes</title>
		<link rel="alternate" type="text/html" href="https://wiki.ocetechnology.com/mediawiki/index.php?title=OCEOSmp/notes&amp;diff=1687"/>
		<updated>2024-05-03T15:23:36Z</updated>

		<summary type="html">&lt;p&gt;Bkavanagh: /* Usage by OCEOSmp itself */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= &amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;'''When things go wrong'''&amp;lt;/span&amp;gt; =&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Prof. M. Ryan'''&lt;br /&gt;
&lt;br /&gt;
Things can go wrong even when software is bug free.&lt;br /&gt;
&lt;br /&gt;
Misunderstandings may have led to an inadequate design, real world circumstances may conspire to cause performance problems, radiation or other factors may cause hardware failures, and in general things can always go wrong.&lt;br /&gt;
&lt;br /&gt;
Murphy’s Law then applies, and while the system is in use it is important that system behaviour can be monitored, deviations from expectations noticed, checks made, corrections done, and recovery steps taken if needed.&lt;br /&gt;
&lt;br /&gt;
OCEOSmp has been designed with Murphy’s Law in mind and facilitates such actions in a number of ways.&lt;br /&gt;
&lt;br /&gt;
# Servant not Master&lt;br /&gt;
# White Box not Black Box&lt;br /&gt;
# Directive warning and error status codes&lt;br /&gt;
# Automatic integrity checks&lt;br /&gt;
# System Log&lt;br /&gt;
# System state variable&lt;br /&gt;
# System Policing and Problem Anticipation&lt;br /&gt;
# Problem Detection and Handling&lt;br /&gt;
# Precautions and Correction&lt;br /&gt;
&lt;br /&gt;
== Servant not Master ==&lt;br /&gt;
&lt;br /&gt;
[[File:MasterNotSlave.png|400px]]&lt;br /&gt;
&lt;br /&gt;
Many operating systems begin execution directly after the boot sequence and control all subsequent execution of the application software (ASW). Should something go wrong it can be difficult to assess what has occurred and find appropriate corrective action, particularly if the operating system itself has been involved.&lt;br /&gt;
&lt;br /&gt;
With OCEOSmp the ASW begins execution before the operating system and only starts OCEOSmp at some point after entering main().&lt;br /&gt;
&lt;br /&gt;
Before doing so the ASW should check the circumstances that lead to main() being entered. If due to a system restart then the data accumulated by OCEOSmp in the previous run is still available in its fixed, dynamic, and log data areas for analysis or download to find the cause (assuming power has been maintained or non-volatile memory is used for those areas).&lt;br /&gt;
&lt;br /&gt;
The ASW can then make appropriate modifications, and continue as usual to set up EDAC, set up memory protection, initialise and check CPU cores and peripherals, and once all seems correct proceed to start or restart OCEOSmp.&lt;br /&gt;
&lt;br /&gt;
Once scheduling begins OCEOSmp returns to main() only if a fatal error is detected or if it is instructed to do so by an ASW task. Should this occur all the data accumulated is available for analysis or download by ASW main() code, which can restart scheduling by calling oceos_start().&lt;br /&gt;
 &lt;br /&gt;
Most problems can be dealt with by tasks set up to do so under the control of OCEOSmp, but sufficiently serious ones may cause a system reset (e.g. a watchdog timer running out) or cause OCEOSmp to exit (e.g. corruption of critical data), in both cases with the previous state available for analysis if power is maintained or if non-volatile memory is used.&lt;br /&gt;
&lt;br /&gt;
In main() the ASW takes five principal steps in starting OCEOSmp:&lt;br /&gt;
&lt;br /&gt;
# check whether the entry to main() is due to a restart (e.g. by checking if the OCEOSmp data area sentinels are already in place) and if so use the data areas to determine the cause and make whatever modifications to the system are appropriate.   &lt;br /&gt;
# use oceos_init() with the ASW configuration to set up the log area and prepare the fixed data area to hold various addresses, the number of CPU cores, tasks, mutexes, etc.&lt;br /&gt;
# use various OCEOSmp create functions to create tasks, mutexs etc.&lt;br /&gt;
# use oceos_init_finish() to check that the declared numbers of tasks etc. have been created, finish setting up the fixed data area, and set its checksum.&lt;br /&gt;
&lt;br /&gt;
At this point the fixed data area with fixed information about addresses, cores, tasks, mutexes, data queues etc. has been set up, and need not be set up again if not corrupted. The checksum allows the &lt;br /&gt;
area be checked at any time to ensure it has not been changed. Memory protection if available can make the fixed area read-only and make the stack addresses for each core restricted to being written &lt;br /&gt;
only by that core. &lt;br /&gt;
&lt;br /&gt;
Scheduling can begin.&lt;br /&gt;
&lt;br /&gt;
# &amp;lt;li value=&amp;quot;5&amp;quot;&amp;gt;use oceos_start() to initialise the dynamic data area and begins scheduling. This function usually does not return to main() but may do so if a major problem is detected.&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As scheduling progresses the ASW can use the system log to record events and monitor performance. The log is also used by OCEOSmp to record problems, and OCEOSmp may also make a system state entry and trigger an ASW problem handling function.&lt;br /&gt;
&lt;br /&gt;
If a problem is sufficiently serious OCEOSmp may exit automatically or may be requested to do so by an ASW task, execution then returns to main() at the point after the call to oceos_start() with all performance, log, stack and other data available for analysis or download.&lt;br /&gt;
 &lt;br /&gt;
The ASW main() code can then determine the reason for the unexpected return, take appropriate corrective action, and resume scheduling by calling oceos_start() or modify various settings and start over with oceos_init().&lt;br /&gt;
&lt;br /&gt;
The ASW uses OCEOSmp and remains the master, rather than the reverse.&lt;br /&gt;
&lt;br /&gt;
== White Box not Black Box ==&lt;br /&gt;
&lt;br /&gt;
[[File:WhiteboxNotBlackbox.png|800px]]&lt;br /&gt;
&lt;br /&gt;
The data used by OCEOSmp is stored in statically allocated memory in three data areas and in an overall stack area. These usually are specified by the ASW as arrays of 32-bit words and can be examined by the ASW at any time.&lt;br /&gt;
&lt;br /&gt;
The data includes actual and expected task maximum and minimum execution times, activities on CPU cores, and other records of what has been happening. These records can be readily examined by the ASW while scheduling is under way and after OCEOSmp exits should this occur.&lt;br /&gt;
&lt;br /&gt;
OCEOSmp configures each data area to begin with a 32-bit sentinel followed by its size measured in 32-bit words, then the corresponding data, and finally a 32-bit sentinel. In the case of the fixed data area a 32-bit XOR checksum is located before the end sentinel.&lt;br /&gt;
&lt;br /&gt;
The size of each data area and the layout of the data within it depends on the application configuration, but are clearly specified with the location of each data item identified.&lt;br /&gt;
&lt;br /&gt;
Whenever an OCEOSmp directive is used a quick check is made that sentinels have not been breached. The ASW itself can check the fixed area checksum at any time (this is not done automatically for reasons of efficiency).&lt;br /&gt;
&lt;br /&gt;
The Log Area is initialized by oceos_init() and contains the system log and system state variable and if used the optional context switch log. Directives are provided to access and update these. The size of the area depends on the number of entries specified for the two logs in the system configuration. Log contents are preserved across system reset and across power failures if stored in non-volatile memory. &lt;br /&gt;
&lt;br /&gt;
The Fixed Data Area is completed by oceos_init_finish() and contains all the constants of the system, such as the addresses of data areas and stacks, the identity of the CPU core that OCEOSmp is to use on startup, the number of cores, tasks etc., the priorities and other attributes of tasks etc. &lt;br /&gt;
&lt;br /&gt;
The Dynamic Data area is created and initialized by oceos_start() and contains the information collected as oceosmp schedules tasks and as mutexes, counting semaphores,  etc. are used. This information is available for inspection by the ASW if OCEOSmp exits, and is only overwritten if the ASW again calls oceos_start().&lt;br /&gt;
&lt;br /&gt;
In OCEOSmp each CPU core has a system stack, a stack for each thread is not required. The stack size per CPU core and the location of the overall top of stack is specified in the application configuration and the overall stack space is statically allocated.&lt;br /&gt;
&lt;br /&gt;
Before scheduling begins OCEOSmp initialises each core’s stack with a filler. This is overwritten as the stack is used and by checking how much memory at the top and bottom of each stack still contains the filler it is possible to determine at any point how close the system has come to a stack overrun.&lt;br /&gt;
&lt;br /&gt;
The white box approach of making all records and the system stacks readily accessible while scheduling is taking place and should OCEOSmp exit facilitates checking that the system is performing as expected and determining the causes of any problems that may occur.&lt;br /&gt;
&lt;br /&gt;
== Directive warning and error status codes ==&lt;br /&gt;
&lt;br /&gt;
[[File:WarningErrorIcon.png|400px]]&lt;br /&gt;
&lt;br /&gt;
The ASW uses OCEOSmp by calling its directives, and is responsible for checking the returned directive status code. (OCEOSmp is a statically linked library, only those components related to the directives used by the ASW are linked into the final executable.)&lt;br /&gt;
&lt;br /&gt;
The system time directives oceos_time_sys_get64() and oceos_time_sys_get32() directly return the requested system time as 64-bit or 32-bit unsigned integers.&lt;br /&gt;
&lt;br /&gt;
Other directives return a 32-bit signed integer status code.&lt;br /&gt;
&lt;br /&gt;
This should always be checked when a directive is used.&lt;br /&gt;
&lt;br /&gt;
The status code indicates ERROR, SUCCESS, or WARNING.&lt;br /&gt;
&lt;br /&gt;
* A negative value indicates that the directive has not executed and gives the reasons&lt;br /&gt;
* A zero value indicates successful execution as expected&lt;br /&gt;
* A non-zero positive value indicates that the directive executed but with warnings&lt;br /&gt;
&lt;br /&gt;
Certain bits in the status code have the same meaning for all directives.&lt;br /&gt;
&lt;br /&gt;
Other bits have meanings that depend on the directive in use.&lt;br /&gt;
&lt;br /&gt;
These meanings are given in the header files associated with each directive as constants that can be compared with the status code to determine the types of errors or warnings involved.&lt;br /&gt;
&lt;br /&gt;
Errors typically involve an incorrect parameter to a directive, or an attempt to use a resource that is not available such as writing to a data queue that is already full.&lt;br /&gt;
&lt;br /&gt;
Warnings typically indicate that the directive has succeeded but that a danger has been created as when a task acquires multiple mutual exclusion semaphores out of order, or that a resource is now fully in use as when a write makes a data queue full.&lt;br /&gt;
&lt;br /&gt;
The task that used the directive and checked the returned status has full access to the data areas and stack areas in deciding the action to take, which may involve making a system log entry, starting a problem handling task, or in the worst case exiting from OCEOSmp and returning to main().&lt;br /&gt;
&lt;br /&gt;
In many situations the returned status code is the only indicator that is needed of directive success or failure. The ASW can then make a system log entry (automatically timestamped by OCEOSmp) for recording or performance analysis purposes if desired.&lt;br /&gt;
&lt;br /&gt;
In some situations OCEOSmp will make a system log entry automatically and may also update the system state variable, resulting in an ASW defined problem handling function being called if the corresponding flag has been set by the ASW in the system action flags.&lt;br /&gt;
&lt;br /&gt;
OCEOSmp may also automatically make a system log entry or take other actions when problems arise later, as when a task completion deadline is missed or a mutex is not returned.&lt;br /&gt;
&lt;br /&gt;
Irrespective of whatever other precautions may be taken, the first line of defence in using a directive is to check the returned status code.&lt;br /&gt;
&lt;br /&gt;
== Automatic integrity tests ==&lt;br /&gt;
&lt;br /&gt;
[[File:Automation.jpg|600px]]&lt;br /&gt;
&lt;br /&gt;
These are done automatically by OCEOSmp when a directive is used or an event occurs.&lt;br /&gt;
&lt;br /&gt;
They include checking that OCEOSmp data area sentinels are intact, and in the event of corruption may result in an exit from OCEOSmp and return to main().&lt;br /&gt;
&lt;br /&gt;
Directive parameters and the current system phase also are automatically checked when a directive is used, together with the availability of any required resources.&lt;br /&gt;
&lt;br /&gt;
Problems detected immediately when a directive is used result in an appropriate status code being returned to the ASW task that called the directive.&lt;br /&gt;
&lt;br /&gt;
Some problems, such as a task missing a deadline, do not occur immediately when a directive is used but only as scheduling proceeds. Such problems are checked for automatically by OCEOSmp.&lt;br /&gt;
&lt;br /&gt;
Checks include task completion times vs. deadlines, task start requests intervals vs. expected maxima and minima, mutual exclusion semaphore not being released before task completion, time taken to obtain spinlocks longer than expected (an indicator of system loading), and other problems. &lt;br /&gt;
&lt;br /&gt;
If a check fails in most cases a system log entry is made and the system state variable may be updated, possibly resulting in an ASW defined problem handler being called. In extreme cases OCEOSmp may exit and return to main().&lt;br /&gt;
&lt;br /&gt;
Overall the automatic integrity tests carried out by OCEOSmp itself include:&lt;br /&gt;
# System meta pointer intact&lt;br /&gt;
# Data area sentinel/s intact&lt;br /&gt;
# Task deadline not missed&lt;br /&gt;
# Task start request gap too short&lt;br /&gt;
# Task start request gap too long&lt;br /&gt;
# …&lt;br /&gt;
&lt;br /&gt;
It should be noted that these checks detect that a problem has happened. To anticipate problems and perhaps avoid them further checks can and should be done by the ASW as part of system policing.&lt;br /&gt;
&lt;br /&gt;
== System Log ==&lt;br /&gt;
&lt;br /&gt;
[[File:Logging.png|600px]]&lt;br /&gt;
&lt;br /&gt;
=== Purpose ===&lt;br /&gt;
&lt;br /&gt;
# Provide application software with the ability to make time stamped records of events for use in application performance monitoring and in application debugging&lt;br /&gt;
# Provide OCEOSmp with the ability to record anomalies should these be detected.&lt;br /&gt;
&lt;br /&gt;
=== Structure ===&lt;br /&gt;
&lt;br /&gt;
# &amp;lt;li value=&amp;quot;3&amp;quot;&amp;gt;A circular buffer with a fixed size that is set in the application configuration&amp;lt;/li&amp;gt; &lt;br /&gt;
# Size from 16 to 1024 entries, default 64 if size not specified&lt;br /&gt;
# If the application defines oceosmp_on_full_log(void *) this is called automatically when the buffer becomes ¾ full, allowing log entries that might otherwise be overwritten be archived. The automatic call will reoccur only after the buffer becomes ¾ empty.&lt;br /&gt;
# Two indices determine the next log entry position to be read from or written to. On system reset these are left unchanged if valid so as to postpone recent entries being overwritten.&lt;br /&gt;
# Log entries are left unchanged until a system log write causes the current entry at the write index be overwritten. Reading the log returns the earliest entry not read so far. Directives are provided to allow any log entry be read and to reset the log indices.&lt;br /&gt;
&lt;br /&gt;
=== Storage ===&lt;br /&gt;
&lt;br /&gt;
#  &amp;lt;li value=&amp;quot;8&amp;quot;&amp;gt;Stored statically in the oceosmp_log_area, which also contains the next-read and next-write buffer indices and the system state related variables.&amp;lt;/li&amp;gt;&lt;br /&gt;
# The log size and the oceosmp_on_full() function declaration are stored in the oceosmp_fixed_area, as also are the  log area addresses.&lt;br /&gt;
&lt;br /&gt;
==== Log entry format (from system_log.h) ====&lt;br /&gt;
&lt;br /&gt;
 Struct log_entry{&lt;br /&gt;
  	U64_t time64;&lt;br /&gt;
  	unsigned int current_cpu_id :8;&lt;br /&gt;
  	unsigned int entry_type :8;&lt;br /&gt;
  	U32_t entry_comment;&lt;br /&gt;
 } __attribute__ ((aligned (8));&lt;br /&gt;
&lt;br /&gt;
# &amp;lt;li value=&amp;quot;10&amp;quot;&amp;gt;When a log entry is made, time64 and current_cpu_id are set automatically by OCEOSmp.&amp;lt;/li&amp;gt;&lt;br /&gt;
# The entry type is an enum defined by the application, with a subset of enum values reserved for use by OCEOSmp. The reserved enum values are specified in system_log.h.&lt;br /&gt;
# The ''entry_comment'' allows noting further information on the current situation&lt;br /&gt;
&lt;br /&gt;
==== Associated directives (from system_log.h) ====&lt;br /&gt;
# &amp;lt;li value=&amp;quot;13&amp;quot;&amp;gt;Add log entry&amp;lt;/li&amp;gt;&lt;br /&gt;
 S32_t 	oceos_log_add_entry(&lt;br /&gt;
 	 	enum LOG_ENTRY_TYPE type, // 8 bit enum LOG_ENTRY_TYPE&lt;br /&gt;
 	 	const U32_t info 		// further information&lt;br /&gt;
 );&lt;br /&gt;
&lt;br /&gt;
This adds an entry, overwriting the currently oldest entry.&lt;br /&gt;
&lt;br /&gt;
# &amp;lt;li value=&amp;quot;14&amp;quot;&amp;gt;Remove log entry&amp;lt;/li&amp;gt;&lt;br /&gt;
 S32_t oceos_log_remove_entry(&lt;br /&gt;
  		struct log_entry * const outputPtr&lt;br /&gt;
 );&lt;br /&gt;
&lt;br /&gt;
This returns the oldest unread entry to outputPtr and updates the buffer indices&lt;br /&gt;
&lt;br /&gt;
# &amp;lt;li value=&amp;quot;15&amp;quot;&amp;gt;Other log directives are detailed in system_log.h&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Usage by OCEOSmp itself&lt;br /&gt;
&lt;br /&gt;
# &amp;lt;li value=&amp;quot;14&amp;quot;&amp;gt;OCEOSmp only uses the system log for problems that do not arise directly when a directive is used (problems that arise directly are described in the returned directive status code).&amp;lt;/li&amp;gt;&lt;br /&gt;
# Such problems fall into a number of categories&lt;br /&gt;
## System corruption is detected and/or oceos_exit is called a&lt;br /&gt;
## Excessive delays in obtaining system spin locks perhaps due to system overloading&lt;br /&gt;
## A timed action misses its specified time&lt;br /&gt;
## A task misses its deadlines&lt;br /&gt;
## Task start requests occur more frequently than expected&lt;br /&gt;
## A task exits without returning a mutex or read-write mutex that it holds&lt;br /&gt;
## Nested mutexes or read-write mutexes not returned in correct order&lt;br /&gt;
## Counts already at max or min&lt;br /&gt;
# In many cases when OCEOSmp makes a system log entry it also updates the system state variable. This is updated using ‘OR’ and so provides a long term record that a problem has occurred even if a log entry is overwritten. In addition, if the update corresponds to an application defined action mask and an application problem handling function is defined this is called automatically.&lt;br /&gt;
&lt;br /&gt;
== System State Variable ==&lt;br /&gt;
&lt;br /&gt;
[[File:SystemState.png|400px]]&lt;br /&gt;
&lt;br /&gt;
=== Purpose ===&lt;br /&gt;
&lt;br /&gt;
To record that certain conditions have occurred and to allow the ASW specify which conditions should cause an ASW defined problem handling function be triggered automatically when the state variable is updated due to these conditions.&lt;br /&gt;
&lt;br /&gt;
=== Structure ===&lt;br /&gt;
Four 32-bit words each containing 32 flags, some available for use by the ASW, some reserved for use by OCEOSmp&lt;br /&gt;
# system state variable		individual bits are set by ASW or by OCEOSmp &lt;br /&gt;
# accumulated system state	updated when system state flags are set &lt;br /&gt;
# action mask			set by ASW in application configuration &lt;br /&gt;
# action mask previous		previous value of action mask if changed by ASW&lt;br /&gt;
&lt;br /&gt;
=== Usage ===&lt;br /&gt;
# &amp;lt;li value=&amp;quot;5&amp;quot;&amp;gt;the system state variable is updated using inclusive ‘OR’ to set the desired flag&amp;lt;/li&amp;gt;&lt;br /&gt;
# the accumulated system state flag is set when the corresponding system state flag is set&lt;br /&gt;
# on reset the system state variable is cleared to 0, all flags clear&lt;br /&gt;
# the accumulated system state variable is reset only by the ASW&lt;br /&gt;
# the action mask is set by the ASW, and causes an ASW defined problem handler to be called when a state flag is updated to 1 that corresponds to a set action mask flag. &lt;br /&gt;
&lt;br /&gt;
Whenever a system state variable flag is set during scheduling (using inclusive ‘OR’) the corresponding accumulated state flag is also set. Accumulated state flags are not affected when a system state flag is cleared to 0, whether by the ASW or on system reset. They can be cleared only directly by the ASW. They keep a record of events across system reset if memory is preserved.&lt;br /&gt;
&lt;br /&gt;
The action mask is specified in the application configuration, which then should also declare a problem handling function. The mask may be altered by the ASW during scheduling.&lt;br /&gt;
&lt;br /&gt;
The ASW problem handling function is called automatically by OCEOSmp as a result of setting a previously clear system state flag that corresponds to a flag that is set in the action mask. The system state flag is set before the function is called. If the system state flag is not reset by the ASW problem handler or otherwise then further settings of that system state flag will not cause the function to be called again.&lt;br /&gt;
&lt;br /&gt;
The ASW can use a system call to modify the action mask at any time, when this is done the previous value of the action mask is stored.&lt;br /&gt;
&lt;br /&gt;
The flags corresponding to the high sixteen bits of the system state variable are reserved for use by OCEOSmp:&lt;br /&gt;
&lt;br /&gt;
These primarily refer to problems that are not immediate consequences of the use of a directive (these are indicated in the returned error or warning status code), but that may occur subsequently during scheduling:&lt;br /&gt;
# &amp;lt;li value=&amp;quot;16&amp;quot;&amp;gt;reserved&amp;lt;/li&amp;gt;	&lt;br /&gt;
# reserved&lt;br /&gt;
# reserved&lt;br /&gt;
# reserved&lt;br /&gt;
# reserved&lt;br /&gt;
# Attempt to start pending task that has been disabled while pending.&lt;br /&gt;
# Time from task start request to job completion exceeds task deadline.&lt;br /&gt;
# Time between task start requests less than specified minimum for task&lt;br /&gt;
# Time between task start requests greater than specified maximum for task&lt;br /&gt;
# Missed latest time for transfer of job from timed action queue to scheduler.&lt;br /&gt;
# Missed latest time for performance of timed output.&lt;br /&gt;
# Mutex not returned before job terminates.&lt;br /&gt;
# Read/Write mutex not returned before job termination.&lt;br /&gt;
# System busy warning&lt;br /&gt;
# Data area sentinels corrupted.&lt;br /&gt;
# System meta pointer corrupted&lt;br /&gt;
&lt;br /&gt;
== System Policing and Problem Anticipation ==&lt;br /&gt;
&lt;br /&gt;
All design involves assumptions, and ‘System Policing’ refers to checking how close these come to being violated as the system operates, and to taking precautions if needed.&lt;br /&gt;
&lt;br /&gt;
The white box design of OCEOSmp facilitates this, with records kept automatically of task timing performances and other parameters that are accessible by the ASW at any time, including after OCEOSmp exits should this occur.&lt;br /&gt;
&lt;br /&gt;
These records can answer questions such as ‘what is the longest time this task took to execute’, ‘what is the shortest time between requests to start this task’, ‘what is the longest time between requests to start this task’, and many others, including stack usage.&lt;br /&gt;
&lt;br /&gt;
By checking such data the ASW can notice that behaviour is not as expected and that something is going wrong, allowing ‘Problem Anticipation’ and an issue being dealt with before it causes serious difficulties.&lt;br /&gt;
&lt;br /&gt;
The ASW might do this by having an external policing function running on a core not in use by OCEOSmp that periodically checks that things are as expected, or by having a policing task that is scheduled by OCEOSmp.&lt;br /&gt;
&lt;br /&gt;
With all the data stored statically in the ‘Log Area’, ‘Fixed Data Area’ and ‘Dynamic Data Area’ arrays by the ASW it is straightforward to retrieve it.&lt;br /&gt;
&lt;br /&gt;
OCEOSmp only requires one system stack per CPU core rather than one stack per thread. Each stack is initialised to a known value, making it straightforward to determine the greatest extent to which each stack has been used.&lt;br /&gt;
&lt;br /&gt;
If suspicious activity is detected, the ASW can for example disable a task or take a CPU core out of use or disable a peripheral or take other corrective action.&lt;br /&gt;
&lt;br /&gt;
It can also make a historical record of bad behaviour by adding an entry to the System Log and by updating a flag in the System State variable, When the System Log becomes ¾ full an ASW function if defined is called that can archive the System Log, and a shadow copy of the System State variable is automatically maintained that is only reset by the ASW itself.&lt;br /&gt;
&lt;br /&gt;
When multiple mutual exclusion semaphores are used by tasks the OCEOSmp design excludes the possibility of unbounded priority inversion and no check for this is needed.&lt;br /&gt;
&lt;br /&gt;
On multi-core systems deadlocks can occur but only if tasks fail to acquire mutual exclusion semaphores in a consistent order corresponding to their identity numbers. A warning status code is then returned although as yet no deadlock has occurred.&lt;br /&gt;
&lt;br /&gt;
The ASW can include a policing function that checks the execution times of tasks (in OCEOSmp tasks on other CPU cores spin waiting to acquire mutexes), and the time when a task start request was issued, allowing detection of deadlocks, livelocks, and task starvation.&lt;br /&gt;
&lt;br /&gt;
It should be noted that OCEOSmp itself may detect an anomaly and automatically make an entry in the System Log and may also update the System State variable, perhaps resulting in an ASW defined problem handling function being called, but this only happens after a problem has occurred and been detected. &lt;br /&gt;
&lt;br /&gt;
== Problem Detection and Handling ==&lt;br /&gt;
&lt;br /&gt;
[[File:PoliceJoke.png|600px]]&lt;br /&gt;
&lt;br /&gt;
This relates to what happens after a problem has occurred and been detected, as distinct from System Policing and Problem Anticipation which aims to forestall problems.&lt;br /&gt;
&lt;br /&gt;
The integrity tests carried out automatically by OCEOSmp check for a number of problems. Some are detected directly when an OCEOSmp directive is used, others when an event occurs such as a job completing execution, others when some internal operation of OCEOSmp does not proceed as expected. &lt;br /&gt;
&lt;br /&gt;
Problems that arise directly from the use or misuse of a directive are identified in the returned status code, and the ASW can then decide the appropriate action.&lt;br /&gt;
&lt;br /&gt;
If appropriate the ASW can disable or terminate tasks and take CPU cores out of use without disrupting scheduling, and can read and update the system log and system state variable. In an extreme case the ASW can end scheduling and return to main().&lt;br /&gt;
&lt;br /&gt;
# Typical directive problems&lt;br /&gt;
## Current phase doesn’t allow this directive&lt;br /&gt;
## Invalid parameters supplied&lt;br /&gt;
## Time for timed action already passed&lt;br /&gt;
## Write fail, data queue full&lt;br /&gt;
## Write succeeded, data queue now full (warning) &lt;br /&gt;
## Mutexes or rwmutexes acquired in an incorrect order (warning)&lt;br /&gt;
&lt;br /&gt;
Other problems may be identified automatically be OCEOSmp after a directive has been used or when an event occurs, or during internal OCEOSmp operations&lt;br /&gt;
Such problems include:&lt;br /&gt;
# &amp;lt;li value=&amp;quot;2&amp;quot;&amp;gt;Unexpected patterns of events&amp;lt;/li&amp;gt;&lt;br /&gt;
## Task misses a deadline&lt;br /&gt;
## Task start requests occur more frequently than expected&lt;br /&gt;
## Task start requests occur less frequently than expected&lt;br /&gt;
## Task disabled after being put on a pending queue&lt;br /&gt;
## Spin locks not being available in a reasonable time&lt;br /&gt;
## Action time missed&lt;br /&gt;
## Pending queues being full&lt;br /&gt;
&lt;br /&gt;
These problems typically cause a system log entry to be made, may update the system state variable and may result in an ASW defined problem handling function being called. This has full access to the performance records and can enable or disable tasks and take CPU cores out of use or restore them to use without disrupting scheduling, and can exit from OCEOSmp if appropriate.&lt;br /&gt;
&lt;br /&gt;
Other problems that may be automatically detected by OCEOSmp include&lt;br /&gt;
# &amp;lt;li value=&amp;quot;3&amp;quot;&amp;gt;Corruption of critical data&amp;lt;/li&amp;gt;&lt;br /&gt;
## Perhaps due to hardware failures&lt;br /&gt;
## Perhaps by application software malfunctioning and overwriting data&lt;br /&gt;
## Perhaps by a bug in OCEOSmp&lt;br /&gt;
&lt;br /&gt;
These problems typically result in exit from OCEOSmp and return to main() at the point immediately after oceos_start() was used. The system state variable and system log may also be updated.&lt;br /&gt;
&lt;br /&gt;
It should be noted that the checks made by OCEOSmp only occur as a result of it being notified of some change in the state of the system, as when a directive is used or a job terminates or an interrupt occurs. It is recommended that these be added to by taking appropriate precautions.&lt;br /&gt;
&lt;br /&gt;
== Precautions and Correction ==&lt;br /&gt;
&lt;br /&gt;
[[File:Precaution.png|600px]]&lt;br /&gt;
&lt;br /&gt;
A primary precaution is policing. As described above this typically involves assigning a CPU core to check the activities of the system, or perhaps assigning a task to that purpose. Anticipation and prevention are better than detection.&lt;br /&gt;
&lt;br /&gt;
Further precautions are also possible, depending on the hardware available in the system. These can detect or perhaps even prevent various malfunctions. &lt;br /&gt;
&lt;br /&gt;
=== Hardware Malfunctions ===&lt;br /&gt;
These can be caused by radiation or other external factors, or simply by parts of the system wearing out.&lt;br /&gt;
&lt;br /&gt;
They fall into three main categories, memory hardware malfunctions, CPU core malfunctions, and peripheral or connected device malfunctions.&lt;br /&gt;
&lt;br /&gt;
==== Memory hardware malfunctions ====&lt;br /&gt;
&lt;br /&gt;
These typically result in one or more bits in a memory location being set to incorrect values.&lt;br /&gt;
&lt;br /&gt;
If the error involve no more than a certain number of bits (BCH 1, RS fixed &amp;gt; 1) then EDAC allows a memory location containing such errors be read correctly despite the error.&lt;br /&gt;
&lt;br /&gt;
While the value read is correct the error remains in the location until the correct value is written back. This should be done before a further bit becomes corrupted, perhaps making the error un-correctable. In some systems this write back is done automatically. &lt;br /&gt;
&lt;br /&gt;
Long intervals can occur between uses of a memory location making ‘memory scrubbing’ necessary. This cycles through all memory locations, reading and writing back if needed, doing so often enough to make it very unlikely that an un-correctable number of erroneous bits will accumulate in any location.&lt;br /&gt;
&lt;br /&gt;
Usually a hardware ‘memory scrubber‘ is available that can be configured to do this at a certain rate for a certain range of addresses.&lt;br /&gt;
&lt;br /&gt;
Memory read errors can still occur however. A combination of bit errors can defeat EDAC error detection and lead to an incorrect value being read. Usually however such un-correctable errors are detected by EDAC causing it to raise an exception. The corresponding handler must then take appropriate action, which may include terminating OCEOSmp.&lt;br /&gt;
&lt;br /&gt;
Precautions: Before starting OCEOSmp &lt;br /&gt;
# The handler for EDAC detected un-correctable errors should be put in place&lt;br /&gt;
# The memory should be initialized&lt;br /&gt;
# The EDAC system configured and put into operation&lt;br /&gt;
# The EDAC memory scrubber hardware configured and put into operation&lt;br /&gt;
&lt;br /&gt;
Once this has been done and OCEOSmp started&lt;br /&gt;
# &amp;lt;li value=&amp;quot;5&amp;quot;&amp;gt;The EDAC exception handler can &amp;lt;/li&amp;gt;	&lt;br /&gt;
## Update the system log&lt;br /&gt;
## Update the system state variable&lt;br /&gt;
## Start a problem handling task&lt;br /&gt;
## If necessary call oceos_exit() to return to main()&lt;br /&gt;
&lt;br /&gt;
==== Computer core hardware malfunctions ====&lt;br /&gt;
&lt;br /&gt;
Cores may use triple modular redundancy and other techniques to reduce the effects of transient errors, but nevertheless can become faulty. If this is detected in a multi-core system OCEOSmp allows the faulty core be taken out of use without scheduling being disrupted.&lt;br /&gt;
&lt;br /&gt;
Detecting that a core has become faulty can be done using computational tasks for which the results including timings are known. Before such tests are used however a malfunction may have led to an erroneous result being used. &lt;br /&gt;
&lt;br /&gt;
To avoid this when result accuracy is critical and immediately needed it is possible in OCEOSmp to have multiple CPU cores carry out the same computation at the same time (within a few clock cycles). &lt;br /&gt;
&lt;br /&gt;
The results can then be compared and the majority agreed value used. A core that was at fault can be tested and taken out of use if the problem is judged not to be transient.&lt;br /&gt;
&lt;br /&gt;
Precaution: Check periodically that cores carry out a computational test correctly.&lt;br /&gt;
# &amp;lt;li value=&amp;quot;6&amp;quot;&amp;gt;oceosmp_cpu_disable() will take the specified CPU core out of use, put it to sleep, and cause the termination functions of any jobs executing on the core be executed on a different core.&amp;lt;/li&amp;gt; &lt;br /&gt;
# oceosmp_cpu_enable() will make the specified CPU core available for use&lt;br /&gt;
&lt;br /&gt;
These directives can also be used to manage the number of active cores for power saving or other purposes. Scheduling is not disrupted as long as a functioning core remains.&lt;br /&gt;
&lt;br /&gt;
==== Peripheral Hardware Malfunctions ====&lt;br /&gt;
&lt;br /&gt;
These can arise due to a fault in the peripheral unit itself, or due to problems in an external system for which the peripheral is an interface.&lt;br /&gt;
&lt;br /&gt;
Before starting OCEOSmp the ASW should carry out appropriate checks of all peripheral units, and should ensure that such checks can be carried out if necessary by tasks after scheduling has begun.&lt;br /&gt;
&lt;br /&gt;
Faults in external systems for which a peripheral unit is an interface tend to either&lt;br /&gt;
# cause no messages to be sent to the interface&lt;br /&gt;
# cause messages to be sent too frequently&lt;br /&gt;
&lt;br /&gt;
In most cases when a peripheral receives an external message it causes an interrupt which then causes a request to start a task.&lt;br /&gt;
&lt;br /&gt;
If the interval between such task start requests is longer than expected this may indicate that the peripheral device has become faulty and is no longer operational.&lt;br /&gt;
&lt;br /&gt;
If the interval between such task start requests is shorter than expected it may indicate the frequency of external events exceeding expectations or some fault in the peripheral device.&lt;br /&gt;
&lt;br /&gt;
In both cases on starting the task OCEOSmp automatically checks the interval since the last task start request and if this is less than the expected minimum or greater than the expected maximum will make a system log entry and set the corresponding flag in the system state variable. If the ASW has set the corresponding system state action flag and defined a problem handling function this will result in the ASW problem handling function being called.&lt;br /&gt;
 &lt;br /&gt;
Precautions: &lt;br /&gt;
	In the ASW configuration structure passed to oceos_init() the ASW set the desired flags in the problem action mask and define a problem handling function.   &lt;br /&gt;
&lt;br /&gt;
=== Software Malfunctions ===&lt;br /&gt;
&lt;br /&gt;
Certain types of software errors can cause problems for the system as a whole.&lt;br /&gt;
&lt;br /&gt;
OCEOSmp automatically checks for some of these, others are best checked for by the ASW itself, perhaps as part of system policing.&lt;br /&gt;
&lt;br /&gt;
In addition to policing, various precautions can be taken against these problems, including making use of any memory protection hardware available and using a system watchdog timer.&lt;br /&gt;
&lt;br /&gt;
==== Invalid memory overwriting ====&lt;br /&gt;
&lt;br /&gt;
Application software may inadvertently overwrite memory areas used by OCEOSmp.&lt;br /&gt;
&lt;br /&gt;
The three memory areas used by OCEOSmp are each protected at their ends by constant sentinels. Each time a directive is used or job terminates OCEOSmp checks these sentinels to ensure that the areas involved have not been encroached upon. If so OCEOSmp will exit.&lt;br /&gt;
&lt;br /&gt;
In addition to its sentinels the fixed data area has an XOR checksum which allows any alteration be detected. This is not checked automatically by OCEOSmp for reasons of efficiency, but can be checked at any time by ASW policing software.&lt;br /&gt;
&lt;br /&gt;
Prevention is better than detection and if a system has a memory protection unit this should be configured to make the fixed area read-only. Any attempt to write this area will then typically cause the protection unit to raise an exception.&lt;br /&gt;
&lt;br /&gt;
Each CPU core has its own system stack. These form part of a contiguous block of statically allocated memory, and a software error may result in the code running on a core overrunning that core’s stack and attempting to use the stack memory of another core.&lt;br /&gt;
&lt;br /&gt;
This can be detected in policing by checking that filler still remains at the top and bottom of each core’s stack, and this can be checked at any time by ASW policing software, but prevention is better than detection.&lt;br /&gt;
 &lt;br /&gt;
Precautions: Any hardware memory protection present should be used on completion of oceos_init_finish() and before oceos_start() to provide these features.&lt;br /&gt;
# Read only (the fixed data area)&lt;br /&gt;
# Writeable only by a specific computer core (for each core’s stack)&lt;br /&gt;
 &lt;br /&gt;
Invalid attempts to use a memory location typically give rise to an exception and an appropriate handler must be in place.&lt;br /&gt;
&lt;br /&gt;
==== Invalid use of Mutual Exclusion Semaphores (Mutexes) or of Read-Write Mutexes ====&lt;br /&gt;
&lt;br /&gt;
In general the time for which the ASW holds a mutex or read-write mutex should be as short as possible.&lt;br /&gt;
&lt;br /&gt;
This time can be estimated at compile time and the estimates taken into account in determining whether a set of tasks can be scheduled so that tasks always meet their deadlines.&lt;br /&gt;
&lt;br /&gt;
Such estimates however can be made wrong by events that occur during scheduling if appropriate precautions are not taken.&lt;br /&gt;
&lt;br /&gt;
One possible problem, unbounded priority inversion, arises when a job holding a mutex is pre-empted by a higher priority task that does not use the mutex, causing any even higher priority task that uses the mutex to wait indefinitely for the low priority job to resume and release the mutex. In OCEOSmp unbounded priority inversion cannot occur. &lt;br /&gt;
&lt;br /&gt;
Another problem, deadlock, can arise when two or more jobs each acquire more than one mutex. A job while holding a mutex may then attempt to acquire a different mutex currently held by some other job. If that other job (without releasing the mutex it holds) attempts to acquire the mutex held by the first job neither job can make progress, the jobs are deadlocked.&lt;br /&gt;
&lt;br /&gt;
These problems are addressed by the design of OCEOSmp.&lt;br /&gt;
&lt;br /&gt;
In OCEOSmp each mutex or read-write mutex has a priority ceiling giving the priority of the highest priority task that uses it. This constant is determined at compile time and set for each mutex when it is created.&lt;br /&gt;
&lt;br /&gt;
In scheduling, once a job running on a CPU core holds one or more mutexes or read-write mutexes only tasks with higher priority than the highest ceiling are allowed to pre-empt the job and start running on that core.&lt;br /&gt;
&lt;br /&gt;
As a result unbounded priority inversion cannot occur, and on single core systems deadlocks also are not possible.&lt;br /&gt;
&lt;br /&gt;
On multi-core systems jobs can spin waiting to acquire a mutex held by a job running on a different core and deadlock becomes possible.&lt;br /&gt;
&lt;br /&gt;
In OCEOSmp mutexes and read-write mutexes are assigned a sequential order as they are created. Deadlocks then cannot occur if jobs always respect this order in acquiring mutexes, never attempting to acquire a mutex or read-write mutex if already holding one that is higher in the order.&lt;br /&gt;
&lt;br /&gt;
OCEOSmp does not prevent jobs from acquiring multiple mutexes in an out of order manner but returns a warning directive status code to the job indicating that deadlock is possible and makes a log entry and updates the system state variable, perhaps causing an ASW defined problem handling function to be called.&lt;br /&gt;
&lt;br /&gt;
When a job simultaneously holds multiple mutexes or read-write mutexes it should acquire and return these in a LIFO manner, e.g. waitA, waitB, waitC…..signalC, signalB, signalA. Failure to do so may affect task scheduling temporarily and will result in a warning directive status code, a log entry, and an update of the system state variable.&lt;br /&gt;
&lt;br /&gt;
Other errors in using mutexes such as failure to release a mutex before a job ends or attempting to release a mutex that is not held give rise to an appropriate directive status codes, a log entry, and a system state variable updates.&lt;br /&gt;
&lt;br /&gt;
Precautions: &lt;br /&gt;
# Ensure at compile time that when a task acquires multiple mutexes or read-write mutexes it always does so in the correct order.&lt;br /&gt;
# Ensure at compile time that when a job releases multiple mutexes or read-write mutexes it always does so in the reverse order to that in which they were acquired&lt;br /&gt;
&lt;br /&gt;
==== Deadlocks, Livelocks and Task Starvation ====&lt;br /&gt;
&lt;br /&gt;
Deadlocks arise primarily due to misuse of mutual exclusion semaphores or read write mutual exclusion semaphores, as described above.&lt;br /&gt;
&lt;br /&gt;
Livelocks, where tasks interact in a way that results in each task having to return to some earlier point with no or very little overall progress, can arise in a number of ways including from attempts to resolve a deadlock so that the tasks involved can proceed.&lt;br /&gt;
&lt;br /&gt;
Task starvation arises when a task is ready to start, but CPU time is not allocated to it within a reasonable time. In OCEOSmp this will occur for a low priority task if higher priority tasks are always ready to run and require all the available CPU cores. &lt;br /&gt;
&lt;br /&gt;
Task starvation, to at least some degree, can also occur for a high priority task if the resources required to allow it pre-empt a lower priority task are not available on the CPU core involved, as for example when the remaining system stack for that core is below the level needed for pre-emption.&lt;br /&gt;
&lt;br /&gt;
All three of these problems result in a task or tasks taking longer to complete than should be the case. This can be detected in two main ways&lt;br /&gt;
# By a policing task that periodically checks each task record in the dynamic area to determine the maximum time between a request to start it and task completion. &lt;br /&gt;
# By watchdog timer hardware that typically is reset periodically by the lowest priority task and which will cause a hardware system reset if its pre-set time elapses before it is reset. On re-entry to main() the ASW can check to determine if this has occurred before restarting OCEOSmp.&lt;br /&gt;
&lt;br /&gt;
Precautions&lt;br /&gt;
# &amp;lt;li value=&amp;quot;3&amp;quot;&amp;gt;ensure each CPU core has adequate system stack so that a lower priority task running on the core can always be pre-empted by a higher priority task. The amount required can be calculated from the number of different priority levels in use.&amp;lt;/li&amp;gt;&lt;br /&gt;
# if watchdog timer hardware is available set up a low priority task to periodically reset it. The ASW should check on entry to main() whether this was due to a watchdog timeout and if so use the OCEOSmp data to determine the cause and appropriate remedial action before restarting OCEOSmp.&lt;br /&gt;
# set up a policing task that checks the execution times of current tasks and detects when this is too long. This task can call an ASW defined problem handling function that can determine how best to deal with the situation, perhaps calling the termination functions of some currently executing tasks, disabling some tasks or changing interrupt intervals.&lt;br /&gt;
# If necessary reserve certain CPU cores to use only by higher priority tasks, perhaps ensuring that there is always at least one CPU core ready to be used immediately by such tasks.&lt;br /&gt;
&lt;br /&gt;
== Summary ==&lt;br /&gt;
&lt;br /&gt;
[[File:MurphysLaw.png|400px]]&lt;br /&gt;
&lt;br /&gt;
Murphy’s Law, ‘if things can go wrong they will’, has had a significant impact on the design of OCEOSmp. &lt;br /&gt;
&lt;br /&gt;
An older maxim ‘the wise man avoids evil by anticipating it’ (Publilius Cyrus) has also had an impact. Software can go wrong without prior indication of stress but it may be possible to notice that all is not well before disaster strikes. Avoidance is better than detection.&lt;br /&gt;
&lt;br /&gt;
These ideas have led to OCEOSmp having features that allow fault anticipation, detection, isolation and recovery, with a white box approach that simplifies system policing and checking behaviour against expectations and with memory statically allocated.&lt;br /&gt;
&lt;br /&gt;
When a problem is found OCEOSmp can take CPU cores out of use or kill or disable tasks without disrupting scheduling, or in severe cases exit and return to the ASW main() with all data still accessible for analysis or download, and with the ASW able to make changes and restart OCEOSmp if desired.&lt;br /&gt;
&lt;br /&gt;
These features help ensure that OCEOSmp is suitable for use in safety critical or other systems that require the highest reliability.&lt;br /&gt;
&lt;br /&gt;
Even where it is hoped that nothing can possibly go wrong….&lt;br /&gt;
&lt;br /&gt;
= &amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;'''System Log'''&amp;lt;/span&amp;gt; =&lt;br /&gt;
&lt;br /&gt;
== Purpose ==&lt;br /&gt;
#Provide application software with the ability to make time stamped records of events for use in application performance monitoring and in application debugging&lt;br /&gt;
#Provide OCEOSmp with the ability to record internal anomalies should these be detected.&lt;br /&gt;
&lt;br /&gt;
== Structure ==&lt;br /&gt;
#A circular buffer with a fixed size that is set in the application configuration&lt;br /&gt;
#Size from 16 to 1024 entries, default 64 if not specified&lt;br /&gt;
#If the application defines oceosmp_on_full_log(void *) this is called automatically when the buffer becomes ¾ full, allowing log entries that might otherwise be overwritten be stored. The automatic call will reoccur only after the buffer becomes ¾ empty.&lt;br /&gt;
#On system reset log entries are not overwritten and buffer indices are reset so as to postpone recent entries being overwritten and allow review of events prior to the reset.&lt;br /&gt;
&lt;br /&gt;
== Storage ==&lt;br /&gt;
#Stored statically in the oceosmp_log_area, which also contains the next-read and next-write buffer indices and the system state related variables.&lt;br /&gt;
#The log size and the oceosmp_on_full() function declaration are stored in the oceosmp_fixed_area, as also are the  log area addresses.&lt;br /&gt;
#Log entry format (from system_log.h): &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
Struct log_entry{&lt;br /&gt;
 	U64_t		time64;&lt;br /&gt;
 	unsigned int       current_cpu_id		:8;&lt;br /&gt;
 	unsigned int	entry_type		:8;&lt;br /&gt;
 	U32_t		entry_comment;&lt;br /&gt;
} __attribute__ ((aligned (8));&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt; &lt;br /&gt;
#When a log entry is made, time64 and current_cpu_id are set automatically by OCEOSmp.&lt;br /&gt;
#The entry type is an enum defined by the application, with a subset of enum values reserved for use by OCEOSmp. The reserved enum values are specified in system_log.h.&lt;br /&gt;
#The entry_comment allows noting further information on the current situation&lt;br /&gt;
&lt;br /&gt;
== Associated directives ==&lt;br /&gt;
#Add Log Entry&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t 	oceos_log_add_entry(&lt;br /&gt;
 	 	enum LOG_ENTRY_TYPE type, // 8 bit enum LOG_ENTRY_TYPE&lt;br /&gt;
 	 	const U32_t info 		// further information&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt; &lt;br /&gt;
This adds an entry, overwriting the currently oldest entry.&lt;br /&gt;
&lt;br /&gt;
#Remove Log Entry&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t oceos_log_remove_entry(&lt;br /&gt;
 		struct log_entry * const outputPtr&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This returns the oldest unread entry to outputPtr and updates the buffer indices&lt;br /&gt;
&lt;br /&gt;
#Other directives are detailed in system_log.h&lt;br /&gt;
 &lt;br /&gt;
== Usage by OCEOSmp itself ==&lt;br /&gt;
#OCEOSmp only uses the system log for problems that do not arise directly when a directive is used (problems that arise directly are described in the returned directive status code).&lt;br /&gt;
#Such problems fall into a number of categories&lt;br /&gt;
## System corruption is detected and/or oceos_exit is called a&lt;br /&gt;
## Excessive delays in obtaining system spin locks perhaps due to system overloading&lt;br /&gt;
## A timed action misses its specified time&lt;br /&gt;
## A task misses its deadlines&lt;br /&gt;
## Task start requests occur more frequently than expected&lt;br /&gt;
## A task exits without returning a mutex or read-write mutex that it holds&lt;br /&gt;
## Nested mutexes or read-write mutexes not returned in correct order&lt;br /&gt;
## Counts already at max or min&lt;br /&gt;
#In many cases when OCEOSmp makes a system log entry it also updates the system state variable. This is updated using ‘OR’ and so provides a long term record that a problem has occurred even if a log entry is overwritten. In addition, if the update corresponds to an application defined action mask an application defined problem handling function may be called which can if desired read the system log.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:backup]]&lt;/div&gt;</summary>
		<author><name>Bkavanagh</name></author>
	</entry>
	<entry>
		<id>https://wiki.ocetechnology.com/mediawiki/index.php?title=OCEOSmp/notes&amp;diff=1686</id>
		<title>OCEOSmp/notes</title>
		<link rel="alternate" type="text/html" href="https://wiki.ocetechnology.com/mediawiki/index.php?title=OCEOSmp/notes&amp;diff=1686"/>
		<updated>2024-05-03T15:22:40Z</updated>

		<summary type="html">&lt;p&gt;Bkavanagh: /* Associated directives (from system_log.h) */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= &amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;'''When things go wrong'''&amp;lt;/span&amp;gt; =&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Prof. M. Ryan'''&lt;br /&gt;
&lt;br /&gt;
Things can go wrong even when software is bug free.&lt;br /&gt;
&lt;br /&gt;
Misunderstandings may have led to an inadequate design, real world circumstances may conspire to cause performance problems, radiation or other factors may cause hardware failures, and in general things can always go wrong.&lt;br /&gt;
&lt;br /&gt;
Murphy’s Law then applies, and while the system is in use it is important that system behaviour can be monitored, deviations from expectations noticed, checks made, corrections done, and recovery steps taken if needed.&lt;br /&gt;
&lt;br /&gt;
OCEOSmp has been designed with Murphy’s Law in mind and facilitates such actions in a number of ways.&lt;br /&gt;
&lt;br /&gt;
# Servant not Master&lt;br /&gt;
# White Box not Black Box&lt;br /&gt;
# Directive warning and error status codes&lt;br /&gt;
# Automatic integrity checks&lt;br /&gt;
# System Log&lt;br /&gt;
# System state variable&lt;br /&gt;
# System Policing and Problem Anticipation&lt;br /&gt;
# Problem Detection and Handling&lt;br /&gt;
# Precautions and Correction&lt;br /&gt;
&lt;br /&gt;
== Servant not Master ==&lt;br /&gt;
&lt;br /&gt;
[[File:MasterNotSlave.png|400px]]&lt;br /&gt;
&lt;br /&gt;
Many operating systems begin execution directly after the boot sequence and control all subsequent execution of the application software (ASW). Should something go wrong it can be difficult to assess what has occurred and find appropriate corrective action, particularly if the operating system itself has been involved.&lt;br /&gt;
&lt;br /&gt;
With OCEOSmp the ASW begins execution before the operating system and only starts OCEOSmp at some point after entering main().&lt;br /&gt;
&lt;br /&gt;
Before doing so the ASW should check the circumstances that lead to main() being entered. If due to a system restart then the data accumulated by OCEOSmp in the previous run is still available in its fixed, dynamic, and log data areas for analysis or download to find the cause (assuming power has been maintained or non-volatile memory is used for those areas).&lt;br /&gt;
&lt;br /&gt;
The ASW can then make appropriate modifications, and continue as usual to set up EDAC, set up memory protection, initialise and check CPU cores and peripherals, and once all seems correct proceed to start or restart OCEOSmp.&lt;br /&gt;
&lt;br /&gt;
Once scheduling begins OCEOSmp returns to main() only if a fatal error is detected or if it is instructed to do so by an ASW task. Should this occur all the data accumulated is available for analysis or download by ASW main() code, which can restart scheduling by calling oceos_start().&lt;br /&gt;
 &lt;br /&gt;
Most problems can be dealt with by tasks set up to do so under the control of OCEOSmp, but sufficiently serious ones may cause a system reset (e.g. a watchdog timer running out) or cause OCEOSmp to exit (e.g. corruption of critical data), in both cases with the previous state available for analysis if power is maintained or if non-volatile memory is used.&lt;br /&gt;
&lt;br /&gt;
In main() the ASW takes five principal steps in starting OCEOSmp:&lt;br /&gt;
&lt;br /&gt;
# check whether the entry to main() is due to a restart (e.g. by checking if the OCEOSmp data area sentinels are already in place) and if so use the data areas to determine the cause and make whatever modifications to the system are appropriate.   &lt;br /&gt;
# use oceos_init() with the ASW configuration to set up the log area and prepare the fixed data area to hold various addresses, the number of CPU cores, tasks, mutexes, etc.&lt;br /&gt;
# use various OCEOSmp create functions to create tasks, mutexs etc.&lt;br /&gt;
# use oceos_init_finish() to check that the declared numbers of tasks etc. have been created, finish setting up the fixed data area, and set its checksum.&lt;br /&gt;
&lt;br /&gt;
At this point the fixed data area with fixed information about addresses, cores, tasks, mutexes, data queues etc. has been set up, and need not be set up again if not corrupted. The checksum allows the &lt;br /&gt;
area be checked at any time to ensure it has not been changed. Memory protection if available can make the fixed area read-only and make the stack addresses for each core restricted to being written &lt;br /&gt;
only by that core. &lt;br /&gt;
&lt;br /&gt;
Scheduling can begin.&lt;br /&gt;
&lt;br /&gt;
# &amp;lt;li value=&amp;quot;5&amp;quot;&amp;gt;use oceos_start() to initialise the dynamic data area and begins scheduling. This function usually does not return to main() but may do so if a major problem is detected.&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As scheduling progresses the ASW can use the system log to record events and monitor performance. The log is also used by OCEOSmp to record problems, and OCEOSmp may also make a system state entry and trigger an ASW problem handling function.&lt;br /&gt;
&lt;br /&gt;
If a problem is sufficiently serious OCEOSmp may exit automatically or may be requested to do so by an ASW task, execution then returns to main() at the point after the call to oceos_start() with all performance, log, stack and other data available for analysis or download.&lt;br /&gt;
 &lt;br /&gt;
The ASW main() code can then determine the reason for the unexpected return, take appropriate corrective action, and resume scheduling by calling oceos_start() or modify various settings and start over with oceos_init().&lt;br /&gt;
&lt;br /&gt;
The ASW uses OCEOSmp and remains the master, rather than the reverse.&lt;br /&gt;
&lt;br /&gt;
== White Box not Black Box ==&lt;br /&gt;
&lt;br /&gt;
[[File:WhiteboxNotBlackbox.png|800px]]&lt;br /&gt;
&lt;br /&gt;
The data used by OCEOSmp is stored in statically allocated memory in three data areas and in an overall stack area. These usually are specified by the ASW as arrays of 32-bit words and can be examined by the ASW at any time.&lt;br /&gt;
&lt;br /&gt;
The data includes actual and expected task maximum and minimum execution times, activities on CPU cores, and other records of what has been happening. These records can be readily examined by the ASW while scheduling is under way and after OCEOSmp exits should this occur.&lt;br /&gt;
&lt;br /&gt;
OCEOSmp configures each data area to begin with a 32-bit sentinel followed by its size measured in 32-bit words, then the corresponding data, and finally a 32-bit sentinel. In the case of the fixed data area a 32-bit XOR checksum is located before the end sentinel.&lt;br /&gt;
&lt;br /&gt;
The size of each data area and the layout of the data within it depends on the application configuration, but are clearly specified with the location of each data item identified.&lt;br /&gt;
&lt;br /&gt;
Whenever an OCEOSmp directive is used a quick check is made that sentinels have not been breached. The ASW itself can check the fixed area checksum at any time (this is not done automatically for reasons of efficiency).&lt;br /&gt;
&lt;br /&gt;
The Log Area is initialized by oceos_init() and contains the system log and system state variable and if used the optional context switch log. Directives are provided to access and update these. The size of the area depends on the number of entries specified for the two logs in the system configuration. Log contents are preserved across system reset and across power failures if stored in non-volatile memory. &lt;br /&gt;
&lt;br /&gt;
The Fixed Data Area is completed by oceos_init_finish() and contains all the constants of the system, such as the addresses of data areas and stacks, the identity of the CPU core that OCEOSmp is to use on startup, the number of cores, tasks etc., the priorities and other attributes of tasks etc. &lt;br /&gt;
&lt;br /&gt;
The Dynamic Data area is created and initialized by oceos_start() and contains the information collected as oceosmp schedules tasks and as mutexes, counting semaphores,  etc. are used. This information is available for inspection by the ASW if OCEOSmp exits, and is only overwritten if the ASW again calls oceos_start().&lt;br /&gt;
&lt;br /&gt;
In OCEOSmp each CPU core has a system stack, a stack for each thread is not required. The stack size per CPU core and the location of the overall top of stack is specified in the application configuration and the overall stack space is statically allocated.&lt;br /&gt;
&lt;br /&gt;
Before scheduling begins OCEOSmp initialises each core’s stack with a filler. This is overwritten as the stack is used and by checking how much memory at the top and bottom of each stack still contains the filler it is possible to determine at any point how close the system has come to a stack overrun.&lt;br /&gt;
&lt;br /&gt;
The white box approach of making all records and the system stacks readily accessible while scheduling is taking place and should OCEOSmp exit facilitates checking that the system is performing as expected and determining the causes of any problems that may occur.&lt;br /&gt;
&lt;br /&gt;
== Directive warning and error status codes ==&lt;br /&gt;
&lt;br /&gt;
[[File:WarningErrorIcon.png|400px]]&lt;br /&gt;
&lt;br /&gt;
The ASW uses OCEOSmp by calling its directives, and is responsible for checking the returned directive status code. (OCEOSmp is a statically linked library, only those components related to the directives used by the ASW are linked into the final executable.)&lt;br /&gt;
&lt;br /&gt;
The system time directives oceos_time_sys_get64() and oceos_time_sys_get32() directly return the requested system time as 64-bit or 32-bit unsigned integers.&lt;br /&gt;
&lt;br /&gt;
Other directives return a 32-bit signed integer status code.&lt;br /&gt;
&lt;br /&gt;
This should always be checked when a directive is used.&lt;br /&gt;
&lt;br /&gt;
The status code indicates ERROR, SUCCESS, or WARNING.&lt;br /&gt;
&lt;br /&gt;
* A negative value indicates that the directive has not executed and gives the reasons&lt;br /&gt;
* A zero value indicates successful execution as expected&lt;br /&gt;
* A non-zero positive value indicates that the directive executed but with warnings&lt;br /&gt;
&lt;br /&gt;
Certain bits in the status code have the same meaning for all directives.&lt;br /&gt;
&lt;br /&gt;
Other bits have meanings that depend on the directive in use.&lt;br /&gt;
&lt;br /&gt;
These meanings are given in the header files associated with each directive as constants that can be compared with the status code to determine the types of errors or warnings involved.&lt;br /&gt;
&lt;br /&gt;
Errors typically involve an incorrect parameter to a directive, or an attempt to use a resource that is not available such as writing to a data queue that is already full.&lt;br /&gt;
&lt;br /&gt;
Warnings typically indicate that the directive has succeeded but that a danger has been created as when a task acquires multiple mutual exclusion semaphores out of order, or that a resource is now fully in use as when a write makes a data queue full.&lt;br /&gt;
&lt;br /&gt;
The task that used the directive and checked the returned status has full access to the data areas and stack areas in deciding the action to take, which may involve making a system log entry, starting a problem handling task, or in the worst case exiting from OCEOSmp and returning to main().&lt;br /&gt;
&lt;br /&gt;
In many situations the returned status code is the only indicator that is needed of directive success or failure. The ASW can then make a system log entry (automatically timestamped by OCEOSmp) for recording or performance analysis purposes if desired.&lt;br /&gt;
&lt;br /&gt;
In some situations OCEOSmp will make a system log entry automatically and may also update the system state variable, resulting in an ASW defined problem handling function being called if the corresponding flag has been set by the ASW in the system action flags.&lt;br /&gt;
&lt;br /&gt;
OCEOSmp may also automatically make a system log entry or take other actions when problems arise later, as when a task completion deadline is missed or a mutex is not returned.&lt;br /&gt;
&lt;br /&gt;
Irrespective of whatever other precautions may be taken, the first line of defence in using a directive is to check the returned status code.&lt;br /&gt;
&lt;br /&gt;
== Automatic integrity tests ==&lt;br /&gt;
&lt;br /&gt;
[[File:Automation.jpg|600px]]&lt;br /&gt;
&lt;br /&gt;
These are done automatically by OCEOSmp when a directive is used or an event occurs.&lt;br /&gt;
&lt;br /&gt;
They include checking that OCEOSmp data area sentinels are intact, and in the event of corruption may result in an exit from OCEOSmp and return to main().&lt;br /&gt;
&lt;br /&gt;
Directive parameters and the current system phase also are automatically checked when a directive is used, together with the availability of any required resources.&lt;br /&gt;
&lt;br /&gt;
Problems detected immediately when a directive is used result in an appropriate status code being returned to the ASW task that called the directive.&lt;br /&gt;
&lt;br /&gt;
Some problems, such as a task missing a deadline, do not occur immediately when a directive is used but only as scheduling proceeds. Such problems are checked for automatically by OCEOSmp.&lt;br /&gt;
&lt;br /&gt;
Checks include task completion times vs. deadlines, task start requests intervals vs. expected maxima and minima, mutual exclusion semaphore not being released before task completion, time taken to obtain spinlocks longer than expected (an indicator of system loading), and other problems. &lt;br /&gt;
&lt;br /&gt;
If a check fails in most cases a system log entry is made and the system state variable may be updated, possibly resulting in an ASW defined problem handler being called. In extreme cases OCEOSmp may exit and return to main().&lt;br /&gt;
&lt;br /&gt;
Overall the automatic integrity tests carried out by OCEOSmp itself include:&lt;br /&gt;
# System meta pointer intact&lt;br /&gt;
# Data area sentinel/s intact&lt;br /&gt;
# Task deadline not missed&lt;br /&gt;
# Task start request gap too short&lt;br /&gt;
# Task start request gap too long&lt;br /&gt;
# …&lt;br /&gt;
&lt;br /&gt;
It should be noted that these checks detect that a problem has happened. To anticipate problems and perhaps avoid them further checks can and should be done by the ASW as part of system policing.&lt;br /&gt;
&lt;br /&gt;
== System Log ==&lt;br /&gt;
&lt;br /&gt;
[[File:Logging.png|600px]]&lt;br /&gt;
&lt;br /&gt;
=== Purpose ===&lt;br /&gt;
&lt;br /&gt;
# Provide application software with the ability to make time stamped records of events for use in application performance monitoring and in application debugging&lt;br /&gt;
# Provide OCEOSmp with the ability to record anomalies should these be detected.&lt;br /&gt;
&lt;br /&gt;
=== Structure ===&lt;br /&gt;
&lt;br /&gt;
# &amp;lt;li value=&amp;quot;3&amp;quot;&amp;gt;A circular buffer with a fixed size that is set in the application configuration&amp;lt;/li&amp;gt; &lt;br /&gt;
# Size from 16 to 1024 entries, default 64 if size not specified&lt;br /&gt;
# If the application defines oceosmp_on_full_log(void *) this is called automatically when the buffer becomes ¾ full, allowing log entries that might otherwise be overwritten be archived. The automatic call will reoccur only after the buffer becomes ¾ empty.&lt;br /&gt;
# Two indices determine the next log entry position to be read from or written to. On system reset these are left unchanged if valid so as to postpone recent entries being overwritten.&lt;br /&gt;
# Log entries are left unchanged until a system log write causes the current entry at the write index be overwritten. Reading the log returns the earliest entry not read so far. Directives are provided to allow any log entry be read and to reset the log indices.&lt;br /&gt;
&lt;br /&gt;
=== Storage ===&lt;br /&gt;
&lt;br /&gt;
#  &amp;lt;li value=&amp;quot;8&amp;quot;&amp;gt;Stored statically in the oceosmp_log_area, which also contains the next-read and next-write buffer indices and the system state related variables.&amp;lt;/li&amp;gt;&lt;br /&gt;
# The log size and the oceosmp_on_full() function declaration are stored in the oceosmp_fixed_area, as also are the  log area addresses.&lt;br /&gt;
&lt;br /&gt;
==== Log entry format (from system_log.h) ====&lt;br /&gt;
&lt;br /&gt;
 Struct log_entry{&lt;br /&gt;
  	U64_t time64;&lt;br /&gt;
  	unsigned int current_cpu_id :8;&lt;br /&gt;
  	unsigned int entry_type :8;&lt;br /&gt;
  	U32_t entry_comment;&lt;br /&gt;
 } __attribute__ ((aligned (8));&lt;br /&gt;
&lt;br /&gt;
# &amp;lt;li value=&amp;quot;10&amp;quot;&amp;gt;When a log entry is made, time64 and current_cpu_id are set automatically by OCEOSmp.&amp;lt;/li&amp;gt;&lt;br /&gt;
# The entry type is an enum defined by the application, with a subset of enum values reserved for use by OCEOSmp. The reserved enum values are specified in system_log.h.&lt;br /&gt;
# The ''entry_comment'' allows noting further information on the current situation&lt;br /&gt;
&lt;br /&gt;
==== Associated directives (from system_log.h) ====&lt;br /&gt;
# &amp;lt;li value=&amp;quot;13&amp;quot;&amp;gt;Add log entry&amp;lt;/li&amp;gt;&lt;br /&gt;
 S32_t 	oceos_log_add_entry(&lt;br /&gt;
 	 	enum LOG_ENTRY_TYPE type, // 8 bit enum LOG_ENTRY_TYPE&lt;br /&gt;
 	 	const U32_t info 		// further information&lt;br /&gt;
 );&lt;br /&gt;
&lt;br /&gt;
This adds an entry, overwriting the currently oldest entry.&lt;br /&gt;
&lt;br /&gt;
# &amp;lt;li value=&amp;quot;14&amp;quot;&amp;gt;Remove log entry&amp;lt;/li&amp;gt;&lt;br /&gt;
 S32_t oceos_log_remove_entry(&lt;br /&gt;
  		struct log_entry * const outputPtr&lt;br /&gt;
 );&lt;br /&gt;
&lt;br /&gt;
This returns the oldest unread entry to outputPtr and updates the buffer indices&lt;br /&gt;
&lt;br /&gt;
# &amp;lt;li value=&amp;quot;15&amp;quot;&amp;gt;Other log directives are detailed in system_log.h&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Usage by OCEOSmp itself&lt;br /&gt;
&lt;br /&gt;
# &amp;lt;li value=&amp;quot;14&amp;quot;&amp;gt;OCEOSmp only uses the system log for problems that do not arise directly when a directive is used (problems that arise directly are described in the returned directive status code).&amp;lt;/li&amp;gt;&lt;br /&gt;
# Such problems fall into a number of categories&lt;br /&gt;
## System corruption is detected and/or oceos_exit is called a&lt;br /&gt;
## Excessive delays in obtaining system spin locks perhaps due to system overloading&lt;br /&gt;
## A timed action misses its specified time&lt;br /&gt;
## A task misses its deadlines&lt;br /&gt;
## Task start requests occur more frequently than expected&lt;br /&gt;
## A task exits without returning a mutex or read-write mutex that it holds&lt;br /&gt;
## Nested mutexes or read-write mutexes not returned in correct order&lt;br /&gt;
## Counts already at max or min&lt;br /&gt;
# In many cases when OCEOSmp makes a system log entry it also updates the system state variable. This is updated using ‘OR’ and so provides a long term record that a problem has occurred even if a log entry is overwritten. In addition, if the update corresponds to an application defined action mask and an application problem handling function is defined this is called automatically.&lt;br /&gt;
&lt;br /&gt;
== System State Variable ==&lt;br /&gt;
&lt;br /&gt;
[[File:SystemState.png|400px]]&lt;br /&gt;
&lt;br /&gt;
=== Purpose ===&lt;br /&gt;
&lt;br /&gt;
To record that certain conditions have occurred and to allow the ASW specify which conditions should cause an ASW defined problem handling function be triggered automatically when the state variable is updated due to these conditions.&lt;br /&gt;
&lt;br /&gt;
=== Structure ===&lt;br /&gt;
Four 32-bit words each containing 32 flags, some available for use by the ASW, some reserved for use by OCEOSmp&lt;br /&gt;
# system state variable		individual bits are set by ASW or by OCEOSmp &lt;br /&gt;
# accumulated system state	updated when system state flags are set &lt;br /&gt;
# action mask			set by ASW in application configuration &lt;br /&gt;
# action mask previous		previous value of action mask if changed by ASW&lt;br /&gt;
&lt;br /&gt;
=== Usage ===&lt;br /&gt;
# &amp;lt;li value=&amp;quot;5&amp;quot;&amp;gt;the system state variable is updated using inclusive ‘OR’ to set the desired flag&amp;lt;/li&amp;gt;&lt;br /&gt;
# the accumulated system state flag is set when the corresponding system state flag is set&lt;br /&gt;
# on reset the system state variable is cleared to 0, all flags clear&lt;br /&gt;
# the accumulated system state variable is reset only by the ASW&lt;br /&gt;
# the action mask is set by the ASW, and causes an ASW defined problem handler to be called when a state flag is updated to 1 that corresponds to a set action mask flag. &lt;br /&gt;
&lt;br /&gt;
Whenever a system state variable flag is set during scheduling (using inclusive ‘OR’) the corresponding accumulated state flag is also set. Accumulated state flags are not affected when a system state flag is cleared to 0, whether by the ASW or on system reset. They can be cleared only directly by the ASW. They keep a record of events across system reset if memory is preserved.&lt;br /&gt;
&lt;br /&gt;
The action mask is specified in the application configuration, which then should also declare a problem handling function. The mask may be altered by the ASW during scheduling.&lt;br /&gt;
&lt;br /&gt;
The ASW problem handling function is called automatically by OCEOSmp as a result of setting a previously clear system state flag that corresponds to a flag that is set in the action mask. The system state flag is set before the function is called. If the system state flag is not reset by the ASW problem handler or otherwise then further settings of that system state flag will not cause the function to be called again.&lt;br /&gt;
&lt;br /&gt;
The ASW can use a system call to modify the action mask at any time, when this is done the previous value of the action mask is stored.&lt;br /&gt;
&lt;br /&gt;
The flags corresponding to the high sixteen bits of the system state variable are reserved for use by OCEOSmp:&lt;br /&gt;
&lt;br /&gt;
These primarily refer to problems that are not immediate consequences of the use of a directive (these are indicated in the returned error or warning status code), but that may occur subsequently during scheduling:&lt;br /&gt;
# &amp;lt;li value=&amp;quot;16&amp;quot;&amp;gt;reserved&amp;lt;/li&amp;gt;	&lt;br /&gt;
# reserved&lt;br /&gt;
# reserved&lt;br /&gt;
# reserved&lt;br /&gt;
# reserved&lt;br /&gt;
# Attempt to start pending task that has been disabled while pending.&lt;br /&gt;
# Time from task start request to job completion exceeds task deadline.&lt;br /&gt;
# Time between task start requests less than specified minimum for task&lt;br /&gt;
# Time between task start requests greater than specified maximum for task&lt;br /&gt;
# Missed latest time for transfer of job from timed action queue to scheduler.&lt;br /&gt;
# Missed latest time for performance of timed output.&lt;br /&gt;
# Mutex not returned before job terminates.&lt;br /&gt;
# Read/Write mutex not returned before job termination.&lt;br /&gt;
# System busy warning&lt;br /&gt;
# Data area sentinels corrupted.&lt;br /&gt;
# System meta pointer corrupted&lt;br /&gt;
&lt;br /&gt;
== System Policing and Problem Anticipation ==&lt;br /&gt;
&lt;br /&gt;
All design involves assumptions, and ‘System Policing’ refers to checking how close these come to being violated as the system operates, and to taking precautions if needed.&lt;br /&gt;
&lt;br /&gt;
The white box design of OCEOSmp facilitates this, with records kept automatically of task timing performances and other parameters that are accessible by the ASW at any time, including after OCEOSmp exits should this occur.&lt;br /&gt;
&lt;br /&gt;
These records can answer questions such as ‘what is the longest time this task took to execute’, ‘what is the shortest time between requests to start this task’, ‘what is the longest time between requests to start this task’, and many others, including stack usage.&lt;br /&gt;
&lt;br /&gt;
By checking such data the ASW can notice that behaviour is not as expected and that something is going wrong, allowing ‘Problem Anticipation’ and an issue being dealt with before it causes serious difficulties.&lt;br /&gt;
&lt;br /&gt;
The ASW might do this by having an external policing function running on a core not in use by OCEOSmp that periodically checks that things are as expected, or by having a policing task that is scheduled by OCEOSmp.&lt;br /&gt;
&lt;br /&gt;
With all the data stored statically in the ‘Log Area’, ‘Fixed Data Area’ and ‘Dynamic Data Area’ arrays by the ASW it is straightforward to retrieve it.&lt;br /&gt;
&lt;br /&gt;
OCEOSmp only requires one system stack per CPU core rather than one stack per thread. Each stack is initialised to a known value, making it straightforward to determine the greatest extent to which each stack has been used.&lt;br /&gt;
&lt;br /&gt;
If suspicious activity is detected, the ASW can for example disable a task or take a CPU core out of use or disable a peripheral or take other corrective action.&lt;br /&gt;
&lt;br /&gt;
It can also make a historical record of bad behaviour by adding an entry to the System Log and by updating a flag in the System State variable, When the System Log becomes ¾ full an ASW function if defined is called that can archive the System Log, and a shadow copy of the System State variable is automatically maintained that is only reset by the ASW itself.&lt;br /&gt;
&lt;br /&gt;
When multiple mutual exclusion semaphores are used by tasks the OCEOSmp design excludes the possibility of unbounded priority inversion and no check for this is needed.&lt;br /&gt;
&lt;br /&gt;
On multi-core systems deadlocks can occur but only if tasks fail to acquire mutual exclusion semaphores in a consistent order corresponding to their identity numbers. A warning status code is then returned although as yet no deadlock has occurred.&lt;br /&gt;
&lt;br /&gt;
The ASW can include a policing function that checks the execution times of tasks (in OCEOSmp tasks on other CPU cores spin waiting to acquire mutexes), and the time when a task start request was issued, allowing detection of deadlocks, livelocks, and task starvation.&lt;br /&gt;
&lt;br /&gt;
It should be noted that OCEOSmp itself may detect an anomaly and automatically make an entry in the System Log and may also update the System State variable, perhaps resulting in an ASW defined problem handling function being called, but this only happens after a problem has occurred and been detected. &lt;br /&gt;
&lt;br /&gt;
== Problem Detection and Handling ==&lt;br /&gt;
&lt;br /&gt;
[[File:PoliceJoke.png|600px]]&lt;br /&gt;
&lt;br /&gt;
This relates to what happens after a problem has occurred and been detected, as distinct from System Policing and Problem Anticipation which aims to forestall problems.&lt;br /&gt;
&lt;br /&gt;
The integrity tests carried out automatically by OCEOSmp check for a number of problems. Some are detected directly when an OCEOSmp directive is used, others when an event occurs such as a job completing execution, others when some internal operation of OCEOSmp does not proceed as expected. &lt;br /&gt;
&lt;br /&gt;
Problems that arise directly from the use or misuse of a directive are identified in the returned status code, and the ASW can then decide the appropriate action.&lt;br /&gt;
&lt;br /&gt;
If appropriate the ASW can disable or terminate tasks and take CPU cores out of use without disrupting scheduling, and can read and update the system log and system state variable. In an extreme case the ASW can end scheduling and return to main().&lt;br /&gt;
&lt;br /&gt;
# Typical directive problems&lt;br /&gt;
## Current phase doesn’t allow this directive&lt;br /&gt;
## Invalid parameters supplied&lt;br /&gt;
## Time for timed action already passed&lt;br /&gt;
## Write fail, data queue full&lt;br /&gt;
## Write succeeded, data queue now full (warning) &lt;br /&gt;
## Mutexes or rwmutexes acquired in an incorrect order (warning)&lt;br /&gt;
&lt;br /&gt;
Other problems may be identified automatically be OCEOSmp after a directive has been used or when an event occurs, or during internal OCEOSmp operations&lt;br /&gt;
Such problems include:&lt;br /&gt;
# &amp;lt;li value=&amp;quot;2&amp;quot;&amp;gt;Unexpected patterns of events&amp;lt;/li&amp;gt;&lt;br /&gt;
## Task misses a deadline&lt;br /&gt;
## Task start requests occur more frequently than expected&lt;br /&gt;
## Task start requests occur less frequently than expected&lt;br /&gt;
## Task disabled after being put on a pending queue&lt;br /&gt;
## Spin locks not being available in a reasonable time&lt;br /&gt;
## Action time missed&lt;br /&gt;
## Pending queues being full&lt;br /&gt;
&lt;br /&gt;
These problems typically cause a system log entry to be made, may update the system state variable and may result in an ASW defined problem handling function being called. This has full access to the performance records and can enable or disable tasks and take CPU cores out of use or restore them to use without disrupting scheduling, and can exit from OCEOSmp if appropriate.&lt;br /&gt;
&lt;br /&gt;
Other problems that may be automatically detected by OCEOSmp include&lt;br /&gt;
# &amp;lt;li value=&amp;quot;3&amp;quot;&amp;gt;Corruption of critical data&amp;lt;/li&amp;gt;&lt;br /&gt;
## Perhaps due to hardware failures&lt;br /&gt;
## Perhaps by application software malfunctioning and overwriting data&lt;br /&gt;
## Perhaps by a bug in OCEOSmp&lt;br /&gt;
&lt;br /&gt;
These problems typically result in exit from OCEOSmp and return to main() at the point immediately after oceos_start() was used. The system state variable and system log may also be updated.&lt;br /&gt;
&lt;br /&gt;
It should be noted that the checks made by OCEOSmp only occur as a result of it being notified of some change in the state of the system, as when a directive is used or a job terminates or an interrupt occurs. It is recommended that these be added to by taking appropriate precautions.&lt;br /&gt;
&lt;br /&gt;
== Precautions and Correction ==&lt;br /&gt;
&lt;br /&gt;
[[File:Precaution.png|600px]]&lt;br /&gt;
&lt;br /&gt;
A primary precaution is policing. As described above this typically involves assigning a CPU core to check the activities of the system, or perhaps assigning a task to that purpose. Anticipation and prevention are better than detection.&lt;br /&gt;
&lt;br /&gt;
Further precautions are also possible, depending on the hardware available in the system. These can detect or perhaps even prevent various malfunctions. &lt;br /&gt;
&lt;br /&gt;
=== Hardware Malfunctions ===&lt;br /&gt;
These can be caused by radiation or other external factors, or simply by parts of the system wearing out.&lt;br /&gt;
&lt;br /&gt;
They fall into three main categories, memory hardware malfunctions, CPU core malfunctions, and peripheral or connected device malfunctions.&lt;br /&gt;
&lt;br /&gt;
==== Memory hardware malfunctions ====&lt;br /&gt;
&lt;br /&gt;
These typically result in one or more bits in a memory location being set to incorrect values.&lt;br /&gt;
&lt;br /&gt;
If the error involve no more than a certain number of bits (BCH 1, RS fixed &amp;gt; 1) then EDAC allows a memory location containing such errors be read correctly despite the error.&lt;br /&gt;
&lt;br /&gt;
While the value read is correct the error remains in the location until the correct value is written back. This should be done before a further bit becomes corrupted, perhaps making the error un-correctable. In some systems this write back is done automatically. &lt;br /&gt;
&lt;br /&gt;
Long intervals can occur between uses of a memory location making ‘memory scrubbing’ necessary. This cycles through all memory locations, reading and writing back if needed, doing so often enough to make it very unlikely that an un-correctable number of erroneous bits will accumulate in any location.&lt;br /&gt;
&lt;br /&gt;
Usually a hardware ‘memory scrubber‘ is available that can be configured to do this at a certain rate for a certain range of addresses.&lt;br /&gt;
&lt;br /&gt;
Memory read errors can still occur however. A combination of bit errors can defeat EDAC error detection and lead to an incorrect value being read. Usually however such un-correctable errors are detected by EDAC causing it to raise an exception. The corresponding handler must then take appropriate action, which may include terminating OCEOSmp.&lt;br /&gt;
&lt;br /&gt;
Precautions: Before starting OCEOSmp &lt;br /&gt;
# The handler for EDAC detected un-correctable errors should be put in place&lt;br /&gt;
# The memory should be initialized&lt;br /&gt;
# The EDAC system configured and put into operation&lt;br /&gt;
# The EDAC memory scrubber hardware configured and put into operation&lt;br /&gt;
&lt;br /&gt;
Once this has been done and OCEOSmp started&lt;br /&gt;
# &amp;lt;li value=&amp;quot;5&amp;quot;&amp;gt;The EDAC exception handler can &amp;lt;/li&amp;gt;	&lt;br /&gt;
## Update the system log&lt;br /&gt;
## Update the system state variable&lt;br /&gt;
## Start a problem handling task&lt;br /&gt;
## If necessary call oceos_exit() to return to main()&lt;br /&gt;
&lt;br /&gt;
==== Computer core hardware malfunctions ====&lt;br /&gt;
&lt;br /&gt;
Cores may use triple modular redundancy and other techniques to reduce the effects of transient errors, but nevertheless can become faulty. If this is detected in a multi-core system OCEOSmp allows the faulty core be taken out of use without scheduling being disrupted.&lt;br /&gt;
&lt;br /&gt;
Detecting that a core has become faulty can be done using computational tasks for which the results including timings are known. Before such tests are used however a malfunction may have led to an erroneous result being used. &lt;br /&gt;
&lt;br /&gt;
To avoid this when result accuracy is critical and immediately needed it is possible in OCEOSmp to have multiple CPU cores carry out the same computation at the same time (within a few clock cycles). &lt;br /&gt;
&lt;br /&gt;
The results can then be compared and the majority agreed value used. A core that was at fault can be tested and taken out of use if the problem is judged not to be transient.&lt;br /&gt;
&lt;br /&gt;
Precaution: Check periodically that cores carry out a computational test correctly.&lt;br /&gt;
# &amp;lt;li value=&amp;quot;6&amp;quot;&amp;gt;oceosmp_cpu_disable() will take the specified CPU core out of use, put it to sleep, and cause the termination functions of any jobs executing on the core be executed on a different core.&amp;lt;/li&amp;gt; &lt;br /&gt;
# oceosmp_cpu_enable() will make the specified CPU core available for use&lt;br /&gt;
&lt;br /&gt;
These directives can also be used to manage the number of active cores for power saving or other purposes. Scheduling is not disrupted as long as a functioning core remains.&lt;br /&gt;
&lt;br /&gt;
==== Peripheral Hardware Malfunctions ====&lt;br /&gt;
&lt;br /&gt;
These can arise due to a fault in the peripheral unit itself, or due to problems in an external system for which the peripheral is an interface.&lt;br /&gt;
&lt;br /&gt;
Before starting OCEOSmp the ASW should carry out appropriate checks of all peripheral units, and should ensure that such checks can be carried out if necessary by tasks after scheduling has begun.&lt;br /&gt;
&lt;br /&gt;
Faults in external systems for which a peripheral unit is an interface tend to either&lt;br /&gt;
# cause no messages to be sent to the interface&lt;br /&gt;
# cause messages to be sent too frequently&lt;br /&gt;
&lt;br /&gt;
In most cases when a peripheral receives an external message it causes an interrupt which then causes a request to start a task.&lt;br /&gt;
&lt;br /&gt;
If the interval between such task start requests is longer than expected this may indicate that the peripheral device has become faulty and is no longer operational.&lt;br /&gt;
&lt;br /&gt;
If the interval between such task start requests is shorter than expected it may indicate the frequency of external events exceeding expectations or some fault in the peripheral device.&lt;br /&gt;
&lt;br /&gt;
In both cases on starting the task OCEOSmp automatically checks the interval since the last task start request and if this is less than the expected minimum or greater than the expected maximum will make a system log entry and set the corresponding flag in the system state variable. If the ASW has set the corresponding system state action flag and defined a problem handling function this will result in the ASW problem handling function being called.&lt;br /&gt;
 &lt;br /&gt;
Precautions: &lt;br /&gt;
	In the ASW configuration structure passed to oceos_init() the ASW set the desired flags in the problem action mask and define a problem handling function.   &lt;br /&gt;
&lt;br /&gt;
=== Software Malfunctions ===&lt;br /&gt;
&lt;br /&gt;
Certain types of software errors can cause problems for the system as a whole.&lt;br /&gt;
&lt;br /&gt;
OCEOSmp automatically checks for some of these, others are best checked for by the ASW itself, perhaps as part of system policing.&lt;br /&gt;
&lt;br /&gt;
In addition to policing, various precautions can be taken against these problems, including making use of any memory protection hardware available and using a system watchdog timer.&lt;br /&gt;
&lt;br /&gt;
==== Invalid memory overwriting ====&lt;br /&gt;
&lt;br /&gt;
Application software may inadvertently overwrite memory areas used by OCEOSmp.&lt;br /&gt;
&lt;br /&gt;
The three memory areas used by OCEOSmp are each protected at their ends by constant sentinels. Each time a directive is used or job terminates OCEOSmp checks these sentinels to ensure that the areas involved have not been encroached upon. If so OCEOSmp will exit.&lt;br /&gt;
&lt;br /&gt;
In addition to its sentinels the fixed data area has an XOR checksum which allows any alteration be detected. This is not checked automatically by OCEOSmp for reasons of efficiency, but can be checked at any time by ASW policing software.&lt;br /&gt;
&lt;br /&gt;
Prevention is better than detection and if a system has a memory protection unit this should be configured to make the fixed area read-only. Any attempt to write this area will then typically cause the protection unit to raise an exception.&lt;br /&gt;
&lt;br /&gt;
Each CPU core has its own system stack. These form part of a contiguous block of statically allocated memory, and a software error may result in the code running on a core overrunning that core’s stack and attempting to use the stack memory of another core.&lt;br /&gt;
&lt;br /&gt;
This can be detected in policing by checking that filler still remains at the top and bottom of each core’s stack, and this can be checked at any time by ASW policing software, but prevention is better than detection.&lt;br /&gt;
 &lt;br /&gt;
Precautions: Any hardware memory protection present should be used on completion of oceos_init_finish() and before oceos_start() to provide these features.&lt;br /&gt;
# Read only (the fixed data area)&lt;br /&gt;
# Writeable only by a specific computer core (for each core’s stack)&lt;br /&gt;
 &lt;br /&gt;
Invalid attempts to use a memory location typically give rise to an exception and an appropriate handler must be in place.&lt;br /&gt;
&lt;br /&gt;
==== Invalid use of Mutual Exclusion Semaphores (Mutexes) or of Read-Write Mutexes ====&lt;br /&gt;
&lt;br /&gt;
In general the time for which the ASW holds a mutex or read-write mutex should be as short as possible.&lt;br /&gt;
&lt;br /&gt;
This time can be estimated at compile time and the estimates taken into account in determining whether a set of tasks can be scheduled so that tasks always meet their deadlines.&lt;br /&gt;
&lt;br /&gt;
Such estimates however can be made wrong by events that occur during scheduling if appropriate precautions are not taken.&lt;br /&gt;
&lt;br /&gt;
One possible problem, unbounded priority inversion, arises when a job holding a mutex is pre-empted by a higher priority task that does not use the mutex, causing any even higher priority task that uses the mutex to wait indefinitely for the low priority job to resume and release the mutex. In OCEOSmp unbounded priority inversion cannot occur. &lt;br /&gt;
&lt;br /&gt;
Another problem, deadlock, can arise when two or more jobs each acquire more than one mutex. A job while holding a mutex may then attempt to acquire a different mutex currently held by some other job. If that other job (without releasing the mutex it holds) attempts to acquire the mutex held by the first job neither job can make progress, the jobs are deadlocked.&lt;br /&gt;
&lt;br /&gt;
These problems are addressed by the design of OCEOSmp.&lt;br /&gt;
&lt;br /&gt;
In OCEOSmp each mutex or read-write mutex has a priority ceiling giving the priority of the highest priority task that uses it. This constant is determined at compile time and set for each mutex when it is created.&lt;br /&gt;
&lt;br /&gt;
In scheduling, once a job running on a CPU core holds one or more mutexes or read-write mutexes only tasks with higher priority than the highest ceiling are allowed to pre-empt the job and start running on that core.&lt;br /&gt;
&lt;br /&gt;
As a result unbounded priority inversion cannot occur, and on single core systems deadlocks also are not possible.&lt;br /&gt;
&lt;br /&gt;
On multi-core systems jobs can spin waiting to acquire a mutex held by a job running on a different core and deadlock becomes possible.&lt;br /&gt;
&lt;br /&gt;
In OCEOSmp mutexes and read-write mutexes are assigned a sequential order as they are created. Deadlocks then cannot occur if jobs always respect this order in acquiring mutexes, never attempting to acquire a mutex or read-write mutex if already holding one that is higher in the order.&lt;br /&gt;
&lt;br /&gt;
OCEOSmp does not prevent jobs from acquiring multiple mutexes in an out of order manner but returns a warning directive status code to the job indicating that deadlock is possible and makes a log entry and updates the system state variable, perhaps causing an ASW defined problem handling function to be called.&lt;br /&gt;
&lt;br /&gt;
When a job simultaneously holds multiple mutexes or read-write mutexes it should acquire and return these in a LIFO manner, e.g. waitA, waitB, waitC…..signalC, signalB, signalA. Failure to do so may affect task scheduling temporarily and will result in a warning directive status code, a log entry, and an update of the system state variable.&lt;br /&gt;
&lt;br /&gt;
Other errors in using mutexes such as failure to release a mutex before a job ends or attempting to release a mutex that is not held give rise to an appropriate directive status codes, a log entry, and a system state variable updates.&lt;br /&gt;
&lt;br /&gt;
Precautions: &lt;br /&gt;
# Ensure at compile time that when a task acquires multiple mutexes or read-write mutexes it always does so in the correct order.&lt;br /&gt;
# Ensure at compile time that when a job releases multiple mutexes or read-write mutexes it always does so in the reverse order to that in which they were acquired&lt;br /&gt;
&lt;br /&gt;
==== Deadlocks, Livelocks and Task Starvation ====&lt;br /&gt;
&lt;br /&gt;
Deadlocks arise primarily due to misuse of mutual exclusion semaphores or read write mutual exclusion semaphores, as described above.&lt;br /&gt;
&lt;br /&gt;
Livelocks, where tasks interact in a way that results in each task having to return to some earlier point with no or very little overall progress, can arise in a number of ways including from attempts to resolve a deadlock so that the tasks involved can proceed.&lt;br /&gt;
&lt;br /&gt;
Task starvation arises when a task is ready to start, but CPU time is not allocated to it within a reasonable time. In OCEOSmp this will occur for a low priority task if higher priority tasks are always ready to run and require all the available CPU cores. &lt;br /&gt;
&lt;br /&gt;
Task starvation, to at least some degree, can also occur for a high priority task if the resources required to allow it pre-empt a lower priority task are not available on the CPU core involved, as for example when the remaining system stack for that core is below the level needed for pre-emption.&lt;br /&gt;
&lt;br /&gt;
All three of these problems result in a task or tasks taking longer to complete than should be the case. This can be detected in two main ways&lt;br /&gt;
# By a policing task that periodically checks each task record in the dynamic area to determine the maximum time between a request to start it and task completion. &lt;br /&gt;
# By watchdog timer hardware that typically is reset periodically by the lowest priority task and which will cause a hardware system reset if its pre-set time elapses before it is reset. On re-entry to main() the ASW can check to determine if this has occurred before restarting OCEOSmp.&lt;br /&gt;
&lt;br /&gt;
Precautions&lt;br /&gt;
# &amp;lt;li value=&amp;quot;3&amp;quot;&amp;gt;ensure each CPU core has adequate system stack so that a lower priority task running on the core can always be pre-empted by a higher priority task. The amount required can be calculated from the number of different priority levels in use.&amp;lt;/li&amp;gt;&lt;br /&gt;
# if watchdog timer hardware is available set up a low priority task to periodically reset it. The ASW should check on entry to main() whether this was due to a watchdog timeout and if so use the OCEOSmp data to determine the cause and appropriate remedial action before restarting OCEOSmp.&lt;br /&gt;
# set up a policing task that checks the execution times of current tasks and detects when this is too long. This task can call an ASW defined problem handling function that can determine how best to deal with the situation, perhaps calling the termination functions of some currently executing tasks, disabling some tasks or changing interrupt intervals.&lt;br /&gt;
# If necessary reserve certain CPU cores to use only by higher priority tasks, perhaps ensuring that there is always at least one CPU core ready to be used immediately by such tasks.&lt;br /&gt;
&lt;br /&gt;
== Summary ==&lt;br /&gt;
&lt;br /&gt;
[[File:MurphysLaw.png|400px]]&lt;br /&gt;
&lt;br /&gt;
Murphy’s Law, ‘if things can go wrong they will’, has had a significant impact on the design of OCEOSmp. &lt;br /&gt;
&lt;br /&gt;
An older maxim ‘the wise man avoids evil by anticipating it’ (Publilius Cyrus) has also had an impact. Software can go wrong without prior indication of stress but it may be possible to notice that all is not well before disaster strikes. Avoidance is better than detection.&lt;br /&gt;
&lt;br /&gt;
These ideas have led to OCEOSmp having features that allow fault anticipation, detection, isolation and recovery, with a white box approach that simplifies system policing and checking behaviour against expectations and with memory statically allocated.&lt;br /&gt;
&lt;br /&gt;
When a problem is found OCEOSmp can take CPU cores out of use or kill or disable tasks without disrupting scheduling, or in severe cases exit and return to the ASW main() with all data still accessible for analysis or download, and with the ASW able to make changes and restart OCEOSmp if desired.&lt;br /&gt;
&lt;br /&gt;
These features help ensure that OCEOSmp is suitable for use in safety critical or other systems that require the highest reliability.&lt;br /&gt;
&lt;br /&gt;
Even where it is hoped that nothing can possibly go wrong….&lt;br /&gt;
&lt;br /&gt;
= &amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;'''System Log'''&amp;lt;/span&amp;gt; =&lt;br /&gt;
&lt;br /&gt;
== Purpose ==&lt;br /&gt;
#Provide application software with the ability to make time stamped records of events for use in application performance monitoring and in application debugging&lt;br /&gt;
#Provide OCEOSmp with the ability to record internal anomalies should these be detected.&lt;br /&gt;
&lt;br /&gt;
== Structure ==&lt;br /&gt;
#A circular buffer with a fixed size that is set in the application configuration&lt;br /&gt;
#Size from 16 to 1024 entries, default 64 if not specified&lt;br /&gt;
#If the application defines oceosmp_on_full_log(void *) this is called automatically when the buffer becomes ¾ full, allowing log entries that might otherwise be overwritten be stored. The automatic call will reoccur only after the buffer becomes ¾ empty.&lt;br /&gt;
#On system reset log entries are not overwritten and buffer indices are reset so as to postpone recent entries being overwritten and allow review of events prior to the reset.&lt;br /&gt;
&lt;br /&gt;
== Storage ==&lt;br /&gt;
#Stored statically in the oceosmp_log_area, which also contains the next-read and next-write buffer indices and the system state related variables.&lt;br /&gt;
#The log size and the oceosmp_on_full() function declaration are stored in the oceosmp_fixed_area, as also are the  log area addresses.&lt;br /&gt;
#Log entry format (from system_log.h): &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
Struct log_entry{&lt;br /&gt;
 	U64_t		time64;&lt;br /&gt;
 	unsigned int       current_cpu_id		:8;&lt;br /&gt;
 	unsigned int	entry_type		:8;&lt;br /&gt;
 	U32_t		entry_comment;&lt;br /&gt;
} __attribute__ ((aligned (8));&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt; &lt;br /&gt;
#When a log entry is made, time64 and current_cpu_id are set automatically by OCEOSmp.&lt;br /&gt;
#The entry type is an enum defined by the application, with a subset of enum values reserved for use by OCEOSmp. The reserved enum values are specified in system_log.h.&lt;br /&gt;
#The entry_comment allows noting further information on the current situation&lt;br /&gt;
&lt;br /&gt;
== Associated directives ==&lt;br /&gt;
#Add Log Entry&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t 	oceos_log_add_entry(&lt;br /&gt;
 	 	enum LOG_ENTRY_TYPE type, // 8 bit enum LOG_ENTRY_TYPE&lt;br /&gt;
 	 	const U32_t info 		// further information&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt; &lt;br /&gt;
This adds an entry, overwriting the currently oldest entry.&lt;br /&gt;
&lt;br /&gt;
#Remove Log Entry&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t oceos_log_remove_entry(&lt;br /&gt;
 		struct log_entry * const outputPtr&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This returns the oldest unread entry to outputPtr and updates the buffer indices&lt;br /&gt;
&lt;br /&gt;
#Other directives are detailed in system_log.h&lt;br /&gt;
 &lt;br /&gt;
== Usage by OCEOSmp itself ==&lt;br /&gt;
#OCEOSmp only uses the system log for problems that do not arise directly when a directive is used (problems that arise directly are described in the returned directive status code).&lt;br /&gt;
#Such problems fall into a number of categories&lt;br /&gt;
a.	System corruption is detected and/or oceos_exit is called&lt;br /&gt;
b.	Excessive delays in obtaining system spin locks perhaps due to system overloading&lt;br /&gt;
c.	A timed action misses its specified time&lt;br /&gt;
d.	A task misses its deadlines&lt;br /&gt;
e.	Task start requests occur more frequently than expected&lt;br /&gt;
f.	A task exits without returning a mutex or read-write mutex that it holds&lt;br /&gt;
g.	Counts already at max or min&lt;br /&gt;
h.	&lt;br /&gt;
18.	In many cases when OCEOSmp makes a system log entry it also updates the system state variable. This is updated using ‘OR’ and so provides a long term record that a problem has occurred even if a log entry is overwritten. In addition, if the update corresponds to an application defined action mask an application defined problem handling function may be called which can if desired read the system log.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:backup]]&lt;/div&gt;</summary>
		<author><name>Bkavanagh</name></author>
	</entry>
	<entry>
		<id>https://wiki.ocetechnology.com/mediawiki/index.php?title=OCEOSmp/notes&amp;diff=1685</id>
		<title>OCEOSmp/notes</title>
		<link rel="alternate" type="text/html" href="https://wiki.ocetechnology.com/mediawiki/index.php?title=OCEOSmp/notes&amp;diff=1685"/>
		<updated>2024-05-03T15:18:41Z</updated>

		<summary type="html">&lt;p&gt;Bkavanagh: /* Associated directives (from system_log.h) */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= &amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;'''When things go wrong'''&amp;lt;/span&amp;gt; =&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Prof. M. Ryan'''&lt;br /&gt;
&lt;br /&gt;
Things can go wrong even when software is bug free.&lt;br /&gt;
&lt;br /&gt;
Misunderstandings may have led to an inadequate design, real world circumstances may conspire to cause performance problems, radiation or other factors may cause hardware failures, and in general things can always go wrong.&lt;br /&gt;
&lt;br /&gt;
Murphy’s Law then applies, and while the system is in use it is important that system behaviour can be monitored, deviations from expectations noticed, checks made, corrections done, and recovery steps taken if needed.&lt;br /&gt;
&lt;br /&gt;
OCEOSmp has been designed with Murphy’s Law in mind and facilitates such actions in a number of ways.&lt;br /&gt;
&lt;br /&gt;
# Servant not Master&lt;br /&gt;
# White Box not Black Box&lt;br /&gt;
# Directive warning and error status codes&lt;br /&gt;
# Automatic integrity checks&lt;br /&gt;
# System Log&lt;br /&gt;
# System state variable&lt;br /&gt;
# System Policing and Problem Anticipation&lt;br /&gt;
# Problem Detection and Handling&lt;br /&gt;
# Precautions and Correction&lt;br /&gt;
&lt;br /&gt;
== Servant not Master ==&lt;br /&gt;
&lt;br /&gt;
[[File:MasterNotSlave.png|400px]]&lt;br /&gt;
&lt;br /&gt;
Many operating systems begin execution directly after the boot sequence and control all subsequent execution of the application software (ASW). Should something go wrong it can be difficult to assess what has occurred and find appropriate corrective action, particularly if the operating system itself has been involved.&lt;br /&gt;
&lt;br /&gt;
With OCEOSmp the ASW begins execution before the operating system and only starts OCEOSmp at some point after entering main().&lt;br /&gt;
&lt;br /&gt;
Before doing so the ASW should check the circumstances that lead to main() being entered. If due to a system restart then the data accumulated by OCEOSmp in the previous run is still available in its fixed, dynamic, and log data areas for analysis or download to find the cause (assuming power has been maintained or non-volatile memory is used for those areas).&lt;br /&gt;
&lt;br /&gt;
The ASW can then make appropriate modifications, and continue as usual to set up EDAC, set up memory protection, initialise and check CPU cores and peripherals, and once all seems correct proceed to start or restart OCEOSmp.&lt;br /&gt;
&lt;br /&gt;
Once scheduling begins OCEOSmp returns to main() only if a fatal error is detected or if it is instructed to do so by an ASW task. Should this occur all the data accumulated is available for analysis or download by ASW main() code, which can restart scheduling by calling oceos_start().&lt;br /&gt;
 &lt;br /&gt;
Most problems can be dealt with by tasks set up to do so under the control of OCEOSmp, but sufficiently serious ones may cause a system reset (e.g. a watchdog timer running out) or cause OCEOSmp to exit (e.g. corruption of critical data), in both cases with the previous state available for analysis if power is maintained or if non-volatile memory is used.&lt;br /&gt;
&lt;br /&gt;
In main() the ASW takes five principal steps in starting OCEOSmp:&lt;br /&gt;
&lt;br /&gt;
# check whether the entry to main() is due to a restart (e.g. by checking if the OCEOSmp data area sentinels are already in place) and if so use the data areas to determine the cause and make whatever modifications to the system are appropriate.   &lt;br /&gt;
# use oceos_init() with the ASW configuration to set up the log area and prepare the fixed data area to hold various addresses, the number of CPU cores, tasks, mutexes, etc.&lt;br /&gt;
# use various OCEOSmp create functions to create tasks, mutexs etc.&lt;br /&gt;
# use oceos_init_finish() to check that the declared numbers of tasks etc. have been created, finish setting up the fixed data area, and set its checksum.&lt;br /&gt;
&lt;br /&gt;
At this point the fixed data area with fixed information about addresses, cores, tasks, mutexes, data queues etc. has been set up, and need not be set up again if not corrupted. The checksum allows the &lt;br /&gt;
area be checked at any time to ensure it has not been changed. Memory protection if available can make the fixed area read-only and make the stack addresses for each core restricted to being written &lt;br /&gt;
only by that core. &lt;br /&gt;
&lt;br /&gt;
Scheduling can begin.&lt;br /&gt;
&lt;br /&gt;
# &amp;lt;li value=&amp;quot;5&amp;quot;&amp;gt;use oceos_start() to initialise the dynamic data area and begins scheduling. This function usually does not return to main() but may do so if a major problem is detected.&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As scheduling progresses the ASW can use the system log to record events and monitor performance. The log is also used by OCEOSmp to record problems, and OCEOSmp may also make a system state entry and trigger an ASW problem handling function.&lt;br /&gt;
&lt;br /&gt;
If a problem is sufficiently serious OCEOSmp may exit automatically or may be requested to do so by an ASW task, execution then returns to main() at the point after the call to oceos_start() with all performance, log, stack and other data available for analysis or download.&lt;br /&gt;
 &lt;br /&gt;
The ASW main() code can then determine the reason for the unexpected return, take appropriate corrective action, and resume scheduling by calling oceos_start() or modify various settings and start over with oceos_init().&lt;br /&gt;
&lt;br /&gt;
The ASW uses OCEOSmp and remains the master, rather than the reverse.&lt;br /&gt;
&lt;br /&gt;
== White Box not Black Box ==&lt;br /&gt;
&lt;br /&gt;
[[File:WhiteboxNotBlackbox.png|800px]]&lt;br /&gt;
&lt;br /&gt;
The data used by OCEOSmp is stored in statically allocated memory in three data areas and in an overall stack area. These usually are specified by the ASW as arrays of 32-bit words and can be examined by the ASW at any time.&lt;br /&gt;
&lt;br /&gt;
The data includes actual and expected task maximum and minimum execution times, activities on CPU cores, and other records of what has been happening. These records can be readily examined by the ASW while scheduling is under way and after OCEOSmp exits should this occur.&lt;br /&gt;
&lt;br /&gt;
OCEOSmp configures each data area to begin with a 32-bit sentinel followed by its size measured in 32-bit words, then the corresponding data, and finally a 32-bit sentinel. In the case of the fixed data area a 32-bit XOR checksum is located before the end sentinel.&lt;br /&gt;
&lt;br /&gt;
The size of each data area and the layout of the data within it depends on the application configuration, but are clearly specified with the location of each data item identified.&lt;br /&gt;
&lt;br /&gt;
Whenever an OCEOSmp directive is used a quick check is made that sentinels have not been breached. The ASW itself can check the fixed area checksum at any time (this is not done automatically for reasons of efficiency).&lt;br /&gt;
&lt;br /&gt;
The Log Area is initialized by oceos_init() and contains the system log and system state variable and if used the optional context switch log. Directives are provided to access and update these. The size of the area depends on the number of entries specified for the two logs in the system configuration. Log contents are preserved across system reset and across power failures if stored in non-volatile memory. &lt;br /&gt;
&lt;br /&gt;
The Fixed Data Area is completed by oceos_init_finish() and contains all the constants of the system, such as the addresses of data areas and stacks, the identity of the CPU core that OCEOSmp is to use on startup, the number of cores, tasks etc., the priorities and other attributes of tasks etc. &lt;br /&gt;
&lt;br /&gt;
The Dynamic Data area is created and initialized by oceos_start() and contains the information collected as oceosmp schedules tasks and as mutexes, counting semaphores,  etc. are used. This information is available for inspection by the ASW if OCEOSmp exits, and is only overwritten if the ASW again calls oceos_start().&lt;br /&gt;
&lt;br /&gt;
In OCEOSmp each CPU core has a system stack, a stack for each thread is not required. The stack size per CPU core and the location of the overall top of stack is specified in the application configuration and the overall stack space is statically allocated.&lt;br /&gt;
&lt;br /&gt;
Before scheduling begins OCEOSmp initialises each core’s stack with a filler. This is overwritten as the stack is used and by checking how much memory at the top and bottom of each stack still contains the filler it is possible to determine at any point how close the system has come to a stack overrun.&lt;br /&gt;
&lt;br /&gt;
The white box approach of making all records and the system stacks readily accessible while scheduling is taking place and should OCEOSmp exit facilitates checking that the system is performing as expected and determining the causes of any problems that may occur.&lt;br /&gt;
&lt;br /&gt;
== Directive warning and error status codes ==&lt;br /&gt;
&lt;br /&gt;
[[File:WarningErrorIcon.png|400px]]&lt;br /&gt;
&lt;br /&gt;
The ASW uses OCEOSmp by calling its directives, and is responsible for checking the returned directive status code. (OCEOSmp is a statically linked library, only those components related to the directives used by the ASW are linked into the final executable.)&lt;br /&gt;
&lt;br /&gt;
The system time directives oceos_time_sys_get64() and oceos_time_sys_get32() directly return the requested system time as 64-bit or 32-bit unsigned integers.&lt;br /&gt;
&lt;br /&gt;
Other directives return a 32-bit signed integer status code.&lt;br /&gt;
&lt;br /&gt;
This should always be checked when a directive is used.&lt;br /&gt;
&lt;br /&gt;
The status code indicates ERROR, SUCCESS, or WARNING.&lt;br /&gt;
&lt;br /&gt;
* A negative value indicates that the directive has not executed and gives the reasons&lt;br /&gt;
* A zero value indicates successful execution as expected&lt;br /&gt;
* A non-zero positive value indicates that the directive executed but with warnings&lt;br /&gt;
&lt;br /&gt;
Certain bits in the status code have the same meaning for all directives.&lt;br /&gt;
&lt;br /&gt;
Other bits have meanings that depend on the directive in use.&lt;br /&gt;
&lt;br /&gt;
These meanings are given in the header files associated with each directive as constants that can be compared with the status code to determine the types of errors or warnings involved.&lt;br /&gt;
&lt;br /&gt;
Errors typically involve an incorrect parameter to a directive, or an attempt to use a resource that is not available such as writing to a data queue that is already full.&lt;br /&gt;
&lt;br /&gt;
Warnings typically indicate that the directive has succeeded but that a danger has been created as when a task acquires multiple mutual exclusion semaphores out of order, or that a resource is now fully in use as when a write makes a data queue full.&lt;br /&gt;
&lt;br /&gt;
The task that used the directive and checked the returned status has full access to the data areas and stack areas in deciding the action to take, which may involve making a system log entry, starting a problem handling task, or in the worst case exiting from OCEOSmp and returning to main().&lt;br /&gt;
&lt;br /&gt;
In many situations the returned status code is the only indicator that is needed of directive success or failure. The ASW can then make a system log entry (automatically timestamped by OCEOSmp) for recording or performance analysis purposes if desired.&lt;br /&gt;
&lt;br /&gt;
In some situations OCEOSmp will make a system log entry automatically and may also update the system state variable, resulting in an ASW defined problem handling function being called if the corresponding flag has been set by the ASW in the system action flags.&lt;br /&gt;
&lt;br /&gt;
OCEOSmp may also automatically make a system log entry or take other actions when problems arise later, as when a task completion deadline is missed or a mutex is not returned.&lt;br /&gt;
&lt;br /&gt;
Irrespective of whatever other precautions may be taken, the first line of defence in using a directive is to check the returned status code.&lt;br /&gt;
&lt;br /&gt;
== Automatic integrity tests ==&lt;br /&gt;
&lt;br /&gt;
[[File:Automation.jpg|600px]]&lt;br /&gt;
&lt;br /&gt;
These are done automatically by OCEOSmp when a directive is used or an event occurs.&lt;br /&gt;
&lt;br /&gt;
They include checking that OCEOSmp data area sentinels are intact, and in the event of corruption may result in an exit from OCEOSmp and return to main().&lt;br /&gt;
&lt;br /&gt;
Directive parameters and the current system phase also are automatically checked when a directive is used, together with the availability of any required resources.&lt;br /&gt;
&lt;br /&gt;
Problems detected immediately when a directive is used result in an appropriate status code being returned to the ASW task that called the directive.&lt;br /&gt;
&lt;br /&gt;
Some problems, such as a task missing a deadline, do not occur immediately when a directive is used but only as scheduling proceeds. Such problems are checked for automatically by OCEOSmp.&lt;br /&gt;
&lt;br /&gt;
Checks include task completion times vs. deadlines, task start requests intervals vs. expected maxima and minima, mutual exclusion semaphore not being released before task completion, time taken to obtain spinlocks longer than expected (an indicator of system loading), and other problems. &lt;br /&gt;
&lt;br /&gt;
If a check fails in most cases a system log entry is made and the system state variable may be updated, possibly resulting in an ASW defined problem handler being called. In extreme cases OCEOSmp may exit and return to main().&lt;br /&gt;
&lt;br /&gt;
Overall the automatic integrity tests carried out by OCEOSmp itself include:&lt;br /&gt;
# System meta pointer intact&lt;br /&gt;
# Data area sentinel/s intact&lt;br /&gt;
# Task deadline not missed&lt;br /&gt;
# Task start request gap too short&lt;br /&gt;
# Task start request gap too long&lt;br /&gt;
# …&lt;br /&gt;
&lt;br /&gt;
It should be noted that these checks detect that a problem has happened. To anticipate problems and perhaps avoid them further checks can and should be done by the ASW as part of system policing.&lt;br /&gt;
&lt;br /&gt;
== System Log ==&lt;br /&gt;
&lt;br /&gt;
[[File:Logging.png|600px]]&lt;br /&gt;
&lt;br /&gt;
=== Purpose ===&lt;br /&gt;
&lt;br /&gt;
# Provide application software with the ability to make time stamped records of events for use in application performance monitoring and in application debugging&lt;br /&gt;
# Provide OCEOSmp with the ability to record anomalies should these be detected.&lt;br /&gt;
&lt;br /&gt;
=== Structure ===&lt;br /&gt;
&lt;br /&gt;
# &amp;lt;li value=&amp;quot;3&amp;quot;&amp;gt;A circular buffer with a fixed size that is set in the application configuration&amp;lt;/li&amp;gt; &lt;br /&gt;
# Size from 16 to 1024 entries, default 64 if size not specified&lt;br /&gt;
# If the application defines oceosmp_on_full_log(void *) this is called automatically when the buffer becomes ¾ full, allowing log entries that might otherwise be overwritten be archived. The automatic call will reoccur only after the buffer becomes ¾ empty.&lt;br /&gt;
# Two indices determine the next log entry position to be read from or written to. On system reset these are left unchanged if valid so as to postpone recent entries being overwritten.&lt;br /&gt;
# Log entries are left unchanged until a system log write causes the current entry at the write index be overwritten. Reading the log returns the earliest entry not read so far. Directives are provided to allow any log entry be read and to reset the log indices.&lt;br /&gt;
&lt;br /&gt;
=== Storage ===&lt;br /&gt;
&lt;br /&gt;
#  &amp;lt;li value=&amp;quot;8&amp;quot;&amp;gt;Stored statically in the oceosmp_log_area, which also contains the next-read and next-write buffer indices and the system state related variables.&amp;lt;/li&amp;gt;&lt;br /&gt;
# The log size and the oceosmp_on_full() function declaration are stored in the oceosmp_fixed_area, as also are the  log area addresses.&lt;br /&gt;
&lt;br /&gt;
==== Log entry format (from system_log.h) ====&lt;br /&gt;
&lt;br /&gt;
 Struct log_entry{&lt;br /&gt;
  	U64_t time64;&lt;br /&gt;
  	unsigned int current_cpu_id :8;&lt;br /&gt;
  	unsigned int entry_type :8;&lt;br /&gt;
  	U32_t entry_comment;&lt;br /&gt;
 } __attribute__ ((aligned (8));&lt;br /&gt;
&lt;br /&gt;
# &amp;lt;li value=&amp;quot;10&amp;quot;&amp;gt;When a log entry is made, time64 and current_cpu_id are set automatically by OCEOSmp.&amp;lt;/li&amp;gt;&lt;br /&gt;
# The entry type is an enum defined by the application, with a subset of enum values reserved for use by OCEOSmp. The reserved enum values are specified in system_log.h.&lt;br /&gt;
# The ''entry_comment'' allows noting further information on the current situation&lt;br /&gt;
&lt;br /&gt;
==== Associated directives (from system_log.h) ====&lt;br /&gt;
#Add log entry&lt;br /&gt;
 S32_t 	oceos_log_add_entry(&lt;br /&gt;
 	 	enum LOG_ENTRY_TYPE type, // 8 bit enum LOG_ENTRY_TYPE&lt;br /&gt;
 	 	const U32_t info 		// further information&lt;br /&gt;
 );&lt;br /&gt;
&lt;br /&gt;
This adds an entry, overwriting the currently oldest entry.&lt;br /&gt;
&lt;br /&gt;
#Remove log entry&lt;br /&gt;
 S32_t oceos_log_remove_entry(&lt;br /&gt;
  		struct log_entry * const outputPtr&lt;br /&gt;
 );&lt;br /&gt;
&lt;br /&gt;
This returns the oldest unread entry to outputPtr and updates the buffer indices&lt;br /&gt;
&lt;br /&gt;
# &amp;lt;li value=&amp;quot;13&amp;quot;&amp;gt;Other log directives are detailed in system_log.h&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Usage by OCEOSmp itself&lt;br /&gt;
&lt;br /&gt;
# &amp;lt;li value=&amp;quot;14&amp;quot;&amp;gt;OCEOSmp only uses the system log for problems that do not arise directly when a directive is used (problems that arise directly are described in the returned directive status code).&amp;lt;/li&amp;gt;&lt;br /&gt;
# Such problems fall into a number of categories&lt;br /&gt;
## System corruption is detected and/or oceos_exit is called a&lt;br /&gt;
## Excessive delays in obtaining system spin locks perhaps due to system overloading&lt;br /&gt;
## A timed action misses its specified time&lt;br /&gt;
## A task misses its deadlines&lt;br /&gt;
## Task start requests occur more frequently than expected&lt;br /&gt;
## A task exits without returning a mutex or read-write mutex that it holds&lt;br /&gt;
## Nested mutexes or read-write mutexes not returned in correct order&lt;br /&gt;
## Counts already at max or min&lt;br /&gt;
# In many cases when OCEOSmp makes a system log entry it also updates the system state variable. This is updated using ‘OR’ and so provides a long term record that a problem has occurred even if a log entry is overwritten. In addition, if the update corresponds to an application defined action mask and an application problem handling function is defined this is called automatically.&lt;br /&gt;
&lt;br /&gt;
== System State Variable ==&lt;br /&gt;
&lt;br /&gt;
[[File:SystemState.png|400px]]&lt;br /&gt;
&lt;br /&gt;
=== Purpose ===&lt;br /&gt;
&lt;br /&gt;
To record that certain conditions have occurred and to allow the ASW specify which conditions should cause an ASW defined problem handling function be triggered automatically when the state variable is updated due to these conditions.&lt;br /&gt;
&lt;br /&gt;
=== Structure ===&lt;br /&gt;
Four 32-bit words each containing 32 flags, some available for use by the ASW, some reserved for use by OCEOSmp&lt;br /&gt;
# system state variable		individual bits are set by ASW or by OCEOSmp &lt;br /&gt;
# accumulated system state	updated when system state flags are set &lt;br /&gt;
# action mask			set by ASW in application configuration &lt;br /&gt;
# action mask previous		previous value of action mask if changed by ASW&lt;br /&gt;
&lt;br /&gt;
=== Usage ===&lt;br /&gt;
# &amp;lt;li value=&amp;quot;5&amp;quot;&amp;gt;the system state variable is updated using inclusive ‘OR’ to set the desired flag&amp;lt;/li&amp;gt;&lt;br /&gt;
# the accumulated system state flag is set when the corresponding system state flag is set&lt;br /&gt;
# on reset the system state variable is cleared to 0, all flags clear&lt;br /&gt;
# the accumulated system state variable is reset only by the ASW&lt;br /&gt;
# the action mask is set by the ASW, and causes an ASW defined problem handler to be called when a state flag is updated to 1 that corresponds to a set action mask flag. &lt;br /&gt;
&lt;br /&gt;
Whenever a system state variable flag is set during scheduling (using inclusive ‘OR’) the corresponding accumulated state flag is also set. Accumulated state flags are not affected when a system state flag is cleared to 0, whether by the ASW or on system reset. They can be cleared only directly by the ASW. They keep a record of events across system reset if memory is preserved.&lt;br /&gt;
&lt;br /&gt;
The action mask is specified in the application configuration, which then should also declare a problem handling function. The mask may be altered by the ASW during scheduling.&lt;br /&gt;
&lt;br /&gt;
The ASW problem handling function is called automatically by OCEOSmp as a result of setting a previously clear system state flag that corresponds to a flag that is set in the action mask. The system state flag is set before the function is called. If the system state flag is not reset by the ASW problem handler or otherwise then further settings of that system state flag will not cause the function to be called again.&lt;br /&gt;
&lt;br /&gt;
The ASW can use a system call to modify the action mask at any time, when this is done the previous value of the action mask is stored.&lt;br /&gt;
&lt;br /&gt;
The flags corresponding to the high sixteen bits of the system state variable are reserved for use by OCEOSmp:&lt;br /&gt;
&lt;br /&gt;
These primarily refer to problems that are not immediate consequences of the use of a directive (these are indicated in the returned error or warning status code), but that may occur subsequently during scheduling:&lt;br /&gt;
# &amp;lt;li value=&amp;quot;16&amp;quot;&amp;gt;reserved&amp;lt;/li&amp;gt;	&lt;br /&gt;
# reserved&lt;br /&gt;
# reserved&lt;br /&gt;
# reserved&lt;br /&gt;
# reserved&lt;br /&gt;
# Attempt to start pending task that has been disabled while pending.&lt;br /&gt;
# Time from task start request to job completion exceeds task deadline.&lt;br /&gt;
# Time between task start requests less than specified minimum for task&lt;br /&gt;
# Time between task start requests greater than specified maximum for task&lt;br /&gt;
# Missed latest time for transfer of job from timed action queue to scheduler.&lt;br /&gt;
# Missed latest time for performance of timed output.&lt;br /&gt;
# Mutex not returned before job terminates.&lt;br /&gt;
# Read/Write mutex not returned before job termination.&lt;br /&gt;
# System busy warning&lt;br /&gt;
# Data area sentinels corrupted.&lt;br /&gt;
# System meta pointer corrupted&lt;br /&gt;
&lt;br /&gt;
== System Policing and Problem Anticipation ==&lt;br /&gt;
&lt;br /&gt;
All design involves assumptions, and ‘System Policing’ refers to checking how close these come to being violated as the system operates, and to taking precautions if needed.&lt;br /&gt;
&lt;br /&gt;
The white box design of OCEOSmp facilitates this, with records kept automatically of task timing performances and other parameters that are accessible by the ASW at any time, including after OCEOSmp exits should this occur.&lt;br /&gt;
&lt;br /&gt;
These records can answer questions such as ‘what is the longest time this task took to execute’, ‘what is the shortest time between requests to start this task’, ‘what is the longest time between requests to start this task’, and many others, including stack usage.&lt;br /&gt;
&lt;br /&gt;
By checking such data the ASW can notice that behaviour is not as expected and that something is going wrong, allowing ‘Problem Anticipation’ and an issue being dealt with before it causes serious difficulties.&lt;br /&gt;
&lt;br /&gt;
The ASW might do this by having an external policing function running on a core not in use by OCEOSmp that periodically checks that things are as expected, or by having a policing task that is scheduled by OCEOSmp.&lt;br /&gt;
&lt;br /&gt;
With all the data stored statically in the ‘Log Area’, ‘Fixed Data Area’ and ‘Dynamic Data Area’ arrays by the ASW it is straightforward to retrieve it.&lt;br /&gt;
&lt;br /&gt;
OCEOSmp only requires one system stack per CPU core rather than one stack per thread. Each stack is initialised to a known value, making it straightforward to determine the greatest extent to which each stack has been used.&lt;br /&gt;
&lt;br /&gt;
If suspicious activity is detected, the ASW can for example disable a task or take a CPU core out of use or disable a peripheral or take other corrective action.&lt;br /&gt;
&lt;br /&gt;
It can also make a historical record of bad behaviour by adding an entry to the System Log and by updating a flag in the System State variable, When the System Log becomes ¾ full an ASW function if defined is called that can archive the System Log, and a shadow copy of the System State variable is automatically maintained that is only reset by the ASW itself.&lt;br /&gt;
&lt;br /&gt;
When multiple mutual exclusion semaphores are used by tasks the OCEOSmp design excludes the possibility of unbounded priority inversion and no check for this is needed.&lt;br /&gt;
&lt;br /&gt;
On multi-core systems deadlocks can occur but only if tasks fail to acquire mutual exclusion semaphores in a consistent order corresponding to their identity numbers. A warning status code is then returned although as yet no deadlock has occurred.&lt;br /&gt;
&lt;br /&gt;
The ASW can include a policing function that checks the execution times of tasks (in OCEOSmp tasks on other CPU cores spin waiting to acquire mutexes), and the time when a task start request was issued, allowing detection of deadlocks, livelocks, and task starvation.&lt;br /&gt;
&lt;br /&gt;
It should be noted that OCEOSmp itself may detect an anomaly and automatically make an entry in the System Log and may also update the System State variable, perhaps resulting in an ASW defined problem handling function being called, but this only happens after a problem has occurred and been detected. &lt;br /&gt;
&lt;br /&gt;
== Problem Detection and Handling ==&lt;br /&gt;
&lt;br /&gt;
[[File:PoliceJoke.png|600px]]&lt;br /&gt;
&lt;br /&gt;
This relates to what happens after a problem has occurred and been detected, as distinct from System Policing and Problem Anticipation which aims to forestall problems.&lt;br /&gt;
&lt;br /&gt;
The integrity tests carried out automatically by OCEOSmp check for a number of problems. Some are detected directly when an OCEOSmp directive is used, others when an event occurs such as a job completing execution, others when some internal operation of OCEOSmp does not proceed as expected. &lt;br /&gt;
&lt;br /&gt;
Problems that arise directly from the use or misuse of a directive are identified in the returned status code, and the ASW can then decide the appropriate action.&lt;br /&gt;
&lt;br /&gt;
If appropriate the ASW can disable or terminate tasks and take CPU cores out of use without disrupting scheduling, and can read and update the system log and system state variable. In an extreme case the ASW can end scheduling and return to main().&lt;br /&gt;
&lt;br /&gt;
# Typical directive problems&lt;br /&gt;
## Current phase doesn’t allow this directive&lt;br /&gt;
## Invalid parameters supplied&lt;br /&gt;
## Time for timed action already passed&lt;br /&gt;
## Write fail, data queue full&lt;br /&gt;
## Write succeeded, data queue now full (warning) &lt;br /&gt;
## Mutexes or rwmutexes acquired in an incorrect order (warning)&lt;br /&gt;
&lt;br /&gt;
Other problems may be identified automatically be OCEOSmp after a directive has been used or when an event occurs, or during internal OCEOSmp operations&lt;br /&gt;
Such problems include:&lt;br /&gt;
# &amp;lt;li value=&amp;quot;2&amp;quot;&amp;gt;Unexpected patterns of events&amp;lt;/li&amp;gt;&lt;br /&gt;
## Task misses a deadline&lt;br /&gt;
## Task start requests occur more frequently than expected&lt;br /&gt;
## Task start requests occur less frequently than expected&lt;br /&gt;
## Task disabled after being put on a pending queue&lt;br /&gt;
## Spin locks not being available in a reasonable time&lt;br /&gt;
## Action time missed&lt;br /&gt;
## Pending queues being full&lt;br /&gt;
&lt;br /&gt;
These problems typically cause a system log entry to be made, may update the system state variable and may result in an ASW defined problem handling function being called. This has full access to the performance records and can enable or disable tasks and take CPU cores out of use or restore them to use without disrupting scheduling, and can exit from OCEOSmp if appropriate.&lt;br /&gt;
&lt;br /&gt;
Other problems that may be automatically detected by OCEOSmp include&lt;br /&gt;
# &amp;lt;li value=&amp;quot;3&amp;quot;&amp;gt;Corruption of critical data&amp;lt;/li&amp;gt;&lt;br /&gt;
## Perhaps due to hardware failures&lt;br /&gt;
## Perhaps by application software malfunctioning and overwriting data&lt;br /&gt;
## Perhaps by a bug in OCEOSmp&lt;br /&gt;
&lt;br /&gt;
These problems typically result in exit from OCEOSmp and return to main() at the point immediately after oceos_start() was used. The system state variable and system log may also be updated.&lt;br /&gt;
&lt;br /&gt;
It should be noted that the checks made by OCEOSmp only occur as a result of it being notified of some change in the state of the system, as when a directive is used or a job terminates or an interrupt occurs. It is recommended that these be added to by taking appropriate precautions.&lt;br /&gt;
&lt;br /&gt;
== Precautions and Correction ==&lt;br /&gt;
&lt;br /&gt;
[[File:Precaution.png|600px]]&lt;br /&gt;
&lt;br /&gt;
A primary precaution is policing. As described above this typically involves assigning a CPU core to check the activities of the system, or perhaps assigning a task to that purpose. Anticipation and prevention are better than detection.&lt;br /&gt;
&lt;br /&gt;
Further precautions are also possible, depending on the hardware available in the system. These can detect or perhaps even prevent various malfunctions. &lt;br /&gt;
&lt;br /&gt;
=== Hardware Malfunctions ===&lt;br /&gt;
These can be caused by radiation or other external factors, or simply by parts of the system wearing out.&lt;br /&gt;
&lt;br /&gt;
They fall into three main categories, memory hardware malfunctions, CPU core malfunctions, and peripheral or connected device malfunctions.&lt;br /&gt;
&lt;br /&gt;
==== Memory hardware malfunctions ====&lt;br /&gt;
&lt;br /&gt;
These typically result in one or more bits in a memory location being set to incorrect values.&lt;br /&gt;
&lt;br /&gt;
If the error involve no more than a certain number of bits (BCH 1, RS fixed &amp;gt; 1) then EDAC allows a memory location containing such errors be read correctly despite the error.&lt;br /&gt;
&lt;br /&gt;
While the value read is correct the error remains in the location until the correct value is written back. This should be done before a further bit becomes corrupted, perhaps making the error un-correctable. In some systems this write back is done automatically. &lt;br /&gt;
&lt;br /&gt;
Long intervals can occur between uses of a memory location making ‘memory scrubbing’ necessary. This cycles through all memory locations, reading and writing back if needed, doing so often enough to make it very unlikely that an un-correctable number of erroneous bits will accumulate in any location.&lt;br /&gt;
&lt;br /&gt;
Usually a hardware ‘memory scrubber‘ is available that can be configured to do this at a certain rate for a certain range of addresses.&lt;br /&gt;
&lt;br /&gt;
Memory read errors can still occur however. A combination of bit errors can defeat EDAC error detection and lead to an incorrect value being read. Usually however such un-correctable errors are detected by EDAC causing it to raise an exception. The corresponding handler must then take appropriate action, which may include terminating OCEOSmp.&lt;br /&gt;
&lt;br /&gt;
Precautions: Before starting OCEOSmp &lt;br /&gt;
# The handler for EDAC detected un-correctable errors should be put in place&lt;br /&gt;
# The memory should be initialized&lt;br /&gt;
# The EDAC system configured and put into operation&lt;br /&gt;
# The EDAC memory scrubber hardware configured and put into operation&lt;br /&gt;
&lt;br /&gt;
Once this has been done and OCEOSmp started&lt;br /&gt;
# &amp;lt;li value=&amp;quot;5&amp;quot;&amp;gt;The EDAC exception handler can &amp;lt;/li&amp;gt;	&lt;br /&gt;
## Update the system log&lt;br /&gt;
## Update the system state variable&lt;br /&gt;
## Start a problem handling task&lt;br /&gt;
## If necessary call oceos_exit() to return to main()&lt;br /&gt;
&lt;br /&gt;
==== Computer core hardware malfunctions ====&lt;br /&gt;
&lt;br /&gt;
Cores may use triple modular redundancy and other techniques to reduce the effects of transient errors, but nevertheless can become faulty. If this is detected in a multi-core system OCEOSmp allows the faulty core be taken out of use without scheduling being disrupted.&lt;br /&gt;
&lt;br /&gt;
Detecting that a core has become faulty can be done using computational tasks for which the results including timings are known. Before such tests are used however a malfunction may have led to an erroneous result being used. &lt;br /&gt;
&lt;br /&gt;
To avoid this when result accuracy is critical and immediately needed it is possible in OCEOSmp to have multiple CPU cores carry out the same computation at the same time (within a few clock cycles). &lt;br /&gt;
&lt;br /&gt;
The results can then be compared and the majority agreed value used. A core that was at fault can be tested and taken out of use if the problem is judged not to be transient.&lt;br /&gt;
&lt;br /&gt;
Precaution: Check periodically that cores carry out a computational test correctly.&lt;br /&gt;
# &amp;lt;li value=&amp;quot;6&amp;quot;&amp;gt;oceosmp_cpu_disable() will take the specified CPU core out of use, put it to sleep, and cause the termination functions of any jobs executing on the core be executed on a different core.&amp;lt;/li&amp;gt; &lt;br /&gt;
# oceosmp_cpu_enable() will make the specified CPU core available for use&lt;br /&gt;
&lt;br /&gt;
These directives can also be used to manage the number of active cores for power saving or other purposes. Scheduling is not disrupted as long as a functioning core remains.&lt;br /&gt;
&lt;br /&gt;
==== Peripheral Hardware Malfunctions ====&lt;br /&gt;
&lt;br /&gt;
These can arise due to a fault in the peripheral unit itself, or due to problems in an external system for which the peripheral is an interface.&lt;br /&gt;
&lt;br /&gt;
Before starting OCEOSmp the ASW should carry out appropriate checks of all peripheral units, and should ensure that such checks can be carried out if necessary by tasks after scheduling has begun.&lt;br /&gt;
&lt;br /&gt;
Faults in external systems for which a peripheral unit is an interface tend to either&lt;br /&gt;
# cause no messages to be sent to the interface&lt;br /&gt;
# cause messages to be sent too frequently&lt;br /&gt;
&lt;br /&gt;
In most cases when a peripheral receives an external message it causes an interrupt which then causes a request to start a task.&lt;br /&gt;
&lt;br /&gt;
If the interval between such task start requests is longer than expected this may indicate that the peripheral device has become faulty and is no longer operational.&lt;br /&gt;
&lt;br /&gt;
If the interval between such task start requests is shorter than expected it may indicate the frequency of external events exceeding expectations or some fault in the peripheral device.&lt;br /&gt;
&lt;br /&gt;
In both cases on starting the task OCEOSmp automatically checks the interval since the last task start request and if this is less than the expected minimum or greater than the expected maximum will make a system log entry and set the corresponding flag in the system state variable. If the ASW has set the corresponding system state action flag and defined a problem handling function this will result in the ASW problem handling function being called.&lt;br /&gt;
 &lt;br /&gt;
Precautions: &lt;br /&gt;
	In the ASW configuration structure passed to oceos_init() the ASW set the desired flags in the problem action mask and define a problem handling function.   &lt;br /&gt;
&lt;br /&gt;
=== Software Malfunctions ===&lt;br /&gt;
&lt;br /&gt;
Certain types of software errors can cause problems for the system as a whole.&lt;br /&gt;
&lt;br /&gt;
OCEOSmp automatically checks for some of these, others are best checked for by the ASW itself, perhaps as part of system policing.&lt;br /&gt;
&lt;br /&gt;
In addition to policing, various precautions can be taken against these problems, including making use of any memory protection hardware available and using a system watchdog timer.&lt;br /&gt;
&lt;br /&gt;
==== Invalid memory overwriting ====&lt;br /&gt;
&lt;br /&gt;
Application software may inadvertently overwrite memory areas used by OCEOSmp.&lt;br /&gt;
&lt;br /&gt;
The three memory areas used by OCEOSmp are each protected at their ends by constant sentinels. Each time a directive is used or job terminates OCEOSmp checks these sentinels to ensure that the areas involved have not been encroached upon. If so OCEOSmp will exit.&lt;br /&gt;
&lt;br /&gt;
In addition to its sentinels the fixed data area has an XOR checksum which allows any alteration be detected. This is not checked automatically by OCEOSmp for reasons of efficiency, but can be checked at any time by ASW policing software.&lt;br /&gt;
&lt;br /&gt;
Prevention is better than detection and if a system has a memory protection unit this should be configured to make the fixed area read-only. Any attempt to write this area will then typically cause the protection unit to raise an exception.&lt;br /&gt;
&lt;br /&gt;
Each CPU core has its own system stack. These form part of a contiguous block of statically allocated memory, and a software error may result in the code running on a core overrunning that core’s stack and attempting to use the stack memory of another core.&lt;br /&gt;
&lt;br /&gt;
This can be detected in policing by checking that filler still remains at the top and bottom of each core’s stack, and this can be checked at any time by ASW policing software, but prevention is better than detection.&lt;br /&gt;
 &lt;br /&gt;
Precautions: Any hardware memory protection present should be used on completion of oceos_init_finish() and before oceos_start() to provide these features.&lt;br /&gt;
# Read only (the fixed data area)&lt;br /&gt;
# Writeable only by a specific computer core (for each core’s stack)&lt;br /&gt;
 &lt;br /&gt;
Invalid attempts to use a memory location typically give rise to an exception and an appropriate handler must be in place.&lt;br /&gt;
&lt;br /&gt;
==== Invalid use of Mutual Exclusion Semaphores (Mutexes) or of Read-Write Mutexes ====&lt;br /&gt;
&lt;br /&gt;
In general the time for which the ASW holds a mutex or read-write mutex should be as short as possible.&lt;br /&gt;
&lt;br /&gt;
This time can be estimated at compile time and the estimates taken into account in determining whether a set of tasks can be scheduled so that tasks always meet their deadlines.&lt;br /&gt;
&lt;br /&gt;
Such estimates however can be made wrong by events that occur during scheduling if appropriate precautions are not taken.&lt;br /&gt;
&lt;br /&gt;
One possible problem, unbounded priority inversion, arises when a job holding a mutex is pre-empted by a higher priority task that does not use the mutex, causing any even higher priority task that uses the mutex to wait indefinitely for the low priority job to resume and release the mutex. In OCEOSmp unbounded priority inversion cannot occur. &lt;br /&gt;
&lt;br /&gt;
Another problem, deadlock, can arise when two or more jobs each acquire more than one mutex. A job while holding a mutex may then attempt to acquire a different mutex currently held by some other job. If that other job (without releasing the mutex it holds) attempts to acquire the mutex held by the first job neither job can make progress, the jobs are deadlocked.&lt;br /&gt;
&lt;br /&gt;
These problems are addressed by the design of OCEOSmp.&lt;br /&gt;
&lt;br /&gt;
In OCEOSmp each mutex or read-write mutex has a priority ceiling giving the priority of the highest priority task that uses it. This constant is determined at compile time and set for each mutex when it is created.&lt;br /&gt;
&lt;br /&gt;
In scheduling, once a job running on a CPU core holds one or more mutexes or read-write mutexes only tasks with higher priority than the highest ceiling are allowed to pre-empt the job and start running on that core.&lt;br /&gt;
&lt;br /&gt;
As a result unbounded priority inversion cannot occur, and on single core systems deadlocks also are not possible.&lt;br /&gt;
&lt;br /&gt;
On multi-core systems jobs can spin waiting to acquire a mutex held by a job running on a different core and deadlock becomes possible.&lt;br /&gt;
&lt;br /&gt;
In OCEOSmp mutexes and read-write mutexes are assigned a sequential order as they are created. Deadlocks then cannot occur if jobs always respect this order in acquiring mutexes, never attempting to acquire a mutex or read-write mutex if already holding one that is higher in the order.&lt;br /&gt;
&lt;br /&gt;
OCEOSmp does not prevent jobs from acquiring multiple mutexes in an out of order manner but returns a warning directive status code to the job indicating that deadlock is possible and makes a log entry and updates the system state variable, perhaps causing an ASW defined problem handling function to be called.&lt;br /&gt;
&lt;br /&gt;
When a job simultaneously holds multiple mutexes or read-write mutexes it should acquire and return these in a LIFO manner, e.g. waitA, waitB, waitC…..signalC, signalB, signalA. Failure to do so may affect task scheduling temporarily and will result in a warning directive status code, a log entry, and an update of the system state variable.&lt;br /&gt;
&lt;br /&gt;
Other errors in using mutexes such as failure to release a mutex before a job ends or attempting to release a mutex that is not held give rise to an appropriate directive status codes, a log entry, and a system state variable updates.&lt;br /&gt;
&lt;br /&gt;
Precautions: &lt;br /&gt;
# Ensure at compile time that when a task acquires multiple mutexes or read-write mutexes it always does so in the correct order.&lt;br /&gt;
# Ensure at compile time that when a job releases multiple mutexes or read-write mutexes it always does so in the reverse order to that in which they were acquired&lt;br /&gt;
&lt;br /&gt;
==== Deadlocks, Livelocks and Task Starvation ====&lt;br /&gt;
&lt;br /&gt;
Deadlocks arise primarily due to misuse of mutual exclusion semaphores or read write mutual exclusion semaphores, as described above.&lt;br /&gt;
&lt;br /&gt;
Livelocks, where tasks interact in a way that results in each task having to return to some earlier point with no or very little overall progress, can arise in a number of ways including from attempts to resolve a deadlock so that the tasks involved can proceed.&lt;br /&gt;
&lt;br /&gt;
Task starvation arises when a task is ready to start, but CPU time is not allocated to it within a reasonable time. In OCEOSmp this will occur for a low priority task if higher priority tasks are always ready to run and require all the available CPU cores. &lt;br /&gt;
&lt;br /&gt;
Task starvation, to at least some degree, can also occur for a high priority task if the resources required to allow it pre-empt a lower priority task are not available on the CPU core involved, as for example when the remaining system stack for that core is below the level needed for pre-emption.&lt;br /&gt;
&lt;br /&gt;
All three of these problems result in a task or tasks taking longer to complete than should be the case. This can be detected in two main ways&lt;br /&gt;
# By a policing task that periodically checks each task record in the dynamic area to determine the maximum time between a request to start it and task completion. &lt;br /&gt;
# By watchdog timer hardware that typically is reset periodically by the lowest priority task and which will cause a hardware system reset if its pre-set time elapses before it is reset. On re-entry to main() the ASW can check to determine if this has occurred before restarting OCEOSmp.&lt;br /&gt;
&lt;br /&gt;
Precautions&lt;br /&gt;
# &amp;lt;li value=&amp;quot;3&amp;quot;&amp;gt;ensure each CPU core has adequate system stack so that a lower priority task running on the core can always be pre-empted by a higher priority task. The amount required can be calculated from the number of different priority levels in use.&amp;lt;/li&amp;gt;&lt;br /&gt;
# if watchdog timer hardware is available set up a low priority task to periodically reset it. The ASW should check on entry to main() whether this was due to a watchdog timeout and if so use the OCEOSmp data to determine the cause and appropriate remedial action before restarting OCEOSmp.&lt;br /&gt;
# set up a policing task that checks the execution times of current tasks and detects when this is too long. This task can call an ASW defined problem handling function that can determine how best to deal with the situation, perhaps calling the termination functions of some currently executing tasks, disabling some tasks or changing interrupt intervals.&lt;br /&gt;
# If necessary reserve certain CPU cores to use only by higher priority tasks, perhaps ensuring that there is always at least one CPU core ready to be used immediately by such tasks.&lt;br /&gt;
&lt;br /&gt;
== Summary ==&lt;br /&gt;
&lt;br /&gt;
[[File:MurphysLaw.png|400px]]&lt;br /&gt;
&lt;br /&gt;
Murphy’s Law, ‘if things can go wrong they will’, has had a significant impact on the design of OCEOSmp. &lt;br /&gt;
&lt;br /&gt;
An older maxim ‘the wise man avoids evil by anticipating it’ (Publilius Cyrus) has also had an impact. Software can go wrong without prior indication of stress but it may be possible to notice that all is not well before disaster strikes. Avoidance is better than detection.&lt;br /&gt;
&lt;br /&gt;
These ideas have led to OCEOSmp having features that allow fault anticipation, detection, isolation and recovery, with a white box approach that simplifies system policing and checking behaviour against expectations and with memory statically allocated.&lt;br /&gt;
&lt;br /&gt;
When a problem is found OCEOSmp can take CPU cores out of use or kill or disable tasks without disrupting scheduling, or in severe cases exit and return to the ASW main() with all data still accessible for analysis or download, and with the ASW able to make changes and restart OCEOSmp if desired.&lt;br /&gt;
&lt;br /&gt;
These features help ensure that OCEOSmp is suitable for use in safety critical or other systems that require the highest reliability.&lt;br /&gt;
&lt;br /&gt;
Even where it is hoped that nothing can possibly go wrong….&lt;br /&gt;
&lt;br /&gt;
= &amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;'''System Log'''&amp;lt;/span&amp;gt; =&lt;br /&gt;
&lt;br /&gt;
== Purpose ==&lt;br /&gt;
#Provide application software with the ability to make time stamped records of events for use in application performance monitoring and in application debugging&lt;br /&gt;
#Provide OCEOSmp with the ability to record internal anomalies should these be detected.&lt;br /&gt;
&lt;br /&gt;
== Structure ==&lt;br /&gt;
#A circular buffer with a fixed size that is set in the application configuration&lt;br /&gt;
#Size from 16 to 1024 entries, default 64 if not specified&lt;br /&gt;
#If the application defines oceosmp_on_full_log(void *) this is called automatically when the buffer becomes ¾ full, allowing log entries that might otherwise be overwritten be stored. The automatic call will reoccur only after the buffer becomes ¾ empty.&lt;br /&gt;
#On system reset log entries are not overwritten and buffer indices are reset so as to postpone recent entries being overwritten and allow review of events prior to the reset.&lt;br /&gt;
&lt;br /&gt;
== Storage ==&lt;br /&gt;
#Stored statically in the oceosmp_log_area, which also contains the next-read and next-write buffer indices and the system state related variables.&lt;br /&gt;
#The log size and the oceosmp_on_full() function declaration are stored in the oceosmp_fixed_area, as also are the  log area addresses.&lt;br /&gt;
#Log entry format (from system_log.h): &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
Struct log_entry{&lt;br /&gt;
 	U64_t		time64;&lt;br /&gt;
 	unsigned int       current_cpu_id		:8;&lt;br /&gt;
 	unsigned int	entry_type		:8;&lt;br /&gt;
 	U32_t		entry_comment;&lt;br /&gt;
} __attribute__ ((aligned (8));&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt; &lt;br /&gt;
#When a log entry is made, time64 and current_cpu_id are set automatically by OCEOSmp.&lt;br /&gt;
#The entry type is an enum defined by the application, with a subset of enum values reserved for use by OCEOSmp. The reserved enum values are specified in system_log.h.&lt;br /&gt;
#The entry_comment allows noting further information on the current situation&lt;br /&gt;
&lt;br /&gt;
== Associated directives ==&lt;br /&gt;
#Add Log Entry&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t 	oceos_log_add_entry(&lt;br /&gt;
 	 	enum LOG_ENTRY_TYPE type, // 8 bit enum LOG_ENTRY_TYPE&lt;br /&gt;
 	 	const U32_t info 		// further information&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt; &lt;br /&gt;
This adds an entry, overwriting the currently oldest entry.&lt;br /&gt;
&lt;br /&gt;
#Remove Log Entry&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t oceos_log_remove_entry(&lt;br /&gt;
 		struct log_entry * const outputPtr&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This returns the oldest unread entry to outputPtr and updates the buffer indices&lt;br /&gt;
&lt;br /&gt;
#Other directives are detailed in system_log.h&lt;br /&gt;
 &lt;br /&gt;
== Usage by OCEOSmp itself ==&lt;br /&gt;
#OCEOSmp only uses the system log for problems that do not arise directly when a directive is used (problems that arise directly are described in the returned directive status code).&lt;br /&gt;
#Such problems fall into a number of categories&lt;br /&gt;
a.	System corruption is detected and/or oceos_exit is called&lt;br /&gt;
b.	Excessive delays in obtaining system spin locks perhaps due to system overloading&lt;br /&gt;
c.	A timed action misses its specified time&lt;br /&gt;
d.	A task misses its deadlines&lt;br /&gt;
e.	Task start requests occur more frequently than expected&lt;br /&gt;
f.	A task exits without returning a mutex or read-write mutex that it holds&lt;br /&gt;
g.	Counts already at max or min&lt;br /&gt;
h.	&lt;br /&gt;
18.	In many cases when OCEOSmp makes a system log entry it also updates the system state variable. This is updated using ‘OR’ and so provides a long term record that a problem has occurred even if a log entry is overwritten. In addition, if the update corresponds to an application defined action mask an application defined problem handling function may be called which can if desired read the system log.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:backup]]&lt;/div&gt;</summary>
		<author><name>Bkavanagh</name></author>
	</entry>
	<entry>
		<id>https://wiki.ocetechnology.com/mediawiki/index.php?title=OCEOSmp/notes&amp;diff=1684</id>
		<title>OCEOSmp/notes</title>
		<link rel="alternate" type="text/html" href="https://wiki.ocetechnology.com/mediawiki/index.php?title=OCEOSmp/notes&amp;diff=1684"/>
		<updated>2024-05-03T15:16:48Z</updated>

		<summary type="html">&lt;p&gt;Bkavanagh: /* Storage */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= &amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;'''When things go wrong'''&amp;lt;/span&amp;gt; =&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Prof. M. Ryan'''&lt;br /&gt;
&lt;br /&gt;
Things can go wrong even when software is bug free.&lt;br /&gt;
&lt;br /&gt;
Misunderstandings may have led to an inadequate design, real world circumstances may conspire to cause performance problems, radiation or other factors may cause hardware failures, and in general things can always go wrong.&lt;br /&gt;
&lt;br /&gt;
Murphy’s Law then applies, and while the system is in use it is important that system behaviour can be monitored, deviations from expectations noticed, checks made, corrections done, and recovery steps taken if needed.&lt;br /&gt;
&lt;br /&gt;
OCEOSmp has been designed with Murphy’s Law in mind and facilitates such actions in a number of ways.&lt;br /&gt;
&lt;br /&gt;
# Servant not Master&lt;br /&gt;
# White Box not Black Box&lt;br /&gt;
# Directive warning and error status codes&lt;br /&gt;
# Automatic integrity checks&lt;br /&gt;
# System Log&lt;br /&gt;
# System state variable&lt;br /&gt;
# System Policing and Problem Anticipation&lt;br /&gt;
# Problem Detection and Handling&lt;br /&gt;
# Precautions and Correction&lt;br /&gt;
&lt;br /&gt;
== Servant not Master ==&lt;br /&gt;
&lt;br /&gt;
[[File:MasterNotSlave.png|400px]]&lt;br /&gt;
&lt;br /&gt;
Many operating systems begin execution directly after the boot sequence and control all subsequent execution of the application software (ASW). Should something go wrong it can be difficult to assess what has occurred and find appropriate corrective action, particularly if the operating system itself has been involved.&lt;br /&gt;
&lt;br /&gt;
With OCEOSmp the ASW begins execution before the operating system and only starts OCEOSmp at some point after entering main().&lt;br /&gt;
&lt;br /&gt;
Before doing so the ASW should check the circumstances that lead to main() being entered. If due to a system restart then the data accumulated by OCEOSmp in the previous run is still available in its fixed, dynamic, and log data areas for analysis or download to find the cause (assuming power has been maintained or non-volatile memory is used for those areas).&lt;br /&gt;
&lt;br /&gt;
The ASW can then make appropriate modifications, and continue as usual to set up EDAC, set up memory protection, initialise and check CPU cores and peripherals, and once all seems correct proceed to start or restart OCEOSmp.&lt;br /&gt;
&lt;br /&gt;
Once scheduling begins OCEOSmp returns to main() only if a fatal error is detected or if it is instructed to do so by an ASW task. Should this occur all the data accumulated is available for analysis or download by ASW main() code, which can restart scheduling by calling oceos_start().&lt;br /&gt;
 &lt;br /&gt;
Most problems can be dealt with by tasks set up to do so under the control of OCEOSmp, but sufficiently serious ones may cause a system reset (e.g. a watchdog timer running out) or cause OCEOSmp to exit (e.g. corruption of critical data), in both cases with the previous state available for analysis if power is maintained or if non-volatile memory is used.&lt;br /&gt;
&lt;br /&gt;
In main() the ASW takes five principal steps in starting OCEOSmp:&lt;br /&gt;
&lt;br /&gt;
# check whether the entry to main() is due to a restart (e.g. by checking if the OCEOSmp data area sentinels are already in place) and if so use the data areas to determine the cause and make whatever modifications to the system are appropriate.   &lt;br /&gt;
# use oceos_init() with the ASW configuration to set up the log area and prepare the fixed data area to hold various addresses, the number of CPU cores, tasks, mutexes, etc.&lt;br /&gt;
# use various OCEOSmp create functions to create tasks, mutexs etc.&lt;br /&gt;
# use oceos_init_finish() to check that the declared numbers of tasks etc. have been created, finish setting up the fixed data area, and set its checksum.&lt;br /&gt;
&lt;br /&gt;
At this point the fixed data area with fixed information about addresses, cores, tasks, mutexes, data queues etc. has been set up, and need not be set up again if not corrupted. The checksum allows the &lt;br /&gt;
area be checked at any time to ensure it has not been changed. Memory protection if available can make the fixed area read-only and make the stack addresses for each core restricted to being written &lt;br /&gt;
only by that core. &lt;br /&gt;
&lt;br /&gt;
Scheduling can begin.&lt;br /&gt;
&lt;br /&gt;
# &amp;lt;li value=&amp;quot;5&amp;quot;&amp;gt;use oceos_start() to initialise the dynamic data area and begins scheduling. This function usually does not return to main() but may do so if a major problem is detected.&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As scheduling progresses the ASW can use the system log to record events and monitor performance. The log is also used by OCEOSmp to record problems, and OCEOSmp may also make a system state entry and trigger an ASW problem handling function.&lt;br /&gt;
&lt;br /&gt;
If a problem is sufficiently serious OCEOSmp may exit automatically or may be requested to do so by an ASW task, execution then returns to main() at the point after the call to oceos_start() with all performance, log, stack and other data available for analysis or download.&lt;br /&gt;
 &lt;br /&gt;
The ASW main() code can then determine the reason for the unexpected return, take appropriate corrective action, and resume scheduling by calling oceos_start() or modify various settings and start over with oceos_init().&lt;br /&gt;
&lt;br /&gt;
The ASW uses OCEOSmp and remains the master, rather than the reverse.&lt;br /&gt;
&lt;br /&gt;
== White Box not Black Box ==&lt;br /&gt;
&lt;br /&gt;
[[File:WhiteboxNotBlackbox.png|800px]]&lt;br /&gt;
&lt;br /&gt;
The data used by OCEOSmp is stored in statically allocated memory in three data areas and in an overall stack area. These usually are specified by the ASW as arrays of 32-bit words and can be examined by the ASW at any time.&lt;br /&gt;
&lt;br /&gt;
The data includes actual and expected task maximum and minimum execution times, activities on CPU cores, and other records of what has been happening. These records can be readily examined by the ASW while scheduling is under way and after OCEOSmp exits should this occur.&lt;br /&gt;
&lt;br /&gt;
OCEOSmp configures each data area to begin with a 32-bit sentinel followed by its size measured in 32-bit words, then the corresponding data, and finally a 32-bit sentinel. In the case of the fixed data area a 32-bit XOR checksum is located before the end sentinel.&lt;br /&gt;
&lt;br /&gt;
The size of each data area and the layout of the data within it depends on the application configuration, but are clearly specified with the location of each data item identified.&lt;br /&gt;
&lt;br /&gt;
Whenever an OCEOSmp directive is used a quick check is made that sentinels have not been breached. The ASW itself can check the fixed area checksum at any time (this is not done automatically for reasons of efficiency).&lt;br /&gt;
&lt;br /&gt;
The Log Area is initialized by oceos_init() and contains the system log and system state variable and if used the optional context switch log. Directives are provided to access and update these. The size of the area depends on the number of entries specified for the two logs in the system configuration. Log contents are preserved across system reset and across power failures if stored in non-volatile memory. &lt;br /&gt;
&lt;br /&gt;
The Fixed Data Area is completed by oceos_init_finish() and contains all the constants of the system, such as the addresses of data areas and stacks, the identity of the CPU core that OCEOSmp is to use on startup, the number of cores, tasks etc., the priorities and other attributes of tasks etc. &lt;br /&gt;
&lt;br /&gt;
The Dynamic Data area is created and initialized by oceos_start() and contains the information collected as oceosmp schedules tasks and as mutexes, counting semaphores,  etc. are used. This information is available for inspection by the ASW if OCEOSmp exits, and is only overwritten if the ASW again calls oceos_start().&lt;br /&gt;
&lt;br /&gt;
In OCEOSmp each CPU core has a system stack, a stack for each thread is not required. The stack size per CPU core and the location of the overall top of stack is specified in the application configuration and the overall stack space is statically allocated.&lt;br /&gt;
&lt;br /&gt;
Before scheduling begins OCEOSmp initialises each core’s stack with a filler. This is overwritten as the stack is used and by checking how much memory at the top and bottom of each stack still contains the filler it is possible to determine at any point how close the system has come to a stack overrun.&lt;br /&gt;
&lt;br /&gt;
The white box approach of making all records and the system stacks readily accessible while scheduling is taking place and should OCEOSmp exit facilitates checking that the system is performing as expected and determining the causes of any problems that may occur.&lt;br /&gt;
&lt;br /&gt;
== Directive warning and error status codes ==&lt;br /&gt;
&lt;br /&gt;
[[File:WarningErrorIcon.png|400px]]&lt;br /&gt;
&lt;br /&gt;
The ASW uses OCEOSmp by calling its directives, and is responsible for checking the returned directive status code. (OCEOSmp is a statically linked library, only those components related to the directives used by the ASW are linked into the final executable.)&lt;br /&gt;
&lt;br /&gt;
The system time directives oceos_time_sys_get64() and oceos_time_sys_get32() directly return the requested system time as 64-bit or 32-bit unsigned integers.&lt;br /&gt;
&lt;br /&gt;
Other directives return a 32-bit signed integer status code.&lt;br /&gt;
&lt;br /&gt;
This should always be checked when a directive is used.&lt;br /&gt;
&lt;br /&gt;
The status code indicates ERROR, SUCCESS, or WARNING.&lt;br /&gt;
&lt;br /&gt;
* A negative value indicates that the directive has not executed and gives the reasons&lt;br /&gt;
* A zero value indicates successful execution as expected&lt;br /&gt;
* A non-zero positive value indicates that the directive executed but with warnings&lt;br /&gt;
&lt;br /&gt;
Certain bits in the status code have the same meaning for all directives.&lt;br /&gt;
&lt;br /&gt;
Other bits have meanings that depend on the directive in use.&lt;br /&gt;
&lt;br /&gt;
These meanings are given in the header files associated with each directive as constants that can be compared with the status code to determine the types of errors or warnings involved.&lt;br /&gt;
&lt;br /&gt;
Errors typically involve an incorrect parameter to a directive, or an attempt to use a resource that is not available such as writing to a data queue that is already full.&lt;br /&gt;
&lt;br /&gt;
Warnings typically indicate that the directive has succeeded but that a danger has been created as when a task acquires multiple mutual exclusion semaphores out of order, or that a resource is now fully in use as when a write makes a data queue full.&lt;br /&gt;
&lt;br /&gt;
The task that used the directive and checked the returned status has full access to the data areas and stack areas in deciding the action to take, which may involve making a system log entry, starting a problem handling task, or in the worst case exiting from OCEOSmp and returning to main().&lt;br /&gt;
&lt;br /&gt;
In many situations the returned status code is the only indicator that is needed of directive success or failure. The ASW can then make a system log entry (automatically timestamped by OCEOSmp) for recording or performance analysis purposes if desired.&lt;br /&gt;
&lt;br /&gt;
In some situations OCEOSmp will make a system log entry automatically and may also update the system state variable, resulting in an ASW defined problem handling function being called if the corresponding flag has been set by the ASW in the system action flags.&lt;br /&gt;
&lt;br /&gt;
OCEOSmp may also automatically make a system log entry or take other actions when problems arise later, as when a task completion deadline is missed or a mutex is not returned.&lt;br /&gt;
&lt;br /&gt;
Irrespective of whatever other precautions may be taken, the first line of defence in using a directive is to check the returned status code.&lt;br /&gt;
&lt;br /&gt;
== Automatic integrity tests ==&lt;br /&gt;
&lt;br /&gt;
[[File:Automation.jpg|600px]]&lt;br /&gt;
&lt;br /&gt;
These are done automatically by OCEOSmp when a directive is used or an event occurs.&lt;br /&gt;
&lt;br /&gt;
They include checking that OCEOSmp data area sentinels are intact, and in the event of corruption may result in an exit from OCEOSmp and return to main().&lt;br /&gt;
&lt;br /&gt;
Directive parameters and the current system phase also are automatically checked when a directive is used, together with the availability of any required resources.&lt;br /&gt;
&lt;br /&gt;
Problems detected immediately when a directive is used result in an appropriate status code being returned to the ASW task that called the directive.&lt;br /&gt;
&lt;br /&gt;
Some problems, such as a task missing a deadline, do not occur immediately when a directive is used but only as scheduling proceeds. Such problems are checked for automatically by OCEOSmp.&lt;br /&gt;
&lt;br /&gt;
Checks include task completion times vs. deadlines, task start requests intervals vs. expected maxima and minima, mutual exclusion semaphore not being released before task completion, time taken to obtain spinlocks longer than expected (an indicator of system loading), and other problems. &lt;br /&gt;
&lt;br /&gt;
If a check fails in most cases a system log entry is made and the system state variable may be updated, possibly resulting in an ASW defined problem handler being called. In extreme cases OCEOSmp may exit and return to main().&lt;br /&gt;
&lt;br /&gt;
Overall the automatic integrity tests carried out by OCEOSmp itself include:&lt;br /&gt;
# System meta pointer intact&lt;br /&gt;
# Data area sentinel/s intact&lt;br /&gt;
# Task deadline not missed&lt;br /&gt;
# Task start request gap too short&lt;br /&gt;
# Task start request gap too long&lt;br /&gt;
# …&lt;br /&gt;
&lt;br /&gt;
It should be noted that these checks detect that a problem has happened. To anticipate problems and perhaps avoid them further checks can and should be done by the ASW as part of system policing.&lt;br /&gt;
&lt;br /&gt;
== System Log ==&lt;br /&gt;
&lt;br /&gt;
[[File:Logging.png|600px]]&lt;br /&gt;
&lt;br /&gt;
=== Purpose ===&lt;br /&gt;
&lt;br /&gt;
# Provide application software with the ability to make time stamped records of events for use in application performance monitoring and in application debugging&lt;br /&gt;
# Provide OCEOSmp with the ability to record anomalies should these be detected.&lt;br /&gt;
&lt;br /&gt;
=== Structure ===&lt;br /&gt;
&lt;br /&gt;
# &amp;lt;li value=&amp;quot;3&amp;quot;&amp;gt;A circular buffer with a fixed size that is set in the application configuration&amp;lt;/li&amp;gt; &lt;br /&gt;
# Size from 16 to 1024 entries, default 64 if size not specified&lt;br /&gt;
# If the application defines oceosmp_on_full_log(void *) this is called automatically when the buffer becomes ¾ full, allowing log entries that might otherwise be overwritten be archived. The automatic call will reoccur only after the buffer becomes ¾ empty.&lt;br /&gt;
# Two indices determine the next log entry position to be read from or written to. On system reset these are left unchanged if valid so as to postpone recent entries being overwritten.&lt;br /&gt;
# Log entries are left unchanged until a system log write causes the current entry at the write index be overwritten. Reading the log returns the earliest entry not read so far. Directives are provided to allow any log entry be read and to reset the log indices.&lt;br /&gt;
&lt;br /&gt;
=== Storage ===&lt;br /&gt;
&lt;br /&gt;
#  &amp;lt;li value=&amp;quot;8&amp;quot;&amp;gt;Stored statically in the oceosmp_log_area, which also contains the next-read and next-write buffer indices and the system state related variables.&amp;lt;/li&amp;gt;&lt;br /&gt;
# The log size and the oceosmp_on_full() function declaration are stored in the oceosmp_fixed_area, as also are the  log area addresses.&lt;br /&gt;
&lt;br /&gt;
==== Log entry format (from system_log.h) ====&lt;br /&gt;
&lt;br /&gt;
 Struct log_entry{&lt;br /&gt;
  	U64_t time64;&lt;br /&gt;
  	unsigned int current_cpu_id :8;&lt;br /&gt;
  	unsigned int entry_type :8;&lt;br /&gt;
  	U32_t entry_comment;&lt;br /&gt;
 } __attribute__ ((aligned (8));&lt;br /&gt;
&lt;br /&gt;
# &amp;lt;li value=&amp;quot;10&amp;quot;&amp;gt;When a log entry is made, time64 and current_cpu_id are set automatically by OCEOSmp.&amp;lt;/li&amp;gt;&lt;br /&gt;
# The entry type is an enum defined by the application, with a subset of enum values reserved for use by OCEOSmp. The reserved enum values are specified in system_log.h.&lt;br /&gt;
# The ''entry_comment'' allows noting further information on the current situation&lt;br /&gt;
&lt;br /&gt;
==== Associated directives (from system_log.h) ====&lt;br /&gt;
&lt;br /&gt;
 S32_t 	oceos_log_add_entry(&lt;br /&gt;
 	 	enum LOG_ENTRY_TYPE type, // 8 bit enum LOG_ENTRY_TYPE&lt;br /&gt;
 	 	const U32_t info 		// further information&lt;br /&gt;
 );&lt;br /&gt;
&lt;br /&gt;
This adds an entry, overwriting the currently oldest entry.&lt;br /&gt;
&lt;br /&gt;
 S32_t oceos_log_remove_entry(&lt;br /&gt;
  		struct log_entry * const outputPtr&lt;br /&gt;
 );&lt;br /&gt;
&lt;br /&gt;
This returns the oldest unread entry to outputPtr and updates the buffer indices&lt;br /&gt;
&lt;br /&gt;
# &amp;lt;li value=&amp;quot;13&amp;quot;&amp;gt;Other log directives are detailed in system_log.h&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Usage by OCEOSmp itself&lt;br /&gt;
&lt;br /&gt;
# &amp;lt;li value=&amp;quot;14&amp;quot;&amp;gt;OCEOSmp only uses the system log for problems that do not arise directly when a directive is used (problems that arise directly are described in the returned directive status code).&amp;lt;/li&amp;gt;&lt;br /&gt;
# Such problems fall into a number of categories&lt;br /&gt;
## System corruption is detected and/or oceos_exit is called a&lt;br /&gt;
## Excessive delays in obtaining system spin locks perhaps due to system overloading&lt;br /&gt;
## A timed action misses its specified time&lt;br /&gt;
## A task misses its deadlines&lt;br /&gt;
## Task start requests occur more frequently than expected&lt;br /&gt;
## A task exits without returning a mutex or read-write mutex that it holds&lt;br /&gt;
## Nested mutexes or read-write mutexes not returned in correct order&lt;br /&gt;
## Counts already at max or min&lt;br /&gt;
# In many cases when OCEOSmp makes a system log entry it also updates the system state variable. This is updated using ‘OR’ and so provides a long term record that a problem has occurred even if a log entry is overwritten. In addition, if the update corresponds to an application defined action mask and an application problem handling function is defined this is called automatically.&lt;br /&gt;
&lt;br /&gt;
== System State Variable ==&lt;br /&gt;
&lt;br /&gt;
[[File:SystemState.png|400px]]&lt;br /&gt;
&lt;br /&gt;
=== Purpose ===&lt;br /&gt;
&lt;br /&gt;
To record that certain conditions have occurred and to allow the ASW specify which conditions should cause an ASW defined problem handling function be triggered automatically when the state variable is updated due to these conditions.&lt;br /&gt;
&lt;br /&gt;
=== Structure ===&lt;br /&gt;
Four 32-bit words each containing 32 flags, some available for use by the ASW, some reserved for use by OCEOSmp&lt;br /&gt;
# system state variable		individual bits are set by ASW or by OCEOSmp &lt;br /&gt;
# accumulated system state	updated when system state flags are set &lt;br /&gt;
# action mask			set by ASW in application configuration &lt;br /&gt;
# action mask previous		previous value of action mask if changed by ASW&lt;br /&gt;
&lt;br /&gt;
=== Usage ===&lt;br /&gt;
# &amp;lt;li value=&amp;quot;5&amp;quot;&amp;gt;the system state variable is updated using inclusive ‘OR’ to set the desired flag&amp;lt;/li&amp;gt;&lt;br /&gt;
# the accumulated system state flag is set when the corresponding system state flag is set&lt;br /&gt;
# on reset the system state variable is cleared to 0, all flags clear&lt;br /&gt;
# the accumulated system state variable is reset only by the ASW&lt;br /&gt;
# the action mask is set by the ASW, and causes an ASW defined problem handler to be called when a state flag is updated to 1 that corresponds to a set action mask flag. &lt;br /&gt;
&lt;br /&gt;
Whenever a system state variable flag is set during scheduling (using inclusive ‘OR’) the corresponding accumulated state flag is also set. Accumulated state flags are not affected when a system state flag is cleared to 0, whether by the ASW or on system reset. They can be cleared only directly by the ASW. They keep a record of events across system reset if memory is preserved.&lt;br /&gt;
&lt;br /&gt;
The action mask is specified in the application configuration, which then should also declare a problem handling function. The mask may be altered by the ASW during scheduling.&lt;br /&gt;
&lt;br /&gt;
The ASW problem handling function is called automatically by OCEOSmp as a result of setting a previously clear system state flag that corresponds to a flag that is set in the action mask. The system state flag is set before the function is called. If the system state flag is not reset by the ASW problem handler or otherwise then further settings of that system state flag will not cause the function to be called again.&lt;br /&gt;
&lt;br /&gt;
The ASW can use a system call to modify the action mask at any time, when this is done the previous value of the action mask is stored.&lt;br /&gt;
&lt;br /&gt;
The flags corresponding to the high sixteen bits of the system state variable are reserved for use by OCEOSmp:&lt;br /&gt;
&lt;br /&gt;
These primarily refer to problems that are not immediate consequences of the use of a directive (these are indicated in the returned error or warning status code), but that may occur subsequently during scheduling:&lt;br /&gt;
# &amp;lt;li value=&amp;quot;16&amp;quot;&amp;gt;reserved&amp;lt;/li&amp;gt;	&lt;br /&gt;
# reserved&lt;br /&gt;
# reserved&lt;br /&gt;
# reserved&lt;br /&gt;
# reserved&lt;br /&gt;
# Attempt to start pending task that has been disabled while pending.&lt;br /&gt;
# Time from task start request to job completion exceeds task deadline.&lt;br /&gt;
# Time between task start requests less than specified minimum for task&lt;br /&gt;
# Time between task start requests greater than specified maximum for task&lt;br /&gt;
# Missed latest time for transfer of job from timed action queue to scheduler.&lt;br /&gt;
# Missed latest time for performance of timed output.&lt;br /&gt;
# Mutex not returned before job terminates.&lt;br /&gt;
# Read/Write mutex not returned before job termination.&lt;br /&gt;
# System busy warning&lt;br /&gt;
# Data area sentinels corrupted.&lt;br /&gt;
# System meta pointer corrupted&lt;br /&gt;
&lt;br /&gt;
== System Policing and Problem Anticipation ==&lt;br /&gt;
&lt;br /&gt;
All design involves assumptions, and ‘System Policing’ refers to checking how close these come to being violated as the system operates, and to taking precautions if needed.&lt;br /&gt;
&lt;br /&gt;
The white box design of OCEOSmp facilitates this, with records kept automatically of task timing performances and other parameters that are accessible by the ASW at any time, including after OCEOSmp exits should this occur.&lt;br /&gt;
&lt;br /&gt;
These records can answer questions such as ‘what is the longest time this task took to execute’, ‘what is the shortest time between requests to start this task’, ‘what is the longest time between requests to start this task’, and many others, including stack usage.&lt;br /&gt;
&lt;br /&gt;
By checking such data the ASW can notice that behaviour is not as expected and that something is going wrong, allowing ‘Problem Anticipation’ and an issue being dealt with before it causes serious difficulties.&lt;br /&gt;
&lt;br /&gt;
The ASW might do this by having an external policing function running on a core not in use by OCEOSmp that periodically checks that things are as expected, or by having a policing task that is scheduled by OCEOSmp.&lt;br /&gt;
&lt;br /&gt;
With all the data stored statically in the ‘Log Area’, ‘Fixed Data Area’ and ‘Dynamic Data Area’ arrays by the ASW it is straightforward to retrieve it.&lt;br /&gt;
&lt;br /&gt;
OCEOSmp only requires one system stack per CPU core rather than one stack per thread. Each stack is initialised to a known value, making it straightforward to determine the greatest extent to which each stack has been used.&lt;br /&gt;
&lt;br /&gt;
If suspicious activity is detected, the ASW can for example disable a task or take a CPU core out of use or disable a peripheral or take other corrective action.&lt;br /&gt;
&lt;br /&gt;
It can also make a historical record of bad behaviour by adding an entry to the System Log and by updating a flag in the System State variable, When the System Log becomes ¾ full an ASW function if defined is called that can archive the System Log, and a shadow copy of the System State variable is automatically maintained that is only reset by the ASW itself.&lt;br /&gt;
&lt;br /&gt;
When multiple mutual exclusion semaphores are used by tasks the OCEOSmp design excludes the possibility of unbounded priority inversion and no check for this is needed.&lt;br /&gt;
&lt;br /&gt;
On multi-core systems deadlocks can occur but only if tasks fail to acquire mutual exclusion semaphores in a consistent order corresponding to their identity numbers. A warning status code is then returned although as yet no deadlock has occurred.&lt;br /&gt;
&lt;br /&gt;
The ASW can include a policing function that checks the execution times of tasks (in OCEOSmp tasks on other CPU cores spin waiting to acquire mutexes), and the time when a task start request was issued, allowing detection of deadlocks, livelocks, and task starvation.&lt;br /&gt;
&lt;br /&gt;
It should be noted that OCEOSmp itself may detect an anomaly and automatically make an entry in the System Log and may also update the System State variable, perhaps resulting in an ASW defined problem handling function being called, but this only happens after a problem has occurred and been detected. &lt;br /&gt;
&lt;br /&gt;
== Problem Detection and Handling ==&lt;br /&gt;
&lt;br /&gt;
[[File:PoliceJoke.png|600px]]&lt;br /&gt;
&lt;br /&gt;
This relates to what happens after a problem has occurred and been detected, as distinct from System Policing and Problem Anticipation which aims to forestall problems.&lt;br /&gt;
&lt;br /&gt;
The integrity tests carried out automatically by OCEOSmp check for a number of problems. Some are detected directly when an OCEOSmp directive is used, others when an event occurs such as a job completing execution, others when some internal operation of OCEOSmp does not proceed as expected. &lt;br /&gt;
&lt;br /&gt;
Problems that arise directly from the use or misuse of a directive are identified in the returned status code, and the ASW can then decide the appropriate action.&lt;br /&gt;
&lt;br /&gt;
If appropriate the ASW can disable or terminate tasks and take CPU cores out of use without disrupting scheduling, and can read and update the system log and system state variable. In an extreme case the ASW can end scheduling and return to main().&lt;br /&gt;
&lt;br /&gt;
# Typical directive problems&lt;br /&gt;
## Current phase doesn’t allow this directive&lt;br /&gt;
## Invalid parameters supplied&lt;br /&gt;
## Time for timed action already passed&lt;br /&gt;
## Write fail, data queue full&lt;br /&gt;
## Write succeeded, data queue now full (warning) &lt;br /&gt;
## Mutexes or rwmutexes acquired in an incorrect order (warning)&lt;br /&gt;
&lt;br /&gt;
Other problems may be identified automatically be OCEOSmp after a directive has been used or when an event occurs, or during internal OCEOSmp operations&lt;br /&gt;
Such problems include:&lt;br /&gt;
# &amp;lt;li value=&amp;quot;2&amp;quot;&amp;gt;Unexpected patterns of events&amp;lt;/li&amp;gt;&lt;br /&gt;
## Task misses a deadline&lt;br /&gt;
## Task start requests occur more frequently than expected&lt;br /&gt;
## Task start requests occur less frequently than expected&lt;br /&gt;
## Task disabled after being put on a pending queue&lt;br /&gt;
## Spin locks not being available in a reasonable time&lt;br /&gt;
## Action time missed&lt;br /&gt;
## Pending queues being full&lt;br /&gt;
&lt;br /&gt;
These problems typically cause a system log entry to be made, may update the system state variable and may result in an ASW defined problem handling function being called. This has full access to the performance records and can enable or disable tasks and take CPU cores out of use or restore them to use without disrupting scheduling, and can exit from OCEOSmp if appropriate.&lt;br /&gt;
&lt;br /&gt;
Other problems that may be automatically detected by OCEOSmp include&lt;br /&gt;
# &amp;lt;li value=&amp;quot;3&amp;quot;&amp;gt;Corruption of critical data&amp;lt;/li&amp;gt;&lt;br /&gt;
## Perhaps due to hardware failures&lt;br /&gt;
## Perhaps by application software malfunctioning and overwriting data&lt;br /&gt;
## Perhaps by a bug in OCEOSmp&lt;br /&gt;
&lt;br /&gt;
These problems typically result in exit from OCEOSmp and return to main() at the point immediately after oceos_start() was used. The system state variable and system log may also be updated.&lt;br /&gt;
&lt;br /&gt;
It should be noted that the checks made by OCEOSmp only occur as a result of it being notified of some change in the state of the system, as when a directive is used or a job terminates or an interrupt occurs. It is recommended that these be added to by taking appropriate precautions.&lt;br /&gt;
&lt;br /&gt;
== Precautions and Correction ==&lt;br /&gt;
&lt;br /&gt;
[[File:Precaution.png|600px]]&lt;br /&gt;
&lt;br /&gt;
A primary precaution is policing. As described above this typically involves assigning a CPU core to check the activities of the system, or perhaps assigning a task to that purpose. Anticipation and prevention are better than detection.&lt;br /&gt;
&lt;br /&gt;
Further precautions are also possible, depending on the hardware available in the system. These can detect or perhaps even prevent various malfunctions. &lt;br /&gt;
&lt;br /&gt;
=== Hardware Malfunctions ===&lt;br /&gt;
These can be caused by radiation or other external factors, or simply by parts of the system wearing out.&lt;br /&gt;
&lt;br /&gt;
They fall into three main categories, memory hardware malfunctions, CPU core malfunctions, and peripheral or connected device malfunctions.&lt;br /&gt;
&lt;br /&gt;
==== Memory hardware malfunctions ====&lt;br /&gt;
&lt;br /&gt;
These typically result in one or more bits in a memory location being set to incorrect values.&lt;br /&gt;
&lt;br /&gt;
If the error involve no more than a certain number of bits (BCH 1, RS fixed &amp;gt; 1) then EDAC allows a memory location containing such errors be read correctly despite the error.&lt;br /&gt;
&lt;br /&gt;
While the value read is correct the error remains in the location until the correct value is written back. This should be done before a further bit becomes corrupted, perhaps making the error un-correctable. In some systems this write back is done automatically. &lt;br /&gt;
&lt;br /&gt;
Long intervals can occur between uses of a memory location making ‘memory scrubbing’ necessary. This cycles through all memory locations, reading and writing back if needed, doing so often enough to make it very unlikely that an un-correctable number of erroneous bits will accumulate in any location.&lt;br /&gt;
&lt;br /&gt;
Usually a hardware ‘memory scrubber‘ is available that can be configured to do this at a certain rate for a certain range of addresses.&lt;br /&gt;
&lt;br /&gt;
Memory read errors can still occur however. A combination of bit errors can defeat EDAC error detection and lead to an incorrect value being read. Usually however such un-correctable errors are detected by EDAC causing it to raise an exception. The corresponding handler must then take appropriate action, which may include terminating OCEOSmp.&lt;br /&gt;
&lt;br /&gt;
Precautions: Before starting OCEOSmp &lt;br /&gt;
# The handler for EDAC detected un-correctable errors should be put in place&lt;br /&gt;
# The memory should be initialized&lt;br /&gt;
# The EDAC system configured and put into operation&lt;br /&gt;
# The EDAC memory scrubber hardware configured and put into operation&lt;br /&gt;
&lt;br /&gt;
Once this has been done and OCEOSmp started&lt;br /&gt;
# &amp;lt;li value=&amp;quot;5&amp;quot;&amp;gt;The EDAC exception handler can &amp;lt;/li&amp;gt;	&lt;br /&gt;
## Update the system log&lt;br /&gt;
## Update the system state variable&lt;br /&gt;
## Start a problem handling task&lt;br /&gt;
## If necessary call oceos_exit() to return to main()&lt;br /&gt;
&lt;br /&gt;
==== Computer core hardware malfunctions ====&lt;br /&gt;
&lt;br /&gt;
Cores may use triple modular redundancy and other techniques to reduce the effects of transient errors, but nevertheless can become faulty. If this is detected in a multi-core system OCEOSmp allows the faulty core be taken out of use without scheduling being disrupted.&lt;br /&gt;
&lt;br /&gt;
Detecting that a core has become faulty can be done using computational tasks for which the results including timings are known. Before such tests are used however a malfunction may have led to an erroneous result being used. &lt;br /&gt;
&lt;br /&gt;
To avoid this when result accuracy is critical and immediately needed it is possible in OCEOSmp to have multiple CPU cores carry out the same computation at the same time (within a few clock cycles). &lt;br /&gt;
&lt;br /&gt;
The results can then be compared and the majority agreed value used. A core that was at fault can be tested and taken out of use if the problem is judged not to be transient.&lt;br /&gt;
&lt;br /&gt;
Precaution: Check periodically that cores carry out a computational test correctly.&lt;br /&gt;
# &amp;lt;li value=&amp;quot;6&amp;quot;&amp;gt;oceosmp_cpu_disable() will take the specified CPU core out of use, put it to sleep, and cause the termination functions of any jobs executing on the core be executed on a different core.&amp;lt;/li&amp;gt; &lt;br /&gt;
# oceosmp_cpu_enable() will make the specified CPU core available for use&lt;br /&gt;
&lt;br /&gt;
These directives can also be used to manage the number of active cores for power saving or other purposes. Scheduling is not disrupted as long as a functioning core remains.&lt;br /&gt;
&lt;br /&gt;
==== Peripheral Hardware Malfunctions ====&lt;br /&gt;
&lt;br /&gt;
These can arise due to a fault in the peripheral unit itself, or due to problems in an external system for which the peripheral is an interface.&lt;br /&gt;
&lt;br /&gt;
Before starting OCEOSmp the ASW should carry out appropriate checks of all peripheral units, and should ensure that such checks can be carried out if necessary by tasks after scheduling has begun.&lt;br /&gt;
&lt;br /&gt;
Faults in external systems for which a peripheral unit is an interface tend to either&lt;br /&gt;
# cause no messages to be sent to the interface&lt;br /&gt;
# cause messages to be sent too frequently&lt;br /&gt;
&lt;br /&gt;
In most cases when a peripheral receives an external message it causes an interrupt which then causes a request to start a task.&lt;br /&gt;
&lt;br /&gt;
If the interval between such task start requests is longer than expected this may indicate that the peripheral device has become faulty and is no longer operational.&lt;br /&gt;
&lt;br /&gt;
If the interval between such task start requests is shorter than expected it may indicate the frequency of external events exceeding expectations or some fault in the peripheral device.&lt;br /&gt;
&lt;br /&gt;
In both cases on starting the task OCEOSmp automatically checks the interval since the last task start request and if this is less than the expected minimum or greater than the expected maximum will make a system log entry and set the corresponding flag in the system state variable. If the ASW has set the corresponding system state action flag and defined a problem handling function this will result in the ASW problem handling function being called.&lt;br /&gt;
 &lt;br /&gt;
Precautions: &lt;br /&gt;
	In the ASW configuration structure passed to oceos_init() the ASW set the desired flags in the problem action mask and define a problem handling function.   &lt;br /&gt;
&lt;br /&gt;
=== Software Malfunctions ===&lt;br /&gt;
&lt;br /&gt;
Certain types of software errors can cause problems for the system as a whole.&lt;br /&gt;
&lt;br /&gt;
OCEOSmp automatically checks for some of these, others are best checked for by the ASW itself, perhaps as part of system policing.&lt;br /&gt;
&lt;br /&gt;
In addition to policing, various precautions can be taken against these problems, including making use of any memory protection hardware available and using a system watchdog timer.&lt;br /&gt;
&lt;br /&gt;
==== Invalid memory overwriting ====&lt;br /&gt;
&lt;br /&gt;
Application software may inadvertently overwrite memory areas used by OCEOSmp.&lt;br /&gt;
&lt;br /&gt;
The three memory areas used by OCEOSmp are each protected at their ends by constant sentinels. Each time a directive is used or job terminates OCEOSmp checks these sentinels to ensure that the areas involved have not been encroached upon. If so OCEOSmp will exit.&lt;br /&gt;
&lt;br /&gt;
In addition to its sentinels the fixed data area has an XOR checksum which allows any alteration be detected. This is not checked automatically by OCEOSmp for reasons of efficiency, but can be checked at any time by ASW policing software.&lt;br /&gt;
&lt;br /&gt;
Prevention is better than detection and if a system has a memory protection unit this should be configured to make the fixed area read-only. Any attempt to write this area will then typically cause the protection unit to raise an exception.&lt;br /&gt;
&lt;br /&gt;
Each CPU core has its own system stack. These form part of a contiguous block of statically allocated memory, and a software error may result in the code running on a core overrunning that core’s stack and attempting to use the stack memory of another core.&lt;br /&gt;
&lt;br /&gt;
This can be detected in policing by checking that filler still remains at the top and bottom of each core’s stack, and this can be checked at any time by ASW policing software, but prevention is better than detection.&lt;br /&gt;
 &lt;br /&gt;
Precautions: Any hardware memory protection present should be used on completion of oceos_init_finish() and before oceos_start() to provide these features.&lt;br /&gt;
# Read only (the fixed data area)&lt;br /&gt;
# Writeable only by a specific computer core (for each core’s stack)&lt;br /&gt;
 &lt;br /&gt;
Invalid attempts to use a memory location typically give rise to an exception and an appropriate handler must be in place.&lt;br /&gt;
&lt;br /&gt;
==== Invalid use of Mutual Exclusion Semaphores (Mutexes) or of Read-Write Mutexes ====&lt;br /&gt;
&lt;br /&gt;
In general the time for which the ASW holds a mutex or read-write mutex should be as short as possible.&lt;br /&gt;
&lt;br /&gt;
This time can be estimated at compile time and the estimates taken into account in determining whether a set of tasks can be scheduled so that tasks always meet their deadlines.&lt;br /&gt;
&lt;br /&gt;
Such estimates however can be made wrong by events that occur during scheduling if appropriate precautions are not taken.&lt;br /&gt;
&lt;br /&gt;
One possible problem, unbounded priority inversion, arises when a job holding a mutex is pre-empted by a higher priority task that does not use the mutex, causing any even higher priority task that uses the mutex to wait indefinitely for the low priority job to resume and release the mutex. In OCEOSmp unbounded priority inversion cannot occur. &lt;br /&gt;
&lt;br /&gt;
Another problem, deadlock, can arise when two or more jobs each acquire more than one mutex. A job while holding a mutex may then attempt to acquire a different mutex currently held by some other job. If that other job (without releasing the mutex it holds) attempts to acquire the mutex held by the first job neither job can make progress, the jobs are deadlocked.&lt;br /&gt;
&lt;br /&gt;
These problems are addressed by the design of OCEOSmp.&lt;br /&gt;
&lt;br /&gt;
In OCEOSmp each mutex or read-write mutex has a priority ceiling giving the priority of the highest priority task that uses it. This constant is determined at compile time and set for each mutex when it is created.&lt;br /&gt;
&lt;br /&gt;
In scheduling, once a job running on a CPU core holds one or more mutexes or read-write mutexes only tasks with higher priority than the highest ceiling are allowed to pre-empt the job and start running on that core.&lt;br /&gt;
&lt;br /&gt;
As a result unbounded priority inversion cannot occur, and on single core systems deadlocks also are not possible.&lt;br /&gt;
&lt;br /&gt;
On multi-core systems jobs can spin waiting to acquire a mutex held by a job running on a different core and deadlock becomes possible.&lt;br /&gt;
&lt;br /&gt;
In OCEOSmp mutexes and read-write mutexes are assigned a sequential order as they are created. Deadlocks then cannot occur if jobs always respect this order in acquiring mutexes, never attempting to acquire a mutex or read-write mutex if already holding one that is higher in the order.&lt;br /&gt;
&lt;br /&gt;
OCEOSmp does not prevent jobs from acquiring multiple mutexes in an out of order manner but returns a warning directive status code to the job indicating that deadlock is possible and makes a log entry and updates the system state variable, perhaps causing an ASW defined problem handling function to be called.&lt;br /&gt;
&lt;br /&gt;
When a job simultaneously holds multiple mutexes or read-write mutexes it should acquire and return these in a LIFO manner, e.g. waitA, waitB, waitC…..signalC, signalB, signalA. Failure to do so may affect task scheduling temporarily and will result in a warning directive status code, a log entry, and an update of the system state variable.&lt;br /&gt;
&lt;br /&gt;
Other errors in using mutexes such as failure to release a mutex before a job ends or attempting to release a mutex that is not held give rise to an appropriate directive status codes, a log entry, and a system state variable updates.&lt;br /&gt;
&lt;br /&gt;
Precautions: &lt;br /&gt;
# Ensure at compile time that when a task acquires multiple mutexes or read-write mutexes it always does so in the correct order.&lt;br /&gt;
# Ensure at compile time that when a job releases multiple mutexes or read-write mutexes it always does so in the reverse order to that in which they were acquired&lt;br /&gt;
&lt;br /&gt;
==== Deadlocks, Livelocks and Task Starvation ====&lt;br /&gt;
&lt;br /&gt;
Deadlocks arise primarily due to misuse of mutual exclusion semaphores or read write mutual exclusion semaphores, as described above.&lt;br /&gt;
&lt;br /&gt;
Livelocks, where tasks interact in a way that results in each task having to return to some earlier point with no or very little overall progress, can arise in a number of ways including from attempts to resolve a deadlock so that the tasks involved can proceed.&lt;br /&gt;
&lt;br /&gt;
Task starvation arises when a task is ready to start, but CPU time is not allocated to it within a reasonable time. In OCEOSmp this will occur for a low priority task if higher priority tasks are always ready to run and require all the available CPU cores. &lt;br /&gt;
&lt;br /&gt;
Task starvation, to at least some degree, can also occur for a high priority task if the resources required to allow it pre-empt a lower priority task are not available on the CPU core involved, as for example when the remaining system stack for that core is below the level needed for pre-emption.&lt;br /&gt;
&lt;br /&gt;
All three of these problems result in a task or tasks taking longer to complete than should be the case. This can be detected in two main ways&lt;br /&gt;
# By a policing task that periodically checks each task record in the dynamic area to determine the maximum time between a request to start it and task completion. &lt;br /&gt;
# By watchdog timer hardware that typically is reset periodically by the lowest priority task and which will cause a hardware system reset if its pre-set time elapses before it is reset. On re-entry to main() the ASW can check to determine if this has occurred before restarting OCEOSmp.&lt;br /&gt;
&lt;br /&gt;
Precautions&lt;br /&gt;
# &amp;lt;li value=&amp;quot;3&amp;quot;&amp;gt;ensure each CPU core has adequate system stack so that a lower priority task running on the core can always be pre-empted by a higher priority task. The amount required can be calculated from the number of different priority levels in use.&amp;lt;/li&amp;gt;&lt;br /&gt;
# if watchdog timer hardware is available set up a low priority task to periodically reset it. The ASW should check on entry to main() whether this was due to a watchdog timeout and if so use the OCEOSmp data to determine the cause and appropriate remedial action before restarting OCEOSmp.&lt;br /&gt;
# set up a policing task that checks the execution times of current tasks and detects when this is too long. This task can call an ASW defined problem handling function that can determine how best to deal with the situation, perhaps calling the termination functions of some currently executing tasks, disabling some tasks or changing interrupt intervals.&lt;br /&gt;
# If necessary reserve certain CPU cores to use only by higher priority tasks, perhaps ensuring that there is always at least one CPU core ready to be used immediately by such tasks.&lt;br /&gt;
&lt;br /&gt;
== Summary ==&lt;br /&gt;
&lt;br /&gt;
[[File:MurphysLaw.png|400px]]&lt;br /&gt;
&lt;br /&gt;
Murphy’s Law, ‘if things can go wrong they will’, has had a significant impact on the design of OCEOSmp. &lt;br /&gt;
&lt;br /&gt;
An older maxim ‘the wise man avoids evil by anticipating it’ (Publilius Cyrus) has also had an impact. Software can go wrong without prior indication of stress but it may be possible to notice that all is not well before disaster strikes. Avoidance is better than detection.&lt;br /&gt;
&lt;br /&gt;
These ideas have led to OCEOSmp having features that allow fault anticipation, detection, isolation and recovery, with a white box approach that simplifies system policing and checking behaviour against expectations and with memory statically allocated.&lt;br /&gt;
&lt;br /&gt;
When a problem is found OCEOSmp can take CPU cores out of use or kill or disable tasks without disrupting scheduling, or in severe cases exit and return to the ASW main() with all data still accessible for analysis or download, and with the ASW able to make changes and restart OCEOSmp if desired.&lt;br /&gt;
&lt;br /&gt;
These features help ensure that OCEOSmp is suitable for use in safety critical or other systems that require the highest reliability.&lt;br /&gt;
&lt;br /&gt;
Even where it is hoped that nothing can possibly go wrong….&lt;br /&gt;
&lt;br /&gt;
= &amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;'''System Log'''&amp;lt;/span&amp;gt; =&lt;br /&gt;
&lt;br /&gt;
== Purpose ==&lt;br /&gt;
#Provide application software with the ability to make time stamped records of events for use in application performance monitoring and in application debugging&lt;br /&gt;
#Provide OCEOSmp with the ability to record internal anomalies should these be detected.&lt;br /&gt;
&lt;br /&gt;
== Structure ==&lt;br /&gt;
#A circular buffer with a fixed size that is set in the application configuration&lt;br /&gt;
#Size from 16 to 1024 entries, default 64 if not specified&lt;br /&gt;
#If the application defines oceosmp_on_full_log(void *) this is called automatically when the buffer becomes ¾ full, allowing log entries that might otherwise be overwritten be stored. The automatic call will reoccur only after the buffer becomes ¾ empty.&lt;br /&gt;
#On system reset log entries are not overwritten and buffer indices are reset so as to postpone recent entries being overwritten and allow review of events prior to the reset.&lt;br /&gt;
&lt;br /&gt;
== Storage ==&lt;br /&gt;
#Stored statically in the oceosmp_log_area, which also contains the next-read and next-write buffer indices and the system state related variables.&lt;br /&gt;
#The log size and the oceosmp_on_full() function declaration are stored in the oceosmp_fixed_area, as also are the  log area addresses.&lt;br /&gt;
#Log entry format (from system_log.h): &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
Struct log_entry{&lt;br /&gt;
 	U64_t		time64;&lt;br /&gt;
 	unsigned int       current_cpu_id		:8;&lt;br /&gt;
 	unsigned int	entry_type		:8;&lt;br /&gt;
 	U32_t		entry_comment;&lt;br /&gt;
} __attribute__ ((aligned (8));&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt; &lt;br /&gt;
#When a log entry is made, time64 and current_cpu_id are set automatically by OCEOSmp.&lt;br /&gt;
#The entry type is an enum defined by the application, with a subset of enum values reserved for use by OCEOSmp. The reserved enum values are specified in system_log.h.&lt;br /&gt;
#The entry_comment allows noting further information on the current situation&lt;br /&gt;
&lt;br /&gt;
== Associated directives ==&lt;br /&gt;
#Add Log Entry&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t 	oceos_log_add_entry(&lt;br /&gt;
 	 	enum LOG_ENTRY_TYPE type, // 8 bit enum LOG_ENTRY_TYPE&lt;br /&gt;
 	 	const U32_t info 		// further information&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt; &lt;br /&gt;
This adds an entry, overwriting the currently oldest entry.&lt;br /&gt;
&lt;br /&gt;
#Remove Log Entry&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t oceos_log_remove_entry(&lt;br /&gt;
 		struct log_entry * const outputPtr&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This returns the oldest unread entry to outputPtr and updates the buffer indices&lt;br /&gt;
&lt;br /&gt;
#Other directives are detailed in system_log.h&lt;br /&gt;
 &lt;br /&gt;
== Usage by OCEOSmp itself ==&lt;br /&gt;
#OCEOSmp only uses the system log for problems that do not arise directly when a directive is used (problems that arise directly are described in the returned directive status code).&lt;br /&gt;
#Such problems fall into a number of categories&lt;br /&gt;
a.	System corruption is detected and/or oceos_exit is called&lt;br /&gt;
b.	Excessive delays in obtaining system spin locks perhaps due to system overloading&lt;br /&gt;
c.	A timed action misses its specified time&lt;br /&gt;
d.	A task misses its deadlines&lt;br /&gt;
e.	Task start requests occur more frequently than expected&lt;br /&gt;
f.	A task exits without returning a mutex or read-write mutex that it holds&lt;br /&gt;
g.	Counts already at max or min&lt;br /&gt;
h.	&lt;br /&gt;
18.	In many cases when OCEOSmp makes a system log entry it also updates the system state variable. This is updated using ‘OR’ and so provides a long term record that a problem has occurred even if a log entry is overwritten. In addition, if the update corresponds to an application defined action mask an application defined problem handling function may be called which can if desired read the system log.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:backup]]&lt;/div&gt;</summary>
		<author><name>Bkavanagh</name></author>
	</entry>
	<entry>
		<id>https://wiki.ocetechnology.com/mediawiki/index.php?title=OCEOSmp/notes&amp;diff=1683</id>
		<title>OCEOSmp/notes</title>
		<link rel="alternate" type="text/html" href="https://wiki.ocetechnology.com/mediawiki/index.php?title=OCEOSmp/notes&amp;diff=1683"/>
		<updated>2024-05-03T15:13:57Z</updated>

		<summary type="html">&lt;p&gt;Bkavanagh: /* Storage */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= &amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;'''When things go wrong'''&amp;lt;/span&amp;gt; =&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Prof. M. Ryan'''&lt;br /&gt;
&lt;br /&gt;
Things can go wrong even when software is bug free.&lt;br /&gt;
&lt;br /&gt;
Misunderstandings may have led to an inadequate design, real world circumstances may conspire to cause performance problems, radiation or other factors may cause hardware failures, and in general things can always go wrong.&lt;br /&gt;
&lt;br /&gt;
Murphy’s Law then applies, and while the system is in use it is important that system behaviour can be monitored, deviations from expectations noticed, checks made, corrections done, and recovery steps taken if needed.&lt;br /&gt;
&lt;br /&gt;
OCEOSmp has been designed with Murphy’s Law in mind and facilitates such actions in a number of ways.&lt;br /&gt;
&lt;br /&gt;
# Servant not Master&lt;br /&gt;
# White Box not Black Box&lt;br /&gt;
# Directive warning and error status codes&lt;br /&gt;
# Automatic integrity checks&lt;br /&gt;
# System Log&lt;br /&gt;
# System state variable&lt;br /&gt;
# System Policing and Problem Anticipation&lt;br /&gt;
# Problem Detection and Handling&lt;br /&gt;
# Precautions and Correction&lt;br /&gt;
&lt;br /&gt;
== Servant not Master ==&lt;br /&gt;
&lt;br /&gt;
[[File:MasterNotSlave.png|400px]]&lt;br /&gt;
&lt;br /&gt;
Many operating systems begin execution directly after the boot sequence and control all subsequent execution of the application software (ASW). Should something go wrong it can be difficult to assess what has occurred and find appropriate corrective action, particularly if the operating system itself has been involved.&lt;br /&gt;
&lt;br /&gt;
With OCEOSmp the ASW begins execution before the operating system and only starts OCEOSmp at some point after entering main().&lt;br /&gt;
&lt;br /&gt;
Before doing so the ASW should check the circumstances that lead to main() being entered. If due to a system restart then the data accumulated by OCEOSmp in the previous run is still available in its fixed, dynamic, and log data areas for analysis or download to find the cause (assuming power has been maintained or non-volatile memory is used for those areas).&lt;br /&gt;
&lt;br /&gt;
The ASW can then make appropriate modifications, and continue as usual to set up EDAC, set up memory protection, initialise and check CPU cores and peripherals, and once all seems correct proceed to start or restart OCEOSmp.&lt;br /&gt;
&lt;br /&gt;
Once scheduling begins OCEOSmp returns to main() only if a fatal error is detected or if it is instructed to do so by an ASW task. Should this occur all the data accumulated is available for analysis or download by ASW main() code, which can restart scheduling by calling oceos_start().&lt;br /&gt;
 &lt;br /&gt;
Most problems can be dealt with by tasks set up to do so under the control of OCEOSmp, but sufficiently serious ones may cause a system reset (e.g. a watchdog timer running out) or cause OCEOSmp to exit (e.g. corruption of critical data), in both cases with the previous state available for analysis if power is maintained or if non-volatile memory is used.&lt;br /&gt;
&lt;br /&gt;
In main() the ASW takes five principal steps in starting OCEOSmp:&lt;br /&gt;
&lt;br /&gt;
# check whether the entry to main() is due to a restart (e.g. by checking if the OCEOSmp data area sentinels are already in place) and if so use the data areas to determine the cause and make whatever modifications to the system are appropriate.   &lt;br /&gt;
# use oceos_init() with the ASW configuration to set up the log area and prepare the fixed data area to hold various addresses, the number of CPU cores, tasks, mutexes, etc.&lt;br /&gt;
# use various OCEOSmp create functions to create tasks, mutexs etc.&lt;br /&gt;
# use oceos_init_finish() to check that the declared numbers of tasks etc. have been created, finish setting up the fixed data area, and set its checksum.&lt;br /&gt;
&lt;br /&gt;
At this point the fixed data area with fixed information about addresses, cores, tasks, mutexes, data queues etc. has been set up, and need not be set up again if not corrupted. The checksum allows the &lt;br /&gt;
area be checked at any time to ensure it has not been changed. Memory protection if available can make the fixed area read-only and make the stack addresses for each core restricted to being written &lt;br /&gt;
only by that core. &lt;br /&gt;
&lt;br /&gt;
Scheduling can begin.&lt;br /&gt;
&lt;br /&gt;
# &amp;lt;li value=&amp;quot;5&amp;quot;&amp;gt;use oceos_start() to initialise the dynamic data area and begins scheduling. This function usually does not return to main() but may do so if a major problem is detected.&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As scheduling progresses the ASW can use the system log to record events and monitor performance. The log is also used by OCEOSmp to record problems, and OCEOSmp may also make a system state entry and trigger an ASW problem handling function.&lt;br /&gt;
&lt;br /&gt;
If a problem is sufficiently serious OCEOSmp may exit automatically or may be requested to do so by an ASW task, execution then returns to main() at the point after the call to oceos_start() with all performance, log, stack and other data available for analysis or download.&lt;br /&gt;
 &lt;br /&gt;
The ASW main() code can then determine the reason for the unexpected return, take appropriate corrective action, and resume scheduling by calling oceos_start() or modify various settings and start over with oceos_init().&lt;br /&gt;
&lt;br /&gt;
The ASW uses OCEOSmp and remains the master, rather than the reverse.&lt;br /&gt;
&lt;br /&gt;
== White Box not Black Box ==&lt;br /&gt;
&lt;br /&gt;
[[File:WhiteboxNotBlackbox.png|800px]]&lt;br /&gt;
&lt;br /&gt;
The data used by OCEOSmp is stored in statically allocated memory in three data areas and in an overall stack area. These usually are specified by the ASW as arrays of 32-bit words and can be examined by the ASW at any time.&lt;br /&gt;
&lt;br /&gt;
The data includes actual and expected task maximum and minimum execution times, activities on CPU cores, and other records of what has been happening. These records can be readily examined by the ASW while scheduling is under way and after OCEOSmp exits should this occur.&lt;br /&gt;
&lt;br /&gt;
OCEOSmp configures each data area to begin with a 32-bit sentinel followed by its size measured in 32-bit words, then the corresponding data, and finally a 32-bit sentinel. In the case of the fixed data area a 32-bit XOR checksum is located before the end sentinel.&lt;br /&gt;
&lt;br /&gt;
The size of each data area and the layout of the data within it depends on the application configuration, but are clearly specified with the location of each data item identified.&lt;br /&gt;
&lt;br /&gt;
Whenever an OCEOSmp directive is used a quick check is made that sentinels have not been breached. The ASW itself can check the fixed area checksum at any time (this is not done automatically for reasons of efficiency).&lt;br /&gt;
&lt;br /&gt;
The Log Area is initialized by oceos_init() and contains the system log and system state variable and if used the optional context switch log. Directives are provided to access and update these. The size of the area depends on the number of entries specified for the two logs in the system configuration. Log contents are preserved across system reset and across power failures if stored in non-volatile memory. &lt;br /&gt;
&lt;br /&gt;
The Fixed Data Area is completed by oceos_init_finish() and contains all the constants of the system, such as the addresses of data areas and stacks, the identity of the CPU core that OCEOSmp is to use on startup, the number of cores, tasks etc., the priorities and other attributes of tasks etc. &lt;br /&gt;
&lt;br /&gt;
The Dynamic Data area is created and initialized by oceos_start() and contains the information collected as oceosmp schedules tasks and as mutexes, counting semaphores,  etc. are used. This information is available for inspection by the ASW if OCEOSmp exits, and is only overwritten if the ASW again calls oceos_start().&lt;br /&gt;
&lt;br /&gt;
In OCEOSmp each CPU core has a system stack, a stack for each thread is not required. The stack size per CPU core and the location of the overall top of stack is specified in the application configuration and the overall stack space is statically allocated.&lt;br /&gt;
&lt;br /&gt;
Before scheduling begins OCEOSmp initialises each core’s stack with a filler. This is overwritten as the stack is used and by checking how much memory at the top and bottom of each stack still contains the filler it is possible to determine at any point how close the system has come to a stack overrun.&lt;br /&gt;
&lt;br /&gt;
The white box approach of making all records and the system stacks readily accessible while scheduling is taking place and should OCEOSmp exit facilitates checking that the system is performing as expected and determining the causes of any problems that may occur.&lt;br /&gt;
&lt;br /&gt;
== Directive warning and error status codes ==&lt;br /&gt;
&lt;br /&gt;
[[File:WarningErrorIcon.png|400px]]&lt;br /&gt;
&lt;br /&gt;
The ASW uses OCEOSmp by calling its directives, and is responsible for checking the returned directive status code. (OCEOSmp is a statically linked library, only those components related to the directives used by the ASW are linked into the final executable.)&lt;br /&gt;
&lt;br /&gt;
The system time directives oceos_time_sys_get64() and oceos_time_sys_get32() directly return the requested system time as 64-bit or 32-bit unsigned integers.&lt;br /&gt;
&lt;br /&gt;
Other directives return a 32-bit signed integer status code.&lt;br /&gt;
&lt;br /&gt;
This should always be checked when a directive is used.&lt;br /&gt;
&lt;br /&gt;
The status code indicates ERROR, SUCCESS, or WARNING.&lt;br /&gt;
&lt;br /&gt;
* A negative value indicates that the directive has not executed and gives the reasons&lt;br /&gt;
* A zero value indicates successful execution as expected&lt;br /&gt;
* A non-zero positive value indicates that the directive executed but with warnings&lt;br /&gt;
&lt;br /&gt;
Certain bits in the status code have the same meaning for all directives.&lt;br /&gt;
&lt;br /&gt;
Other bits have meanings that depend on the directive in use.&lt;br /&gt;
&lt;br /&gt;
These meanings are given in the header files associated with each directive as constants that can be compared with the status code to determine the types of errors or warnings involved.&lt;br /&gt;
&lt;br /&gt;
Errors typically involve an incorrect parameter to a directive, or an attempt to use a resource that is not available such as writing to a data queue that is already full.&lt;br /&gt;
&lt;br /&gt;
Warnings typically indicate that the directive has succeeded but that a danger has been created as when a task acquires multiple mutual exclusion semaphores out of order, or that a resource is now fully in use as when a write makes a data queue full.&lt;br /&gt;
&lt;br /&gt;
The task that used the directive and checked the returned status has full access to the data areas and stack areas in deciding the action to take, which may involve making a system log entry, starting a problem handling task, or in the worst case exiting from OCEOSmp and returning to main().&lt;br /&gt;
&lt;br /&gt;
In many situations the returned status code is the only indicator that is needed of directive success or failure. The ASW can then make a system log entry (automatically timestamped by OCEOSmp) for recording or performance analysis purposes if desired.&lt;br /&gt;
&lt;br /&gt;
In some situations OCEOSmp will make a system log entry automatically and may also update the system state variable, resulting in an ASW defined problem handling function being called if the corresponding flag has been set by the ASW in the system action flags.&lt;br /&gt;
&lt;br /&gt;
OCEOSmp may also automatically make a system log entry or take other actions when problems arise later, as when a task completion deadline is missed or a mutex is not returned.&lt;br /&gt;
&lt;br /&gt;
Irrespective of whatever other precautions may be taken, the first line of defence in using a directive is to check the returned status code.&lt;br /&gt;
&lt;br /&gt;
== Automatic integrity tests ==&lt;br /&gt;
&lt;br /&gt;
[[File:Automation.jpg|600px]]&lt;br /&gt;
&lt;br /&gt;
These are done automatically by OCEOSmp when a directive is used or an event occurs.&lt;br /&gt;
&lt;br /&gt;
They include checking that OCEOSmp data area sentinels are intact, and in the event of corruption may result in an exit from OCEOSmp and return to main().&lt;br /&gt;
&lt;br /&gt;
Directive parameters and the current system phase also are automatically checked when a directive is used, together with the availability of any required resources.&lt;br /&gt;
&lt;br /&gt;
Problems detected immediately when a directive is used result in an appropriate status code being returned to the ASW task that called the directive.&lt;br /&gt;
&lt;br /&gt;
Some problems, such as a task missing a deadline, do not occur immediately when a directive is used but only as scheduling proceeds. Such problems are checked for automatically by OCEOSmp.&lt;br /&gt;
&lt;br /&gt;
Checks include task completion times vs. deadlines, task start requests intervals vs. expected maxima and minima, mutual exclusion semaphore not being released before task completion, time taken to obtain spinlocks longer than expected (an indicator of system loading), and other problems. &lt;br /&gt;
&lt;br /&gt;
If a check fails in most cases a system log entry is made and the system state variable may be updated, possibly resulting in an ASW defined problem handler being called. In extreme cases OCEOSmp may exit and return to main().&lt;br /&gt;
&lt;br /&gt;
Overall the automatic integrity tests carried out by OCEOSmp itself include:&lt;br /&gt;
# System meta pointer intact&lt;br /&gt;
# Data area sentinel/s intact&lt;br /&gt;
# Task deadline not missed&lt;br /&gt;
# Task start request gap too short&lt;br /&gt;
# Task start request gap too long&lt;br /&gt;
# …&lt;br /&gt;
&lt;br /&gt;
It should be noted that these checks detect that a problem has happened. To anticipate problems and perhaps avoid them further checks can and should be done by the ASW as part of system policing.&lt;br /&gt;
&lt;br /&gt;
== System Log ==&lt;br /&gt;
&lt;br /&gt;
[[File:Logging.png|600px]]&lt;br /&gt;
&lt;br /&gt;
=== Purpose ===&lt;br /&gt;
&lt;br /&gt;
# Provide application software with the ability to make time stamped records of events for use in application performance monitoring and in application debugging&lt;br /&gt;
# Provide OCEOSmp with the ability to record anomalies should these be detected.&lt;br /&gt;
&lt;br /&gt;
=== Structure ===&lt;br /&gt;
&lt;br /&gt;
# &amp;lt;li value=&amp;quot;3&amp;quot;&amp;gt;A circular buffer with a fixed size that is set in the application configuration&amp;lt;/li&amp;gt; &lt;br /&gt;
# Size from 16 to 1024 entries, default 64 if size not specified&lt;br /&gt;
# If the application defines oceosmp_on_full_log(void *) this is called automatically when the buffer becomes ¾ full, allowing log entries that might otherwise be overwritten be archived. The automatic call will reoccur only after the buffer becomes ¾ empty.&lt;br /&gt;
# Two indices determine the next log entry position to be read from or written to. On system reset these are left unchanged if valid so as to postpone recent entries being overwritten.&lt;br /&gt;
# Log entries are left unchanged until a system log write causes the current entry at the write index be overwritten. Reading the log returns the earliest entry not read so far. Directives are provided to allow any log entry be read and to reset the log indices.&lt;br /&gt;
&lt;br /&gt;
=== Storage ===&lt;br /&gt;
&lt;br /&gt;
#  &amp;lt;li value=&amp;quot;8&amp;quot;&amp;gt;Stored statically in the oceosmp_log_area, which also contains the next-read and next-write buffer indices and the system state related variables.&amp;lt;/li&amp;gt;&lt;br /&gt;
# The log size and the oceosmp_on_full() function declaration are stored in the oceosmp_fixed_area, as also are the  log area addresses.&lt;br /&gt;
&lt;br /&gt;
==== Log entry format (from system_log.h) ====&lt;br /&gt;
&lt;br /&gt;
 Struct log_entry{&lt;br /&gt;
  	U64_t time64;&lt;br /&gt;
  	unsigned int current_cpu_id :8;&lt;br /&gt;
  	unsigned int entry_type :8;&lt;br /&gt;
  	U32_t entry_comment;&lt;br /&gt;
 } __attribute__ ((aligned (8));&lt;br /&gt;
&lt;br /&gt;
# &amp;lt;li value=&amp;quot;10&amp;quot;&amp;gt;When a log entry is made, time64 and current_cpu_id are set automatically by OCEOSmp.&amp;lt;/li&amp;gt;&lt;br /&gt;
# The entry type is an enum defined by the application, with a subset of enum values reserved for use by OCEOSmp. The reserved enum values are specified in system_log.h.&lt;br /&gt;
# The entry_comment allows noting further information on the current situation&lt;br /&gt;
&lt;br /&gt;
==== Associated directives (from system_log.h) ====&lt;br /&gt;
&lt;br /&gt;
 S32_t 	oceos_log_add_entry(&lt;br /&gt;
 	 	enum LOG_ENTRY_TYPE type, // 8 bit enum LOG_ENTRY_TYPE&lt;br /&gt;
 	 	const U32_t info 		// further information&lt;br /&gt;
 );&lt;br /&gt;
&lt;br /&gt;
This adds an entry, overwriting the currently oldest entry.&lt;br /&gt;
&lt;br /&gt;
 S32_t oceos_log_remove_entry(&lt;br /&gt;
  		struct log_entry * const outputPtr&lt;br /&gt;
 );&lt;br /&gt;
&lt;br /&gt;
This returns the oldest unread entry to outputPtr and updates the buffer indices&lt;br /&gt;
&lt;br /&gt;
# &amp;lt;li value=&amp;quot;13&amp;quot;&amp;gt;Other log directives are detailed in system_log.h&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Usage by OCEOSmp itself&lt;br /&gt;
&lt;br /&gt;
# &amp;lt;li value=&amp;quot;14&amp;quot;&amp;gt;OCEOSmp only uses the system log for problems that do not arise directly when a directive is used (problems that arise directly are described in the returned directive status code).&amp;lt;/li&amp;gt;&lt;br /&gt;
# Such problems fall into a number of categories&lt;br /&gt;
## System corruption is detected and/or oceos_exit is called a&lt;br /&gt;
## Excessive delays in obtaining system spin locks perhaps due to system overloading&lt;br /&gt;
## A timed action misses its specified time&lt;br /&gt;
## A task misses its deadlines&lt;br /&gt;
## Task start requests occur more frequently than expected&lt;br /&gt;
## A task exits without returning a mutex or read-write mutex that it holds&lt;br /&gt;
## Nested mutexes or read-write mutexes not returned in correct order&lt;br /&gt;
## Counts already at max or min&lt;br /&gt;
# In many cases when OCEOSmp makes a system log entry it also updates the system state variable. This is updated using ‘OR’ and so provides a long term record that a problem has occurred even if a log entry is overwritten. In addition, if the update corresponds to an application defined action mask and an application problem handling function is defined this is called automatically.&lt;br /&gt;
&lt;br /&gt;
== System State Variable ==&lt;br /&gt;
&lt;br /&gt;
[[File:SystemState.png|400px]]&lt;br /&gt;
&lt;br /&gt;
=== Purpose ===&lt;br /&gt;
&lt;br /&gt;
To record that certain conditions have occurred and to allow the ASW specify which conditions should cause an ASW defined problem handling function be triggered automatically when the state variable is updated due to these conditions.&lt;br /&gt;
&lt;br /&gt;
=== Structure ===&lt;br /&gt;
Four 32-bit words each containing 32 flags, some available for use by the ASW, some reserved for use by OCEOSmp&lt;br /&gt;
# system state variable		individual bits are set by ASW or by OCEOSmp &lt;br /&gt;
# accumulated system state	updated when system state flags are set &lt;br /&gt;
# action mask			set by ASW in application configuration &lt;br /&gt;
# action mask previous		previous value of action mask if changed by ASW&lt;br /&gt;
&lt;br /&gt;
=== Usage ===&lt;br /&gt;
# &amp;lt;li value=&amp;quot;5&amp;quot;&amp;gt;the system state variable is updated using inclusive ‘OR’ to set the desired flag&amp;lt;/li&amp;gt;&lt;br /&gt;
# the accumulated system state flag is set when the corresponding system state flag is set&lt;br /&gt;
# on reset the system state variable is cleared to 0, all flags clear&lt;br /&gt;
# the accumulated system state variable is reset only by the ASW&lt;br /&gt;
# the action mask is set by the ASW, and causes an ASW defined problem handler to be called when a state flag is updated to 1 that corresponds to a set action mask flag. &lt;br /&gt;
&lt;br /&gt;
Whenever a system state variable flag is set during scheduling (using inclusive ‘OR’) the corresponding accumulated state flag is also set. Accumulated state flags are not affected when a system state flag is cleared to 0, whether by the ASW or on system reset. They can be cleared only directly by the ASW. They keep a record of events across system reset if memory is preserved.&lt;br /&gt;
&lt;br /&gt;
The action mask is specified in the application configuration, which then should also declare a problem handling function. The mask may be altered by the ASW during scheduling.&lt;br /&gt;
&lt;br /&gt;
The ASW problem handling function is called automatically by OCEOSmp as a result of setting a previously clear system state flag that corresponds to a flag that is set in the action mask. The system state flag is set before the function is called. If the system state flag is not reset by the ASW problem handler or otherwise then further settings of that system state flag will not cause the function to be called again.&lt;br /&gt;
&lt;br /&gt;
The ASW can use a system call to modify the action mask at any time, when this is done the previous value of the action mask is stored.&lt;br /&gt;
&lt;br /&gt;
The flags corresponding to the high sixteen bits of the system state variable are reserved for use by OCEOSmp:&lt;br /&gt;
&lt;br /&gt;
These primarily refer to problems that are not immediate consequences of the use of a directive (these are indicated in the returned error or warning status code), but that may occur subsequently during scheduling:&lt;br /&gt;
# &amp;lt;li value=&amp;quot;16&amp;quot;&amp;gt;reserved&amp;lt;/li&amp;gt;	&lt;br /&gt;
# reserved&lt;br /&gt;
# reserved&lt;br /&gt;
# reserved&lt;br /&gt;
# reserved&lt;br /&gt;
# Attempt to start pending task that has been disabled while pending.&lt;br /&gt;
# Time from task start request to job completion exceeds task deadline.&lt;br /&gt;
# Time between task start requests less than specified minimum for task&lt;br /&gt;
# Time between task start requests greater than specified maximum for task&lt;br /&gt;
# Missed latest time for transfer of job from timed action queue to scheduler.&lt;br /&gt;
# Missed latest time for performance of timed output.&lt;br /&gt;
# Mutex not returned before job terminates.&lt;br /&gt;
# Read/Write mutex not returned before job termination.&lt;br /&gt;
# System busy warning&lt;br /&gt;
# Data area sentinels corrupted.&lt;br /&gt;
# System meta pointer corrupted&lt;br /&gt;
&lt;br /&gt;
== System Policing and Problem Anticipation ==&lt;br /&gt;
&lt;br /&gt;
All design involves assumptions, and ‘System Policing’ refers to checking how close these come to being violated as the system operates, and to taking precautions if needed.&lt;br /&gt;
&lt;br /&gt;
The white box design of OCEOSmp facilitates this, with records kept automatically of task timing performances and other parameters that are accessible by the ASW at any time, including after OCEOSmp exits should this occur.&lt;br /&gt;
&lt;br /&gt;
These records can answer questions such as ‘what is the longest time this task took to execute’, ‘what is the shortest time between requests to start this task’, ‘what is the longest time between requests to start this task’, and many others, including stack usage.&lt;br /&gt;
&lt;br /&gt;
By checking such data the ASW can notice that behaviour is not as expected and that something is going wrong, allowing ‘Problem Anticipation’ and an issue being dealt with before it causes serious difficulties.&lt;br /&gt;
&lt;br /&gt;
The ASW might do this by having an external policing function running on a core not in use by OCEOSmp that periodically checks that things are as expected, or by having a policing task that is scheduled by OCEOSmp.&lt;br /&gt;
&lt;br /&gt;
With all the data stored statically in the ‘Log Area’, ‘Fixed Data Area’ and ‘Dynamic Data Area’ arrays by the ASW it is straightforward to retrieve it.&lt;br /&gt;
&lt;br /&gt;
OCEOSmp only requires one system stack per CPU core rather than one stack per thread. Each stack is initialised to a known value, making it straightforward to determine the greatest extent to which each stack has been used.&lt;br /&gt;
&lt;br /&gt;
If suspicious activity is detected, the ASW can for example disable a task or take a CPU core out of use or disable a peripheral or take other corrective action.&lt;br /&gt;
&lt;br /&gt;
It can also make a historical record of bad behaviour by adding an entry to the System Log and by updating a flag in the System State variable, When the System Log becomes ¾ full an ASW function if defined is called that can archive the System Log, and a shadow copy of the System State variable is automatically maintained that is only reset by the ASW itself.&lt;br /&gt;
&lt;br /&gt;
When multiple mutual exclusion semaphores are used by tasks the OCEOSmp design excludes the possibility of unbounded priority inversion and no check for this is needed.&lt;br /&gt;
&lt;br /&gt;
On multi-core systems deadlocks can occur but only if tasks fail to acquire mutual exclusion semaphores in a consistent order corresponding to their identity numbers. A warning status code is then returned although as yet no deadlock has occurred.&lt;br /&gt;
&lt;br /&gt;
The ASW can include a policing function that checks the execution times of tasks (in OCEOSmp tasks on other CPU cores spin waiting to acquire mutexes), and the time when a task start request was issued, allowing detection of deadlocks, livelocks, and task starvation.&lt;br /&gt;
&lt;br /&gt;
It should be noted that OCEOSmp itself may detect an anomaly and automatically make an entry in the System Log and may also update the System State variable, perhaps resulting in an ASW defined problem handling function being called, but this only happens after a problem has occurred and been detected. &lt;br /&gt;
&lt;br /&gt;
== Problem Detection and Handling ==&lt;br /&gt;
&lt;br /&gt;
[[File:PoliceJoke.png|600px]]&lt;br /&gt;
&lt;br /&gt;
This relates to what happens after a problem has occurred and been detected, as distinct from System Policing and Problem Anticipation which aims to forestall problems.&lt;br /&gt;
&lt;br /&gt;
The integrity tests carried out automatically by OCEOSmp check for a number of problems. Some are detected directly when an OCEOSmp directive is used, others when an event occurs such as a job completing execution, others when some internal operation of OCEOSmp does not proceed as expected. &lt;br /&gt;
&lt;br /&gt;
Problems that arise directly from the use or misuse of a directive are identified in the returned status code, and the ASW can then decide the appropriate action.&lt;br /&gt;
&lt;br /&gt;
If appropriate the ASW can disable or terminate tasks and take CPU cores out of use without disrupting scheduling, and can read and update the system log and system state variable. In an extreme case the ASW can end scheduling and return to main().&lt;br /&gt;
&lt;br /&gt;
# Typical directive problems&lt;br /&gt;
## Current phase doesn’t allow this directive&lt;br /&gt;
## Invalid parameters supplied&lt;br /&gt;
## Time for timed action already passed&lt;br /&gt;
## Write fail, data queue full&lt;br /&gt;
## Write succeeded, data queue now full (warning) &lt;br /&gt;
## Mutexes or rwmutexes acquired in an incorrect order (warning)&lt;br /&gt;
&lt;br /&gt;
Other problems may be identified automatically be OCEOSmp after a directive has been used or when an event occurs, or during internal OCEOSmp operations&lt;br /&gt;
Such problems include:&lt;br /&gt;
# &amp;lt;li value=&amp;quot;2&amp;quot;&amp;gt;Unexpected patterns of events&amp;lt;/li&amp;gt;&lt;br /&gt;
## Task misses a deadline&lt;br /&gt;
## Task start requests occur more frequently than expected&lt;br /&gt;
## Task start requests occur less frequently than expected&lt;br /&gt;
## Task disabled after being put on a pending queue&lt;br /&gt;
## Spin locks not being available in a reasonable time&lt;br /&gt;
## Action time missed&lt;br /&gt;
## Pending queues being full&lt;br /&gt;
&lt;br /&gt;
These problems typically cause a system log entry to be made, may update the system state variable and may result in an ASW defined problem handling function being called. This has full access to the performance records and can enable or disable tasks and take CPU cores out of use or restore them to use without disrupting scheduling, and can exit from OCEOSmp if appropriate.&lt;br /&gt;
&lt;br /&gt;
Other problems that may be automatically detected by OCEOSmp include&lt;br /&gt;
# &amp;lt;li value=&amp;quot;3&amp;quot;&amp;gt;Corruption of critical data&amp;lt;/li&amp;gt;&lt;br /&gt;
## Perhaps due to hardware failures&lt;br /&gt;
## Perhaps by application software malfunctioning and overwriting data&lt;br /&gt;
## Perhaps by a bug in OCEOSmp&lt;br /&gt;
&lt;br /&gt;
These problems typically result in exit from OCEOSmp and return to main() at the point immediately after oceos_start() was used. The system state variable and system log may also be updated.&lt;br /&gt;
&lt;br /&gt;
It should be noted that the checks made by OCEOSmp only occur as a result of it being notified of some change in the state of the system, as when a directive is used or a job terminates or an interrupt occurs. It is recommended that these be added to by taking appropriate precautions.&lt;br /&gt;
&lt;br /&gt;
== Precautions and Correction ==&lt;br /&gt;
&lt;br /&gt;
[[File:Precaution.png|600px]]&lt;br /&gt;
&lt;br /&gt;
A primary precaution is policing. As described above this typically involves assigning a CPU core to check the activities of the system, or perhaps assigning a task to that purpose. Anticipation and prevention are better than detection.&lt;br /&gt;
&lt;br /&gt;
Further precautions are also possible, depending on the hardware available in the system. These can detect or perhaps even prevent various malfunctions. &lt;br /&gt;
&lt;br /&gt;
=== Hardware Malfunctions ===&lt;br /&gt;
These can be caused by radiation or other external factors, or simply by parts of the system wearing out.&lt;br /&gt;
&lt;br /&gt;
They fall into three main categories, memory hardware malfunctions, CPU core malfunctions, and peripheral or connected device malfunctions.&lt;br /&gt;
&lt;br /&gt;
==== Memory hardware malfunctions ====&lt;br /&gt;
&lt;br /&gt;
These typically result in one or more bits in a memory location being set to incorrect values.&lt;br /&gt;
&lt;br /&gt;
If the error involve no more than a certain number of bits (BCH 1, RS fixed &amp;gt; 1) then EDAC allows a memory location containing such errors be read correctly despite the error.&lt;br /&gt;
&lt;br /&gt;
While the value read is correct the error remains in the location until the correct value is written back. This should be done before a further bit becomes corrupted, perhaps making the error un-correctable. In some systems this write back is done automatically. &lt;br /&gt;
&lt;br /&gt;
Long intervals can occur between uses of a memory location making ‘memory scrubbing’ necessary. This cycles through all memory locations, reading and writing back if needed, doing so often enough to make it very unlikely that an un-correctable number of erroneous bits will accumulate in any location.&lt;br /&gt;
&lt;br /&gt;
Usually a hardware ‘memory scrubber‘ is available that can be configured to do this at a certain rate for a certain range of addresses.&lt;br /&gt;
&lt;br /&gt;
Memory read errors can still occur however. A combination of bit errors can defeat EDAC error detection and lead to an incorrect value being read. Usually however such un-correctable errors are detected by EDAC causing it to raise an exception. The corresponding handler must then take appropriate action, which may include terminating OCEOSmp.&lt;br /&gt;
&lt;br /&gt;
Precautions: Before starting OCEOSmp &lt;br /&gt;
# The handler for EDAC detected un-correctable errors should be put in place&lt;br /&gt;
# The memory should be initialized&lt;br /&gt;
# The EDAC system configured and put into operation&lt;br /&gt;
# The EDAC memory scrubber hardware configured and put into operation&lt;br /&gt;
&lt;br /&gt;
Once this has been done and OCEOSmp started&lt;br /&gt;
# &amp;lt;li value=&amp;quot;5&amp;quot;&amp;gt;The EDAC exception handler can &amp;lt;/li&amp;gt;	&lt;br /&gt;
## Update the system log&lt;br /&gt;
## Update the system state variable&lt;br /&gt;
## Start a problem handling task&lt;br /&gt;
## If necessary call oceos_exit() to return to main()&lt;br /&gt;
&lt;br /&gt;
==== Computer core hardware malfunctions ====&lt;br /&gt;
&lt;br /&gt;
Cores may use triple modular redundancy and other techniques to reduce the effects of transient errors, but nevertheless can become faulty. If this is detected in a multi-core system OCEOSmp allows the faulty core be taken out of use without scheduling being disrupted.&lt;br /&gt;
&lt;br /&gt;
Detecting that a core has become faulty can be done using computational tasks for which the results including timings are known. Before such tests are used however a malfunction may have led to an erroneous result being used. &lt;br /&gt;
&lt;br /&gt;
To avoid this when result accuracy is critical and immediately needed it is possible in OCEOSmp to have multiple CPU cores carry out the same computation at the same time (within a few clock cycles). &lt;br /&gt;
&lt;br /&gt;
The results can then be compared and the majority agreed value used. A core that was at fault can be tested and taken out of use if the problem is judged not to be transient.&lt;br /&gt;
&lt;br /&gt;
Precaution: Check periodically that cores carry out a computational test correctly.&lt;br /&gt;
# &amp;lt;li value=&amp;quot;6&amp;quot;&amp;gt;oceosmp_cpu_disable() will take the specified CPU core out of use, put it to sleep, and cause the termination functions of any jobs executing on the core be executed on a different core.&amp;lt;/li&amp;gt; &lt;br /&gt;
# oceosmp_cpu_enable() will make the specified CPU core available for use&lt;br /&gt;
&lt;br /&gt;
These directives can also be used to manage the number of active cores for power saving or other purposes. Scheduling is not disrupted as long as a functioning core remains.&lt;br /&gt;
&lt;br /&gt;
==== Peripheral Hardware Malfunctions ====&lt;br /&gt;
&lt;br /&gt;
These can arise due to a fault in the peripheral unit itself, or due to problems in an external system for which the peripheral is an interface.&lt;br /&gt;
&lt;br /&gt;
Before starting OCEOSmp the ASW should carry out appropriate checks of all peripheral units, and should ensure that such checks can be carried out if necessary by tasks after scheduling has begun.&lt;br /&gt;
&lt;br /&gt;
Faults in external systems for which a peripheral unit is an interface tend to either&lt;br /&gt;
# cause no messages to be sent to the interface&lt;br /&gt;
# cause messages to be sent too frequently&lt;br /&gt;
&lt;br /&gt;
In most cases when a peripheral receives an external message it causes an interrupt which then causes a request to start a task.&lt;br /&gt;
&lt;br /&gt;
If the interval between such task start requests is longer than expected this may indicate that the peripheral device has become faulty and is no longer operational.&lt;br /&gt;
&lt;br /&gt;
If the interval between such task start requests is shorter than expected it may indicate the frequency of external events exceeding expectations or some fault in the peripheral device.&lt;br /&gt;
&lt;br /&gt;
In both cases on starting the task OCEOSmp automatically checks the interval since the last task start request and if this is less than the expected minimum or greater than the expected maximum will make a system log entry and set the corresponding flag in the system state variable. If the ASW has set the corresponding system state action flag and defined a problem handling function this will result in the ASW problem handling function being called.&lt;br /&gt;
 &lt;br /&gt;
Precautions: &lt;br /&gt;
	In the ASW configuration structure passed to oceos_init() the ASW set the desired flags in the problem action mask and define a problem handling function.   &lt;br /&gt;
&lt;br /&gt;
=== Software Malfunctions ===&lt;br /&gt;
&lt;br /&gt;
Certain types of software errors can cause problems for the system as a whole.&lt;br /&gt;
&lt;br /&gt;
OCEOSmp automatically checks for some of these, others are best checked for by the ASW itself, perhaps as part of system policing.&lt;br /&gt;
&lt;br /&gt;
In addition to policing, various precautions can be taken against these problems, including making use of any memory protection hardware available and using a system watchdog timer.&lt;br /&gt;
&lt;br /&gt;
==== Invalid memory overwriting ====&lt;br /&gt;
&lt;br /&gt;
Application software may inadvertently overwrite memory areas used by OCEOSmp.&lt;br /&gt;
&lt;br /&gt;
The three memory areas used by OCEOSmp are each protected at their ends by constant sentinels. Each time a directive is used or job terminates OCEOSmp checks these sentinels to ensure that the areas involved have not been encroached upon. If so OCEOSmp will exit.&lt;br /&gt;
&lt;br /&gt;
In addition to its sentinels the fixed data area has an XOR checksum which allows any alteration be detected. This is not checked automatically by OCEOSmp for reasons of efficiency, but can be checked at any time by ASW policing software.&lt;br /&gt;
&lt;br /&gt;
Prevention is better than detection and if a system has a memory protection unit this should be configured to make the fixed area read-only. Any attempt to write this area will then typically cause the protection unit to raise an exception.&lt;br /&gt;
&lt;br /&gt;
Each CPU core has its own system stack. These form part of a contiguous block of statically allocated memory, and a software error may result in the code running on a core overrunning that core’s stack and attempting to use the stack memory of another core.&lt;br /&gt;
&lt;br /&gt;
This can be detected in policing by checking that filler still remains at the top and bottom of each core’s stack, and this can be checked at any time by ASW policing software, but prevention is better than detection.&lt;br /&gt;
 &lt;br /&gt;
Precautions: Any hardware memory protection present should be used on completion of oceos_init_finish() and before oceos_start() to provide these features.&lt;br /&gt;
# Read only (the fixed data area)&lt;br /&gt;
# Writeable only by a specific computer core (for each core’s stack)&lt;br /&gt;
 &lt;br /&gt;
Invalid attempts to use a memory location typically give rise to an exception and an appropriate handler must be in place.&lt;br /&gt;
&lt;br /&gt;
==== Invalid use of Mutual Exclusion Semaphores (Mutexes) or of Read-Write Mutexes ====&lt;br /&gt;
&lt;br /&gt;
In general the time for which the ASW holds a mutex or read-write mutex should be as short as possible.&lt;br /&gt;
&lt;br /&gt;
This time can be estimated at compile time and the estimates taken into account in determining whether a set of tasks can be scheduled so that tasks always meet their deadlines.&lt;br /&gt;
&lt;br /&gt;
Such estimates however can be made wrong by events that occur during scheduling if appropriate precautions are not taken.&lt;br /&gt;
&lt;br /&gt;
One possible problem, unbounded priority inversion, arises when a job holding a mutex is pre-empted by a higher priority task that does not use the mutex, causing any even higher priority task that uses the mutex to wait indefinitely for the low priority job to resume and release the mutex. In OCEOSmp unbounded priority inversion cannot occur. &lt;br /&gt;
&lt;br /&gt;
Another problem, deadlock, can arise when two or more jobs each acquire more than one mutex. A job while holding a mutex may then attempt to acquire a different mutex currently held by some other job. If that other job (without releasing the mutex it holds) attempts to acquire the mutex held by the first job neither job can make progress, the jobs are deadlocked.&lt;br /&gt;
&lt;br /&gt;
These problems are addressed by the design of OCEOSmp.&lt;br /&gt;
&lt;br /&gt;
In OCEOSmp each mutex or read-write mutex has a priority ceiling giving the priority of the highest priority task that uses it. This constant is determined at compile time and set for each mutex when it is created.&lt;br /&gt;
&lt;br /&gt;
In scheduling, once a job running on a CPU core holds one or more mutexes or read-write mutexes only tasks with higher priority than the highest ceiling are allowed to pre-empt the job and start running on that core.&lt;br /&gt;
&lt;br /&gt;
As a result unbounded priority inversion cannot occur, and on single core systems deadlocks also are not possible.&lt;br /&gt;
&lt;br /&gt;
On multi-core systems jobs can spin waiting to acquire a mutex held by a job running on a different core and deadlock becomes possible.&lt;br /&gt;
&lt;br /&gt;
In OCEOSmp mutexes and read-write mutexes are assigned a sequential order as they are created. Deadlocks then cannot occur if jobs always respect this order in acquiring mutexes, never attempting to acquire a mutex or read-write mutex if already holding one that is higher in the order.&lt;br /&gt;
&lt;br /&gt;
OCEOSmp does not prevent jobs from acquiring multiple mutexes in an out of order manner but returns a warning directive status code to the job indicating that deadlock is possible and makes a log entry and updates the system state variable, perhaps causing an ASW defined problem handling function to be called.&lt;br /&gt;
&lt;br /&gt;
When a job simultaneously holds multiple mutexes or read-write mutexes it should acquire and return these in a LIFO manner, e.g. waitA, waitB, waitC…..signalC, signalB, signalA. Failure to do so may affect task scheduling temporarily and will result in a warning directive status code, a log entry, and an update of the system state variable.&lt;br /&gt;
&lt;br /&gt;
Other errors in using mutexes such as failure to release a mutex before a job ends or attempting to release a mutex that is not held give rise to an appropriate directive status codes, a log entry, and a system state variable updates.&lt;br /&gt;
&lt;br /&gt;
Precautions: &lt;br /&gt;
# Ensure at compile time that when a task acquires multiple mutexes or read-write mutexes it always does so in the correct order.&lt;br /&gt;
# Ensure at compile time that when a job releases multiple mutexes or read-write mutexes it always does so in the reverse order to that in which they were acquired&lt;br /&gt;
&lt;br /&gt;
==== Deadlocks, Livelocks and Task Starvation ====&lt;br /&gt;
&lt;br /&gt;
Deadlocks arise primarily due to misuse of mutual exclusion semaphores or read write mutual exclusion semaphores, as described above.&lt;br /&gt;
&lt;br /&gt;
Livelocks, where tasks interact in a way that results in each task having to return to some earlier point with no or very little overall progress, can arise in a number of ways including from attempts to resolve a deadlock so that the tasks involved can proceed.&lt;br /&gt;
&lt;br /&gt;
Task starvation arises when a task is ready to start, but CPU time is not allocated to it within a reasonable time. In OCEOSmp this will occur for a low priority task if higher priority tasks are always ready to run and require all the available CPU cores. &lt;br /&gt;
&lt;br /&gt;
Task starvation, to at least some degree, can also occur for a high priority task if the resources required to allow it pre-empt a lower priority task are not available on the CPU core involved, as for example when the remaining system stack for that core is below the level needed for pre-emption.&lt;br /&gt;
&lt;br /&gt;
All three of these problems result in a task or tasks taking longer to complete than should be the case. This can be detected in two main ways&lt;br /&gt;
# By a policing task that periodically checks each task record in the dynamic area to determine the maximum time between a request to start it and task completion. &lt;br /&gt;
# By watchdog timer hardware that typically is reset periodically by the lowest priority task and which will cause a hardware system reset if its pre-set time elapses before it is reset. On re-entry to main() the ASW can check to determine if this has occurred before restarting OCEOSmp.&lt;br /&gt;
&lt;br /&gt;
Precautions&lt;br /&gt;
# &amp;lt;li value=&amp;quot;3&amp;quot;&amp;gt;ensure each CPU core has adequate system stack so that a lower priority task running on the core can always be pre-empted by a higher priority task. The amount required can be calculated from the number of different priority levels in use.&amp;lt;/li&amp;gt;&lt;br /&gt;
# if watchdog timer hardware is available set up a low priority task to periodically reset it. The ASW should check on entry to main() whether this was due to a watchdog timeout and if so use the OCEOSmp data to determine the cause and appropriate remedial action before restarting OCEOSmp.&lt;br /&gt;
# set up a policing task that checks the execution times of current tasks and detects when this is too long. This task can call an ASW defined problem handling function that can determine how best to deal with the situation, perhaps calling the termination functions of some currently executing tasks, disabling some tasks or changing interrupt intervals.&lt;br /&gt;
# If necessary reserve certain CPU cores to use only by higher priority tasks, perhaps ensuring that there is always at least one CPU core ready to be used immediately by such tasks.&lt;br /&gt;
&lt;br /&gt;
== Summary ==&lt;br /&gt;
&lt;br /&gt;
[[File:MurphysLaw.png|400px]]&lt;br /&gt;
&lt;br /&gt;
Murphy’s Law, ‘if things can go wrong they will’, has had a significant impact on the design of OCEOSmp. &lt;br /&gt;
&lt;br /&gt;
An older maxim ‘the wise man avoids evil by anticipating it’ (Publilius Cyrus) has also had an impact. Software can go wrong without prior indication of stress but it may be possible to notice that all is not well before disaster strikes. Avoidance is better than detection.&lt;br /&gt;
&lt;br /&gt;
These ideas have led to OCEOSmp having features that allow fault anticipation, detection, isolation and recovery, with a white box approach that simplifies system policing and checking behaviour against expectations and with memory statically allocated.&lt;br /&gt;
&lt;br /&gt;
When a problem is found OCEOSmp can take CPU cores out of use or kill or disable tasks without disrupting scheduling, or in severe cases exit and return to the ASW main() with all data still accessible for analysis or download, and with the ASW able to make changes and restart OCEOSmp if desired.&lt;br /&gt;
&lt;br /&gt;
These features help ensure that OCEOSmp is suitable for use in safety critical or other systems that require the highest reliability.&lt;br /&gt;
&lt;br /&gt;
Even where it is hoped that nothing can possibly go wrong….&lt;br /&gt;
&lt;br /&gt;
= &amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;'''System Log'''&amp;lt;/span&amp;gt; =&lt;br /&gt;
&lt;br /&gt;
== Purpose ==&lt;br /&gt;
#Provide application software with the ability to make time stamped records of events for use in application performance monitoring and in application debugging&lt;br /&gt;
#Provide OCEOSmp with the ability to record internal anomalies should these be detected.&lt;br /&gt;
&lt;br /&gt;
== Structure ==&lt;br /&gt;
#A circular buffer with a fixed size that is set in the application configuration&lt;br /&gt;
#Size from 16 to 1024 entries, default 64 if not specified&lt;br /&gt;
#If the application defines oceosmp_on_full_log(void *) this is called automatically when the buffer becomes ¾ full, allowing log entries that might otherwise be overwritten be stored. The automatic call will reoccur only after the buffer becomes ¾ empty.&lt;br /&gt;
#On system reset log entries are not overwritten and buffer indices are reset so as to postpone recent entries being overwritten and allow review of events prior to the reset.&lt;br /&gt;
&lt;br /&gt;
== Storage ==&lt;br /&gt;
#Stored statically in the oceosmp_log_area, which also contains the next-read and next-write buffer indices and the system state related variables.&lt;br /&gt;
#The log size and the oceosmp_on_full() function declaration are stored in the oceosmp_fixed_area, as also are the  log area addresses.&lt;br /&gt;
#Log entry format (from system_log.h): &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
Struct log_entry{&lt;br /&gt;
 	U64_t		time64;&lt;br /&gt;
 	unsigned int       current_cpu_id		:8;&lt;br /&gt;
 	unsigned int	entry_type		:8;&lt;br /&gt;
 	U32_t		entry_comment;&lt;br /&gt;
} __attribute__ ((aligned (8));&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt; &lt;br /&gt;
#When a log entry is made, time64 and current_cpu_id are set automatically by OCEOSmp.&lt;br /&gt;
#The entry type is an enum defined by the application, with a subset of enum values reserved for use by OCEOSmp. The reserved enum values are specified in system_log.h.&lt;br /&gt;
#The entry_comment allows noting further information on the current situation&lt;br /&gt;
&lt;br /&gt;
== Associated directives ==&lt;br /&gt;
#Add Log Entry&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t 	oceos_log_add_entry(&lt;br /&gt;
 	 	enum LOG_ENTRY_TYPE type, // 8 bit enum LOG_ENTRY_TYPE&lt;br /&gt;
 	 	const U32_t info 		// further information&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt; &lt;br /&gt;
This adds an entry, overwriting the currently oldest entry.&lt;br /&gt;
&lt;br /&gt;
#Remove Log Entry&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t oceos_log_remove_entry(&lt;br /&gt;
 		struct log_entry * const outputPtr&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This returns the oldest unread entry to outputPtr and updates the buffer indices&lt;br /&gt;
&lt;br /&gt;
#Other directives are detailed in system_log.h&lt;br /&gt;
 &lt;br /&gt;
== Usage by OCEOSmp itself ==&lt;br /&gt;
#OCEOSmp only uses the system log for problems that do not arise directly when a directive is used (problems that arise directly are described in the returned directive status code).&lt;br /&gt;
#Such problems fall into a number of categories&lt;br /&gt;
a.	System corruption is detected and/or oceos_exit is called&lt;br /&gt;
b.	Excessive delays in obtaining system spin locks perhaps due to system overloading&lt;br /&gt;
c.	A timed action misses its specified time&lt;br /&gt;
d.	A task misses its deadlines&lt;br /&gt;
e.	Task start requests occur more frequently than expected&lt;br /&gt;
f.	A task exits without returning a mutex or read-write mutex that it holds&lt;br /&gt;
g.	Counts already at max or min&lt;br /&gt;
h.	&lt;br /&gt;
18.	In many cases when OCEOSmp makes a system log entry it also updates the system state variable. This is updated using ‘OR’ and so provides a long term record that a problem has occurred even if a log entry is overwritten. In addition, if the update corresponds to an application defined action mask an application defined problem handling function may be called which can if desired read the system log.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:backup]]&lt;/div&gt;</summary>
		<author><name>Bkavanagh</name></author>
	</entry>
	<entry>
		<id>https://wiki.ocetechnology.com/mediawiki/index.php?title=OCEOSmp/notes&amp;diff=1682</id>
		<title>OCEOSmp/notes</title>
		<link rel="alternate" type="text/html" href="https://wiki.ocetechnology.com/mediawiki/index.php?title=OCEOSmp/notes&amp;diff=1682"/>
		<updated>2024-05-03T14:59:32Z</updated>

		<summary type="html">&lt;p&gt;Bkavanagh: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= &amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;'''When things go wrong'''&amp;lt;/span&amp;gt; =&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Prof. M. Ryan'''&lt;br /&gt;
&lt;br /&gt;
Things can go wrong even when software is bug free.&lt;br /&gt;
&lt;br /&gt;
Misunderstandings may have led to an inadequate design, real world circumstances may conspire to cause performance problems, radiation or other factors may cause hardware failures, and in general things can always go wrong.&lt;br /&gt;
&lt;br /&gt;
Murphy’s Law then applies, and while the system is in use it is important that system behaviour can be monitored, deviations from expectations noticed, checks made, corrections done, and recovery steps taken if needed.&lt;br /&gt;
&lt;br /&gt;
OCEOSmp has been designed with Murphy’s Law in mind and facilitates such actions in a number of ways.&lt;br /&gt;
&lt;br /&gt;
# Servant not Master&lt;br /&gt;
# White Box not Black Box&lt;br /&gt;
# Directive warning and error status codes&lt;br /&gt;
# Automatic integrity checks&lt;br /&gt;
# System Log&lt;br /&gt;
# System state variable&lt;br /&gt;
# System Policing and Problem Anticipation&lt;br /&gt;
# Problem Detection and Handling&lt;br /&gt;
# Precautions and Correction&lt;br /&gt;
&lt;br /&gt;
== Servant not Master ==&lt;br /&gt;
&lt;br /&gt;
[[File:MasterNotSlave.png|400px]]&lt;br /&gt;
&lt;br /&gt;
Many operating systems begin execution directly after the boot sequence and control all subsequent execution of the application software (ASW). Should something go wrong it can be difficult to assess what has occurred and find appropriate corrective action, particularly if the operating system itself has been involved.&lt;br /&gt;
&lt;br /&gt;
With OCEOSmp the ASW begins execution before the operating system and only starts OCEOSmp at some point after entering main().&lt;br /&gt;
&lt;br /&gt;
Before doing so the ASW should check the circumstances that lead to main() being entered. If due to a system restart then the data accumulated by OCEOSmp in the previous run is still available in its fixed, dynamic, and log data areas for analysis or download to find the cause (assuming power has been maintained or non-volatile memory is used for those areas).&lt;br /&gt;
&lt;br /&gt;
The ASW can then make appropriate modifications, and continue as usual to set up EDAC, set up memory protection, initialise and check CPU cores and peripherals, and once all seems correct proceed to start or restart OCEOSmp.&lt;br /&gt;
&lt;br /&gt;
Once scheduling begins OCEOSmp returns to main() only if a fatal error is detected or if it is instructed to do so by an ASW task. Should this occur all the data accumulated is available for analysis or download by ASW main() code, which can restart scheduling by calling oceos_start().&lt;br /&gt;
 &lt;br /&gt;
Most problems can be dealt with by tasks set up to do so under the control of OCEOSmp, but sufficiently serious ones may cause a system reset (e.g. a watchdog timer running out) or cause OCEOSmp to exit (e.g. corruption of critical data), in both cases with the previous state available for analysis if power is maintained or if non-volatile memory is used.&lt;br /&gt;
&lt;br /&gt;
In main() the ASW takes five principal steps in starting OCEOSmp:&lt;br /&gt;
&lt;br /&gt;
# check whether the entry to main() is due to a restart (e.g. by checking if the OCEOSmp data area sentinels are already in place) and if so use the data areas to determine the cause and make whatever modifications to the system are appropriate.   &lt;br /&gt;
# use oceos_init() with the ASW configuration to set up the log area and prepare the fixed data area to hold various addresses, the number of CPU cores, tasks, mutexes, etc.&lt;br /&gt;
# use various OCEOSmp create functions to create tasks, mutexs etc.&lt;br /&gt;
# use oceos_init_finish() to check that the declared numbers of tasks etc. have been created, finish setting up the fixed data area, and set its checksum.&lt;br /&gt;
&lt;br /&gt;
At this point the fixed data area with fixed information about addresses, cores, tasks, mutexes, data queues etc. has been set up, and need not be set up again if not corrupted. The checksum allows the &lt;br /&gt;
area be checked at any time to ensure it has not been changed. Memory protection if available can make the fixed area read-only and make the stack addresses for each core restricted to being written &lt;br /&gt;
only by that core. &lt;br /&gt;
&lt;br /&gt;
Scheduling can begin.&lt;br /&gt;
&lt;br /&gt;
# &amp;lt;li value=&amp;quot;5&amp;quot;&amp;gt;use oceos_start() to initialise the dynamic data area and begins scheduling. This function usually does not return to main() but may do so if a major problem is detected.&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As scheduling progresses the ASW can use the system log to record events and monitor performance. The log is also used by OCEOSmp to record problems, and OCEOSmp may also make a system state entry and trigger an ASW problem handling function.&lt;br /&gt;
&lt;br /&gt;
If a problem is sufficiently serious OCEOSmp may exit automatically or may be requested to do so by an ASW task, execution then returns to main() at the point after the call to oceos_start() with all performance, log, stack and other data available for analysis or download.&lt;br /&gt;
 &lt;br /&gt;
The ASW main() code can then determine the reason for the unexpected return, take appropriate corrective action, and resume scheduling by calling oceos_start() or modify various settings and start over with oceos_init().&lt;br /&gt;
&lt;br /&gt;
The ASW uses OCEOSmp and remains the master, rather than the reverse.&lt;br /&gt;
&lt;br /&gt;
== White Box not Black Box ==&lt;br /&gt;
&lt;br /&gt;
[[File:WhiteboxNotBlackbox.png|800px]]&lt;br /&gt;
&lt;br /&gt;
The data used by OCEOSmp is stored in statically allocated memory in three data areas and in an overall stack area. These usually are specified by the ASW as arrays of 32-bit words and can be examined by the ASW at any time.&lt;br /&gt;
&lt;br /&gt;
The data includes actual and expected task maximum and minimum execution times, activities on CPU cores, and other records of what has been happening. These records can be readily examined by the ASW while scheduling is under way and after OCEOSmp exits should this occur.&lt;br /&gt;
&lt;br /&gt;
OCEOSmp configures each data area to begin with a 32-bit sentinel followed by its size measured in 32-bit words, then the corresponding data, and finally a 32-bit sentinel. In the case of the fixed data area a 32-bit XOR checksum is located before the end sentinel.&lt;br /&gt;
&lt;br /&gt;
The size of each data area and the layout of the data within it depends on the application configuration, but are clearly specified with the location of each data item identified.&lt;br /&gt;
&lt;br /&gt;
Whenever an OCEOSmp directive is used a quick check is made that sentinels have not been breached. The ASW itself can check the fixed area checksum at any time (this is not done automatically for reasons of efficiency).&lt;br /&gt;
&lt;br /&gt;
The Log Area is initialized by oceos_init() and contains the system log and system state variable and if used the optional context switch log. Directives are provided to access and update these. The size of the area depends on the number of entries specified for the two logs in the system configuration. Log contents are preserved across system reset and across power failures if stored in non-volatile memory. &lt;br /&gt;
&lt;br /&gt;
The Fixed Data Area is completed by oceos_init_finish() and contains all the constants of the system, such as the addresses of data areas and stacks, the identity of the CPU core that OCEOSmp is to use on startup, the number of cores, tasks etc., the priorities and other attributes of tasks etc. &lt;br /&gt;
&lt;br /&gt;
The Dynamic Data area is created and initialized by oceos_start() and contains the information collected as oceosmp schedules tasks and as mutexes, counting semaphores,  etc. are used. This information is available for inspection by the ASW if OCEOSmp exits, and is only overwritten if the ASW again calls oceos_start().&lt;br /&gt;
&lt;br /&gt;
In OCEOSmp each CPU core has a system stack, a stack for each thread is not required. The stack size per CPU core and the location of the overall top of stack is specified in the application configuration and the overall stack space is statically allocated.&lt;br /&gt;
&lt;br /&gt;
Before scheduling begins OCEOSmp initialises each core’s stack with a filler. This is overwritten as the stack is used and by checking how much memory at the top and bottom of each stack still contains the filler it is possible to determine at any point how close the system has come to a stack overrun.&lt;br /&gt;
&lt;br /&gt;
The white box approach of making all records and the system stacks readily accessible while scheduling is taking place and should OCEOSmp exit facilitates checking that the system is performing as expected and determining the causes of any problems that may occur.&lt;br /&gt;
&lt;br /&gt;
== Directive warning and error status codes ==&lt;br /&gt;
&lt;br /&gt;
[[File:WarningErrorIcon.png|400px]]&lt;br /&gt;
&lt;br /&gt;
The ASW uses OCEOSmp by calling its directives, and is responsible for checking the returned directive status code. (OCEOSmp is a statically linked library, only those components related to the directives used by the ASW are linked into the final executable.)&lt;br /&gt;
&lt;br /&gt;
The system time directives oceos_time_sys_get64() and oceos_time_sys_get32() directly return the requested system time as 64-bit or 32-bit unsigned integers.&lt;br /&gt;
&lt;br /&gt;
Other directives return a 32-bit signed integer status code.&lt;br /&gt;
&lt;br /&gt;
This should always be checked when a directive is used.&lt;br /&gt;
&lt;br /&gt;
The status code indicates ERROR, SUCCESS, or WARNING.&lt;br /&gt;
&lt;br /&gt;
* A negative value indicates that the directive has not executed and gives the reasons&lt;br /&gt;
* A zero value indicates successful execution as expected&lt;br /&gt;
* A non-zero positive value indicates that the directive executed but with warnings&lt;br /&gt;
&lt;br /&gt;
Certain bits in the status code have the same meaning for all directives.&lt;br /&gt;
&lt;br /&gt;
Other bits have meanings that depend on the directive in use.&lt;br /&gt;
&lt;br /&gt;
These meanings are given in the header files associated with each directive as constants that can be compared with the status code to determine the types of errors or warnings involved.&lt;br /&gt;
&lt;br /&gt;
Errors typically involve an incorrect parameter to a directive, or an attempt to use a resource that is not available such as writing to a data queue that is already full.&lt;br /&gt;
&lt;br /&gt;
Warnings typically indicate that the directive has succeeded but that a danger has been created as when a task acquires multiple mutual exclusion semaphores out of order, or that a resource is now fully in use as when a write makes a data queue full.&lt;br /&gt;
&lt;br /&gt;
The task that used the directive and checked the returned status has full access to the data areas and stack areas in deciding the action to take, which may involve making a system log entry, starting a problem handling task, or in the worst case exiting from OCEOSmp and returning to main().&lt;br /&gt;
&lt;br /&gt;
In many situations the returned status code is the only indicator that is needed of directive success or failure. The ASW can then make a system log entry (automatically timestamped by OCEOSmp) for recording or performance analysis purposes if desired.&lt;br /&gt;
&lt;br /&gt;
In some situations OCEOSmp will make a system log entry automatically and may also update the system state variable, resulting in an ASW defined problem handling function being called if the corresponding flag has been set by the ASW in the system action flags.&lt;br /&gt;
&lt;br /&gt;
OCEOSmp may also automatically make a system log entry or take other actions when problems arise later, as when a task completion deadline is missed or a mutex is not returned.&lt;br /&gt;
&lt;br /&gt;
Irrespective of whatever other precautions may be taken, the first line of defence in using a directive is to check the returned status code.&lt;br /&gt;
&lt;br /&gt;
== Automatic integrity tests ==&lt;br /&gt;
&lt;br /&gt;
[[File:Automation.jpg|600px]]&lt;br /&gt;
&lt;br /&gt;
These are done automatically by OCEOSmp when a directive is used or an event occurs.&lt;br /&gt;
&lt;br /&gt;
They include checking that OCEOSmp data area sentinels are intact, and in the event of corruption may result in an exit from OCEOSmp and return to main().&lt;br /&gt;
&lt;br /&gt;
Directive parameters and the current system phase also are automatically checked when a directive is used, together with the availability of any required resources.&lt;br /&gt;
&lt;br /&gt;
Problems detected immediately when a directive is used result in an appropriate status code being returned to the ASW task that called the directive.&lt;br /&gt;
&lt;br /&gt;
Some problems, such as a task missing a deadline, do not occur immediately when a directive is used but only as scheduling proceeds. Such problems are checked for automatically by OCEOSmp.&lt;br /&gt;
&lt;br /&gt;
Checks include task completion times vs. deadlines, task start requests intervals vs. expected maxima and minima, mutual exclusion semaphore not being released before task completion, time taken to obtain spinlocks longer than expected (an indicator of system loading), and other problems. &lt;br /&gt;
&lt;br /&gt;
If a check fails in most cases a system log entry is made and the system state variable may be updated, possibly resulting in an ASW defined problem handler being called. In extreme cases OCEOSmp may exit and return to main().&lt;br /&gt;
&lt;br /&gt;
Overall the automatic integrity tests carried out by OCEOSmp itself include:&lt;br /&gt;
# System meta pointer intact&lt;br /&gt;
# Data area sentinel/s intact&lt;br /&gt;
# Task deadline not missed&lt;br /&gt;
# Task start request gap too short&lt;br /&gt;
# Task start request gap too long&lt;br /&gt;
# …&lt;br /&gt;
&lt;br /&gt;
It should be noted that these checks detect that a problem has happened. To anticipate problems and perhaps avoid them further checks can and should be done by the ASW as part of system policing.&lt;br /&gt;
&lt;br /&gt;
== System Log ==&lt;br /&gt;
&lt;br /&gt;
[[File:Logging.png|600px]]&lt;br /&gt;
&lt;br /&gt;
=== Purpose ===&lt;br /&gt;
&lt;br /&gt;
# Provide application software with the ability to make time stamped records of events for use in application performance monitoring and in application debugging&lt;br /&gt;
# Provide OCEOSmp with the ability to record anomalies should these be detected.&lt;br /&gt;
&lt;br /&gt;
=== Structure ===&lt;br /&gt;
&lt;br /&gt;
# &amp;lt;li value=&amp;quot;3&amp;quot;&amp;gt;A circular buffer with a fixed size that is set in the application configuration&amp;lt;/li&amp;gt; &lt;br /&gt;
# Size from 16 to 1024 entries, default 64 if size not specified&lt;br /&gt;
# If the application defines oceosmp_on_full_log(void *) this is called automatically when the buffer becomes ¾ full, allowing log entries that might otherwise be overwritten be archived. The automatic call will reoccur only after the buffer becomes ¾ empty.&lt;br /&gt;
# Two indices determine the next log entry position to be read from or written to. On system reset these are left unchanged if valid so as to postpone recent entries being overwritten.&lt;br /&gt;
# Log entries are left unchanged until a system log write causes the current entry at the write index be overwritten. Reading the log returns the earliest entry not read so far. Directives are provided to allow any log entry be read and to reset the log indices.&lt;br /&gt;
&lt;br /&gt;
=== Storage ===&lt;br /&gt;
&lt;br /&gt;
#  &amp;lt;li value=&amp;quot;8&amp;quot;&amp;gt;Stored statically in the oceosmp_log_area, which also contains the next-read and next-write buffer indices and the system state related variables.&amp;lt;/li&amp;gt;&lt;br /&gt;
# The log size and the oceosmp_on_full() function declaration are stored in the oceosmp_fixed_area, as also are the  log area addresses.&lt;br /&gt;
&lt;br /&gt;
==== Log entry format (from system_log.h) ====&lt;br /&gt;
&lt;br /&gt;
 Struct log_entry{&lt;br /&gt;
  	U64_t time64;&lt;br /&gt;
  	unsigned int current_cpu_id :8;&lt;br /&gt;
  	unsigned int entry_type :8;&lt;br /&gt;
  	U32_t entry_comment;&lt;br /&gt;
 } __attribute__ ((aligned (8));&lt;br /&gt;
&lt;br /&gt;
# &amp;lt;li value=&amp;quot;10&amp;quot;&amp;gt;When a log entry is made, time64 and current_cpu_id are set automatically by OCEOSmp.&amp;lt;/li&amp;gt;&lt;br /&gt;
# The entry type is an enum defined by the application, with a subset of enum values reserved for use by OCEOSmp. The reserved enum values are specified in system_log.h.&lt;br /&gt;
# The entry_comment allows noting further information on the current situation&lt;br /&gt;
&lt;br /&gt;
==== Associated directives (from system_log.h) ====&lt;br /&gt;
&lt;br /&gt;
 S32_t 	oceos_log_add_entry(&lt;br /&gt;
 	 	enum LOG_ENTRY_TYPE type, // 8 bit enum LOG_ENTRY_TYPE&lt;br /&gt;
 	 	const U32_t info 		// further information&lt;br /&gt;
 );&lt;br /&gt;
&lt;br /&gt;
This adds an entry, overwriting the currently oldest entry.&lt;br /&gt;
&lt;br /&gt;
 S32_t oceos_log_remove_entry(&lt;br /&gt;
  		struct log_entry * const outputPtr&lt;br /&gt;
 );&lt;br /&gt;
&lt;br /&gt;
This returns the oldest unread entry to outputPtr and updates the buffer indices&lt;br /&gt;
&lt;br /&gt;
# &amp;lt;li value=&amp;quot;13&amp;quot;&amp;gt;Other log directives are detailed in system_log.h&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Usage by OCEOSmp itself&lt;br /&gt;
&lt;br /&gt;
# &amp;lt;li value=&amp;quot;14&amp;quot;&amp;gt;OCEOSmp only uses the system log for problems that do not arise directly when a directive is used (problems that arise directly are described in the returned directive status code).&amp;lt;/li&amp;gt;&lt;br /&gt;
# Such problems fall into a number of categories&lt;br /&gt;
## System corruption is detected and/or oceos_exit is called a&lt;br /&gt;
## Excessive delays in obtaining system spin locks perhaps due to system overloading&lt;br /&gt;
## A timed action misses its specified time&lt;br /&gt;
## A task misses its deadlines&lt;br /&gt;
## Task start requests occur more frequently than expected&lt;br /&gt;
## A task exits without returning a mutex or read-write mutex that it holds&lt;br /&gt;
## Nested mutexes or read-write mutexes not returned in correct order&lt;br /&gt;
## Counts already at max or min&lt;br /&gt;
# In many cases when OCEOSmp makes a system log entry it also updates the system state variable. This is updated using ‘OR’ and so provides a long term record that a problem has occurred even if a log entry is overwritten. In addition, if the update corresponds to an application defined action mask and an application problem handling function is defined this is called automatically.&lt;br /&gt;
&lt;br /&gt;
== System State Variable ==&lt;br /&gt;
&lt;br /&gt;
[[File:SystemState.png|400px]]&lt;br /&gt;
&lt;br /&gt;
=== Purpose ===&lt;br /&gt;
&lt;br /&gt;
To record that certain conditions have occurred and to allow the ASW specify which conditions should cause an ASW defined problem handling function be triggered automatically when the state variable is updated due to these conditions.&lt;br /&gt;
&lt;br /&gt;
=== Structure ===&lt;br /&gt;
Four 32-bit words each containing 32 flags, some available for use by the ASW, some reserved for use by OCEOSmp&lt;br /&gt;
# system state variable		individual bits are set by ASW or by OCEOSmp &lt;br /&gt;
# accumulated system state	updated when system state flags are set &lt;br /&gt;
# action mask			set by ASW in application configuration &lt;br /&gt;
# action mask previous		previous value of action mask if changed by ASW&lt;br /&gt;
&lt;br /&gt;
=== Usage ===&lt;br /&gt;
# &amp;lt;li value=&amp;quot;5&amp;quot;&amp;gt;the system state variable is updated using inclusive ‘OR’ to set the desired flag&amp;lt;/li&amp;gt;&lt;br /&gt;
# the accumulated system state flag is set when the corresponding system state flag is set&lt;br /&gt;
# on reset the system state variable is cleared to 0, all flags clear&lt;br /&gt;
# the accumulated system state variable is reset only by the ASW&lt;br /&gt;
# the action mask is set by the ASW, and causes an ASW defined problem handler to be called when a state flag is updated to 1 that corresponds to a set action mask flag. &lt;br /&gt;
&lt;br /&gt;
Whenever a system state variable flag is set during scheduling (using inclusive ‘OR’) the corresponding accumulated state flag is also set. Accumulated state flags are not affected when a system state flag is cleared to 0, whether by the ASW or on system reset. They can be cleared only directly by the ASW. They keep a record of events across system reset if memory is preserved.&lt;br /&gt;
&lt;br /&gt;
The action mask is specified in the application configuration, which then should also declare a problem handling function. The mask may be altered by the ASW during scheduling.&lt;br /&gt;
&lt;br /&gt;
The ASW problem handling function is called automatically by OCEOSmp as a result of setting a previously clear system state flag that corresponds to a flag that is set in the action mask. The system state flag is set before the function is called. If the system state flag is not reset by the ASW problem handler or otherwise then further settings of that system state flag will not cause the function to be called again.&lt;br /&gt;
&lt;br /&gt;
The ASW can use a system call to modify the action mask at any time, when this is done the previous value of the action mask is stored.&lt;br /&gt;
&lt;br /&gt;
The flags corresponding to the high sixteen bits of the system state variable are reserved for use by OCEOSmp:&lt;br /&gt;
&lt;br /&gt;
These primarily refer to problems that are not immediate consequences of the use of a directive (these are indicated in the returned error or warning status code), but that may occur subsequently during scheduling:&lt;br /&gt;
# &amp;lt;li value=&amp;quot;16&amp;quot;&amp;gt;reserved&amp;lt;/li&amp;gt;	&lt;br /&gt;
# reserved&lt;br /&gt;
# reserved&lt;br /&gt;
# reserved&lt;br /&gt;
# reserved&lt;br /&gt;
# Attempt to start pending task that has been disabled while pending.&lt;br /&gt;
# Time from task start request to job completion exceeds task deadline.&lt;br /&gt;
# Time between task start requests less than specified minimum for task&lt;br /&gt;
# Time between task start requests greater than specified maximum for task&lt;br /&gt;
# Missed latest time for transfer of job from timed action queue to scheduler.&lt;br /&gt;
# Missed latest time for performance of timed output.&lt;br /&gt;
# Mutex not returned before job terminates.&lt;br /&gt;
# Read/Write mutex not returned before job termination.&lt;br /&gt;
# System busy warning&lt;br /&gt;
# Data area sentinels corrupted.&lt;br /&gt;
# System meta pointer corrupted&lt;br /&gt;
&lt;br /&gt;
== System Policing and Problem Anticipation ==&lt;br /&gt;
&lt;br /&gt;
All design involves assumptions, and ‘System Policing’ refers to checking how close these come to being violated as the system operates, and to taking precautions if needed.&lt;br /&gt;
&lt;br /&gt;
The white box design of OCEOSmp facilitates this, with records kept automatically of task timing performances and other parameters that are accessible by the ASW at any time, including after OCEOSmp exits should this occur.&lt;br /&gt;
&lt;br /&gt;
These records can answer questions such as ‘what is the longest time this task took to execute’, ‘what is the shortest time between requests to start this task’, ‘what is the longest time between requests to start this task’, and many others, including stack usage.&lt;br /&gt;
&lt;br /&gt;
By checking such data the ASW can notice that behaviour is not as expected and that something is going wrong, allowing ‘Problem Anticipation’ and an issue being dealt with before it causes serious difficulties.&lt;br /&gt;
&lt;br /&gt;
The ASW might do this by having an external policing function running on a core not in use by OCEOSmp that periodically checks that things are as expected, or by having a policing task that is scheduled by OCEOSmp.&lt;br /&gt;
&lt;br /&gt;
With all the data stored statically in the ‘Log Area’, ‘Fixed Data Area’ and ‘Dynamic Data Area’ arrays by the ASW it is straightforward to retrieve it.&lt;br /&gt;
&lt;br /&gt;
OCEOSmp only requires one system stack per CPU core rather than one stack per thread. Each stack is initialised to a known value, making it straightforward to determine the greatest extent to which each stack has been used.&lt;br /&gt;
&lt;br /&gt;
If suspicious activity is detected, the ASW can for example disable a task or take a CPU core out of use or disable a peripheral or take other corrective action.&lt;br /&gt;
&lt;br /&gt;
It can also make a historical record of bad behaviour by adding an entry to the System Log and by updating a flag in the System State variable, When the System Log becomes ¾ full an ASW function if defined is called that can archive the System Log, and a shadow copy of the System State variable is automatically maintained that is only reset by the ASW itself.&lt;br /&gt;
&lt;br /&gt;
When multiple mutual exclusion semaphores are used by tasks the OCEOSmp design excludes the possibility of unbounded priority inversion and no check for this is needed.&lt;br /&gt;
&lt;br /&gt;
On multi-core systems deadlocks can occur but only if tasks fail to acquire mutual exclusion semaphores in a consistent order corresponding to their identity numbers. A warning status code is then returned although as yet no deadlock has occurred.&lt;br /&gt;
&lt;br /&gt;
The ASW can include a policing function that checks the execution times of tasks (in OCEOSmp tasks on other CPU cores spin waiting to acquire mutexes), and the time when a task start request was issued, allowing detection of deadlocks, livelocks, and task starvation.&lt;br /&gt;
&lt;br /&gt;
It should be noted that OCEOSmp itself may detect an anomaly and automatically make an entry in the System Log and may also update the System State variable, perhaps resulting in an ASW defined problem handling function being called, but this only happens after a problem has occurred and been detected. &lt;br /&gt;
&lt;br /&gt;
== Problem Detection and Handling ==&lt;br /&gt;
&lt;br /&gt;
[[File:PoliceJoke.png|600px]]&lt;br /&gt;
&lt;br /&gt;
This relates to what happens after a problem has occurred and been detected, as distinct from System Policing and Problem Anticipation which aims to forestall problems.&lt;br /&gt;
&lt;br /&gt;
The integrity tests carried out automatically by OCEOSmp check for a number of problems. Some are detected directly when an OCEOSmp directive is used, others when an event occurs such as a job completing execution, others when some internal operation of OCEOSmp does not proceed as expected. &lt;br /&gt;
&lt;br /&gt;
Problems that arise directly from the use or misuse of a directive are identified in the returned status code, and the ASW can then decide the appropriate action.&lt;br /&gt;
&lt;br /&gt;
If appropriate the ASW can disable or terminate tasks and take CPU cores out of use without disrupting scheduling, and can read and update the system log and system state variable. In an extreme case the ASW can end scheduling and return to main().&lt;br /&gt;
&lt;br /&gt;
# Typical directive problems&lt;br /&gt;
## Current phase doesn’t allow this directive&lt;br /&gt;
## Invalid parameters supplied&lt;br /&gt;
## Time for timed action already passed&lt;br /&gt;
## Write fail, data queue full&lt;br /&gt;
## Write succeeded, data queue now full (warning) &lt;br /&gt;
## Mutexes or rwmutexes acquired in an incorrect order (warning)&lt;br /&gt;
&lt;br /&gt;
Other problems may be identified automatically be OCEOSmp after a directive has been used or when an event occurs, or during internal OCEOSmp operations&lt;br /&gt;
Such problems include:&lt;br /&gt;
# &amp;lt;li value=&amp;quot;2&amp;quot;&amp;gt;Unexpected patterns of events&amp;lt;/li&amp;gt;&lt;br /&gt;
## Task misses a deadline&lt;br /&gt;
## Task start requests occur more frequently than expected&lt;br /&gt;
## Task start requests occur less frequently than expected&lt;br /&gt;
## Task disabled after being put on a pending queue&lt;br /&gt;
## Spin locks not being available in a reasonable time&lt;br /&gt;
## Action time missed&lt;br /&gt;
## Pending queues being full&lt;br /&gt;
&lt;br /&gt;
These problems typically cause a system log entry to be made, may update the system state variable and may result in an ASW defined problem handling function being called. This has full access to the performance records and can enable or disable tasks and take CPU cores out of use or restore them to use without disrupting scheduling, and can exit from OCEOSmp if appropriate.&lt;br /&gt;
&lt;br /&gt;
Other problems that may be automatically detected by OCEOSmp include&lt;br /&gt;
# &amp;lt;li value=&amp;quot;3&amp;quot;&amp;gt;Corruption of critical data&amp;lt;/li&amp;gt;&lt;br /&gt;
## Perhaps due to hardware failures&lt;br /&gt;
## Perhaps by application software malfunctioning and overwriting data&lt;br /&gt;
## Perhaps by a bug in OCEOSmp&lt;br /&gt;
&lt;br /&gt;
These problems typically result in exit from OCEOSmp and return to main() at the point immediately after oceos_start() was used. The system state variable and system log may also be updated.&lt;br /&gt;
&lt;br /&gt;
It should be noted that the checks made by OCEOSmp only occur as a result of it being notified of some change in the state of the system, as when a directive is used or a job terminates or an interrupt occurs. It is recommended that these be added to by taking appropriate precautions.&lt;br /&gt;
&lt;br /&gt;
== Precautions and Correction ==&lt;br /&gt;
&lt;br /&gt;
[[File:Precaution.png|600px]]&lt;br /&gt;
&lt;br /&gt;
A primary precaution is policing. As described above this typically involves assigning a CPU core to check the activities of the system, or perhaps assigning a task to that purpose. Anticipation and prevention are better than detection.&lt;br /&gt;
&lt;br /&gt;
Further precautions are also possible, depending on the hardware available in the system. These can detect or perhaps even prevent various malfunctions. &lt;br /&gt;
&lt;br /&gt;
=== Hardware Malfunctions ===&lt;br /&gt;
These can be caused by radiation or other external factors, or simply by parts of the system wearing out.&lt;br /&gt;
&lt;br /&gt;
They fall into three main categories, memory hardware malfunctions, CPU core malfunctions, and peripheral or connected device malfunctions.&lt;br /&gt;
&lt;br /&gt;
==== Memory hardware malfunctions ====&lt;br /&gt;
&lt;br /&gt;
These typically result in one or more bits in a memory location being set to incorrect values.&lt;br /&gt;
&lt;br /&gt;
If the error involve no more than a certain number of bits (BCH 1, RS fixed &amp;gt; 1) then EDAC allows a memory location containing such errors be read correctly despite the error.&lt;br /&gt;
&lt;br /&gt;
While the value read is correct the error remains in the location until the correct value is written back. This should be done before a further bit becomes corrupted, perhaps making the error un-correctable. In some systems this write back is done automatically. &lt;br /&gt;
&lt;br /&gt;
Long intervals can occur between uses of a memory location making ‘memory scrubbing’ necessary. This cycles through all memory locations, reading and writing back if needed, doing so often enough to make it very unlikely that an un-correctable number of erroneous bits will accumulate in any location.&lt;br /&gt;
&lt;br /&gt;
Usually a hardware ‘memory scrubber‘ is available that can be configured to do this at a certain rate for a certain range of addresses.&lt;br /&gt;
&lt;br /&gt;
Memory read errors can still occur however. A combination of bit errors can defeat EDAC error detection and lead to an incorrect value being read. Usually however such un-correctable errors are detected by EDAC causing it to raise an exception. The corresponding handler must then take appropriate action, which may include terminating OCEOSmp.&lt;br /&gt;
&lt;br /&gt;
Precautions: Before starting OCEOSmp &lt;br /&gt;
# The handler for EDAC detected un-correctable errors should be put in place&lt;br /&gt;
# The memory should be initialized&lt;br /&gt;
# The EDAC system configured and put into operation&lt;br /&gt;
# The EDAC memory scrubber hardware configured and put into operation&lt;br /&gt;
&lt;br /&gt;
Once this has been done and OCEOSmp started&lt;br /&gt;
# &amp;lt;li value=&amp;quot;5&amp;quot;&amp;gt;The EDAC exception handler can &amp;lt;/li&amp;gt;	&lt;br /&gt;
## Update the system log&lt;br /&gt;
## Update the system state variable&lt;br /&gt;
## Start a problem handling task&lt;br /&gt;
## If necessary call oceos_exit() to return to main()&lt;br /&gt;
&lt;br /&gt;
==== Computer core hardware malfunctions ====&lt;br /&gt;
&lt;br /&gt;
Cores may use triple modular redundancy and other techniques to reduce the effects of transient errors, but nevertheless can become faulty. If this is detected in a multi-core system OCEOSmp allows the faulty core be taken out of use without scheduling being disrupted.&lt;br /&gt;
&lt;br /&gt;
Detecting that a core has become faulty can be done using computational tasks for which the results including timings are known. Before such tests are used however a malfunction may have led to an erroneous result being used. &lt;br /&gt;
&lt;br /&gt;
To avoid this when result accuracy is critical and immediately needed it is possible in OCEOSmp to have multiple CPU cores carry out the same computation at the same time (within a few clock cycles). &lt;br /&gt;
&lt;br /&gt;
The results can then be compared and the majority agreed value used. A core that was at fault can be tested and taken out of use if the problem is judged not to be transient.&lt;br /&gt;
&lt;br /&gt;
Precaution: Check periodically that cores carry out a computational test correctly.&lt;br /&gt;
# &amp;lt;li value=&amp;quot;6&amp;quot;&amp;gt;oceosmp_cpu_disable() will take the specified CPU core out of use, put it to sleep, and cause the termination functions of any jobs executing on the core be executed on a different core.&amp;lt;/li&amp;gt; &lt;br /&gt;
# oceosmp_cpu_enable() will make the specified CPU core available for use&lt;br /&gt;
&lt;br /&gt;
These directives can also be used to manage the number of active cores for power saving or other purposes. Scheduling is not disrupted as long as a functioning core remains.&lt;br /&gt;
&lt;br /&gt;
==== Peripheral Hardware Malfunctions ====&lt;br /&gt;
&lt;br /&gt;
These can arise due to a fault in the peripheral unit itself, or due to problems in an external system for which the peripheral is an interface.&lt;br /&gt;
&lt;br /&gt;
Before starting OCEOSmp the ASW should carry out appropriate checks of all peripheral units, and should ensure that such checks can be carried out if necessary by tasks after scheduling has begun.&lt;br /&gt;
&lt;br /&gt;
Faults in external systems for which a peripheral unit is an interface tend to either&lt;br /&gt;
# cause no messages to be sent to the interface&lt;br /&gt;
# cause messages to be sent too frequently&lt;br /&gt;
&lt;br /&gt;
In most cases when a peripheral receives an external message it causes an interrupt which then causes a request to start a task.&lt;br /&gt;
&lt;br /&gt;
If the interval between such task start requests is longer than expected this may indicate that the peripheral device has become faulty and is no longer operational.&lt;br /&gt;
&lt;br /&gt;
If the interval between such task start requests is shorter than expected it may indicate the frequency of external events exceeding expectations or some fault in the peripheral device.&lt;br /&gt;
&lt;br /&gt;
In both cases on starting the task OCEOSmp automatically checks the interval since the last task start request and if this is less than the expected minimum or greater than the expected maximum will make a system log entry and set the corresponding flag in the system state variable. If the ASW has set the corresponding system state action flag and defined a problem handling function this will result in the ASW problem handling function being called.&lt;br /&gt;
 &lt;br /&gt;
Precautions: &lt;br /&gt;
	In the ASW configuration structure passed to oceos_init() the ASW set the desired flags in the problem action mask and define a problem handling function.   &lt;br /&gt;
&lt;br /&gt;
=== Software Malfunctions ===&lt;br /&gt;
&lt;br /&gt;
Certain types of software errors can cause problems for the system as a whole.&lt;br /&gt;
&lt;br /&gt;
OCEOSmp automatically checks for some of these, others are best checked for by the ASW itself, perhaps as part of system policing.&lt;br /&gt;
&lt;br /&gt;
In addition to policing, various precautions can be taken against these problems, including making use of any memory protection hardware available and using a system watchdog timer.&lt;br /&gt;
&lt;br /&gt;
==== Invalid memory overwriting ====&lt;br /&gt;
&lt;br /&gt;
Application software may inadvertently overwrite memory areas used by OCEOSmp.&lt;br /&gt;
&lt;br /&gt;
The three memory areas used by OCEOSmp are each protected at their ends by constant sentinels. Each time a directive is used or job terminates OCEOSmp checks these sentinels to ensure that the areas involved have not been encroached upon. If so OCEOSmp will exit.&lt;br /&gt;
&lt;br /&gt;
In addition to its sentinels the fixed data area has an XOR checksum which allows any alteration be detected. This is not checked automatically by OCEOSmp for reasons of efficiency, but can be checked at any time by ASW policing software.&lt;br /&gt;
&lt;br /&gt;
Prevention is better than detection and if a system has a memory protection unit this should be configured to make the fixed area read-only. Any attempt to write this area will then typically cause the protection unit to raise an exception.&lt;br /&gt;
&lt;br /&gt;
Each CPU core has its own system stack. These form part of a contiguous block of statically allocated memory, and a software error may result in the code running on a core overrunning that core’s stack and attempting to use the stack memory of another core.&lt;br /&gt;
&lt;br /&gt;
This can be detected in policing by checking that filler still remains at the top and bottom of each core’s stack, and this can be checked at any time by ASW policing software, but prevention is better than detection.&lt;br /&gt;
 &lt;br /&gt;
Precautions: Any hardware memory protection present should be used on completion of oceos_init_finish() and before oceos_start() to provide these features.&lt;br /&gt;
# Read only (the fixed data area)&lt;br /&gt;
# Writeable only by a specific computer core (for each core’s stack)&lt;br /&gt;
 &lt;br /&gt;
Invalid attempts to use a memory location typically give rise to an exception and an appropriate handler must be in place.&lt;br /&gt;
&lt;br /&gt;
==== Invalid use of Mutual Exclusion Semaphores (Mutexes) or of Read-Write Mutexes ====&lt;br /&gt;
&lt;br /&gt;
In general the time for which the ASW holds a mutex or read-write mutex should be as short as possible.&lt;br /&gt;
&lt;br /&gt;
This time can be estimated at compile time and the estimates taken into account in determining whether a set of tasks can be scheduled so that tasks always meet their deadlines.&lt;br /&gt;
&lt;br /&gt;
Such estimates however can be made wrong by events that occur during scheduling if appropriate precautions are not taken.&lt;br /&gt;
&lt;br /&gt;
One possible problem, unbounded priority inversion, arises when a job holding a mutex is pre-empted by a higher priority task that does not use the mutex, causing any even higher priority task that uses the mutex to wait indefinitely for the low priority job to resume and release the mutex. In OCEOSmp unbounded priority inversion cannot occur. &lt;br /&gt;
&lt;br /&gt;
Another problem, deadlock, can arise when two or more jobs each acquire more than one mutex. A job while holding a mutex may then attempt to acquire a different mutex currently held by some other job. If that other job (without releasing the mutex it holds) attempts to acquire the mutex held by the first job neither job can make progress, the jobs are deadlocked.&lt;br /&gt;
&lt;br /&gt;
These problems are addressed by the design of OCEOSmp.&lt;br /&gt;
&lt;br /&gt;
In OCEOSmp each mutex or read-write mutex has a priority ceiling giving the priority of the highest priority task that uses it. This constant is determined at compile time and set for each mutex when it is created.&lt;br /&gt;
&lt;br /&gt;
In scheduling, once a job running on a CPU core holds one or more mutexes or read-write mutexes only tasks with higher priority than the highest ceiling are allowed to pre-empt the job and start running on that core.&lt;br /&gt;
&lt;br /&gt;
As a result unbounded priority inversion cannot occur, and on single core systems deadlocks also are not possible.&lt;br /&gt;
&lt;br /&gt;
On multi-core systems jobs can spin waiting to acquire a mutex held by a job running on a different core and deadlock becomes possible.&lt;br /&gt;
&lt;br /&gt;
In OCEOSmp mutexes and read-write mutexes are assigned a sequential order as they are created. Deadlocks then cannot occur if jobs always respect this order in acquiring mutexes, never attempting to acquire a mutex or read-write mutex if already holding one that is higher in the order.&lt;br /&gt;
&lt;br /&gt;
OCEOSmp does not prevent jobs from acquiring multiple mutexes in an out of order manner but returns a warning directive status code to the job indicating that deadlock is possible and makes a log entry and updates the system state variable, perhaps causing an ASW defined problem handling function to be called.&lt;br /&gt;
&lt;br /&gt;
When a job simultaneously holds multiple mutexes or read-write mutexes it should acquire and return these in a LIFO manner, e.g. waitA, waitB, waitC…..signalC, signalB, signalA. Failure to do so may affect task scheduling temporarily and will result in a warning directive status code, a log entry, and an update of the system state variable.&lt;br /&gt;
&lt;br /&gt;
Other errors in using mutexes such as failure to release a mutex before a job ends or attempting to release a mutex that is not held give rise to an appropriate directive status codes, a log entry, and a system state variable updates.&lt;br /&gt;
&lt;br /&gt;
Precautions: &lt;br /&gt;
# Ensure at compile time that when a task acquires multiple mutexes or read-write mutexes it always does so in the correct order.&lt;br /&gt;
# Ensure at compile time that when a job releases multiple mutexes or read-write mutexes it always does so in the reverse order to that in which they were acquired&lt;br /&gt;
&lt;br /&gt;
==== Deadlocks, Livelocks and Task Starvation ====&lt;br /&gt;
&lt;br /&gt;
Deadlocks arise primarily due to misuse of mutual exclusion semaphores or read write mutual exclusion semaphores, as described above.&lt;br /&gt;
&lt;br /&gt;
Livelocks, where tasks interact in a way that results in each task having to return to some earlier point with no or very little overall progress, can arise in a number of ways including from attempts to resolve a deadlock so that the tasks involved can proceed.&lt;br /&gt;
&lt;br /&gt;
Task starvation arises when a task is ready to start, but CPU time is not allocated to it within a reasonable time. In OCEOSmp this will occur for a low priority task if higher priority tasks are always ready to run and require all the available CPU cores. &lt;br /&gt;
&lt;br /&gt;
Task starvation, to at least some degree, can also occur for a high priority task if the resources required to allow it pre-empt a lower priority task are not available on the CPU core involved, as for example when the remaining system stack for that core is below the level needed for pre-emption.&lt;br /&gt;
&lt;br /&gt;
All three of these problems result in a task or tasks taking longer to complete than should be the case. This can be detected in two main ways&lt;br /&gt;
# By a policing task that periodically checks each task record in the dynamic area to determine the maximum time between a request to start it and task completion. &lt;br /&gt;
# By watchdog timer hardware that typically is reset periodically by the lowest priority task and which will cause a hardware system reset if its pre-set time elapses before it is reset. On re-entry to main() the ASW can check to determine if this has occurred before restarting OCEOSmp.&lt;br /&gt;
&lt;br /&gt;
Precautions&lt;br /&gt;
# &amp;lt;li value=&amp;quot;3&amp;quot;&amp;gt;ensure each CPU core has adequate system stack so that a lower priority task running on the core can always be pre-empted by a higher priority task. The amount required can be calculated from the number of different priority levels in use.&amp;lt;/li&amp;gt;&lt;br /&gt;
# if watchdog timer hardware is available set up a low priority task to periodically reset it. The ASW should check on entry to main() whether this was due to a watchdog timeout and if so use the OCEOSmp data to determine the cause and appropriate remedial action before restarting OCEOSmp.&lt;br /&gt;
# set up a policing task that checks the execution times of current tasks and detects when this is too long. This task can call an ASW defined problem handling function that can determine how best to deal with the situation, perhaps calling the termination functions of some currently executing tasks, disabling some tasks or changing interrupt intervals.&lt;br /&gt;
# If necessary reserve certain CPU cores to use only by higher priority tasks, perhaps ensuring that there is always at least one CPU core ready to be used immediately by such tasks.&lt;br /&gt;
&lt;br /&gt;
== Summary ==&lt;br /&gt;
&lt;br /&gt;
[[File:MurphysLaw.png|400px]]&lt;br /&gt;
&lt;br /&gt;
Murphy’s Law, ‘if things can go wrong they will’, has had a significant impact on the design of OCEOSmp. &lt;br /&gt;
&lt;br /&gt;
An older maxim ‘the wise man avoids evil by anticipating it’ (Publilius Cyrus) has also had an impact. Software can go wrong without prior indication of stress but it may be possible to notice that all is not well before disaster strikes. Avoidance is better than detection.&lt;br /&gt;
&lt;br /&gt;
These ideas have led to OCEOSmp having features that allow fault anticipation, detection, isolation and recovery, with a white box approach that simplifies system policing and checking behaviour against expectations and with memory statically allocated.&lt;br /&gt;
&lt;br /&gt;
When a problem is found OCEOSmp can take CPU cores out of use or kill or disable tasks without disrupting scheduling, or in severe cases exit and return to the ASW main() with all data still accessible for analysis or download, and with the ASW able to make changes and restart OCEOSmp if desired.&lt;br /&gt;
&lt;br /&gt;
These features help ensure that OCEOSmp is suitable for use in safety critical or other systems that require the highest reliability.&lt;br /&gt;
&lt;br /&gt;
Even where it is hoped that nothing can possibly go wrong….&lt;br /&gt;
&lt;br /&gt;
= &amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;'''System Log'''&amp;lt;/span&amp;gt; =&lt;br /&gt;
&lt;br /&gt;
== Purpose ==&lt;br /&gt;
#Provide application software with the ability to make time stamped records of events for use in application performance monitoring and in application debugging&lt;br /&gt;
#Provide OCEOSmp with the ability to record internal anomalies should these be detected.&lt;br /&gt;
&lt;br /&gt;
== Structure ==&lt;br /&gt;
#A circular buffer with a fixed size that is set in the application configuration&lt;br /&gt;
#Size from 16 to 1024 entries, default 64 if not specified&lt;br /&gt;
#If the application defines oceosmp_on_full_log(void *) this is called automatically when the buffer becomes ¾ full, allowing log entries that might otherwise be overwritten be stored. The automatic call will reoccur only after the buffer becomes ¾ empty.&lt;br /&gt;
#On system reset log entries are not overwritten and buffer indices are reset so as to postpone recent entries being overwritten and allow review of events prior to the reset.&lt;br /&gt;
&lt;br /&gt;
== Storage ==&lt;br /&gt;
#Stored statically in the oceosmp_log_area, which also contains the next-read and next-write buffer indices and the system state related variables.&lt;br /&gt;
#The log size and the oceosmp_on_full() function declaration are stored in the oceosmp_fixed_area, as also are the  log area addresses.&lt;br /&gt;
#Log entry format (from system_log.h): &lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
Struct log_entry{&lt;br /&gt;
 	U64_t		time64;&lt;br /&gt;
 	unsigned int       current_cpu_id		:8;&lt;br /&gt;
 	unsigned int	entry_type		:8;&lt;br /&gt;
 	U32_t		entry_comment;&lt;br /&gt;
} __attribute__ ((aligned (8));&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt; &lt;br /&gt;
#When a log entry is made, time64 and current_cpu_id are set automatically by OCEOSmp.&lt;br /&gt;
#The entry type is an enum defined by the application, with a subset of enum values reserved for use by OCEOSmp. The reserved enum values are specified in system_log.h.&lt;br /&gt;
#The entry_comment allows noting further information on the current situation  &lt;br /&gt;
&lt;br /&gt;
== Associated directives ==&lt;br /&gt;
#Add Log Entry&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t 	oceos_log_add_entry(&lt;br /&gt;
 	 	enum LOG_ENTRY_TYPE type, // 8 bit enum LOG_ENTRY_TYPE&lt;br /&gt;
 	 	const U32_t info 		// further information&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt; &lt;br /&gt;
This adds an entry, overwriting the currently oldest entry.&lt;br /&gt;
&lt;br /&gt;
#Remove Log Entry&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t oceos_log_remove_entry(&lt;br /&gt;
 		struct log_entry * const outputPtr&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This returns the oldest unread entry to outputPtr and updates the buffer indices&lt;br /&gt;
&lt;br /&gt;
#Other directives are detailed in system_log.h&lt;br /&gt;
 &lt;br /&gt;
== Usage by OCEOSmp itself ==&lt;br /&gt;
#OCEOSmp only uses the system log for problems that do not arise directly when a directive is used (problems that arise directly are described in the returned directive status code).&lt;br /&gt;
#Such problems fall into a number of categories&lt;br /&gt;
a.	System corruption is detected and/or oceos_exit is called&lt;br /&gt;
b.	Excessive delays in obtaining system spin locks perhaps due to system overloading&lt;br /&gt;
c.	A timed action misses its specified time&lt;br /&gt;
d.	A task misses its deadlines&lt;br /&gt;
e.	Task start requests occur more frequently than expected&lt;br /&gt;
f.	A task exits without returning a mutex or read-write mutex that it holds&lt;br /&gt;
g.	Counts already at max or min&lt;br /&gt;
h.	&lt;br /&gt;
18.	In many cases when OCEOSmp makes a system log entry it also updates the system state variable. This is updated using ‘OR’ and so provides a long term record that a problem has occurred even if a log entry is overwritten. In addition, if the update corresponds to an application defined action mask an application defined problem handling function may be called which can if desired read the system log.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:backup]]&lt;/div&gt;</summary>
		<author><name>Bkavanagh</name></author>
	</entry>
	<entry>
		<id>https://wiki.ocetechnology.com/mediawiki/index.php?title=OCEOSmp/directive_reference&amp;diff=1681</id>
		<title>OCEOSmp/directive reference</title>
		<link rel="alternate" type="text/html" href="https://wiki.ocetechnology.com/mediawiki/index.php?title=OCEOSmp/directive_reference&amp;diff=1681"/>
		<updated>2024-05-03T14:14:09Z</updated>

		<summary type="html">&lt;p&gt;Bkavanagh: /* Timing directives */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt;'''This section is under construction'''&amp;lt;/span&amp;gt; =&lt;br /&gt;
&lt;br /&gt;
= Introduction =&lt;br /&gt;
&lt;br /&gt;
To be added&lt;br /&gt;
&lt;br /&gt;
= Directives =&lt;br /&gt;
&lt;br /&gt;
== Initialisation directives ==&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_init()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''initialisation.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Initialises OCEOS and  must be the first directive used.&lt;br /&gt;
&lt;br /&gt;
Initialises the OCEOS system meta data using the information supplied in the application configuration and prepares for creation of tasks etc.&lt;br /&gt;
&lt;br /&gt;
The values provided in the application configuration are checked as much as possible before being used.&lt;br /&gt;
&lt;br /&gt;
The system log also is created here.&lt;br /&gt;
&lt;br /&gt;
This function sets up sysMetaPtr and init_meta_ptr and must have completed successfully before tasks etc. can be created.&lt;br /&gt;
&lt;br /&gt;
It disables interrupts and leaves them disabled, they will be re-enabled to the previous level after all tasks etc. have been created and [[OCEOSmp/directive_reference#oceos_init_finish()|oceos_init_finish()]] has completed successfully.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Initialises OCEOS and  must be the first directive used.&lt;br /&gt;
 *&lt;br /&gt;
 * Initialises the OCEOS system meta data using the information supplied in&lt;br /&gt;
 * the application configuration and prepares for creation of tasks etc.&lt;br /&gt;
 *&lt;br /&gt;
 * The values provided in the application configuration are checked as much&lt;br /&gt;
 * as possible before being used.&lt;br /&gt;
 *&lt;br /&gt;
 * The system log also is created here.&lt;br /&gt;
 *&lt;br /&gt;
 * This function sets up sysMetaPtr and init_meta_ptr and must have completed&lt;br /&gt;
 * successfully before tasks etc. can be created.&lt;br /&gt;
 *&lt;br /&gt;
 * It disables interrupts and leaves them disabled, they will be re-enabled to&lt;br /&gt;
 * the previous level after all tasks etc. have been created and&lt;br /&gt;
 * oceos_init_finish() has completed successfully.&lt;br /&gt;
 *&lt;br /&gt;
 * @param app_config Pointer to configuration struct&lt;br /&gt;
 * @return SUCCESSFUL                        All OK&lt;br /&gt;
 *         WARN_LOG_SIZE_DEFAULT             Warning, log size is set to default value of 64 entries&lt;br /&gt;
 *         WARN_NO_ERROR_FUNCTION            Warning, user defined function for ERROR handling is not provided&lt;br /&gt;
 *         ERR_CPU_FIRST_CORE_INVALID        Start CPU not in a range of available cores for this target; or greater than end CPU&lt;br /&gt;
 *         ERR_CPU_LAST_CORE_INVALID         Last CPU not in a range of available cores for this target&lt;br /&gt;
 *         ERR_NOT_START_CPU_CORE            Executing oceos_init on wrong CPU&lt;br /&gt;
 *         ERR_STACK_START_MISALIGNED        Stack start address is not set by user misaligned&lt;br /&gt;
 *         ERR_STACK_PER_CORE_INVALID        Stack per CPU size is zero, or not 8byte aligned, or less then min require&lt;br /&gt;
 *         ERR_LOG_ADDR_MISALIGNED           Log start address is not 8 byte aligned&lt;br /&gt;
 *         ERR_FIX_ADDR_MISALIGNED           Fixed area start address is not 8 byte aligned&lt;br /&gt;
 *         ERR_DYN_ADDR_MISALIGNED           Dynamic area start address is not 8 byte aligned&lt;br /&gt;
 *         ERR_CPU_CORE_RANGE_WRONG          CPU cores in use exceed available CPUs on the SoC&lt;br /&gt;
 *         ERR_STACK_SPACE_WRONG             Current CPU SP is not within user provided stack range&lt;br /&gt;
 *         ERR_LOG_SIZE_INVALID              Log size outside expected range&lt;br /&gt;
 *         ERR_CS_LOG_SIZE_INVALID           Context switch log size invalid&lt;br /&gt;
 *         ERR_TASK_NUMBER_INVALID           Number of tasks invalid&lt;br /&gt;
 *         ERR_MUTEX_NUMBER_INVALID          Number of mutexes invalid&lt;br /&gt;
 *         ERR_RWMUTEX_NUMBER_INVALID        Number of rwmutexes invalid&lt;br /&gt;
 *         ERR_SEM_NUMBER_INVALID            Number of semaphores invalid&lt;br /&gt;
 *         ERR_DATAQ_NUMBER_INVALID          Number of datqs invalid&lt;br /&gt;
 *         ERR_TIMED_ACTIONS_NUMBER_INVALID  Number of timed actions invalid&lt;br /&gt;
 *         ERR_OVERLAP_STACK                 Overlap stack end address with (two overlap areas are set)&lt;br /&gt;
 *         ERR_OVERLAP_LOG                   Overlap log with (two overlap areas are set)&lt;br /&gt;
 *         ERR_OVERLAP_FIXED                 Overlap fixed area with (two overlap areas are set)&lt;br /&gt;
 *         ERR_OVERLAP_DYNAMIC               Overlap dynamic area with (two overlap areas are set)&lt;br /&gt;
 *         ERR_FIXED_MEMORY_FAILED           Fixed area memory write fail&lt;br /&gt;
 *         ERR_DYNAMIC_MEMORY_FAILED         Dynamic area memory write fail&lt;br /&gt;
 *         ERR_TIMER_ADDR_INVALID            Timer address not provided by user (null). SPARC only&lt;br /&gt;
 *         ERR_SYS_TIMER_INDEX_INVALID       System timer index of subtimer invalid; SPARC only; Subtimers start from index 1; Need index of subtimer plus one in front&lt;br /&gt;
 *         ERR_PERIPHERAL_CLOCK_INVALID      System peripheral code invalid&lt;br /&gt;
 *&lt;br /&gt;
 */&lt;br /&gt;
S32_t   oceos_init(&lt;br /&gt;
    const struct application_configuration app_config&lt;br /&gt;
);&lt;br /&gt;
 &amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| app_config || Pointer to configuration struct.  struct application_configuration defined in '''''basic_structs.h'''''&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| WARN_LOG_SIZE_DEFAULT             || Warning, log size is set to default value of 64 entries&lt;br /&gt;
|-&lt;br /&gt;
| WARN_NO_ERROR_FUNCTION            || Warning, user defined function for ERROR handling is not provided&lt;br /&gt;
|-&lt;br /&gt;
| ERR_CPU_FIRST_CORE_INVALID        || Start CPU not in a range of available cores for this target; or greater than end CPU&lt;br /&gt;
|-&lt;br /&gt;
| ERR_CPU_LAST_CORE_INVALID         || Last CPU not in a range of available cores for this target&lt;br /&gt;
|-&lt;br /&gt;
| ERR_NOT_START_CPU_CORE            || Executing oceos_init on wrong CPU&lt;br /&gt;
|-&lt;br /&gt;
| ERR_STACK_START_MISALIGNED        || Stack start address is not set by user misaligned&lt;br /&gt;
|-&lt;br /&gt;
| ERR_STACK_PER_CORE_INVALID        || Stack per CPU size is zero, or not 8byte aligned, or less then min require&lt;br /&gt;
|-&lt;br /&gt;
| ERR_LOG_ADDR_MISALIGNED           || Log start address is not 8 byte aligned&lt;br /&gt;
|-&lt;br /&gt;
| ERR_FIX_ADDR_MISALIGNED           || Fixed area start address is not 8 byte aligned&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DYN_ADDR_MISALIGNED           || Dynamic area start address is not 8 byte aligned&lt;br /&gt;
|-&lt;br /&gt;
| ERR_CPU_CORE_RANGE_WRONG          || CPU cores in use exceed available CPUs on the SoC&lt;br /&gt;
|-&lt;br /&gt;
| ERR_STACK_SPACE_WRONG             || Current CPU SP is not within user provided stack range&lt;br /&gt;
|-&lt;br /&gt;
| ERR_LOG_SIZE_INVALID              || Log size outside expected range&lt;br /&gt;
|-&lt;br /&gt;
| ERR_CS_LOG_SIZE_INVALID           || Context switch log size invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TASK_NUMBER_INVALID           || Number of tasks invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_MUTEX_NUMBER_INVALID          || Number of mutexes invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_RWMUTEX_NUMBER_INVALID        || Number of rwmutexes invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SEM_NUMBER_INVALID            || Number of semaphores invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DATAQ_NUMBER_INVALID          || Number of datqs invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TIMED_ACTIONS_NUMBER_INVALID  || Number of timed actions invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_OVERLAP_STACK                 || Overlap stack end address with (two overlap areas are set)&lt;br /&gt;
|-&lt;br /&gt;
| ERR_OVERLAP_LOG                   || Overlap log with (two overlap areas are set)&lt;br /&gt;
|-&lt;br /&gt;
| ERR_OVERLAP_FIXED                 || Overlap fixed area with (two overlap areas are set)&lt;br /&gt;
|-&lt;br /&gt;
| ERR_OVERLAP_DYNAMIC               || Overlap dynamic area with (two overlap areas are set)&lt;br /&gt;
|-&lt;br /&gt;
| ERR_FIXED_MEMORY_FAILED           || Fixed area memory write fail&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DYNAMIC_MEMORY_FAILED         || Dynamic area memory write fail&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TIMER_ADDR_INVALID            || Timer address not provided by user (null). SPARC only&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_TIMER_INDEX_INVALID       || System timer index of subtimer invalid; SPARC only; Subtimers start from index 1; Need index of subtimer plus one in front&lt;br /&gt;
|-&lt;br /&gt;
| ERR_PERIPHERAL_CLOCK_INVALID      || System peripheral code invalid&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
    /*&lt;br /&gt;
     * Create the application configuration structure&lt;br /&gt;
     */&lt;br /&gt;
    struct application_configuration           app_config = {0};&lt;br /&gt;
&lt;br /&gt;
    /*&lt;br /&gt;
     * Fill in the application parameters&lt;br /&gt;
     */&lt;br /&gt;
    app_config.log_address                   = (log_t)log_data;              // required&lt;br /&gt;
    app_config.fixed_data_address            = (adrs_t)fixed_data;            // required&lt;br /&gt;
    app_config.dynamic_data_address          = (adrs_t)dynamic_data;          // required&lt;br /&gt;
&lt;br /&gt;
    app_config.stack_start_address           = start_stack_array[OCEOS_START_CPU_INDEX];// OCEOSMP_STACK_START_ADDRESS;&lt;br /&gt;
    app_config.stack_size_per_cpu            = (U32_t)&amp;amp;__oceos_stack_size_per_cpu;  // OCEOSMP_STACK_LOW_BOUND_ADDRESS;&lt;br /&gt;
&lt;br /&gt;
    app_config.system_error_function         = oceosmp_on_error;               // NULL =&amp;gt; ignore&lt;br /&gt;
    app_config.log_full_function             = oceosmp_on_full_log;            // NULL =&amp;gt; ignore&lt;br /&gt;
&lt;br /&gt;
    // used in setting up system log and fixed data array&lt;br /&gt;
    app_config.log_number_of_entries         = NUMBER_OF_LOG_ENTRIES;          // 0 =&amp;gt; use default&lt;br /&gt;
&lt;br /&gt;
    app_config.number_of_tasks               = NUMBER_OF_TASKS;                // &amp;gt;= 1&lt;br /&gt;
&lt;br /&gt;
    app_config.number_of_mutexes             = NUMBER_OF_MUTEXES;&lt;br /&gt;
	app_config.number_of_rwmutexes			 = NUMBER_OF_RWMUTEXES;&lt;br /&gt;
    app_config.number_of_counting_semaphores = NUMBER_OF_SEMAPHORES;&lt;br /&gt;
    app_config.number_of_data_queues         = NUMBER_OF_DATAQS;&lt;br /&gt;
&lt;br /&gt;
    /**&lt;br /&gt;
     * FOR SPARC TARGET ONLY.&lt;br /&gt;
     */&lt;br /&gt;
    app_config.sys_time_timer_index          = SYS_TIME_TIMER_INDEX;           // 0 =&amp;gt; invalid index&lt;br /&gt;
    /**&lt;br /&gt;
     * FOR SPARC TARGET ONLY.&lt;br /&gt;
     * Not Used for ARM. Always Nested&lt;br /&gt;
     */&lt;br /&gt;
    app_config.interrupt_nesting_enabled     = TRUE;                           // TRUE =&amp;gt; single vector&lt;br /&gt;
    app_config.oceos_cpu_switch_int_number   = OCEOS_CPU_INTER_COM_INT_NUMBER; // User should provide SGI ID (0-15)&lt;br /&gt;
&lt;br /&gt;
    app_config.timed_actions_queue_size      = NUMBER_OF_ACTION_ENTRIES;&lt;br /&gt;
    app_config.CS_log_entries_base2          = CS_LOG_DEF_ENTRIES_BASE2;&lt;br /&gt;
    /**&lt;br /&gt;
     * Set starting index of CPU that will be used by OCEOSMP&lt;br /&gt;
     */&lt;br /&gt;
    app_config.oceos_cpu_start_index         = OCEOS_START_CPU_INDEX;&lt;br /&gt;
    /**&lt;br /&gt;
     * Set last index of CPU that will be used by OCEOSMP&lt;br /&gt;
     */&lt;br /&gt;
    app_config.oceos_cpu_last_index          = OCEOS_LAST_CPU_INDEX;&lt;br /&gt;
    /*&lt;br /&gt;
     * Set system/peripheral clock used to initialise system timer&lt;br /&gt;
     */&lt;br /&gt;
    app_config.soc_peripheral_clck           = BSP_SYSFREQ * 1000 * 1000;&lt;br /&gt;
&lt;br /&gt;
    // initialise OCEOSMP&lt;br /&gt;
    S32_t status;&lt;br /&gt;
    status = oceos_init(app_config);&lt;br /&gt;
    if (OCEOS_SUCCESS &amp;gt; status) {&lt;br /&gt;
      oceosmp_print(&amp;quot;\n oceos_init failure\n\r&amp;quot;);&lt;br /&gt;
      return 0;&lt;br /&gt;
    } else {&lt;br /&gt;
      return 1;&lt;br /&gt;
    }   // else&lt;br /&gt;
 &amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_init_finish()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''initialisation.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Finalizes the fixed data array after all tasks etc. have been created&lt;br /&gt;
&lt;br /&gt;
All information needed to start OCEOS can be found in the fixed data area&lt;br /&gt;
when oceos_init_finish() has completed.&lt;br /&gt;
&lt;br /&gt;
Once all tasks etc. have been created oceos_init_finish() checks the&lt;br /&gt;
accumulated information against the application configuration data&lt;br /&gt;
stored in the fixed meta structure.&lt;br /&gt;
&lt;br /&gt;
oceos_init_finish also calculates the size of the dynamic data area and&lt;br /&gt;
checks it does not overlap with the system stack, the system log, or the&lt;br /&gt;
fixed data, and if all ok sets up pointers to the various dynamic area&lt;br /&gt;
components in the fixed data.&lt;br /&gt;
&lt;br /&gt;
It then adds an XOR checksum to the fixed data area, and checks that this&lt;br /&gt;
is followed by FILLER, which it replaces with the end sentinel.&lt;br /&gt;
&lt;br /&gt;
On successful completion it restores the interrupt level to its value&lt;br /&gt;
before oceos_init() was called, otherwise interrupts remain disabled.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Finalizes the fixed data array after all tasks etc. have been created&lt;br /&gt;
 *&lt;br /&gt;
 * All information needed to start OCEOS can be found in the fixed data area&lt;br /&gt;
 * when oceos_init_finish() has completed.&lt;br /&gt;
 *&lt;br /&gt;
 * Once all tasks etc. have been created oceos_init_finish() checks the&lt;br /&gt;
 * accumulated information against the application configuration data&lt;br /&gt;
 * stored in the fixed meta structure.&lt;br /&gt;
 *&lt;br /&gt;
 * oceos_init_finish also calculates the size of the dynamic data area and&lt;br /&gt;
 * checks it does not overlap with the system stack, the system log, or the&lt;br /&gt;
 * fixed data, and if all ok sets up pointers to the various dynamic area&lt;br /&gt;
 * components in the fixed data.&lt;br /&gt;
 *&lt;br /&gt;
 * It then adds an XOR checksum to the fixed data area, and checks that this&lt;br /&gt;
 * is followed by FILLER, which it replaces with the end sentinel.&lt;br /&gt;
 *&lt;br /&gt;
 * On successful completion it restores the interrupt level to its value&lt;br /&gt;
 * before oceos_init() was called, otherwise interrupts remain disabled.&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS                             All OK&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT               System Meta data is NULL or corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT                 System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_CPU_CORE                  Executing directive on wrong CPU&lt;br /&gt;
 *          ERR_WRONG_PHASE                     Called before oceos_init()&lt;br /&gt;
 *          ERR_TASKS_INCOMPLETE                Created wrong number of tasks&lt;br /&gt;
 *          ERR_MUTEX_INCOMPLETE                Created wrong number of mutexes&lt;br /&gt;
 *          ERR_RWMUTEX_INCOMPLETE              Created wrong number of rwmutexes&lt;br /&gt;
 *          ERR_SEM_INCOMPLETE                  Created wrong number of semaphores&lt;br /&gt;
 *          ERR_DATAQ_INCOMPLETE                Created wrong number of dataqs&lt;br /&gt;
 *          ERR_TASK_MAX_ID_INVALID             Task's max id invalid&lt;br /&gt;
 *          ERR_MUTEX_MAX_ID_INVALID            Mutexe's max id invalid&lt;br /&gt;
 *          ERR_RWMUTEX_MAX_ID_INVALID          Rwmutexe's max id invalid&lt;br /&gt;
 *          ERR_SEM_MAX_ID_INVALID              Semaphore's max id invalid&lt;br /&gt;
 *          ERR_DATAQ_MAX_ID_INVALID            Dataq's max id invalid&lt;br /&gt;
 *          ERR_TOTAL_JOBS_NUMBER_WRONG         Wrong number of total jobs created&lt;br /&gt;
 *          ERR_ORDER_ARRAY_PTR_INVALID         Order array pointer is NULL or mis-aligned&lt;br /&gt;
 *          ERR_FIXED_AREA_TOO_SMALL            Not enough space for fixed data area&lt;br /&gt;
 */&lt;br /&gt;
S32_t   oceos_init_finish(void);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
There are no input parameters to this function.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit  || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT               || System Meta data is NULL or corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT                 || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_CPU_CORE                  || Executing directive on wrong CPU&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE                     || Called before oceos_init()&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TASKS_INCOMPLETE                || Created wrong number of tasks&lt;br /&gt;
|-&lt;br /&gt;
| ERR_MUTEX_INCOMPLETE                || Created wrong number of mutexes&lt;br /&gt;
|-&lt;br /&gt;
| ERR_RWMUTEX_INCOMPLETE              || Created wrong number of rwmutexes&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SEM_INCOMPLETE                  || Created wrong number of semaphores&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DATAQ_INCOMPLETE                || Created wrong number of dataqs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TASK_MAX_ID_INVALID             || Task's max id invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_MUTEX_MAX_ID_INVALID            || Mutexe's max id invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_RWMUTEX_MAX_ID_INVALID          || Rwmutexe's max id invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SEM_MAX_ID_INVALID              || Semaphore's max id invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DATAQ_MAX_ID_INVALID            || Dataq's max id invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TOTAL_JOBS_NUMBER_WRONG         || Wrong number of total jobs created&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ORDER_ARRAY_PTR_INVALID         || Order array pointer is NULL or mis-aligned&lt;br /&gt;
|-&lt;br /&gt;
| ERR_FIXED_AREA_TOO_SMALL            || Not enough space for fixed data area&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
    /*&lt;br /&gt;
     * Finish initialising OCEOS and setting up the fixed data&lt;br /&gt;
     */&lt;br /&gt;
    status = oceos_init_finish();&lt;br /&gt;
    if(OCEOS_SUCCESS &amp;gt; status){&lt;br /&gt;
        // LOG&lt;br /&gt;
      oceosmp_print(&amp;quot;\nAbandoning, problem ending OCEOS initialisation\n\r&amp;quot;);&lt;br /&gt;
        return -1;&lt;br /&gt;
    }   // if&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_start()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''initialisation.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Starts OCEOS scheduling.&amp;lt;br&amp;gt;&lt;br /&gt;
Create dynamic OCEOS structures and start scheduling.&amp;lt;br&amp;gt;&lt;br /&gt;
This function should only be called once and only after [[OCEOSmp/directive_reference#oceos_init()|oceos_init()]] and [[OCEOSmp/directive_reference#oceos_init_finish()|oceos_init_finish()]] have been called successfully.&amp;lt;br&amp;gt;&lt;br /&gt;
Normally this function does not return. &amp;lt;br&amp;gt;&lt;br /&gt;
If a problem is detected the function terminates and returns an appropriate DIRECTIVE_STATUS code, with interrupts disabled.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Starts OCEOS scheduling&lt;br /&gt;
 *&lt;br /&gt;
 * Create dynamic OCEOS structures and start scheduling&lt;br /&gt;
 *&lt;br /&gt;
 * This function should only be called once&lt;br /&gt;
 * and only after oceos_init()&lt;br /&gt;
 * and oceos_init_finish() have&lt;br /&gt;
 *  been called successfully.&lt;br /&gt;
 * Normally this function does not return.&lt;br /&gt;
 * If a problem is detected the function&lt;br /&gt;
 * terminates and returns an appropriate&lt;br /&gt;
 * DIRECTIVE_STATUS code, with interrupts disabled.&lt;br /&gt;
 *&lt;br /&gt;
 * @param fixed_array_ptr   Pointer to fixed data array&lt;br /&gt;
 * @param start_task        Task ID&lt;br /&gt;
 * @param data_ptr          Pointer to data to be passed to the task&lt;br /&gt;
 * @return  OCEOSMP_EXIT                        OCEOSMP return from scheduling and exit&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT               Fixed area pointer is null or bad sentinel&lt;br /&gt;
 *          ERR_FIXED_AREA_SIZE_WRONG           Fixed area size is zero&lt;br /&gt;
 *          ERR_FIXED_AREA_END_SENTINEL_BAD     Fixed data end sentinel corrupt&lt;br /&gt;
 *          ERR_FIXED_AREA_BAD_XOR              Fixed area bad checksum or checksum mis-match&lt;br /&gt;
 *          ERR_INIT_NOT_DONE                   oceos_start() called without initialisation&lt;br /&gt;
 *          ERR_DYN_AREA_PTR_BAD                Dynamic area pointer invalid in sysMetaPtr&lt;br /&gt;
 *          ERR_INT_HANDLER_BAD                 IRQ controller pointer provided by BCC is NULL;or OCEOS handler is not set&lt;br /&gt;
 *          ERR_DYN_JOB_PTR_BAD                 Job array pointer is NULL&lt;br /&gt;
 *          ERR_FIXED_TASK_PTR_BAD              Tasks array pointer is NULL&lt;br /&gt;
 *          ERR_JOB_COUNT_WRONG                 Total job count inconsistent&lt;br /&gt;
 *          ERR_DYN_MUTEX_PTR_BAD               Mutex dynamic pointer is NULL&lt;br /&gt;
 *          ERR_DYN_LOCK_PTR_BAD                Mutex lock array pointer is NULL&lt;br /&gt;
 *          ERR_DYN_RWMUTEX_PTR_BAD             Rwmutex dynamic pointer is NULL&lt;br /&gt;
 *          ERR_DYN_RWLOCK_PTR_BAD              Rwmutex lock array pointer is NULL&lt;br /&gt;
 *          ERR_FIXED_SEM_PTR_BAD               Semaphore fixed pointer is NULL&lt;br /&gt;
 *          ERR_DYN_SEM_PTR_BAD                 Semaphore dynamic pointer is NULL&lt;br /&gt;
 *          ERR_SEM_PEND_PTR_BAD                Semaphore pending queue pointer is NULL&lt;br /&gt;
 *          ERR_FIXED_DATAQ_PTR_BAD             Dataq fixed pointer is NULL&lt;br /&gt;
 *          ERR_DYN_DATAQ_PTR_BAD               Dataq dynamic pointer is NULL&lt;br /&gt;
 *          ERR_DATAQ_PEND_PTR_BAD              Dataq pending queue pointer is NULL&lt;br /&gt;
 *          ERR_DATAQ_DATA_PTR_BAD              Dataq data pointer is NULL&lt;br /&gt;
 *          ERR_CPU_INT_NUMBER_INVALID          SPARC only.IRQ number for CPU inter-comunication invalid(zero or used by timer)&lt;br /&gt;
 *          ERR_REGISTER_CPU_IRQ_FAILED         SPARC only. Failed to set CPU IRQ handler in BCC&lt;br /&gt;
 *          ERR_CPU_STACK_INVALID               Current CPU stack not within specified range&lt;br /&gt;
 *          ERR_CPU_PRIORITY_STACK_INVALID      Per CPU priority stack invalid&lt;br /&gt;
 *          ERR_LOG_AREA_END_SENTINEL_BAD       Log area end sentinel override&lt;br /&gt;
 *          ERR_TA_CONFIG_PTR_BAD               SPARC only; Timed action configuration data pointer is NULL&lt;br /&gt;
 *          ERR_TA_TIMER_INDEX_INVALID          SPARC only; Timed action sub-timer index in timer unit is invalid&lt;br /&gt;
 *          ERR_TA_IRQ_NUMBER_INVALID           SPARC only; Timer action timer IRQ number is invalid&lt;br /&gt;
 *          ERR_TA_BCC_IRQ_REGISTER_FAILED      SPARC only; Timed action timer IRQ handler failed to register&lt;br /&gt;
 */&lt;br /&gt;
S32_t   oceos_start(&lt;br /&gt;
    const U32_t * const fixed_array_ptr,// pointer to fixed data array&lt;br /&gt;
    const U32_t start_task,             // taskID&lt;br /&gt;
    void * const data_ptr               // pointer to data to be passed to task&lt;br /&gt;
);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| fixed_array_ptr || Pointer to fixed data array&lt;br /&gt;
|-&lt;br /&gt;
| start_task      || Task ID&lt;br /&gt;
|-&lt;br /&gt;
| data_ptr        || Pointer to data to be passed to the task&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit  || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT               || Fixed area pointer is null or bad sentinel&lt;br /&gt;
|-&lt;br /&gt;
| ERR_FIXED_AREA_SIZE_WRONG           || Fixed area size is zero&lt;br /&gt;
|-&lt;br /&gt;
| ERR_FIXED_AREA_END_SENTINEL_BAD     || Fixed data end sentinel corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_FIXED_AREA_BAD_XOR              || Fixed area bad checksum or checksum mis-match&lt;br /&gt;
|-&lt;br /&gt;
| ERR_INIT_NOT_DONE                   || oceos_start() called without initialisation&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DYN_AREA_PTR_BAD                || Dynamic area pointer invalid in sysMetaPtr&lt;br /&gt;
|-&lt;br /&gt;
| ERR_INT_HANDLER_BAD                 || IRQ controller pointer provided by BCC is NULL;or OCEOS handler is not set&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DYN_JOB_PTR_BAD                 || Job array pointer is NULL&lt;br /&gt;
|-&lt;br /&gt;
| ERR_FIXED_TASK_PTR_BAD              || Tasks array pointer is NULL&lt;br /&gt;
|-&lt;br /&gt;
| ERR_JOB_COUNT_WRONG                 || Total job count inconsistent&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DYN_MUTEX_PTR_BAD               || Mutex dynamic pointer is NULL&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DYN_LOCK_PTR_BAD                || Mutex lock array pointer is NULL&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DYN_RWMUTEX_PTR_BAD             || Rwmutex dynamic pointer is NULL&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DYN_RWLOCK_PTR_BAD              || Rwmutex lock array pointer is NULL&lt;br /&gt;
|-&lt;br /&gt;
| ERR_FIXED_SEM_PTR_BAD               || Semaphore fixed pointer is NULL&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DYN_SEM_PTR_BAD                 || Semaphore dynamic pointer is NULL&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SEM_PEND_PTR_BAD                || Semaphore pending queue pointer is NULL&lt;br /&gt;
|-&lt;br /&gt;
| ERR_FIXED_DATAQ_PTR_BAD             || Dataq fixed pointer is NULL&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DYN_DATAQ_PTR_BAD               || Dataq dynamic pointer is NULL&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DATAQ_PEND_PTR_BAD              || Dataq pending queue pointer is NULL&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DATAQ_DATA_PTR_BAD              || Dataq data pointer is NULL&lt;br /&gt;
|-&lt;br /&gt;
| ERR_CPU_INT_NUMBER_INVALID          || SPARC only.IRQ number for CPU inter-comunication invalid(zero or used by timer)&lt;br /&gt;
|-&lt;br /&gt;
| ERR_REGISTER_CPU_IRQ_FAILED         || SPARC only. Failed to set CPU IRQ handler in BCC&lt;br /&gt;
|-&lt;br /&gt;
| ERR_CPU_STACK_INVALID               || Current CPU stack not within specified range&lt;br /&gt;
|-&lt;br /&gt;
| ERR_CPU_PRIORITY_STACK_INVALID      || Per CPU priority stack invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_LOG_AREA_END_SENTINEL_BAD       || Log area end sentinel override&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_CONFIG_PTR_BAD               || SPARC only; Timed action configuration data pointer is NULL&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_TIMER_INDEX_INVALID          || SPARC only; Timed action sub-timer index in timer unit is invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_IRQ_NUMBER_INVALID           || SPARC only; Timer action timer IRQ number is invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_BCC_IRQ_REGISTER_FAILED      || SPARC only; Timed action timer IRQ handler failed to register&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/* Sample Task names - all here start with t_ to help avoid name confusion */&lt;br /&gt;
enum TASK_NAME{&lt;br /&gt;
    t_tom,                      // will have task ID 0&lt;br /&gt;
    t_dick,                     // will have task ID 1&lt;br /&gt;
};&lt;br /&gt;
extern U32_t fixed_data[];&lt;br /&gt;
...&lt;br /&gt;
S32_t status;&lt;br /&gt;
&lt;br /&gt;
status = oceos_start(fixed_data, t_tom, NULL);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_exit()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''initialisation.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Ends scheduling and exit from [[OCEOSmp/directive_reference#oceos_start()|oceos_start()]].&lt;br /&gt;
No task can be started after this.&amp;lt;br&amp;gt;&lt;br /&gt;
OCEOS will exit when the current job ends.&amp;lt;br&amp;gt;&lt;br /&gt;
An idle task in an endless loop should check that scheduling is enabled.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Ends scheduling and exit from oceos_start.&lt;br /&gt;
 * No task can be started after this.&lt;br /&gt;
 * OCEOS will exit when the current job ends.&lt;br /&gt;
 * An idle task in an endless loop should check that scheduling is enabled.&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Called before scheduling started&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_exit(void);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
There are no input parameters to this function.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit  || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Called before scheduling started&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
// Exit OCEOS&lt;br /&gt;
oceos_exit();&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_CPU_sleep()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''initialisation.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
 Puts CPU in sleep mode.&amp;lt;br&amp;gt;&lt;br /&gt;
 User must to be sure that interrupts are enabled.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Puts CPU in sleep mode.&lt;br /&gt;
 * User must to be sure that interrupts are enabled.&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_CPU_sleep(void);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
There are no input parameters to this function.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
// Put CPU to sleep&lt;br /&gt;
oceos_CPU_sleep();&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceosmp_cpu_disable()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''initialisation.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function ends execution of all tasks running on particular CPU and removes the CPU from scheduling.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Ends execution of all tasks running on particular CPU and removes this CPU from scheduling.&lt;br /&gt;
 * @param cpu_id&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              CPU ID outside allowed range 0 to 254&lt;br /&gt;
 *          ERR_ID_WRONG                CPU ID &amp;gt;= number of available CPUs&lt;br /&gt;
 *          ERR_CPU_ALREADY_DISABLED    CPU already disabled&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceosmp_cpu_disable(&lt;br /&gt;
    U32_t cpu_id&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| cpu_id || ID of CPU core to be disabled.&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit  || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || CPU ID outside allowed range 0 to 254&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || CPU ID &amp;gt;= number of available CPUs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_CPU_ALREADY_DISABLED    || CPU already disabled&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, faulty_cpu;&lt;br /&gt;
...&lt;br /&gt;
// Disable faulty CPU core&lt;br /&gt;
status = oceosmp_cpu_disable(faulty_cpu));&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceosmp_cpu_enable()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''initialisation.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function adds a disabled CPU core to the OCEOSmp scheduler. It should only be called after scheduling has started&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 *  Adds disabled CPU to OCEOSmp scheduler&lt;br /&gt;
 *&lt;br /&gt;
 *  N.B. This function should only be called after scheduling has started&lt;br /&gt;
 *&lt;br /&gt;
 * @param cpu_id&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              CPU ID outside allowed range 0 to 254&lt;br /&gt;
 *          ERR_ID_WRONG                CPU ID &amp;gt;= number of available CPUs; or the same as currently running&lt;br /&gt;
 *          ERR_CPU_ALREADY_ENABLED     CPU already enabled&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceosmp_cpu_enable(&lt;br /&gt;
    U32_t cpu_id&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| cpu_id || ID of CPU core to be enabled.&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit  || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || CPU ID outside allowed range 0 to 254&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || CPU ID &amp;gt;= number of available CPUs; or the same as currently running&lt;br /&gt;
|-&lt;br /&gt;
| ERR_CPU_ALREADY_ENABLED     || CPU already enabled&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, good_cpu;&lt;br /&gt;
...&lt;br /&gt;
// Enable CPU core&lt;br /&gt;
status = oceosmp_cpu_enable(good_cpu));&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceosmp_cpu_terminate()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''initialisation.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function removes a CPU core from the OCEOSmp scheduler and marks it so it cannot be restarted. It puts CPU to sleep with interrupts disabled. It should only be called after scheduling has started.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 *  Removes CPU from OCEOSMP scheduler and terminates, cannot be restarted.&lt;br /&gt;
 *  Puts CPU to sleep with interrupts disabled&lt;br /&gt;
 *&lt;br /&gt;
 *  N.B. This function should only be called after scheduling has started&lt;br /&gt;
 *  Steps:&lt;br /&gt;
 *     1. Set terminate flag on this CPU;&lt;br /&gt;
 *     2. Trigger software interrupt to transfer execution to IRQ handler;&lt;br /&gt;
 *     3. Check flag and if set =&amp;gt; put CPU to sleep in while loop with interrupts disabled;&lt;br /&gt;
 *     4. Set MAX priority on this CPU priority stack;&lt;br /&gt;
 *     5. Remove CPU from scheduling;&lt;br /&gt;
 *     6. Clean up all the tasks by calling task terminate function and free up all the&lt;br /&gt;
 *        preempted jobs by this CPU;&lt;br /&gt;
 *&lt;br /&gt;
 * @param cpu_id&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              CPU ID outside allowed range 0 to 254&lt;br /&gt;
 *          ERR_ID_WRONG                CPU ID &amp;gt;= number of available CPUs; or the same as currently running&lt;br /&gt;
 *          ERR_CPU_ALREADY_TERMINATED  CPU already terminated&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceosmp_cpu_terminate(&lt;br /&gt;
    U32_t cpu_id&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| cpu_id || ID of CPU core to be terminated.&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit  || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || CPU ID outside allowed range 0 to 254&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || CPU ID &amp;gt;= number of available CPUs; or the same as currently running&lt;br /&gt;
|-&lt;br /&gt;
| ERR_CPU_ALREADY_TERMINATED  || CPU already terminated&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, faulty_cpu;&lt;br /&gt;
...&lt;br /&gt;
// Terminate CPU core&lt;br /&gt;
status = oceosmp_cpu_terminate(faulty_cpu));&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;Task directives&amp;lt;/span&amp;gt;==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ API Functions&lt;br /&gt;
|-&lt;br /&gt;
| Directive                                                                     || Description                          || main || task || IRQ handler&lt;br /&gt;
|-&lt;br /&gt;
| [[OCEOSmp/directive reference#oceos_task_create()| oceos_task_create()]]             || Create Task                        || *    ||      || &lt;br /&gt;
|-&lt;br /&gt;
| [[OCEOSmp/directive reference#oceos_task_start()| oceos_task_start()]]               || Start Task                         ||      ||  *   || *&lt;br /&gt;
|-&lt;br /&gt;
| [[OCEOSmp/directive reference#oceos_task_timed_start()| oceos_task_timed_start()]]   || Schedule a task to start execution at a given system time||      ||  *   || *&lt;br /&gt;
|-&lt;br /&gt;
| [[OCEOSmp/directive reference#oceos_task_disable()| oceos_task_disable()]]           || Disable Task                       ||      ||  *   || *&lt;br /&gt;
|-&lt;br /&gt;
| [[OCEOSmp/directive reference#oceos_task_enable()| oceos_task_enable()]]             || Enable Task                        ||      ||  *   || *&lt;br /&gt;
|-&lt;br /&gt;
| [[OCEOSmp/directive reference#oceos_task_self()| oceos_task_self()]]                 || Returns the task ID of the currently executing task ||    ||  *   || *&lt;br /&gt;
|-&lt;br /&gt;
| [[OCEOSmp/directive reference#oceos_task_get_priority()| oceos_task_get_priority()]] || Get priority of a task             ||      ||  *   || *&lt;br /&gt;
|-&lt;br /&gt;
| [[OCEOSmp/directive reference#oceos_task_get_status()| oceos_task_get_status()]]     || Get status of a task               ||      ||  *   || *&lt;br /&gt;
|-&lt;br /&gt;
| [[OCEOSmp/directive reference#oceos_task_kill()| oceos_task_kill()]]                 || Directive to terminate current task||      ||  *   || *&lt;br /&gt;
|-&lt;br /&gt;
| [[OCEOSmp/directive reference#oceos_task_get_info()| oceos_task_get_info()]]         || Get task information               ||      ||  *   || *&lt;br /&gt;
|-&lt;br /&gt;
| [[OCEOSmp/directive reference#oceosmp_task_kill()| oceosmp_task_kill()]]                 || Directive to terminate current task||      ||  *   || *&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;Task data structures&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''tasks.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The following data structures are used by some of the task directives.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Data structures'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * A pointer to this structure is passed to oceos_task_create().&lt;br /&gt;
 * The structure is first initialised according to a tasks's parameters,&lt;br /&gt;
 * and is not used again after the task is created and may then be discarded.&lt;br /&gt;
 */&lt;br /&gt;
struct task_descriptor {&lt;br /&gt;
&lt;br /&gt;
	void (*function_start)(void*);	// name of task start function&lt;br /&gt;
	void (*function_end)(void*);	// optional, NULL or task end function&lt;br /&gt;
&lt;br /&gt;
	U32_t task_id;					// 0 to 254, usually an enum&lt;br /&gt;
	U32_t task_jobs_max;			// 1 to 15, max concurrent 'jobs'&lt;br /&gt;
	U32_t task_priority;			// 1 (highest) to 254 (lowest)&lt;br /&gt;
	U32_t task_threshold;			// &amp;gt;=1, &amp;lt;= task_priority (higher or same priority)&lt;br /&gt;
	U32_t task_turned_on_initially;	// 0: disabled initially, else enabled&lt;br /&gt;
&lt;br /&gt;
	U32_t time_deadline_microsecs;	// start request to finish, 0 to ignore&lt;br /&gt;
	U32_t time_min_interval_microsecs;	// between start requests, 0 to ignore&lt;br /&gt;
&lt;br /&gt;
	U32_t uses_cpu_affinity;		// 0: not restricted, else core restricted&lt;br /&gt;
	U32_t uses_cpu_affinity_core_id;// core ID to which restricted if affinity used&lt;br /&gt;
}__attribute__ ((aligned (8)));&lt;br /&gt;
&lt;br /&gt;
/**&lt;br /&gt;
 * Task info used with oceos_task_get_info&lt;br /&gt;
 */&lt;br /&gt;
struct task_info {&lt;br /&gt;
  U64_t           time_max_delay;               // maximum time job is waiting on ready queue before becoming active&lt;br /&gt;
  U64_t           time_max_finish;              // maximum time to finish job execution after starting&lt;br /&gt;
  U64_t           time_max_exec;                // maximum time spent executing&lt;br /&gt;
  U64_t           time_total_exec;              // total CPU time used by this task&lt;br /&gt;
  U64_t           time_min_gap_starts;          // minimum time between job creations, can be reset&lt;br /&gt;
  U64_t           time_min_gap_finish_start;    // minimum time between job ending and new job creation, can be reset&lt;br /&gt;
&lt;br /&gt;
  U64_t           time_last_start;              // time of most recent job creation&lt;br /&gt;
  U64_t           time_last_finish;             // time of most recent job finish&lt;br /&gt;
&lt;br /&gt;
  unsigned int    jobs_current_max  :16;        // maximum number of current jobs for this task, no roll over, can be reset&lt;br /&gt;
  unsigned int    jobs_total        :16;        // number of times this task was started, no roll-over, can be reset&lt;br /&gt;
  U32_t           jobs_current;                 // Number of task instances currently in use by oceos&lt;br /&gt;
&lt;br /&gt;
  U32_t           preempt_max;                  // maximum times any job was pre-empted, no roll-over, can be reset&lt;br /&gt;
}__attribute__ ((aligned (8)));&lt;br /&gt;
&lt;br /&gt;
/* A task's status is returned as below if queried */&lt;br /&gt;
enum TASK_STATUS {&lt;br /&gt;
    TASK_DISABLED,      // cannot be scheduled, and no current jobs&lt;br /&gt;
    TASK_ENABLED,       // can be scheduled, but no current jobs&lt;br /&gt;
    TASK_INVALID,       // task does not exist&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_task_create()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''tasks.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Create a task.&lt;br /&gt;
Can only be use before OCEOS starts. Stores the task information in the OCEOS fixed data area.&lt;br /&gt;
This directive populates the data structures for a task. It should be called after [[OCEOSmp/directive_reference#oceos_init()|oceos_init()]] and before [[OCEOSmp/directive_reference#oceos_init_finish()|oceos_init_finish()]].&amp;lt;br&amp;gt;&lt;br /&gt;
It must be called for each task otherwise [[OCEOSmp/directive_reference#oceos_start()|oceos_start()]] will return an error.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Create a task using a task descriptor structure&lt;br /&gt;
 *&lt;br /&gt;
 * Can only be used in Initialisation Phase.&lt;br /&gt;
 *&lt;br /&gt;
 * A task has twelve constant parameters set when the task is created.&lt;br /&gt;
 * Rather than setting a list of these parameters the named fields of a&lt;br /&gt;
 * task_descriptor structure are set and a pointer to it passed here.&lt;br /&gt;
 *&lt;br /&gt;
 * The task_descriptor structure fields are described above.&lt;br /&gt;
 * Once the task has been created the structure can be discarded.&lt;br /&gt;
 *&lt;br /&gt;
 * To create a task:&lt;br /&gt;
 *		set up a task_descriptor structure,&lt;br /&gt;
 *		set its fields to the parameter values for the task,&lt;br /&gt;
 *		pass a pointer to the structure to this directive.&lt;br /&gt;
 *&lt;br /&gt;
 * The structure is checked for validity by oceos_task_create and its&lt;br /&gt;
 * information used to set the task details in the OCEOS fixed data area.&lt;br /&gt;
 *&lt;br /&gt;
 * @param  struct task_descriptor *	fields give task characteristics&lt;br /&gt;
 *&lt;br /&gt;
 * @return OCEOS_SUCCESS            No errors or warnings&lt;br /&gt;
 *         WARN_NO_END_FUNCTION     Warning, no end task function specified&lt;br /&gt;
 *&lt;br /&gt;
 *         ERR_SYS_FIXED_CORRUPT    System Fixed area corrupt&lt;br /&gt;
 *         ERR_WRONG_CPU_CORE       Executing directive on wrong CPU&lt;br /&gt;
 *         ERR_WRONG_PHASE          Called before oceos_init() is done&lt;br /&gt;
 *         ERR_TOO_MANY             MAX number of tasks already created&lt;br /&gt;
 *         ERR_ID_INVALID           Task ID outside allowed range 0 to 254&lt;br /&gt;
 *         ERR_ID_WRONG             Task ID outside &amp;gt;= number of tasks&lt;br /&gt;
 *         ERR_T_ALREADY_ALLOCATED  Task ID already in use&lt;br /&gt;
 *         ERR_T_PRIORITY_INVALID   Task priority outside allowed range 1 to 254&lt;br /&gt;
 *         ERR_THRESHOLD_INVALID    Task threshold outside range 1 to 254&lt;br /&gt;
 *         ERR_THRESHOLD_WRONG      Task threshold  higher priority than task priority&lt;br /&gt;
 *         ERR_JOBS_MAX_INVALID     Job number outside range 1 to 15&lt;br /&gt;
 *         ERR_JOBS_TOO_MANY        System capacity exceeded&lt;br /&gt;
 *         ERR_AFFINITY_WRONG       CPU core specified is outside chosen range&lt;br /&gt;
 *         ERR_START_FUNCTION_BAD   Task start function address either NULL or misaligned&lt;br /&gt;
 */&lt;br /&gt;
S32_t   oceos_task_create(&lt;br /&gt;
    const struct task_descriptor * const task_description_ptr&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter           || Description&lt;br /&gt;
|-&lt;br /&gt;
|struct task_descriptor * || Pointer to task descriptor which contains task attributes&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit     || Description&lt;br /&gt;
|-&lt;br /&gt;
|WARN_NO_END_FUNCTION     || Warning, no end task function specified&lt;br /&gt;
|-&lt;br /&gt;
|ERR_SYS_FIXED_CORRUPT    || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
|ERR_WRONG_CPU_CORE       || Executing directive on wrong CPU&lt;br /&gt;
|-&lt;br /&gt;
|ERR_WRONG_PHASE          || Called before oceos_init() is done&lt;br /&gt;
|-&lt;br /&gt;
|ERR_TOO_MANY             || MAX number of tasks already created&lt;br /&gt;
|-&lt;br /&gt;
|ERR_ID_INVALID           || Task ID outside allowed range 0 to 254&lt;br /&gt;
|-&lt;br /&gt;
|ERR_ID_WRONG             || Task ID outside &amp;gt;= number of tasks&lt;br /&gt;
|-&lt;br /&gt;
|ERR_T_ALREADY_ALLOCATED  || Task ID already in use&lt;br /&gt;
|-&lt;br /&gt;
|ERR_T_PRIORITY_INVALID   || Task priority outside allowed range 1 to 254&lt;br /&gt;
|-&lt;br /&gt;
|ERR_THRESHOLD_INVALID    || Task threshold outside range 1 to 254&lt;br /&gt;
|-&lt;br /&gt;
|ERR_THRESHOLD_WRONG      || Task threshold  higher priority than task priority&lt;br /&gt;
|-&lt;br /&gt;
|ERR_JOBS_MAX_INVALID     || Job number outside range 1 to 15&lt;br /&gt;
|-&lt;br /&gt;
|ERR_JOBS_TOO_MANY        || System capacity exceeded&lt;br /&gt;
|-&lt;br /&gt;
|ERR_AFFINITY_WRONG       || CPU core specified is outside chosen range&lt;br /&gt;
|-&lt;br /&gt;
|ERR_START_FUNCTION_BAD   || Task start function address either NULL or misaligned&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
/* Sample Task names - all here start with t_ to help avoid name confusion */&lt;br /&gt;
enum TASK_NAME{&lt;br /&gt;
      t_0,&lt;br /&gt;
      t_1,&lt;br /&gt;
      t_2&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
/*&lt;br /&gt;
 * APPLICATION FUNCTION DECLARATIONS&lt;br /&gt;
 */&lt;br /&gt;
void fun0(void *);&lt;br /&gt;
void fun1(void *);&lt;br /&gt;
void fun2(void *);&lt;br /&gt;
void end_function(void *);&lt;br /&gt;
&lt;br /&gt;
const struct task_descriptor tasks_data[NUMBER_OF_TASKS] = {&lt;br /&gt;
    {fun0, end_function, t_0, 2, 10, 8, TASK_ENABLED, 0, 0, 0, 0},&lt;br /&gt;
    {fun1, end_function, t_1, 2, 10, 8, TASK_ENABLED, 0, 0, 0, 0},&lt;br /&gt;
    {fun2, end_function, t_2, 2, 10, 8, TASK_ENABLED, 0, 0, 0, 0}&lt;br /&gt;
}; &lt;br /&gt;
&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
    // create tasks (names are defined in the application header)&lt;br /&gt;
    for (i=0; i&amp;lt;NUMBER_OF_TASKS; i++){&lt;br /&gt;
        if ( oceos_task_create(&amp;amp;tasks_data[i]) != OCEOS_SUCCESS ){&lt;br /&gt;
        	oceosmp_print(&amp;quot;\nFailed to create task\n\r&amp;quot;);&lt;br /&gt;
        	return -i;&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_task_start()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''tasks.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function starts an instance of a task. An instance of a task is called a job in OCEOS terminology.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 *  Starting a task involves three main stages&lt;br /&gt;
 *      1 setting up a job&lt;br /&gt;
 *          finding a free job entry if available&lt;br /&gt;
 *          setting up this entry including passing it the data void *&lt;br /&gt;
 *&lt;br /&gt;
 *      2 placing the job on readyQ&lt;br /&gt;
 *&lt;br /&gt;
 *      3 doing a context switch&lt;br /&gt;
 * This function should only be called after OCEOS is initialised&lt;br /&gt;
 *       and the dynamic task and job structures set up&lt;br /&gt;
 *&lt;br /&gt;
 *  When used from an interrupt handler,&lt;br /&gt;
 *  the context switch is only done&lt;br /&gt;
 *  after all nested interrupts have unwound&lt;br /&gt;
 *&lt;br /&gt;
 * @param task_id Task ID must be in range 0 to 254&lt;br /&gt;
 * @param ptr     Pointer to task data&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT    System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT      System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE          Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID           Task ID is invalid&lt;br /&gt;
 *          ERR_ID_WRONG             Task ID is wrong&lt;br /&gt;
 *          ERR_START_TASK_DISABLED  Starting task is disabled&lt;br /&gt;
 *          ERR_TOO_MANY             There is no free job&lt;br /&gt;
 *          ERR_SYS_BUSY             Failed to grab the lock&lt;br /&gt;
 */&lt;br /&gt;
S32_t   oceos_task_start(&lt;br /&gt;
    const U32_t task_id, // task ID, must be in range 0 to 254&lt;br /&gt;
    void * const ptr    // pointer to data&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| task_id || U32_t with Task ID in range 0 to 254.&lt;br /&gt;
|-&lt;br /&gt;
| ptr    || void * pointer to task data&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit  || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT    || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT      || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE          || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID           || Task ID is invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG             || Task ID is wrong&lt;br /&gt;
|-&lt;br /&gt;
| ERR_START_TASK_DISABLED  || Starting task is disabled&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TOO_MANY             || There is no free job&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY             || Failed to grab the lock&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
void *ptr;&lt;br /&gt;
...&lt;br /&gt;
// Start instance of task T_1 passing pointer ptr&lt;br /&gt;
status = oceos_task_start(t_1,ptr);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_task_timed_start()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''tasks.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function schedules a task to start execution at a given system time.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 *  Schedule a task to start execution at a given system time&lt;br /&gt;
 *&lt;br /&gt;
 *  The before and after offsets define a window around the selected time&lt;br /&gt;
 *  in which the task may be started.&lt;br /&gt;
 *&lt;br /&gt;
 *  If the current system time is before the start window a job is created&lt;br /&gt;
 *  and a corresponding action put on the timed action queue.&lt;br /&gt;
 *&lt;br /&gt;
 *  If the current system time is within the time window for starting the task,&lt;br /&gt;
 *  it is started immediately.&lt;br /&gt;
 *&lt;br /&gt;
 *  If the current system time is after the window, an error is reported.&lt;br /&gt;
 *&lt;br /&gt;
 *  Times are in microseconds.&lt;br /&gt;
 *&lt;br /&gt;
 *  This function should only be called after OCEOS is initialised&lt;br /&gt;
 *  and the dynamic task and job structures set up&lt;br /&gt;
 *&lt;br /&gt;
 * @param taskID        Task ID must be in range 0 to 254&lt;br /&gt;
 * @param ptr           Pointer to data&lt;br /&gt;
 * @param start_time    System time at which job should start&lt;br /&gt;
 * @param before        Forward tolerance for time&lt;br /&gt;
 * @param after         Backward tolerance for time&lt;br /&gt;
 * @param return_job_id Return job_id to the user, to remove this job from timed action if needed&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              Task ID invalid&lt;br /&gt;
 *          ERR_ID_WRONG                Task ID is wrong&lt;br /&gt;
 *          ERR_TA_NOT_INIT             Timed action inialisation is not done and tried to be used&lt;br /&gt;
 *          ERR_START_TASK_DISABLED     Starting task is disabled&lt;br /&gt;
 *          ERR_TOO_MANY                There is no free job&lt;br /&gt;
 *          ERR_TOO_LATE                Starting task is too late(out of time frame)&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to grab the lock&lt;br /&gt;
 *          ERR_TA_Q_FULL               Timed action queue is full&lt;br /&gt;
 *          ERR_TA_START_FAILED         Timed action execute failed; See log&lt;br /&gt;
 */&lt;br /&gt;
S32_t   oceos_task_timed_start(&lt;br /&gt;
    const U32_t task_id,     // task ID, must be in range 0 to 254&lt;br /&gt;
    void * const ptr,        // pointer to data&lt;br /&gt;
    const U64_t start_time,  // system time at which job should start&lt;br /&gt;
    const U32_t before,      // forward tolerance for time&lt;br /&gt;
    const U32_t after,       // backward tolerance for time&lt;br /&gt;
    U32_t * return_job_id    // return job_id to the user, to remove this job from timed action if needed&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| taskID        || U32_t task ID must be in range 0 to 254&lt;br /&gt;
|-&lt;br /&gt;
| ptr           || void * pointer to data&lt;br /&gt;
|-&lt;br /&gt;
| start_time    || U64_t system time at which job should start&lt;br /&gt;
|-&lt;br /&gt;
| before        || U32_t forward tolerance for time&lt;br /&gt;
|-&lt;br /&gt;
| after         || U32_t backward tolerance for time&lt;br /&gt;
|-&lt;br /&gt;
| return_job_id || U32_t return job_id to the user, to remove this job from timed action if needed&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit  || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || Task ID invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || Task ID is wrong&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_NOT_INIT             || Timed action inialisation is not done and tried to be used&lt;br /&gt;
|-&lt;br /&gt;
| ERR_START_TASK_DISABLED     || Starting task is disabled&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TOO_MANY                || There is no free job&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TOO_LATE                || Starting task is too late(out of time frame)&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to grab the lock&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_Q_FULL               || Timed action queue is full&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_START_FAILED         || Timed action execute failed; See log&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
U32_t job_id;&lt;br /&gt;
U64_t cur_sys_time;&lt;br /&gt;
...&lt;br /&gt;
  cur_sys_time = oceos_time_sys_get64();&lt;br /&gt;
&lt;br /&gt;
  // Start task 10,000 microseconds (us) from now and advise if started more than 1,000 us before or 2,000 us after.&lt;br /&gt;
  status = oceos_task_timed_start(t_2, ptr, cur_sys_time + 10000, 1000, 2000, &amp;amp;job_id);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_task_disable()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''initialisation.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function disables a task and removes any current pending jobs from the readyQ.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 *  Disable a task and remove any current pending jobs on readyQ.&lt;br /&gt;
 *&lt;br /&gt;
 *  A disabled task's jobs  will not be put into execution nor put on readyQ.&lt;br /&gt;
 *&lt;br /&gt;
 *  Note that where execution of a task has already commenced,&lt;br /&gt;
 *  disabling the task will not prevent it from completing.&lt;br /&gt;
 *&lt;br /&gt;
 *  This function should only be called after OCEOS is initialised&lt;br /&gt;
 *  and the dynamic task and job structures set up&lt;br /&gt;
 *&lt;br /&gt;
 * @param taskID  Task ID must be in range 0 to 254&lt;br /&gt;
 * @return: OCEOS_SUCCESS&lt;br /&gt;
 *          WARN_ALREADY_DISABLED        Task already disabled&lt;br /&gt;
 *          WARN_SEM_PEND_REMOVE_FAILED  Failed to remove job from semaphore pending queue&lt;br /&gt;
 *          WARN_DQ_PEND_REMOVE_FAILED   Failed to remove job from dataq pending queue&lt;br /&gt;
 *&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT        System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT          System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE              Directive was called before OCEOS init is finished&lt;br /&gt;
 *          ERR_ID_INVALID               Task ID is invalid&lt;br /&gt;
 *          ERR_ID_WRONG                 Task ID is wrong&lt;br /&gt;
 *          ERR_SYS_BUSY                 Failed to grab the lock&lt;br /&gt;
 */&lt;br /&gt;
S32_t   oceos_task_disable(&lt;br /&gt;
    const U32_t task_id // task ID, must be in range 0 to 254&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| taskID || U32_t task ID must be in range 0 to 254&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit  || Description&lt;br /&gt;
|-&lt;br /&gt;
| WARN_ALREADY_DISABLED        || Task already disabled&lt;br /&gt;
|-&lt;br /&gt;
| WARN_SEM_PEND_REMOVE_FAILED  || Failed to remove job from semaphore pending queue&lt;br /&gt;
|-&lt;br /&gt;
| WARN_DQ_PEND_REMOVE_FAILED   || Failed to remove job from dataq pending queue&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT        || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT          || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE              || Directive was called before OCEOS init is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID               || Task ID is invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                 || Task ID is wrong&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                 || Failed to grab the lock&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Disable task t_1&lt;br /&gt;
status = oceos_task_disable(t_1);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_task_enable()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''tasks.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function enables a task. Only enabled tasks may be started.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 *  Enable a task - only enabled tasks are placed on readyQ or started.&lt;br /&gt;
 *&lt;br /&gt;
 *  This function should only be called after OCEOS is initialised&lt;br /&gt;
 *  and the dynamic task and job structures set up&lt;br /&gt;
 *&lt;br /&gt;
 * @param taskID   Task ID must be in range 0 to 254&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          WARN_ALREADY_ENABLED     Task already enabled&lt;br /&gt;
 *&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT    System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT      System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE          Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID           Task ID is invalid&lt;br /&gt;
 *          ERR_ID_WRONG             Task ID is wrong&lt;br /&gt;
 *          ERR_SYS_BUSY             Failed to grab the lock&lt;br /&gt;
 */&lt;br /&gt;
S32_t   oceos_task_enable(&lt;br /&gt;
    const U32_t task_id // task ID, must be in range 0 to 254&lt;br /&gt;
);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| taskID  || U32_t task ID must be in range 0 to 254&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit  || Description&lt;br /&gt;
|-&lt;br /&gt;
| WARN_ALREADY_ENABLED     || Task already enabled&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT    || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT      || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE          || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID           || Task ID is invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG             || Task ID is wrong&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY             || Failed to grab the lock&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Enable task t_2&lt;br /&gt;
status = oceos_task_enable(t_2);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_task_self()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''tasks.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the task number of the currently running task on the calling CPU.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Get currently running task on calling CPU&lt;br /&gt;
 *&lt;br /&gt;
 * @param t_id  Task ID holder&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT        System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT          System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE              Directive was called before OCEOS init is finished&lt;br /&gt;
 *          ERR_CPU_DYN_PTR_BAD          CPU dynamic area pointer corrupt&lt;br /&gt;
 */&lt;br /&gt;
S32_t  oceos_task_self(&lt;br /&gt;
    U32_t *t_id&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| t_id || S32_t * pointer to variable where task ID will be written.&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit  || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT        || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT          || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE              || Directive was called before OCEOS init is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_CPU_DYN_PTR_BAD          || CPU dynamic area pointer corrupt&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, task_running;&lt;br /&gt;
...&lt;br /&gt;
// Return task ID that's running on this core&lt;br /&gt;
status = oceos_task_self(&amp;amp;task_running);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_task_get_priority()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''tasks.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the priority of the task ID passed to it.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Get priority of the task&lt;br /&gt;
 *&lt;br /&gt;
 * @param taskID        ID of task, must be in range 0 to 254&lt;br /&gt;
 * @param t_priority    Pointer to task priority holder&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT        System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT          System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE              Directive was called before OCEOS init is finished&lt;br /&gt;
 *          ERR_ID_INVALID               Task ID is invalid&lt;br /&gt;
 *          ERR_ID_WRONG                 Task ID is wrong&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_task_get_priority(&lt;br /&gt;
    const U32_t task_id, // task ID, must be in range 0 to 254&lt;br /&gt;
    U32_t *t_priority   // Pointer to task priority holder&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| task_id || S32_t task ID of task whose priority is required&lt;br /&gt;
|-&lt;br /&gt;
| t_priority || S32_t * pointer to variable where priority will be written&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit  || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT        || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT          || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE              || Directive was called before OCEOS init is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID               || Task ID is invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                 || Task ID is wrong&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
U32_t t_priority;&lt;br /&gt;
...&lt;br /&gt;
// Return the priority of task ID t_4 &lt;br /&gt;
status = oceos_task_get_priority(t_4, &amp;amp;t_priority);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_task_get_status()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''tasks.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the status of the task ID passed to it.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Get status of the task;&lt;br /&gt;
 * if OK t_status holds enum TASK_STATUS&lt;br /&gt;
 *&lt;br /&gt;
 * @param taskID    ID of task, must be in range 0 to 254&lt;br /&gt;
 * @param t_status  enum TASK_STATUS holder&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT        System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT          System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE              Directive was called before OCEOS init is finished&lt;br /&gt;
 *          ERR_ID_INVALID               Task ID is invalid&lt;br /&gt;
 *          ERR_ID_WRONG                 Task ID is wrong&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_task_get_status(&lt;br /&gt;
    const U32_t task_id,&lt;br /&gt;
    U32_t *t_status&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| task_id || S32_t task ID of task whose priority is required&lt;br /&gt;
|-&lt;br /&gt;
| t_status || S32_t * pointer to variable where status will be written&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit  || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT        || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT          || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE              || Directive was called before OCEOS init is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID               || Task ID is invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                 || Task ID is wrong&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
U32_t t_status;&lt;br /&gt;
...&lt;br /&gt;
// Return the status of task ID t_4 &lt;br /&gt;
status = oceos_task_get_status(t_4, &amp;amp;t_status);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_task_get_info()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''tasks.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the task information for the specified task.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Get task information for task with ID.&lt;br /&gt;
 *&lt;br /&gt;
 * User must pass pointer to struct task_info in order to retrieve data.&lt;br /&gt;
 *&lt;br /&gt;
 * @param task_id  Task ID&lt;br /&gt;
 * @param info     Pointer to struct task_info&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT    System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT      System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE          Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID           Task ID invalid&lt;br /&gt;
 *          ERR_ID_WRONG             Task ID wrong&lt;br /&gt;
 *          ERR_TASK_INFO_PTR_BAD    Task info pointer provided by user is NULL&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_task_get_info (&lt;br /&gt;
    const U32_t task_id,   // Task ID&lt;br /&gt;
    struct task_info *info // Pointer to struct task_info&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| task_id || ID of task for which information is required&lt;br /&gt;
|-&lt;br /&gt;
| task_info || struct task_info * pointer to the structure where task information is to be written&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit  || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT    || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT      || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE          || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID           || Task ID invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG             || Task ID wrong&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TASK_INFO_PTR_BAD    || Task info pointer provided by user is NULL&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
struct task_info info;&lt;br /&gt;
...&lt;br /&gt;
// Get information for task T3&lt;br /&gt;
status = oceos_task_get_info(t_3, &amp;amp;info);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceosmp_task_kill()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''tasks.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function kills the specified task running on the specified CPU.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 *  Function to kill currently running task on CPU;&lt;br /&gt;
 *  Can be used:&lt;br /&gt;
 *      From Mode_SVC  =&amp;gt; normal running mode for application&lt;br /&gt;
 *          If nesting level is zero and Mode_SVC&lt;br /&gt;
 *      From Mode_IRQ  =&amp;gt; from IRQ handler&lt;br /&gt;
 *          If nesting level is not zero, set flag to call this function within IRQ handler&lt;br /&gt;
 *      From Exception =&amp;gt; Mode_ABT and Mode_UND&lt;br /&gt;
 *          If nesting level is zero and NOT Mode_SVC, it is exception;&lt;br /&gt;
 *              Disable IRQs on current CPU;&lt;br /&gt;
 *              Set kill current task flag to TRUE;&lt;br /&gt;
 *              Issue SGI on current CPU, will be interrupted on return from Exception and&lt;br /&gt;
 *              this function will be called within IRQ handler&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT    System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT      System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE          Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_CPU_DYN_PTR_BAD      CPU dynamic area pointer corrupt&lt;br /&gt;
 *          ERR_ID_INVALID           Task ID invalid&lt;br /&gt;
 *          ERR_ID_WRONG             Task ID wrong&lt;br /&gt;
 *          ERR_CPU_ID_WRONG         CPU ID wrong&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceosmp_task_kill(&lt;br /&gt;
    U32_t task_id,&lt;br /&gt;
    U32_t cpu_id&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| task_id  || U32_t task ID to be killed (must be in range 0 to 254)&lt;br /&gt;
|-&lt;br /&gt;
| cpu_id  || U32_t CPU ID where task_id is to be killed&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT    || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT      || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE          || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_CPU_DYN_PTR_BAD      || CPU dynamic area pointer corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID           || Task ID invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG             || Task ID wrong&lt;br /&gt;
|-&lt;br /&gt;
| ERR_CPU_ID_WRONG         || CPU ID wrong&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Kill task t_2 on CPU cpu_1&lt;br /&gt;
status = oceosmp_task_kill(t_2, cpu_1);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;Mutex directives&amp;lt;/span&amp;gt;==&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_mutex_create()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''mutex.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function creates a mutex of specified ID with a specified priority ceiling.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Creates a mutex with priority ceiling&lt;br /&gt;
 *&lt;br /&gt;
 * NOTE: This function should only be called after OCEOSmp is initialised with&lt;br /&gt;
 *  oceos_init() and before initialisation ends with oceos_init_finish()&lt;br /&gt;
 *  and scheduling starts with oceos_start()&lt;br /&gt;
 *&lt;br /&gt;
 * @param mutex_id  mutex ID value 0 to 62&lt;br /&gt;
 * @param priority  mutex priority ceiling 1 to 254 (high to low task priority)&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_WRONG_CPU_CORE          Executing directive on wrong CPU&lt;br /&gt;
 *          ERR_WRONG_PHASE             Called before oceos_init() is done&lt;br /&gt;
 *          ERR_TOO_MANY                MAX number of MUTEXs already created&lt;br /&gt;
 *          ERR_ID_INVALID              MUTEX ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                MUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
 *          ERR_MX_ALREADY_ALLOCATED    MUTEX ID already used&lt;br /&gt;
 *          ERR_MX_PRIORITY_WRONG       MUTEX priority ceiling outside allowed range 1 to 254&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_mutex_create(&lt;br /&gt;
    const U32_t mutex_id,  // mutex ID, must be in range 0 to 62&lt;br /&gt;
    const U8_t  priority  // mutex priority ceiling&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| mutex_id  || u32_t mutex ID to be created (value 0 to 62).&lt;br /&gt;
|-&lt;br /&gt;
| priority_ceiling ||  U32_t mutex priority ceiling 1 to 254 (high to low task priority)&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_CPU_CORE          || Executing directive on wrong CPU&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Called before oceos_init() is done&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TOO_MANY                || MAX number of MUTEXs already created&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || MUTEX ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || MUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_MX_ALREADY_ALLOCATED    || MUTEX ID already used&lt;br /&gt;
|-&lt;br /&gt;
| ERR_MX_PRIORITY_WRONG       || MUTEX priority ceiling outside allowed range 1 to 254&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Create mutex with ID print_mutex and priority ceiling of 5&lt;br /&gt;
status = oceos_mutex_create(print_mutex, 5);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_mutex_wait()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''mutex.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function makes the task wait until the specified mutex is available.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
 /*&lt;br /&gt;
  * Wait on mutex with ID.&lt;br /&gt;
  * If task succeeds in grabbing mutex, system level priority rises to&lt;br /&gt;
  * priority of this mutex, so tasks with lower or equal priority will&lt;br /&gt;
  * not be able to start till mutex is released.&lt;br /&gt;
  *&lt;br /&gt;
  * This should only be called after OCEOSmp scheduling has started.&lt;br /&gt;
  *&lt;br /&gt;
  * @param mutex_id     const U32_t  : value 0 to 62&lt;br /&gt;
  *&lt;br /&gt;
  * @return  OCEOS_SUCCESS&lt;br /&gt;
  *          WARN_MX_INCORRECT_ORDER     MUTEX acquired in incorrect order&lt;br /&gt;
  *&lt;br /&gt;
  *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
  *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
  *          ERR_WRONG_PHASE             Directive was called before OCEOSmp initialisation is finished&lt;br /&gt;
  *          ERR_ID_INVALID              MUTEX ID outside allowed range 0 to 62&lt;br /&gt;
  *           ERR_ID_WRONG                MUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
  *          ERR_MX_CEILING_BAD          MUTEX ceiling not lower priority than job priority&lt;br /&gt;
  *          ERR_MX_ALREADY_HELD         MUTEX already held by this job&lt;br /&gt;
  *          ERR_SYS_BUSY                Failed to grab context switch guard&lt;br /&gt;
  */&lt;br /&gt;
S32_t oceos_mutex_wait(&lt;br /&gt;
    const U32_t  mutex_id      // mutex ID, must be in range 0 to 62&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| mutex_id  || u32_t mutex ID to be waited on (value 0 to 62).&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| WARN_MX_INCORRECT_ORDER     || MUTEX acquired in incorrect order&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOSmp initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || MUTEX ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || MUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_MX_CEILING_BAD          || MUTEX ceiling not lower priority than job priority&lt;br /&gt;
|-&lt;br /&gt;
| ERR_MX_ALREADY_HELD         || MUTEX already held by this job&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to grab context switch guard&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Wait on mutex m_2&lt;br /&gt;
status = oceos_mutex_wait(m_2);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_mutex_signal()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''mutex.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function signals the specified mutex.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Signal a mutex with ID&lt;br /&gt;
 *&lt;br /&gt;
 * N.B. :&lt;br /&gt;
 *      This function should not be called from an interrupt handler&lt;br /&gt;
 *      This should only be called after OCEOSmp scheduling has started.&lt;br /&gt;
 *&lt;br /&gt;
 * @param mutex_id     const U32_t  : value 0 to 62&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          WARN_MX_ALREADY_FREE        MUTEX is free already&lt;br /&gt;
 *          WARN_MX_NESTING_BAD         MUTEX nesting incorrect&lt;br /&gt;
 *&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOSmp initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              MUTEX ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                MUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
 *          ERR_MX_WRONG_JOB            MUTEX not held by this job&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to grab context switch guard&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_mutex_signal(&lt;br /&gt;
    const U32_t  mutex_id     // mutex ID, must be in range 0 to 62&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| mutex_id  || u32_t mutex ID to be signalled (value 0 to 62).&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| WARN_MX_ALREADY_FREE        || MUTEX is free already&lt;br /&gt;
|-&lt;br /&gt;
| WARN_MX_NESTING_BAD         || MUTEX nesting incorrect&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOSmp initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || MUTEX ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || MUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_MX_WRONG_JOB            || MUTEX not held by this job&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to grab context switch guard&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Signal mutex m_2&lt;br /&gt;
status = oceos_mutex_signal(m_2);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_mutex_get_value()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''mutex.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the value of the specified mutex.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Get current value of mutex with ID&lt;br /&gt;
 *&lt;br /&gt;
 * @param mutex_id      const U32_t  : value 0 to 62&lt;br /&gt;
 * @param m_value       pointer to MUTEX value holder&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOSmp initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              MUTEX ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                MUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
 *          ERR_MX_DATA_PTR_BAD         Pointer to MUTEX value return holder is null&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_mutex_get_value(&lt;br /&gt;
    const U32_t  mutex_id,      // mutex ID, must be in range 0 to 62&lt;br /&gt;
    U32_t *m_value              // Pointer to MUTEX value holder&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| mutex_id  || u32_t mutex ID to be signalled (value 0 to 62)&lt;br /&gt;
|-&lt;br /&gt;
| m_value  || u32_t * pointer where mutex value is to be written&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOSmp initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || MUTEX ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || MUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_MX_DATA_PTR_BAD         || Pointer to MUTEX value return holder is null&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
U32_t value;&lt;br /&gt;
...&lt;br /&gt;
// Get value of mutex m_2&lt;br /&gt;
status = oceos_mutex_get_value(m_2, &amp;amp;value);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;Read/write mutex directives&amp;lt;/span&amp;gt;==&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;Read/write mutex overview&amp;lt;/span&amp;gt;===&lt;br /&gt;
&lt;br /&gt;
Contents:&lt;br /&gt;
&lt;br /&gt;
 1.  Read/Write Mutex features&lt;br /&gt;
 2.  Read/Write Mutex data structures&lt;br /&gt;
 3.  Read/Write Mutex constants&lt;br /&gt;
 4.  Read/Write Mutex manager Directives&lt;br /&gt;
&lt;br /&gt;
==== Read/Write Mutex Features ====&lt;br /&gt;
&lt;br /&gt;
Read/Write Mutexes (rwmutexes) can be held for 'read' at the same time&lt;br /&gt;
by multiple jobs on different CPUs, but once held for 'write' by any job&lt;br /&gt;
cannot be obtained for 'read' or for 'write' by another job until released.&lt;br /&gt;
&lt;br /&gt;
They can be used to allow data be read simultaneously by multiple jobs when&lt;br /&gt;
the data is not being updated while ensuring that no updating can take&lt;br /&gt;
place while any job is reading the data.&lt;br /&gt;
&lt;br /&gt;
Pending write requests take precedence over pending read requests and are&lt;br /&gt;
done on a first come, first served basis. Once any job on a CPU has a&lt;br /&gt;
rwmutex for 'read' no other job on that CPU can acquire it so as to avoid&lt;br /&gt;
potential problems and minimise delays in servicing write requests by other&lt;br /&gt;
CPUs.&lt;br /&gt;
&lt;br /&gt;
While any job holds a rwmutex for reading any job on another CPU can also&lt;br /&gt;
acquire it for reading. Other jobs on the same CPU that may attempt to&lt;br /&gt;
acquire the rwmutex are delayed in starting until return of the rwmutex.&lt;br /&gt;
No job can acquire the rwmutex for writing until all read acquisitions&lt;br /&gt;
have been returned.&lt;br /&gt;
&lt;br /&gt;
No job will acquire a rwmutex for reading if any job is trying to acquire&lt;br /&gt;
it for writing, giving write precedence over read. Multiple write requests&lt;br /&gt;
waiting for existing read acquisitions to complete are serviced in the&lt;br /&gt;
order in which they were made when the current read acquisitions complete.&lt;br /&gt;
&lt;br /&gt;
If a task waits on a rwmutex that it already holds a system log entry is&lt;br /&gt;
made (LOG_RWMUTEX_ALREADY_HELD) and an INTERNAL_ERROR status code returned.&lt;br /&gt;
&lt;br /&gt;
If a task attempts to release a rwmutex it does not hold a system log entry&lt;br /&gt;
is made (LOG_RWMUTEX_ALREADY_FREE) and an INTERNAL_ERROR status code returned.&lt;br /&gt;
&lt;br /&gt;
If a job holds more than one rwmutex at the same time these must be&lt;br /&gt;
acquired and released in a nested manner&lt;br /&gt;
(e.g. wait 1, wait 2, wait 3, signal 3, signal 2, signal 1).&lt;br /&gt;
&lt;br /&gt;
If a task exits while holding one or more rwmutexes these are returned and&lt;br /&gt;
a system log entry made (LOG_RWMUTEX_NOT_RETURNED).&lt;br /&gt;
&lt;br /&gt;
==== Read/Write Mutex data structures ====&lt;br /&gt;
&lt;br /&gt;
In OCEOSmp each rwmutex has a priority ceiling, the priority of the highest&lt;br /&gt;
priority task that acquires the rwmutex for read or for write.&lt;br /&gt;
OCEOSmp uses this to ensure that once a job on a particular CPU has the&lt;br /&gt;
rwmutex for reading or for writing no other job on that CPU can be started&lt;br /&gt;
that might try to obtain that rwmutex.&lt;br /&gt;
&lt;br /&gt;
The priority ceiling of a rwmutex is specified when the rwmutex is created&lt;br /&gt;
and does not change subsequently. Priority ceilings are stored in the&lt;br /&gt;
fixed data area as an array U8_t rwmutexCeilings[] indexed by mutex ID.&lt;br /&gt;
This array is extended to be a whole number of 32-bit words.&lt;br /&gt;
&lt;br /&gt;
A rwmutex has a unique rwmutex ID, an unsigned integer usually defined in&lt;br /&gt;
the application header file as an enum RWMUTEX_NAME{} thus allowing a&lt;br /&gt;
user-friendly name be associated with each rwmutex ID.&lt;br /&gt;
&lt;br /&gt;
Using an enum is strongly recommended as it allows a user-friendly name be&lt;br /&gt;
associated with each ID, and helps ensure IDs are contiguous from 0.&lt;br /&gt;
&lt;br /&gt;
These rwmutex IDs are used as indices into both fixed and dynamic data&lt;br /&gt;
arrays and must cover the range 0 to ((number of rwmutexes) -1). Using&lt;br /&gt;
enum RWMUTEX_NAME{} automatically assigns names to IDs 0, 1, 2...&lt;br /&gt;
&lt;br /&gt;
Read write mutex dynamic data such as the current write requests and&lt;br /&gt;
current read count are stored in the dynamic data area in an array of&lt;br /&gt;
struct rwmutex_dyn_block also indexed by the rwmutex ID.&lt;br /&gt;
&lt;br /&gt;
A further dynamic area array of guard_t is used in providing mutual&lt;br /&gt;
exclusion when updating the rwmutex dynamic data.&lt;br /&gt;
&lt;br /&gt;
==== Read/Write Mutex constants ====&lt;br /&gt;
&lt;br /&gt;
In OCEOSmp there can be a maximum of 63 rwmutexes,&lt;br /&gt;
with IDs from 0 to 62 (the value 63 is used as an invalid ID).&lt;br /&gt;
&lt;br /&gt;
The rwmutexes can be created in any order, but OCEOSmp will return an error&lt;br /&gt;
and fail to start if the resulting IDs fail to be contiguous from 0 as IDs&lt;br /&gt;
are used by OCEOS as indices into arrays.&lt;br /&gt;
&lt;br /&gt;
Each rwmutex has a priority ceiling, the priority of the highest priority&lt;br /&gt;
task that uses the rwmutex for reading or for writing. This is specified&lt;br /&gt;
when the rwmutex is created, does not change subsequently, and must be in&lt;br /&gt;
the range 1 (TASK_MAX_PRIORITY) to 254 (TASK_MIN_PRIORITY).&lt;br /&gt;
The application developer must ensure that the correct rwmutex ceiling&lt;br /&gt;
is used. OCEOSmp will detect an attempt to acquire a rwmutex by a task&lt;br /&gt;
with higher priority than that rwmutex's priority ceiling, make a&lt;br /&gt;
system log entry (LOG_RWMUTEX_BAD_CEILING) and return an INTERNAL_ERROR&lt;br /&gt;
status code.&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_rwmutex_create()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''rwmutex.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function ees a read/write mutex.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Creates a Read/Write Mutex (RWMUTEX)&lt;br /&gt;
 *&lt;br /&gt;
 * This function should only be called after OCEOSmp is initialised with&lt;br /&gt;
 * oceos_init() and before initialisation ends with oceos_init_finish()&lt;br /&gt;
 * and scheduling starts with oceos_start()&lt;br /&gt;
 *&lt;br /&gt;
 * @param rwm_id    Read/Write RWMUTEX ID, must be in range 0 to 62&lt;br /&gt;
 * @param priority  Priority ceiling of highest priority task that uses the RWMUTEX&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_WRONG_CPU_CORE          Executing directive on wrong CPU&lt;br /&gt;
 *          ERR_WRONG_PHASE             Called before oceos_init() is done&lt;br /&gt;
 *          ERR_TOO_MANY                MAX number of RWMUTEXs already created&lt;br /&gt;
 *          ERR_ID_INVALID              RWMUTEX ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                RWMUTEX ID &amp;gt;= number of RWMUTEXs&lt;br /&gt;
 *          ERR_RWMX_ALREADY_ALLOCATED  RWMUTEX ID already used&lt;br /&gt;
 *          ERR_RWMX_PRIORITY_WRONG     RWMUTEX priority ceiling outside allowed range 1 to 254&lt;br /&gt;
 */&lt;br /&gt;
S32_t   oceos_rwmutex_create(&lt;br /&gt;
    const U32_t rwm_id,   // RWMUTEX ID, must be in range 0 to max rwm&lt;br /&gt;
    const U8_t priority   // RWMUTEX priority ceiling&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| rwm_id || Read/Write RWMUTEX ID, must be in range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| priority || Priority ceiling of highest priority task that uses the RWMUTEX&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_CPU_CORE          || Executing directive on wrong CPU&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Called before oceos_init() is done&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TOO_MANY                || MAX number of RWMUTEXs already created&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || RWMUTEX ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || RWMUTEX ID &amp;gt;= number of RWMUTEXs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_RWMX_ALREADY_ALLOCATED  || RWMUTEX ID already used&lt;br /&gt;
|-&lt;br /&gt;
| ERR_RWMX_PRIORITY_WRONG     || RWMUTEX priority ceiling outside allowed range 1 to 254&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Create read/write mutex with ID rwm_2 and priority ceiling of 100 &lt;br /&gt;
status = oceos_rwmutex_create(rwm_1, 100);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_rwmutex_read_wait()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''rwmutex.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function acquires a read/write mutex for read. If successful, jobs on other CPUs can also acquire it for read, but no job will be able to acquire it for write while any read is under way. If job already holds RWMUTEX for read or for write the appropriate status code is returned, a system log entry made, and the job continues. It will not succeed while any job is waiting to obtain RWMUTEX for write, and will loop waiting for all pending writes on this RWMUTEX to complete.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Read wait on RWMUTEX.&lt;br /&gt;
 *&lt;br /&gt;
 * If successful jobs on other CPUs can also acquire it for read, but no job&lt;br /&gt;
 * will be able to acquire it for write while any read is under way.&lt;br /&gt;
 * If job already holds RWMUTEX for read or for write appropriate status code&lt;br /&gt;
 * is returned, a system log entry made, and the job continues.&lt;br /&gt;
 * Will not succeed while any job is waiting to obtain RWMUTEX for write,&lt;br /&gt;
 * will loop waiting for all pending writes on this RWMUTEX to complete.&lt;br /&gt;
 *&lt;br /&gt;
 * This should only be called after OCEOS scheduling has started.&lt;br /&gt;
 *&lt;br /&gt;
 * N.B.	The returned status code must be checked and appropriate action&lt;br /&gt;
 * 		taken.&lt;br /&gt;
 *&lt;br /&gt;
 * @param rwm_id    const U32_t  : value 0 to 62&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          WARN_RWMX_NOT_HIGHEST       Already holds a RWMUTEX higher in the RWMUTEX order&lt;br /&gt;
 *                                      (there then may be a risk of deadlock)&lt;br /&gt;
 *&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              RWMUTEX ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                RWMUTEX ID &amp;gt;= number of RWMUTEXs&lt;br /&gt;
 *          ERR_RWMX_CEILING_BAD        RWMUTEX ceiling not lower priority than job priority&lt;br /&gt;
 *          ERR_RWMX_ALREADY_HELD       RWMUTEX already held by this job&lt;br /&gt;
 *          ERR_RWMX_CPU_STACK_FULL     CPU priority ceiling stack full&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_rwmutex_read_wait(&lt;br /&gt;
    const U32_t rwm_id  // RWMUTEX ID, must be in range 0 to 62&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| rwm_id || U32_t rwmutex to be acquired for read (value 0 to 62)&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| WARN_RWMX_NOT_HIGHEST       || Already holds a RWMUTEX higher in the RWMUTEX order (deadlock risk)&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || RWMUTEX ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || RWMUTEX ID &amp;gt;= number of RWMUTEXs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_RWMX_CEILING_BAD        || RWMUTEX ceiling not lower priority than job priority&lt;br /&gt;
|-&lt;br /&gt;
| ERR_RWMX_ALREADY_HELD       || RWMUTEX already held by this job&lt;br /&gt;
|-&lt;br /&gt;
| ERR_RWMX_CPU_STACK_FULL     || CPU priority ceiling stack full&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Acquire read/write mutex rwm_1 for read&lt;br /&gt;
status = oceos_rwmutex_read_wait(rwm_1);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_rwmutex_write_wait()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''rwmutex.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function acquires the specified read/write mutex for write.&lt;br /&gt;
If successful, no other job can also obtain it for reading or for writing. Will not succeed while any other job has acquired RWMUTEX for write,&lt;br /&gt;
or any jobs have obtained RWMUTEX for read. Will then loop until the RWMUTEX is released and for its turn in the sequence of jobs that have tried to acquire the RWMUTEX for writing. If already holds the RWMUTEX for writing or reading an appropriate status code is returned, a system log entry made, and the job continues. While there are any outstanding attempts to obtain the RWMUTEX for write no job will be able to acquire it for reading.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Write wait on RWMUTEX.&lt;br /&gt;
 *&lt;br /&gt;
 * If successful no other job can also obtain it for reading or for writing.&lt;br /&gt;
 * Will not succeed while any other job has acquired RWMUTEX for write,&lt;br /&gt;
 * or any jobs have obtained RWMUTEX for read. Will then loop until the&lt;br /&gt;
 * RWMUTEX is released and for its turn in the sequence of jobs that have&lt;br /&gt;
 * tried to acquire the RWMUTEX for writing.&lt;br /&gt;
 * If already holds the RWMUTEX for writing or reading an appropriate status&lt;br /&gt;
 * code is returned, a system log entry made, and the job continues.&lt;br /&gt;
 * While there are any outstanding attempts to obtain the RWMUTEX for write&lt;br /&gt;
 * no job will be able to acquire it for reading.&lt;br /&gt;
 *&lt;br /&gt;
 * This should only be called after OCEOS scheduling has started.&lt;br /&gt;
 *&lt;br /&gt;
 * N.B.	The returned status code must be checked and appropriate action&lt;br /&gt;
 * 		taken.&lt;br /&gt;
 *&lt;br /&gt;
 * @param rwm_id     const U32_t  : value 0 to 62&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          WARN_RWMX_NOT_HIGHEST       Already holds a RWMUTEX higher in the RWMUTEX order&lt;br /&gt;
 *                                      (there then may be a risk of deadlock)&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              RWMUTEX ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                RWMUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
 *          ERR_RWMX_CEILING_BAD        RWMUTEX ceiling not lower priority than job priority&lt;br /&gt;
 *          ERR_RWMX_ALREADY_HELD       RWMUTEX already held by this job&lt;br /&gt;
 *          ERR_RWMX_CPU_STACK_FULL     CPU priority ceiling stack full&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_rwmutex_write_wait(&lt;br /&gt;
    const U32_t rwm_id  // RWMUTEX ID, must be in range 0 to 62&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| rwm_id || U32_t rwmutex to be acquired for write(value 0 to 62)&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| WARN_RWMX_NOT_HIGHEST       || Already holds a RWMUTEX higher in the RWMUTEX order (deadlock risk)&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || RWMUTEX ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || RWMUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_RWMX_CEILING_BAD        || RWMUTEX ceiling not lower priority than job priority&lt;br /&gt;
|-&lt;br /&gt;
| ERR_RWMX_ALREADY_HELD       || RWMUTEX already held by this job&lt;br /&gt;
|-&lt;br /&gt;
| ERR_RWMX_CPU_STACK_FULL     || CPU priority ceiling stack full&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Acquire read/write mutex rwm_1 for write&lt;br /&gt;
status = oceos_rwmutex_read_wait(rwm_1);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_rwmutex_signal()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''rwmutex.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function signals the specified read/write mutex.&lt;br /&gt;
It frees the RWMUTEX for use by other jobs, irrespective of whether the RWMUTEX is held for reading or for writing. If the RWMUTEX is not held by the job then it returns an appropriate status code. It does not take into account how many times a job has obtained the RWMUTEX for read or for write.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Signal a RWMUTEX&lt;br /&gt;
 *&lt;br /&gt;
 * Frees the RWMUTEX for use by other jobs, irrespective of whether&lt;br /&gt;
 * RWMUTEX is held for reading or for writing.&lt;br /&gt;
 * if the RWMUTEX is not held by the job returns an appropriate status code.&lt;br /&gt;
 * Does not take into account how many times a job has obtained the RWMUTEX&lt;br /&gt;
 * for read or for write.&lt;br /&gt;
 *&lt;br /&gt;
 * This should only be called after OCEOS scheduling has started.&lt;br /&gt;
 *&lt;br /&gt;
 * N.B. The returned status code must be checked and appropriate action taken.&lt;br /&gt;
 *&lt;br /&gt;
 * @param rwm_id    const U32_t  : value 0 to 62&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          WARN_RWMX_ALREADY_FREE      RWMUTEX is free already&lt;br /&gt;
 *&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              RWMUTEX ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                RWMUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
 *          ERR_RWMX_CEILING_BAD        RWMUTEX ceiling not lower priority than job priority&lt;br /&gt;
 *          ERR_RWMX_CPU_STACK_EMPTY    CPU priority ceiling stack empty&lt;br /&gt;
 *          ERR_RWMX_CEILING_INVALID    CPU current priority ceiling on the priority stack is invalid&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_rwmutex_signal(&lt;br /&gt;
    const U32_t rwm_id // RWMUTEX ID, must be in range 0 to 62&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| rwm_id || U32_t rwmutex to be signaled(value 0 to 62)&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| WARN_RWMX_ALREADY_FREE      || RWMUTEX is free already&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || RWMUTEX ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || RWMUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_RWMX_CEILING_BAD        || RWMUTEX ceiling not lower priority than job priority&lt;br /&gt;
|-&lt;br /&gt;
| ERR_RWMX_CPU_STACK_EMPTY    || CPU priority ceiling stack empty&lt;br /&gt;
|-&lt;br /&gt;
| ERR_RWMX_CEILING_INVALID    || CPU current priority ceiling on the priority stack is invalid&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Signal read/write mutex number rwm_4&lt;br /&gt;
status = oceos_rwmutex_signal(rwm_4);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_rwmutex_check_status()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''rwmutex.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function checks the status of a read/write mutex. The possible states are free, in-use for read, and in-use for write.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Check whether RWMUTEX is free&lt;br /&gt;
 *&lt;br /&gt;
 * @param rwm_id        must be in range 0 to 62&lt;br /&gt;
 * @param m_status      pointer to RWMUTEX status holder;&lt;br /&gt;
 *                      if return code OCEOS_SUCCESS RWMUTEX status:&lt;br /&gt;
 *                          0 =&amp;gt; Free for use&lt;br /&gt;
 *                          1 =&amp;gt; In use for read&lt;br /&gt;
 *                          2 =&amp;gt; In use for write&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              RWMUTEX ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                RWMUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
 *          ERR_RWMX_DATA_PTR_BAD       Pointer to RWMUTEX status return holder is null&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_rwmutex_check_status(&lt;br /&gt;
    const U32_t rwm_id, // RWMUTEX ID, must be in range 0 to 62&lt;br /&gt;
    U32_t *m_status&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| rwm_id || read/write mutex number in range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| m_status || U32_t pointer to RWMUTEX status holder (0 = free, 1 = in-use for read, 2 = in-use for write &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || RWMUTEX ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || RWMUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_RWMX_DATA_PTR_BAD       || Pointer to RWMUTEX status return holder is null&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, rwm_status;&lt;br /&gt;
...&lt;br /&gt;
// Check the status of read/write mutex rwm_2&lt;br /&gt;
status = oceos_rwmutex_check_status(rwm_2, &amp;amp;rwm_status);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_rwmutex_reading_count()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''rwmutex.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the current number of jobs holding a specified read/write mutex for read.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 *&lt;br /&gt;
 * Get current number of jobs holding RWMUTEX for read&lt;br /&gt;
 *&lt;br /&gt;
 * @param rwm_id    must be in range 0 to 62&lt;br /&gt;
 * @param m_count   pointer to RWMUTEX count holder&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              RWMUTEX ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                RWMUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
 *          ERR_RWMX_DATA_PTR_BAD       Pointer to RWMUTEX count return holder is null&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_rwmutex_reading_count(&lt;br /&gt;
    const U32_t rwm_id, // RWMUTEX ID, must be in range 0 to 62&lt;br /&gt;
    U32_t *m_count&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| rwm_id || U32 value of read/write mutex (in range 0 to 62)&lt;br /&gt;
|-&lt;br /&gt;
| m_count || U32_t pointer to read/write mutex count holder&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || RWMUTEX ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || RWMUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_RWMX_DATA_PTR_BAD       || Pointer to RWMUTEX count return holder is null&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, rwm_count;&lt;br /&gt;
...&lt;br /&gt;
// Get the number of jobs holding the read/write mutex rwm_2 for read&lt;br /&gt;
status = oceos_rwmutex_reading_count(rwm_2, &amp;amp;rwm_count);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_rwmutex_write_reqs_count()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''header.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the current number of write requests for the specified read/write mutex .&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Get current RWMUTEX write requests count&lt;br /&gt;
 *&lt;br /&gt;
 * @param rwm_id    must be in range 0 to 62&lt;br /&gt;
 * @param m_count   pointer to RWMUTEX count holder&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              RWMUTEX ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                RWMUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
 *          ERR_RWMX_DATA_PTR_BAD       Pointer to RWMUTEX count return holder is null&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_rwmutex_write_reqs_count(&lt;br /&gt;
    const U32_t rwm_id, // RWMUTEX ID, must be in range 0 to 62&lt;br /&gt;
    U32_t *m_count&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| rwm_id || U32_t value of read/write mutex (must be in range 0 to 62)&lt;br /&gt;
|-&lt;br /&gt;
| m_count || U32_t pointer to read/write mutex count holder&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || RWMUTEX ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || RWMUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_RWMX_DATA_PTR_BAD       || Pointer to RWMUTEX count return holder is null&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, rwm_count;&lt;br /&gt;
...&lt;br /&gt;
// Get the count of cuurent write requests for read/write mutex rwm_1&lt;br /&gt;
status = oceos_rwmutex_write_reqs_count(rwm_1, &amp;amp;rwm_count);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_rwmutex_writes_pending_count()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''rwmutex.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the current number of pending writes for the specified read/write mutex.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Get current RWMUTEX writes pending count&lt;br /&gt;
 *&lt;br /&gt;
 * @param rwm_id    must be in range 0 to 62&lt;br /&gt;
 * @param m_count   pointer to RWMUTEX count holder&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              RWMUTEX ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                RWMUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
 *          ERR_RWMX_DATA_PTR_BAD       Pointer to RWMUTEX pending count return holder is null&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_rwmutex_writes_pending_count(&lt;br /&gt;
    const U32_t rwm_id, // RWMUTEX ID, must be in range 0 to 62&lt;br /&gt;
    U32_t *m_count&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| rwm_id || U32_t value of read/write mutex (must be in range 0 to 62)&lt;br /&gt;
|-&lt;br /&gt;
| m_count || U32_t pointer to read/write mutex count holder&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || RWMUTEX ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || RWMUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_RWMX_DATA_PTR_BAD       || Pointer to RWMUTEX count return holder is null&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, rwm_count;&lt;br /&gt;
...&lt;br /&gt;
// Get the count of cuurent write requests for read/write mutex rwm_1&lt;br /&gt;
status = oceos_rwmutex_writes_pending_count(rwm_1, &amp;amp;rwm_count);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_rwmutex_holding()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''header.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the read/write mutexes currently held by this instance of this task (job).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Get RWMUTEXs currently held by this instance of the task (job)&lt;br /&gt;
 *&lt;br /&gt;
 * @param m_data    U64_t pointer, each bit indicating RWMUTEX held by current task&lt;br /&gt;
 *                          0 =&amp;gt; Not held by job&lt;br /&gt;
 *                          1 =&amp;gt; Held by job&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_RWMX_DATA_PTR_BAD       Pointer to RWMUTEX status return holder is null&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_rwmutex_holding(&lt;br /&gt;
    U64_t *m_data&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| m_data || U64_t pointer, each bit indicating RWMUTEX held by current task, 0 =&amp;gt; not held, 1 =&amp;gt; held &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_RWMX_DATA_PTR_BAD       || Pointer to RWMUTEX status return holder is null&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
U64_t rwm_held;&lt;br /&gt;
...&lt;br /&gt;
// Which read/write mutexes does this job hold&lt;br /&gt;
status = oceos_rwmutex_holding(&amp;amp;rwm_held);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Semaphores directives ==&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_sem_create()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''semaphore.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function creates a semaphore.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Create a counting semaphore&lt;br /&gt;
 *&lt;br /&gt;
 * @param sem_id            SEMAPHORE ID (from 0 to 62)&lt;br /&gt;
 * @param max_permits       number of max permits allowed for this SEMAPHORE, 1 to 4095&lt;br /&gt;
 * @param count_permits     starting number of permits available 0 to 4095&lt;br /&gt;
 * @param pending_q_size    MAX Number of tasks on SEMAPHORE pending queue 1 to 253&lt;br /&gt;
 * @param use_timeout       if TRUE, directive oceos_sem_wait_restart_timeout can be used&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_WRONG_CPU_CORE          Executing directive on wrong CPU&lt;br /&gt;
 *          ERR_WRONG_PHASE             Called before oceos_init() is done&lt;br /&gt;
 *          ERR_TOO_MANY                MAX number of SEMAPHOREs already created&lt;br /&gt;
 *          ERR_ID_INVALID              SEMAPHORE ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                SEMAPHORE ID &amp;gt;= number of SEMAPHOREs&lt;br /&gt;
 *          ERR_SM_ALREADY_ALLOCATED    SEMAPHORE ID already used&lt;br /&gt;
 *          ERR_SM_MAX_PERMIT_WRONG     MAX permits outside allowed range 1 to 4095&lt;br /&gt;
 *          ERR_SM_COUNT_PERMIT_WRONG   Count permits outside allowed range 0 to 4095&lt;br /&gt;
 *          ERR_SM_COUNT_PERMIT_INVALID Count permits is greater than MAX permits for this SEMAPHORE&lt;br /&gt;
 *          ERR_SM_PENQ_SIZE_WRONG      SEMAPHORE pending queue size outside allowed range 1 to 253&lt;br /&gt;
 *          ERR_SM_TA_MAX_NUM_REACHED   Number of timed actions exceeds MAX allowed 255,&lt;br /&gt;
 *                                      each task on SEMAPHORE pending queue is timed action&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_sem_create(&lt;br /&gt;
    sem_t sem_id,         // counting semaphore ID (MAX 63)&lt;br /&gt;
    U16_t max_permits,    // max number of permits (MAX 4095)&lt;br /&gt;
    U16_t count_permits,  // initial number of permits (MAX 4095)&lt;br /&gt;
    U8_t  pending_q_size, // max number of pending queue jobs (MAX 253)&lt;br /&gt;
    BOOLE_t use_timeout   // whether timeout is used in oceos_sem_wait_restart_timeout&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| sem_id || Semaphore ID to be created (from 0 to 62)&lt;br /&gt;
|-&lt;br /&gt;
| max_permits || number of max permits allowed for this semaphore, 1 to 4095&lt;br /&gt;
|-&lt;br /&gt;
| count_permits || starting number of permits available 0 to 4095&lt;br /&gt;
|-&lt;br /&gt;
| pending_q_size || Maximum Number of tasks on SEMAPHORE pending queue 1 to 253&lt;br /&gt;
|-&lt;br /&gt;
| use_timeout || if TRUE, directive oceos_sem_wait_restart_timeout can be used&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_CPU_CORE          || Executing directive on wrong CPU&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Called before oceos_init() is done&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TOO_MANY                || MAX number of SEMAPHOREs already created&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || SEMAPHORE ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || SEMAPHORE ID &amp;gt;= number of SEMAPHOREs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SM_ALREADY_ALLOCATED    || SEMAPHORE ID already used&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SM_MAX_PERMIT_WRONG     || MAX permits outside allowed range 1 to 4095&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SM_COUNT_PERMIT_WRONG   || Count permits outside allowed range 0 to 4095&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SM_COUNT_PERMIT_INVALID || Count permits is greater than MAX permits for this SEMAPHORE&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SM_PENQ_SIZE_WRONG      || SEMAPHORE pending queue size outside allowed range 1 to 253&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SM_TA_MAX_NUM_REACHED   || Number of timed actions exceeds MAX allowed 255&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, param;&lt;br /&gt;
...&lt;br /&gt;
// Create semaphore called s_audi with max permits of 1000, starting permits of zero, max of 10 tasks on pending queue, and no timeouts &lt;br /&gt;
status = oceos_sem_create(s_audi, 1000, 0, 10, FALSE);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_sem_signal()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''semaphore.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function signals a semaphore, increments its count and transfers pending jobs to the ready queue.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Signals a semaphore, increments and transfers pending jobs to ready queue&lt;br /&gt;
 *&lt;br /&gt;
 * @param sem_id counting SEM ID&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          WARN_JOB_NOT_GUARDED&lt;br /&gt;
 *&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              SEM ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                SEM ID &amp;gt;= number of SEMs&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to grab SEM guard&lt;br /&gt;
 *          ERR_TOO_MANY                SEM max permits count already reached&lt;br /&gt;
 *          ERR_SM_JOB_ID_WRONG         Job ID of the task on SEM pending queue is wrong&lt;br /&gt;
 *          ERR_TA_NOT_FOUND            Timed action index to be removed for job not found&lt;br /&gt;
 *          ERR_TA_START_FAILED         Timed action re-start failed after job remove from timed action queue&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_sem_signal(&lt;br /&gt;
    sem_t sem_id // counting SEM ID&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| sem_id || U32_t value of semaphore to be signalled (incremented)&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| WARN_JOB_NOT_GUARDED        || job not guarded, application should check system log&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || SEM ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || SEM ID &amp;gt;= number of SEMs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to grab SEM guard&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TOO_MANY                || SEM max permits count already reached&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SM_JOB_ID_WRONG         || Job ID of the task on SEM pending queue is wrong&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_NOT_FOUND            || Timed action index to be removed for job not found&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_START_FAILED         || Timed action re-start failed after job remove from timed action queue&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Signal s_audi semaphore (increment its count)&lt;br /&gt;
status = oceos_sem_signal(s_audi);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_sem_wait_continue()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''semaphore.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function decrements the available permits of a sempahore otherwise returns an unsuccessful status code.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Wait on semaphore,&lt;br /&gt;
 * decrement the number of available permits for semaphore,&lt;br /&gt;
 * if no permits continue and task should handle unsuccessful result&lt;br /&gt;
 *&lt;br /&gt;
 * @param sem_id SEM ID&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              SEM ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                SEM ID &amp;gt;= number of SEMs&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to grab SEM guard&lt;br /&gt;
 *          ERR_SM_NOT_AVAILABLE        No more permits available for this SEM&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_sem_wait_continue(&lt;br /&gt;
    sem_t sem_id // counting SEM ID&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| sem_id || U32_t value of semaphore to be decremented&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || SEM ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || SEM ID &amp;gt;= number of SEMs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to grab SEM guard&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SM_NOT_AVAILABLE        || No more permits available for this SEM&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Decrement available permits on semaphore s_1&lt;br /&gt;
status = oceos_sem_wait_continue(s_1);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_sem_wait_restart()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''semaphore.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function decrements the available permits of a sempahore and if none available, the job is put on the pending queue.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Waits on semaphore,&lt;br /&gt;
 * if fail, put job on pending queue and exit task&lt;br /&gt;
 *&lt;br /&gt;
 * @param sem_id SEM ID&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              SEM ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                SEM ID &amp;gt;= number of SEMs&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to grab SEM guard&lt;br /&gt;
 *          ERR_SM_J_START_FROM_TIMOUT  Task started from timeout already, SEM no permits available second time&lt;br /&gt;
 *          ERR_FAILED                  Should never return this&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_sem_wait_restart(&lt;br /&gt;
    sem_t sem_id  // counting SEM ID&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| sem_id || U32_t value of semaphore to be decremented&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || SEM ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || SEM ID &amp;gt;= number of SEMs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to grab SEM guard&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SM_J_START_FROM_TIMOUT  || Task started from timeout already, SEM no permits available second time&lt;br /&gt;
|-&lt;br /&gt;
| ERR_FAILED                  || Should never return this&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Decrement available permits on semaphore s_1 otherwise job is put on pending queue&lt;br /&gt;
status = oceos_sem_wait_restart(s_1);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_sem_wait_restart_timeout()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''semaphore.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function decrements the available permits of a sempahore and if none available, the job is put on the pending queue with a timeout enabled. The job is restarted either when a permit is available to be decremented or when the timeout has expired. In order to use this directive, semaphore must be created with flag use_timeout is set to TRUE.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Waits on semaphore,&lt;br /&gt;
 * if fail, put job on pending queue with optional timeout.&lt;br /&gt;
 * In order to use this directive, semaphore must be created with&lt;br /&gt;
 * flag use_timeout is set to TRUE&lt;br /&gt;
 *&lt;br /&gt;
 * @param sem_id         SEM ID&lt;br /&gt;
 * @param U64_t timeout  Restart time if no permits, 0 =&amp;gt; ignore&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_TA_NOT_INIT             Timed action intialisation is not done and tried to be used; or SEM created without timeouts&lt;br /&gt;
 *          ERR_ID_INVALID              SEM ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                SEM ID &amp;gt;= number of SEMs&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to grab SEM guard&lt;br /&gt;
 *          ERR_SM_J_START_FROM_TIMOUT  Task started from timeout already, SEM no permits available second time&lt;br /&gt;
 *          ERR_TOO_MANY                SEM pending queue is full&lt;br /&gt;
 *          ERR_FAILED                  Should never return this&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_sem_wait_restart_timeout(&lt;br /&gt;
    sem_t sem_id, // counting SEM ID&lt;br /&gt;
    U64_t timeout // timeout, restart time if no permits, 0 =&amp;gt; ignore&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| sem_id || U32_t value of semaphore to be decremented&lt;br /&gt;
|-&lt;br /&gt;
| timeout | U64_t timeout in time units. A value of 0 causes timeout to be ignored.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_NOT_INIT             || Timed action intialisation is not done and tried to be used; or SEM created without&lt;br /&gt;
timeouts&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || SEM ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || SEM ID &amp;gt;= number of SEMs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to grab SEM guard&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SM_J_START_FROM_TIMOUT  || Task started from timeout already, SEM no permits available second time&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TOO_MANY                || SEM pending queue is full&lt;br /&gt;
|-&lt;br /&gt;
| ERR_FAILED                  || Should never return this&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Decrement available permits on semaphore s_1 otherwise job is put on pending queue with timeout of 10,000 time units (usually usecs)&lt;br /&gt;
status = oceos_sem_wait_restart_timeout(s_1);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_sem_get_value()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''semaphore.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the number of available permits for the specified semaphore.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Returns number of available permits&lt;br /&gt;
 * for SEM ID&lt;br /&gt;
 *&lt;br /&gt;
 * @param sem_id        SEM id&lt;br /&gt;
 * @param s_permits     pointer to permits count holder&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              SEM ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                SEM ID &amp;gt;= number of SEMs&lt;br /&gt;
 *          ERR_SM_DATA_BAD             Data holder pointer is null&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_sem_get_value(&lt;br /&gt;
    sem_t sem_id,    // counting SEM ID&lt;br /&gt;
    U32_t *s_permits // pointer to permits count holder&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| sem_id || U32_t value of semaphore whose permit count is required&lt;br /&gt;
|-&lt;br /&gt;
| s_permits || U32_t pointer to permits count holder&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || SEM ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || SEM ID &amp;gt;= number of SEMs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SM_DATA_BAD             || Data holder pointer is null&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, permit_count;&lt;br /&gt;
...&lt;br /&gt;
// Get the available permits for semaphore s_1&lt;br /&gt;
status = oceos_sem_get_value(s_1, &amp;amp;permit_count);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_sem_penq_get_size()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''semaphore.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the number of jobs on the specified semaphore pending queue.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Returns number of jobs on semaphore pending queue&lt;br /&gt;
 * for semaphore ID&lt;br /&gt;
 *&lt;br /&gt;
 * @param sem_id    SEM id&lt;br /&gt;
 * @param s_size    pointer to pending queue size holder&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              SEM ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                SEM ID &amp;gt;= number of SEMs&lt;br /&gt;
 *          ERR_SM_DATA_BAD             Data holder pointer is null&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_sem_penq_get_size(&lt;br /&gt;
    sem_t sem_id,   // counting SEM ID&lt;br /&gt;
    U32_t *s_size   // pointer to pending queue size holder&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| sem_id || U32_t value of semaphore whose permit count is required&lt;br /&gt;
|-&lt;br /&gt;
| s_size || U32_t pointer to pending queue jobs count holder&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || SEM ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || SEM ID &amp;gt;= number of SEMs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SM_DATA_BAD             || Data holder pointer is null&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, job_count;&lt;br /&gt;
...&lt;br /&gt;
// Get the available permits for semaphore s_1&lt;br /&gt;
status = oceos_sem_penq_get_size(s_1, &amp;amp;job_count);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_sem_reset()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''semaphore.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function restores the permits to the original semaphore initial value and removes any jobs from the pending queue.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Restore permits to original value and&lt;br /&gt;
 * remove jobs from pending queue&lt;br /&gt;
 *&lt;br /&gt;
 * @param sem_id    SEM ID&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              SEM ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                SEM ID &amp;gt;= number of SEMs&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to grab SEM guard&lt;br /&gt;
 *          ERR_SM_JOB_ID_WRONG         Job ID of the task on SEM pending queue is wrong&lt;br /&gt;
 *          ERR_TA_NOT_FOUND            Timed action index to be removed for job not found&lt;br /&gt;
 *          ERR_TA_START_FAILED         Timed action re-start failed after job remove from timed action queue&lt;br /&gt;
 */&lt;br /&gt;
S32_t   oceos_sem_reset(&lt;br /&gt;
    sem_t sem_id   // counting SEM ID&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| sem_id || U32_t value of semaphore to be reset&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || SEM ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || SEM ID &amp;gt;= number of SEMs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to grab SEM guard&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SM_JOB_ID_WRONG         || Job ID of the task on SEM pending queue is wrong&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_NOT_FOUND            || Timed action index to be removed for job not found&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_START_FAILED         || Timed action re-start failed after job remove from timed action queue&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Reset semaphore s_1&lt;br /&gt;
status = oceos_sem_reset(s_1);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Data Queues ==&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_dataq_create()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''dataq.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function creates a data queue with the specified characteristics.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Create data queue&lt;br /&gt;
 * If use_timeout = TRUE, timed actions must be initialised&lt;br /&gt;
 *&lt;br /&gt;
 * @param dataq_id      data queue ID&lt;br /&gt;
 * @param dataq_size    data queue size&lt;br /&gt;
 * @param pen_q_size    pending jobs queue size&lt;br /&gt;
 * @param roll_over     whether to roll over when full&lt;br /&gt;
 * @param use_timeout   if TRUE, directive oceos_dataq_read_restart_timeout can be used&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_WRONG_CPU_CORE          Executing directive on wrong CPU&lt;br /&gt;
 *          ERR_WRONG_PHASE             Called before oceos_init() is done&lt;br /&gt;
 *          ERR_TOO_MANY                MAX number of DATAQs already created&lt;br /&gt;
 *          ERR_ID_INVALID              DATAQ ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                DATAQ ID &amp;gt;= number of DATAQs&lt;br /&gt;
 *          ERR_DQ_ALREADY_ALLOCATED    DATAQ ID already used&lt;br /&gt;
 *          ERR_DQ_SIZE_WRONG           DATAQ size outside allowed range 1 to 255&lt;br /&gt;
 *          ERR_DQ_PENQ_SIZE_WRONG      DATAQ pending queue size outside allowed range 1 to 253&lt;br /&gt;
 *          ERR_DQ_TA_MAX_NUM_REACHED   Number of timed actions exceeds MAX allowed 255,&lt;br /&gt;
 *                                      each task on DATAQ pending queue is timed action&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_dataq_create(&lt;br /&gt;
                         dataq_t dataq_id,    // data queue ID&lt;br /&gt;
                         U16_t dataq_size,    // data queue size&lt;br /&gt;
                         U16_t pen_q_size,    // pending jobs queue size&lt;br /&gt;
                         BOOLE_t roll_over,   // whether to roll over when full&lt;br /&gt;
                         BOOLE_t use_timeout  // whether timeout is used oceos_dataq_read_restart_timeout&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| dataq_id ||   dataq_t data queue ID (number between 0 and 62)&lt;br /&gt;
|-&lt;br /&gt;
| dataq_size ||   data queue size (max number of pointers than can be added to the queue)&lt;br /&gt;
|-&lt;br /&gt;
| pen_q_size ||   pending jobs queue size&lt;br /&gt;
|-&lt;br /&gt;
| roll_over ||    whether to roll over when full (0 =&amp;gt; disabled, 1 =&amp;gt; enabled)&lt;br /&gt;
|-&lt;br /&gt;
| use_timeout ||  if TRUE, directive oceos_dataq_read_restart_timeout can be used&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_CPU_CORE          || Executing directive on wrong CPU&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Called before oceos_init() is done&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TOO_MANY                || MAX number of DATAQs already created&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || DATAQ ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || DATAQ ID &amp;gt;= number of DATAQs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DQ_ALREADY_ALLOCATED    || DATAQ ID already used&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DQ_SIZE_WRONG           || DATAQ size outside allowed range 1 to 255&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DQ_PENQ_SIZE_WRONG      || DATAQ pending queue size outside allowed range 1 to 253&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DQ_TA_MAX_NUM_REACHED   || Number of timed actions exceeds MAX allowed 255, each task on DATAQ pending queue is timed action&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Create data queue d_3 with size 20, max pending jobs of 10, rollover enabled, timeouts disabled &lt;br /&gt;
status = oceos_dataq_create(d_3, 20, 10, 1, 0));&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_dataq_write()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''dataq.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function puts a non-null pointer on the specified data queue.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Puts pointer to the data on data queue.&lt;br /&gt;
 * Pointer to the data must not be NULL&lt;br /&gt;
 *&lt;br /&gt;
 * @param dataq_t dataq_id Data queue ID&lt;br /&gt;
 * @param void* data       Non-null pointer to data&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          WARN_DQ_NOW_FULL            Warning, DATAQ is full now&lt;br /&gt;
 *          WARN_JOB_NOT_GUARDED&lt;br /&gt;
 *&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              DATAQ ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                DATAQ ID &amp;gt;= number of DATAQs&lt;br /&gt;
 *          ERR_DQ_DATA_BAD             Data pointer is null&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to acquire guard&lt;br /&gt;
 *          ERR_TOO_MANY                DATAQ is full&lt;br /&gt;
 *          ERR_DQ_JOB_ID_WRONG         Job ID of the task on pending queue is wrong&lt;br /&gt;
 *          ERR_TA_NOT_FOUND            Timed action index to be removed for job not found&lt;br /&gt;
 *          ERR_TA_START_FAILED         Timed action re-start failed after job remove from timed action queue&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_dataq_write(&lt;br /&gt;
    dataq_t dataq_id, // data queue ID&lt;br /&gt;
    void *data        // non-null pointer to data&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| dataq_id || dataq_t with value of Data queue ID&lt;br /&gt;
|-&lt;br /&gt;
| ptr || void* pointer to application data (non-null pointer)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| WARN_DQ_NOW_FULL            || Warning, DATAQ is full now&lt;br /&gt;
|-&lt;br /&gt;
| WARN_JOB_NOT_GUARDED        || &lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || DATAQ ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || DATAQ ID &amp;gt;= number of DATAQs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DQ_DATA_BAD             || Data pointer is null&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to acquire guard&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TOO_MANY                || DATAQ is full&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DQ_JOB_ID_WRONG         || Job ID of the task on pending queue is wrong&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_NOT_FOUND            || Timed action index to be removed for job not found&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_START_FAILED         || Timed action re-start failed after job remove from timed action queue&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
char[100] message_in;&lt;br /&gt;
...&lt;br /&gt;
// Put pointer to message_in on data queue s_2 &lt;br /&gt;
status = oceos_dataq_write(s_2, (void *)message_in);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_dataq_read_continue()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''dataq.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns a pointer from the specified data queue.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Read data queue&lt;br /&gt;
 *&lt;br /&gt;
 * @param dataq_t dataq_id  Data queue ID&lt;br /&gt;
 * @param void*   data      Pointer to data&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              DATAQ ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                DATAQ ID &amp;gt;= number of DATAQs&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to acquire guard&lt;br /&gt;
 *          ERR_DQ_EMPTY                DATAQ empty(count zero)&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_dataq_read_continue(&lt;br /&gt;
    dataq_t dataq_id, // data queue ID&lt;br /&gt;
    void* *data        // return data&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Descriptionn&lt;br /&gt;
|-&lt;br /&gt;
| dataq_id || dataq_t with value of Data queue ID&lt;br /&gt;
|-&lt;br /&gt;
| ptr || void* pointer to store returned data queue pointer removed from the queue&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || DATAQ ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || DATAQ ID &amp;gt;= number of DATAQs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to acquire guard&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DQ_EMPTY                || DATAQ empty(count zero)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
char *data_ptr;&lt;br /&gt;
...&lt;br /&gt;
// Read pointer from data queue s_2 &lt;br /&gt;
status = oceos_dataq_read_continue(s_2, (void *)data_ptr);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_dataq_read_restart()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''dataq.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns a pointer from the specified data queue. If the queue is empty, the job is added top the dataq pending queue. The job will be restarted when data is available. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Read data queue next item.&lt;br /&gt;
 * If dataq is empty, task is put on pending Q for dataq and&lt;br /&gt;
 * restarted by oceos_dataq_write&lt;br /&gt;
 *&lt;br /&gt;
 * @param dataq_id Data queue ID&lt;br /&gt;
 * @param data     Pointer to return data&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              DATAQ ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                DATAQ ID &amp;gt;= number of DATAQs&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to acquire guard&lt;br /&gt;
 *          ERR_DQ_J_START_FROM_TIMOUT  Job started from timeout already, DATAQ empty second time&lt;br /&gt;
 *          ERR_FAILED                  Should never return this&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_dataq_read_restart(&lt;br /&gt;
    dataq_t dataq_id,    // data queue ID&lt;br /&gt;
    void* *data           // pointer to return data&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| dataq_id || dataq_t with value of Data queue ID&lt;br /&gt;
|-&lt;br /&gt;
| ptr || void* pointer to store returned data queue pointer removed from the queue&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || DATAQ ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || DATAQ ID &amp;gt;= number of DATAQs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to acquire guard&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DQ_J_START_FROM_TIMOUT  || Job started from timeout already, DATAQ empty second time&lt;br /&gt;
|-&lt;br /&gt;
| ERR_FAILED                  || Should never return this&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
char *data_ptr;&lt;br /&gt;
...&lt;br /&gt;
// Read pointer from data queue s_2 with restart when data is available&lt;br /&gt;
status = oceos_dataq_read_restart(s_2, (void *)data_ptr);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_dataq_read_restart_timeout()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''dataq.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns a pointer from the specified data queue. If the queue is empty, the job is added top the dataq pending queue. The job will be restarted either when data is available or the timeout has expired. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Read data queue next item.&lt;br /&gt;
 * If dataq is empty, task is put on pending Q for dataq and&lt;br /&gt;
 * restarted by oceos_dataq_write or by timeout if timeout != 0&lt;br /&gt;
 * In order to use this feature timed actions must be configured and&lt;br /&gt;
 * dataq created with use timeout set to true&lt;br /&gt;
 *&lt;br /&gt;
 * @param dataq_id          Data queue ID&lt;br /&gt;
 * @param data              Pointer to return data&lt;br /&gt;
 * @param timeout           Timeout, restart time if no entry, 0 =&amp;gt; ignore&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_TA_NOT_INIT             Timed action intialisation is not done and tried to be used; or DATAQ created without timeouts&lt;br /&gt;
 *          ERR_ID_INVALID              DATAQ ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                DATAQ ID &amp;gt;= number of DATAQs&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to acquire guard&lt;br /&gt;
 *          ERR_DQ_EMPTY                DATAQ empty(count zero)&lt;br /&gt;
 *          ERR_DQ_J_START_FROM_TIMOUT  Job started from timeout already, DATAQ empty second time&lt;br /&gt;
 *          ERR_TOO_MANY                DATAQ pending queue is full&lt;br /&gt;
 *          ERR_FAILED                  Should never return this&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_dataq_read_restart_timeout(&lt;br /&gt;
    dataq_t dataq_id,   // data queue ID&lt;br /&gt;
    void* *data,         // Pointer to return data&lt;br /&gt;
    U64_t timeout       // timeout, restart time if no entry, 0 =&amp;gt; ignore&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| dataq_id || dataq_t with value of Data queue ID&lt;br /&gt;
|-&lt;br /&gt;
| ptr || void* pointer to store returned data queue pointer removed from the queue&lt;br /&gt;
|-&lt;br /&gt;
| timeout || U64_t containing timeout value, restart time if no entry, 0 =&amp;gt; ignore&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_NOT_INIT             || Timed action intialisation is not done and tried to be used; or DATAQ created without timeouts&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || DATAQ ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || DATAQ ID &amp;gt;= number of DATAQs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to acquire guard&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DQ_EMPTY                || DATAQ empty(count zero)&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DQ_J_START_FROM_TIMOUT  || Job started from timeout already, DATAQ empty second time&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TOO_MANY                || DATAQ pending queue is full&lt;br /&gt;
|-&lt;br /&gt;
| ERR_FAILED                  || Should never return this&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
char *data_ptr;&lt;br /&gt;
...&lt;br /&gt;
// Read pointer from data queue s_2 with timeout after 10,000 time units if no data is available&lt;br /&gt;
status = oceos_dataq_read_restart_timeout(s_2, (void *)data_ptr, 10000ull);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_dataq_get_size()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''dataq.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the number of items on the specified data queue.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Returns number of items on the data queue with ID&lt;br /&gt;
 *&lt;br /&gt;
 * @param dataq_id   DATAQ Id&lt;br /&gt;
 * @param d_size     Pointer to size holder&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              DATAQ ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                DATAQ ID &amp;gt;= number of DATAQs&lt;br /&gt;
 *          ERR_DQ_DATA_BAD             DATAQ size holder pointer is null&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_dataq_get_size(&lt;br /&gt;
    dataq_t dataq_id,   // data queue ID&lt;br /&gt;
    U32_t *d_size&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| dataq_id ||  dataq_t with the ID of the data queue (value between 0 and 62)&lt;br /&gt;
|-&lt;br /&gt;
| d_size || U32_t *d_size pointer to the variable to store the size&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || DATAQ ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || DATAQ ID &amp;gt;= number of DATAQs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DQ_DATA_BAD             || DATAQ size holder pointer is null&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, d_size;&lt;br /&gt;
...&lt;br /&gt;
// Get the number of entries on data queue d_0&lt;br /&gt;
status = oceos_dataq_get_size(d_0, &amp;amp;d_size);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_dataq_penq_get_size()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''dataq.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns number of jobs on the specified data queue pending job's queue.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Returns number of jobs on the dataq pending job's queue&lt;br /&gt;
 *&lt;br /&gt;
 * @param dataq_id  DATAQ Id&lt;br /&gt;
 * @param d_size    Pointer to pending queue size holder&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              DATAQ ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                DATAQ ID &amp;gt;= number of DATAQs&lt;br /&gt;
 *          ERR_DQ_DATA_BAD             DATAQ pending size holder pointer is null&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_dataq_penq_get_size(&lt;br /&gt;
    dataq_t dataq_id,&lt;br /&gt;
    U32_t *d_size&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| dataq_id ||  dataq_t with the ID of the data queue (value between 0 and 62)&lt;br /&gt;
|-&lt;br /&gt;
| d_jobs || U32_t *d_jobs pointer to the variable to store the number of jobs on the pending queue&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || DATAQ ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || DATAQ ID &amp;gt;= number of DATAQs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DQ_DATA_BAD             || DATAQ pending size holder pointer is null&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, d_jobs;&lt;br /&gt;
...&lt;br /&gt;
// Get the number of jobs the the pending jubs queue for data queue d_1&lt;br /&gt;
status = oceos_dataq_penq_get_size(d_1, &amp;amp;d_jobs);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_dataq_clear()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''dataq.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function clears the specified data queue including pending jobs for that queue.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Clears data queue and&lt;br /&gt;
 * frees tasks on pending queue&lt;br /&gt;
 *&lt;br /&gt;
 * @param dataq_t dataq_id Data queue ID&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              DATAQ ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                DATAQ ID &amp;gt;= number of DATAQs&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to acquire guard&lt;br /&gt;
 *          ERR_DQ_JOB_ID_WRONG         Job ID of the task on DATAQ pending queue is wrong&lt;br /&gt;
 *          ERR_TA_NOT_FOUND            Timed action index to be removed for job not found&lt;br /&gt;
 *          ERR_TA_START_FAILED         Timed action re-start failed after job remove from timed action queue&lt;br /&gt;
 */&lt;br /&gt;
S32_t  oceos_dataq_clear(&lt;br /&gt;
    dataq_t dataq_id    // data queue ID&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| dataq_id ||  dataq_t with the ID of the data queue to be cleared (value between 0 and 62)&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || DATAQ ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || DATAQ ID &amp;gt;= number of DATAQs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to acquire guard&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DQ_JOB_ID_WRONG         || Job ID of the task on DATAQ pending queue is wrong&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_NOT_FOUND            || Timed action index to be removed for job not found&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_START_FAILED         || Timed action re-start failed after job remove from timed action queue&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Clear data queue d_1&lt;br /&gt;
status = oceos_dataq_penq_get_size(d_1);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Timed Actions ==&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_timed_output_add()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''timed_action.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function adds a timed action to the timed action queue. It writes a value to an address at a specified system time. An optional mask can be applied so that only those bits are changed.&lt;br /&gt;
The action types are WRITE_ACTION, RMW_ACTION. WRITE_ACTION writes the value to the address. RMW_ACTION reads the values at the address and modifies the bits specified by the mask and value.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Add output action to timed actions queue :&lt;br /&gt;
 *  1. Create timed output action&lt;br /&gt;
 *  2. Stop timer&lt;br /&gt;
 *  3. Add action to action_array&lt;br /&gt;
 *  4. Start timer or execute if time is right&lt;br /&gt;
 *&lt;br /&gt;
 * Returns timed action ID that can be used later to remove&lt;br /&gt;
 * if need by oceos_timed_output_remove&lt;br /&gt;
 *&lt;br /&gt;
 * @param enum ACTION_TYPE action_type  Action type&lt;br /&gt;
 * @param U64_t act_time                System time at which action should be done&lt;br /&gt;
 * @param U32_t before_time             Forward tolerance for time&lt;br /&gt;
 * @param U32_t after_time              Backward tolerance for time&lt;br /&gt;
 * @param adrs_t address                Output address&lt;br /&gt;
 * @param U32_t value                   Output value&lt;br /&gt;
 * @param U32_t mask                    Output mask&lt;br /&gt;
 * @param U32_ *ta_index                Pointer to store timed action index&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_TA_NOT_INIT             Timed action inialisation is not done and tried to be used&lt;br /&gt;
 *          ERR_TA_PTR_BAD              Timed action pointer is null&lt;br /&gt;
 *          ERR_TA_TYPE_WRONG           Timed action type is wrong&lt;br /&gt;
 *          ERR_TOO_LATE                Timed action time is too late&lt;br /&gt;
 *          ERR_SYS_BUSY                Timed action guard failed to acquire&lt;br /&gt;
 *          ERR_TA_Q_FULL               Timed action queue is full&lt;br /&gt;
 *          ERR_TA_START_FAILED         Timed action execute failed; See log&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_timed_output_add(&lt;br /&gt;
    const enum ACTION_TYPE action_type,// Action type&lt;br /&gt;
    U64_t act_time,                    // system time at which action should be done&lt;br /&gt;
    U32_t before_time,                 // forward tolerance for time&lt;br /&gt;
    U32_t after_time,                  // backward tolerance for time&lt;br /&gt;
    const adrs_t address,              // output address&lt;br /&gt;
    const U32_t value,                 // output value&lt;br /&gt;
    const U32_t mask,                  // output mask&lt;br /&gt;
    U32_t *ta_index                    // Pointer to store timed action index&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| enum ACTION_TYPE action_type  || Action type&lt;br /&gt;
|-&lt;br /&gt;
| U64_t act_time                || System time at which action should be done&lt;br /&gt;
|-&lt;br /&gt;
| U32_t before_time             || Forward tolerance for time&lt;br /&gt;
|-&lt;br /&gt;
| U32_t after_time              || Backward tolerance for time&lt;br /&gt;
|-&lt;br /&gt;
| adrs_t address                || Output address&lt;br /&gt;
|-&lt;br /&gt;
| U32_t value                   || Output value&lt;br /&gt;
|-&lt;br /&gt;
| U32_t mask                    || Output mask&lt;br /&gt;
|-&lt;br /&gt;
| U32_ *ta_index                || Pointer to store timed action index&lt;br /&gt;
|-&lt;br /&gt;
| param || parameter to function&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_NOT_INIT             || Timed action inialisation is not done and tried to be used&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_PTR_BAD              || Timed action pointer is null&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_TYPE_WRONG           || Timed action type is wrong&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TOO_LATE                || Timed action time is too late&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Timed action guard failed to acquire&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_Q_FULL               || Timed action queue is full&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_START_FAILED         || Timed action execute failed; See log&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
#define OUTPUT_TIMED_VAL    0xDEADBEEF&lt;br /&gt;
#define OUTPUT_TIMED_MASK   0x1000001&lt;br /&gt;
#define OUTPUT_TIME         0xfffff&lt;br /&gt;
#define OUTPUT_TIME_FW      0x1000&lt;br /&gt;
#define OUTPUT_TIME_BW      0x1000&lt;br /&gt;
&lt;br /&gt;
static U32_t test_data[16] = { 0 };&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Write OUTPUT_TIMED_VAL to test_data[0] at 0xfffff time units from now with a tolerance of 0x1000 before and after the specified time   &lt;br /&gt;
status = oceos_timed_output_add(&lt;br /&gt;
                                       WRITE_ACTION,&lt;br /&gt;
                                       OUTPUT_TIME,&lt;br /&gt;
                                       OUTPUT_TIME_FW,&lt;br /&gt;
                                       OUTPUT_TIME_BW,&lt;br /&gt;
                                       (adrs_t) &amp;amp;test_data[0],&lt;br /&gt;
                                       OUTPUT_TIMED_VAL,&lt;br /&gt;
                                       0,&lt;br /&gt;
                                       &amp;amp;timed_action_index));&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_timed_jobs_number()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''timed_action.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the number of jobs on the timed actions queue.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Get number of Jobs (request to start the task) waiting on timed action queue.&lt;br /&gt;
 * These jobs are added by oceos_task_timed_start() or&lt;br /&gt;
 * oceos_dataq_read_restart_timeout when data is not available (NULL) or&lt;br /&gt;
 * oceos_sem_wait_restart_timeout when counting semaphore is 0&lt;br /&gt;
 *&lt;br /&gt;
 * @param total_jobs    Pointer to store total jobs number waiting on timed action Q&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_TA_NOT_INIT             Timed action inialisation is not done and tried to be used&lt;br /&gt;
 *          ERR_TA_PTR_BAD              Timed action pointer is null&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_timed_jobs_number(U32_t *total_jobs);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| total_jobs || s32_t pointer to store total jobs number waiting on timed action Q&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_NOT_INIT             || Timed action inialisation is not done and tried to be used&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_PTR_BAD              || Timed action pointer is null&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, no_of_jobs;&lt;br /&gt;
...&lt;br /&gt;
// Get the number of jobs on the timed actions queue&lt;br /&gt;
status = oceos_timed_jobs_number(&amp;amp;no_of_jobs);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_timed_jobs_remove()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''timed_action.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function removes the specified timed action from the queue.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Remove job from timed action queue&lt;br /&gt;
 * When task started using oceos_task_timed_start(),&lt;br /&gt;
 * this directive requires pointer to store ID&lt;br /&gt;
 * of job that put on the timed action queue.&lt;br /&gt;
 * This job can be removed later using this directive and stored job ID.&lt;br /&gt;
 *&lt;br /&gt;
 * @param U32_t job_id  Job ID&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_TA_NOT_INIT             Timed action intialisation is not done and tried to be used&lt;br /&gt;
 *          ERR_TA_PTR_BAD              Timed action pointer corrupt&lt;br /&gt;
 *          ERR_ID_WRONG                Job ID is wrong&lt;br /&gt;
 *          ERR_TA_NOT_FOUND            Timed action ID not found for action with job_id or removed already&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to acquire timed action guard&lt;br /&gt;
 *          WARN_TA_Q_EMPTY             Timed action queue is empty&lt;br /&gt;
 *          ERR_TA_START_FAILED         Timed action execute failed; See log&lt;br /&gt;
 */&lt;br /&gt;
S32_t   oceos_timed_jobs_remove(&lt;br /&gt;
    U32_t job_id                             // Job ID&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| job_id || U32_t Job ID to be removed from the timed actions queue&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_NOT_INIT             || Timed action intialisation is not done and tried to be used&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_PTR_BAD              || Timed action pointer corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || Job ID is wrong&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_NOT_FOUND            || Timed action ID not found for action with job_id or removed already&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to acquire timed action guard&lt;br /&gt;
|-&lt;br /&gt;
| WARN_TA_Q_EMPTY             || Timed action queue is empty&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_START_FAILED         || Timed action execute failed; See log&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, job_id;&lt;br /&gt;
...&lt;br /&gt;
// Remove job_id from the timed actions queue&lt;br /&gt;
status = oceos_timed_jobs_remove(job_id);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_timed_jobs_reset()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''timed_action.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function removes all jobs from timed actions queue.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Remove all jobs (requests to start a task) from timed actions queue&lt;br /&gt;
 * These jobs were added by oceos_task_timed_start() or&lt;br /&gt;
 * oceos_dataq_read_restart_timeout when data is not available (NULL) or&lt;br /&gt;
 * oceos_sem_wait_restart_timeout when counting semaphore is 0&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_TA_NOT_INIT             Timed action intialisation is not done and tried to be used&lt;br /&gt;
 *          ERR_TA_PTR_BAD              Timed action pointer is null&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to acquire timed action guard&lt;br /&gt;
 *          WARN_TA_Q_EMPTY             Timed action queue is empty&lt;br /&gt;
 *          ERR_TA_NOT_FOUND            Timed action index not found&lt;br /&gt;
 *          ERR_TA_START_FAILED         Timed action execute failed; See log&lt;br /&gt;
 */&lt;br /&gt;
S32_t   oceos_timed_jobs_reset(void);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
There are no input parameters to this function&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_NOT_INIT             || Timed action intialisation is not done and tried to be used&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_PTR_BAD              || Timed action pointer is null&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to acquire timed action guard&lt;br /&gt;
|-&lt;br /&gt;
| WARN_TA_Q_EMPTY             || Timed action queue is empty&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_NOT_FOUND            || Timed action index not found&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_START_FAILED         || Timed action execute failed; See log&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Remove all jobs from the timed actions queue&lt;br /&gt;
status = oceos_timed_jobs_reset(job_id);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_timed_output_remove()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''timed_action.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function removes the specified timed output action from timed actions queue.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Remove timed output action from timed actions queue.&lt;br /&gt;
 * When action is created, action index should be stored&lt;br /&gt;
 * to remove if need&lt;br /&gt;
 *&lt;br /&gt;
 * @param action_index&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_TA_NOT_INIT             Timed action intialisation is not done and tried to be used&lt;br /&gt;
 *          ERR_TA_PTR_BAD              Timed action pointer is null&lt;br /&gt;
 *          ERR_ID_WRONG                Timed action id is wrong&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to acquire timed action guard&lt;br /&gt;
 *          ERR_TA_NOT_FOUND            Timed action index not found&lt;br /&gt;
 *          ERR_TA_START_FAILED         Timed action execute failed&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_timed_output_remove(&lt;br /&gt;
    const U8_t  action_index    // Index in action array, returned when action was created&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| action_index|| S32_t specifying the timed output action index returned when the timed output was added.&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| Error bit  || Description&lt;br /&gt;
|&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_NOT_INIT             || Timed action intialisation is not done and tried to be used&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_PTR_BAD              || Timed action pointer is null&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || Timed action id is wrong&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to acquire timed action guard&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_NOT_FOUND            || Timed action index not found&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_START_FAILED         || Timed action execute failed&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
U8_t action_index;&lt;br /&gt;
...&lt;br /&gt;
// Remove timed output with specified action_index&lt;br /&gt;
status = oceos_timed_output_remove(action_index);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_timed_output_reset()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''timed_action.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function removes all timed output actions from timed actions queue.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Remove all timed output actions from timed actions queue&lt;br /&gt;
 * These timed output actions were created by oceos_timed_output_add&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_TA_NOT_INIT             Timed action intialisation is not done and tried to be used&lt;br /&gt;
 *          ERR_TA_PTR_BAD              Timed action pointer is null&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to acquire timed action guard&lt;br /&gt;
 *          WARN_TA_Q_EMPTY             Timed action queue is empty&lt;br /&gt;
 *          ERR_TA_NOT_FOUND            Timed action index not found&lt;br /&gt;
 *          ERR_TA_START_FAILED         Timed action execute failed; See log&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_timed_output_reset(void);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
There are no input parameters to this function. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| Error bit  || Description&lt;br /&gt;
|&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_NOT_INIT             || Timed action intialisation is not done and tried to be used&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_PTR_BAD              || Timed action pointer is null&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to acquire timed action guard&lt;br /&gt;
|-&lt;br /&gt;
| WARN_TA_Q_EMPTY             || Timed action queue is empty&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_NOT_FOUND            || Timed action index not found&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_START_FAILED         || Timed action execute failed; See log&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Remove all timed outputs from the timed actions queue&lt;br /&gt;
status = oceos_timed_output_reset();&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Logging directives ==&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;Introduction&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Log Area Features  (for details of other areas see oceos_areas.h)&lt;br /&gt;
&lt;br /&gt;
The system log area holds the system log and the records of the present and previous values of the system state variable.&lt;br /&gt;
&lt;br /&gt;
It is set up initially as an array of 32-bit words that starts at a 32-bit aligned address provided by the application developer.&lt;br /&gt;
&lt;br /&gt;
It is recommended that this address be in non-volatile RAM memory if this is available to allow information be preserved across power-up cycles.&lt;br /&gt;
&lt;br /&gt;
OCEOS preserves log area information across resets as far as possible.&lt;br /&gt;
&lt;br /&gt;
The system log itself is a circular buffer of struct log entry. Older entries are overwritten by new entries once all entries are in use.&lt;br /&gt;
&lt;br /&gt;
The application developer can specify a function to be called when 3/4 of log entries are in use. This function is called again only after 3/4 of log entries have been read and the log has again become 3/4 full.&lt;br /&gt;
&lt;br /&gt;
The read and write indices are stored in the log area and if equal indicate that the log is empty.&lt;br /&gt;
&lt;br /&gt;
As with other OCEOS data areas, the log area starts with a header&lt;br /&gt;
*a 32-bit word holding a constant OCEOS_VERSION&lt;br /&gt;
*a 32-bit word holding the log area size in 32-bit words&lt;br /&gt;
*a 32-bit word, the system status variable&lt;br /&gt;
*a 32-bit word, the system status mask&lt;br /&gt;
*a 32-bit word, the accumulated system status&lt;br /&gt;
*a 32-bit word, the previous system status mask&lt;br /&gt;
*a 32-bit word, the log control, that gives whether the log full function was called&lt;br /&gt;
*the read index&lt;br /&gt;
*the write index&lt;br /&gt;
*an array of struct log_entry making up the system log itself&lt;br /&gt;
*ending with a 32-bit constant END_SENTINEL&lt;br /&gt;
&lt;br /&gt;
The system fixed meta structure at sysMetaPtr provides&lt;br /&gt;
&lt;br /&gt;
*system_log_ptr      the start address of the log area&lt;br /&gt;
*logEntries          the number of log entries&lt;br /&gt;
*logCreated          flag indicating log was created successfully&lt;br /&gt;
*logFullFunction     user defined function, called when the log becomes 3/4 full (or NULL if not used)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Log Entry Types and Structure'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/*****************************************************************************&lt;br /&gt;
 * LOG ENTRY TYPES&lt;br /&gt;
 *&lt;br /&gt;
 * A log entry type is an 8-bit number.&lt;br /&gt;
 * Values from 0 to 127 can be defined by the application.&lt;br /&gt;
 * Values from 128 to 255 are used by OCEOS as below.&lt;br /&gt;
 *&lt;br /&gt;
 *&lt;br /&gt;
 * NOTE: Add new log types at the end for backward compatibility&lt;br /&gt;
 */&lt;br /&gt;
enum LOG_ENTRY_TYPE{&lt;br /&gt;
  LOG_SYS_OK = 0x80U,&lt;br /&gt;
  LOG_OCEOS_ABORT,				// when exiting from oceos_start&lt;br /&gt;
  LOG_LOG_NOT_VALID_ENTRY,		// used to initialise log and when log empty&lt;br /&gt;
  LOG_INIT_TASK_START_FAIL,		// initial task passed to oceos_start failed&lt;br /&gt;
  LOG_DEADLINE_MISSED,			// task deadline missed&lt;br /&gt;
  LOG_JOB_NOT_ACTIVE,			// cpu_terminate but job not active, absurd&lt;br /&gt;
  LOG_JOB_NOT_FREE,				// job guarded but not free&lt;br /&gt;
  LOG_JOBS_INC_FAILED, 			// pending jobs increment failed&lt;br /&gt;
  LOG_JOB_NOT_GUARDED,			// paranoia&lt;br /&gt;
  LOG_CS_LOG_SPIN_FAIL,			// oceos_CPU_sleep, trying to update CS log&lt;br /&gt;
  LOG_MUTEX_ALREADY_HELD,		// oceos_mutex_wait, code returned, not needed&lt;br /&gt;
  LOG_MUTEX_INCORRECT_ORDER,	// oceos_mutex_wait&lt;br /&gt;
  LOG_MUTEX_EXIT_HOLDING,		// task exits holding one or more mutexes&lt;br /&gt;
  LOG_MUTEX_EXIT_NONE,			// __oceos_tasks_remove_mutexes called but no mutex held&lt;br /&gt;
  LOG_SEMAPHORE_PENDING_REMOVE_FAIL,	// timed_action.c&lt;br /&gt;
  LOG_SEMAPHORE_PENDING_QUEUE_FULL,		// __oceos_semaphore_add_pend&lt;br /&gt;
  LOG_SEMAPHORE_SPIN_FAILED,			// trying to access semaphore&lt;br /&gt;
  LOG_DATAQ_PENDING_QUEUE_FULL,&lt;br /&gt;
  LOG_DATAQ_PENDING_REMOVE_FAIL,&lt;br /&gt;
  LOG_DATAQ_SPIN_FAILED,&lt;br /&gt;
  LOG_TIMED_ACTION_TIMER_NULL,&lt;br /&gt;
  LOG_TIMED_ACTION_INVALID,&lt;br /&gt;
  LOG_TIMED_ACTION_BAD_INDEX,&lt;br /&gt;
  LOG_TIMED_ACTION_MISSED,&lt;br /&gt;
  LOG_TIMED_ACTION_Q_EMPTY,&lt;br /&gt;
  LOG_TIMED_ACTION_REMOVE_FAIL,&lt;br /&gt;
  LOG_TIMED_ACTION_BAD_JOB_ID,&lt;br /&gt;
  LOG_TIMED_Q_SPIN_FAIL,&lt;br /&gt;
  LOG_SYSTEM_ERROR,&lt;br /&gt;
  LOG_ATOMICINC_FAILED,&lt;br /&gt;
  LOG_PENDING_PRI_UPDATE_FAILED,&lt;br /&gt;
  LOG_KILL_TASK_INVALID_ID,      // Tried to kill task with invalid ID&lt;br /&gt;
  LOG_OCEOS_EXIT_REQUEST,         // oceos_exit command was called&lt;br /&gt;
  LOG_RWMUTEX_NOT_RETURNED,&lt;br /&gt;
  LOG_RWMUTEX_NOT_HIGHEST&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
/*****************************************************************************&lt;br /&gt;
 * Structures&lt;br /&gt;
 */&lt;br /&gt;
/**&lt;br /&gt;
 * Log entry structure&lt;br /&gt;
 */&lt;br /&gt;
struct log_entry{&lt;br /&gt;
  U64_t             time64;&lt;br /&gt;
&lt;br /&gt;
  unsigned int      entry_cpu          :8;&lt;br /&gt;
  unsigned int      entry_type         :8;&lt;br /&gt;
  unsigned int      entry_note         :16;	// not used at present&lt;br /&gt;
&lt;br /&gt;
  U32_t             entry_comment;&lt;br /&gt;
}__attribute__ ((aligned (8)));&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_log_add_entry()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''system_log.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function adds an entry to the log. The entry overwrites the oldest unread entry if the log is full.&lt;br /&gt;
Custom log entries can be added to enum LOG_ENTRY from 0 to 128.&lt;br /&gt;
The indices are incremented in a circular fashion. If the write index reaches the read_index the read index is moved on, as read and write indices equal would indicate an empty log.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Add an entry to the log.&lt;br /&gt;
 * this overwrites the oldest unread entry if the log is full.&lt;br /&gt;
 * Custom log entries can be added to enum LOG_ENTRY from 0 to 128&lt;br /&gt;
 *&lt;br /&gt;
 * N.B. The indices are incremented in a circular fashion.&lt;br /&gt;
 *      If the write index reaches the read_index the read index is moved on,&lt;br /&gt;
 *      as read and write indices equal would indicate an empty log.&lt;br /&gt;
 *&lt;br /&gt;
 * @param type  enum LOG_ENTRY_TYPE&lt;br /&gt;
 * @param info  extra information to be logged&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_LOG_CORRUPT         System Log area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Log directive called in wrong phase; can be used after oceos_init() called&lt;br /&gt;
 *          ERR_ID_INVALID              Log type invalid&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to acquire log guard&lt;br /&gt;
 *          ERR_LOG_INDEX_WRONG         Read/write log index is wrong&lt;br /&gt;
 */&lt;br /&gt;
S32_t   oceos_log_add_entry(&lt;br /&gt;
    enum LOG_ENTRY_TYPE type,   // 8 bits enum LOG_ENTRY_TYPE&lt;br /&gt;
    const U32_t        info     // information&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| enum LOG_ENTRY_TYPE || Log entry type (see previous section for a list)&lt;br /&gt;
|-&lt;br /&gt;
| info | U32_t with the log information&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit  !! Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_LOG_CORRUPT         || System Log area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Log directive called in wrong phase; can be used after oceos_init() called&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || Log type invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to acquire log guard&lt;br /&gt;
|-&lt;br /&gt;
| ERR_LOG_INDEX_WRONG         || Read/write log index is wrong&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, info;&lt;br /&gt;
...&lt;br /&gt;
// Log LOG_APP_COMMS__ERROR (defined in enum LOG_ENTRY_TYPE) and info with more details&lt;br /&gt;
status = oceos_log_add_entry(LOG_APP_COMMS__ERROR, info);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_log_get_indexed_entry()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''system_log.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the entry at the specified position in the log. The entry is not removed and the log and log indices are not changed.&lt;br /&gt;
One use of this function is to allow the log be examined after a reset.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Returns the entry at the specified position in the log.&lt;br /&gt;
 * The entry is not removed and the log and log indices are not changed.&lt;br /&gt;
 * (intended to allow the log be examined for example after reset)&lt;br /&gt;
 *&lt;br /&gt;
 * @param index         position in the log&lt;br /&gt;
 * @param outputPtr     pointer to return log entry&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_LOG_CORRUPT         System Log area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Log directive called in wrong phase; can be used after oceos_init() called&lt;br /&gt;
 *          ERR_LOG_INDEX_WRONG         Read log index is wrong&lt;br /&gt;
 *          ERR_LOG_DATA_PTR_BAD        Data holder pointer is null&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_log_get_indexed_entry(&lt;br /&gt;
    const unsigned int index,&lt;br /&gt;
    struct log_entry * const outputPtr&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| index || U32_t with position in the log&lt;br /&gt;
|-&lt;br /&gt;
| outputPtr || pointer to struct log_entry to hold the returned entry&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit  !! Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_LOG_CORRUPT         || System Log area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Log directive called in wrong phase; can be used after oceos_init() called&lt;br /&gt;
|-&lt;br /&gt;
| ERR_LOG_INDEX_WRONG         || Read log index is wrong&lt;br /&gt;
|-&lt;br /&gt;
| ERR_LOG_DATA_PTR_BAD        || Data holder pointer is null&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, index;&lt;br /&gt;
struct log_entry store_entry;&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
// Read log_entry at specified index into outputPtr&lt;br /&gt;
status = oceos_log_get_indexed_entry(index, &amp;amp;store_entry);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_log_remove_entry()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''system_log.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function reads and removes the oldest unread log entry. &lt;br /&gt;
If the log is not empty use the entry at the read index to update the value at the output pointer, returning OCEOS_SUCCESS.&lt;br /&gt;
If outputPtr is NULL, entry is removed but no returned.&lt;br /&gt;
If the log is empty, set the value at the output pointer to LOG_LOG_NOT_VALID_ENTRY and return ERR_LOG_EMPTY.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Read and remove the oldest unread log entry&lt;br /&gt;
 *&lt;br /&gt;
 * If the log is not empty use the entry at the read index to update the value&lt;br /&gt;
 * at the output pointer, returning OCEOS_SUCCESS.&lt;br /&gt;
 *&lt;br /&gt;
 * If outputPtr is NULL, entry is removed but no returned&lt;br /&gt;
 *&lt;br /&gt;
 * If the log is empty, set the value at the output pointer to LOG_LOG_NOT_VALID_ENTRY&lt;br /&gt;
 * and return ERR_LOG_EMPTY&lt;br /&gt;
 *&lt;br /&gt;
 * @param outputPtr   pointer to struct log_entry&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_LOG_CORRUPT         System Log area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Log directive called in wrong phase; can be used after oceos_init() called&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to acquire log guard&lt;br /&gt;
 *          ERR_LOG_INDEX_WRONG         Read/write log index is wrong&lt;br /&gt;
 *          ERR_LOG_EMPTY               Log is empty&lt;br /&gt;
 */&lt;br /&gt;
S32_t   oceos_log_remove_entry(&lt;br /&gt;
    struct log_entry * const outputPtr&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| outputPtr || pointer to struct log_entry&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit  !! Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_LOG_CORRUPT         || System Log area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Log directive called in wrong phase; can be used after oceos_init() called&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to acquire log guard&lt;br /&gt;
|-&lt;br /&gt;
| ERR_LOG_INDEX_WRONG         || Read/write log index is wrong&lt;br /&gt;
|-&lt;br /&gt;
| ERR_LOG_EMPTY               || Log is empty&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
struct log_entry *outputPtr;&lt;br /&gt;
...&lt;br /&gt;
// Read log_entry into outputPtr and remove the oldest unread log entry&lt;br /&gt;
status = oceos_log_remove_entry(outputPtr);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_log_reset()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''system_log.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function sets all log entries to LOG_LOG_NOT_VALID_ENTRY and the log to empty, with the read and write indices set to 0.&lt;br /&gt;
The log is empty if the index of the next write is the same as the index of the next read. It does not affect the system status variable. It does not affect the context switch log.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * oceos_log_reset()&lt;br /&gt;
 *&lt;br /&gt;
 * Set all log entries to LOG_LOG_NOT_VALID_ENTRY and the log to empty, with the&lt;br /&gt;
 * read and write indices set to 0. and function called flag 0&lt;br /&gt;
 *&lt;br /&gt;
 * The log is empty if the index of the next write&lt;br /&gt;
 * is the same as the index of the next read.&lt;br /&gt;
 *&lt;br /&gt;
 * Does not affect the system status variable&lt;br /&gt;
 * Does not affect the context switch log&lt;br /&gt;
 *&lt;br /&gt;
 * N.B The fixed data area may no longer be writable&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_LOG_CORRUPT         System Log area corrupt; reset failed&lt;br /&gt;
 *          ERR_WRONG_PHASE             Log directive called in wrong phase; can be used after oceos_init() called&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to acquire log guard&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_log_reset(void);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
There are no input parameters to this function.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit  !! Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_LOG_CORRUPT         || System Log area corrupt; reset failed&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Log directive called in wrong phase; can be used after oceos_init() called&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to acquire log guard&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
// Clear down the system log&lt;br /&gt;
status = oceos_log_reset();&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_log_get_size()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''system_log.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the number of entries in the log according to the current values of the read and write indices.&lt;br /&gt;
The value will be zero if the current values of the read and write indices are the same. There may still be useful information in the log, e.g. after system reset, this can be accessed using oceos_log_get_indexed_entry().&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Return the number of entries in the log&lt;br /&gt;
 * according to the current values of the read and write indices.&lt;br /&gt;
 *&lt;br /&gt;
 * The value will be zero if the current values of the read and write indices&lt;br /&gt;
 * are the same.&lt;br /&gt;
 *&lt;br /&gt;
 * There may still be useful information in the log, e.g. after system reset,&lt;br /&gt;
 * this can be accessed using oceos_log_get_indexed_entry()&lt;br /&gt;
 *&lt;br /&gt;
 * @param l_size        pointer to log size holder&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_LOG_CORRUPT         System Log area corrupt;&lt;br /&gt;
 *          ERR_WRONG_PHASE             Log directive called in wrong phase; can be used after oceos_init() called&lt;br /&gt;
 *          ERR_LOG_DATA_PTR_BAD        Pointer to log size holder is NULL&lt;br /&gt;
 *          ERR_LOG_INDEX_WRONG         Read/write log index is wrong&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_log_get_size(&lt;br /&gt;
    U32_t *l_size&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| l_size|| U32_t pointer where size will be written.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit  !! Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_LOG_CORRUPT         || System Log area corrupt;&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Log directive called in wrong phase; can be used after oceos_init() called&lt;br /&gt;
|-&lt;br /&gt;
| ERR_LOG_DATA_PTR_BAD        || Pointer to log size holder is NULL&lt;br /&gt;
|-&lt;br /&gt;
| ERR_LOG_INDEX_WRONG         || Read/write log index is wrong&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, size;&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
// Clear down the system log&lt;br /&gt;
status = oceos_log_get_size(&amp;amp;size);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;System State Variable and System State Mask&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The System State variable provides a record of anomalies or problems detected by OCEOSmp's automatic consistency checks. An application handler for these can be set to be called automatically.&lt;br /&gt;
&lt;br /&gt;
An anomaly or problem results in a flag bit being set in the 32-bit word used to store the system state variable. The flags are identified below.&lt;br /&gt;
&lt;br /&gt;
All flags are reset to zero by oceos_init() when OCEOSmp is initialised, and may also be reset by the application using the directive provided.&lt;br /&gt;
&lt;br /&gt;
To provide a record across OCEOSmp restarts a copy is updated automatically whenever the state variable is updated. This is not cleared by oceos_init() but may be cleared by the application using a directive.&lt;br /&gt;
&lt;br /&gt;
Application software can define a problem handling function to be called automatically when specified system state flags are set. The flags are specified by setting the corresponding bits in the system state mask. The function and the state mask are defined in the system configuration.&lt;br /&gt;
&lt;br /&gt;
Changing a state flag from clear to set results in the function being called (if defined). Subsequent settings of that flag have no effect until after it has been cleared using the directive provided.&lt;br /&gt;
&lt;br /&gt;
N.B. In many cases when OCEOSmp sets a System State flag it also makes an entry in the system log that provides further information.&lt;br /&gt;
&lt;br /&gt;
SYSTEM STATE VARIABLE FLAGS&lt;br /&gt;
&lt;br /&gt;
These flags are updated by OCEOSmp using inclusive 'OR' when a consistency check detects a problem or anomaly. A copy of the system state variable is updated also and accumulates a record of flag settings that is preserved across restarts of OCEOSmp. OCEOSmp restarts reset the system state variable but not the copy.&lt;br /&gt;
&lt;br /&gt;
Resetting the state variables is the responsibility of the application (except for the state variable reset done when OCEOSmp is restarted).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''System Status Bits'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
#define  STATUS_NORMAL                    0u    // No flag set                              YES&lt;br /&gt;
#define  STATUS_INVALID          0xffffffffu    // System status is invalid                 YES BUT NO DETAIL!!!&lt;br /&gt;
&lt;br /&gt;
#define  STATUS_MASK_NORMAL      0xffffffffu    // Always call user def fn                  YES&lt;br /&gt;
&lt;br /&gt;
/* Task related problems */&lt;br /&gt;
#define  STATUS_DISABLED_TASK_START    0x1U    // An attempt to start a disabled task&lt;br /&gt;
#define  STATUS_TASK_JOB_LIMIT_OVER    0x2U    // An attempt to execute a task when its jobs limit is already reached.&lt;br /&gt;
#define  STATUS_JOB_OVER_TIME          0x4U    // Job time from creation to completion exceeds allowed maximum for task. YES&lt;br /&gt;
#define  STATUS_JOB_INTERVAL_SHORT     0x8U    // Minimum time between job creations is less than the allowed minimum for task&lt;br /&gt;
#define  STATUS_READYQ_FULL           0x10U    // Ready queue unable to accept job as result of being full&lt;br /&gt;
#define  STATUS_READYQ_NO_REMOVE      0x20U    // Remove job from ready queue failed&lt;br /&gt;
&lt;br /&gt;
/* Mutex related problems */&lt;br /&gt;
#define  STATUS_MUTEX_ALREADY_HELD    0x40U    // Mutex wait() when mutex already held&lt;br /&gt;
#define  STATUS_MUTEX_NOT_HELD        0x80U    // Mutex signal() when not already held&lt;br /&gt;
#define  STATUS_MUTEX_NOT_RETURNED   0x100U    // Mutex not returned before job terminates&lt;br /&gt;
#define  STATUS_MUTEX_NOT_NESTED     0x200U    // Use of multiple mutexes not nested&lt;br /&gt;
&lt;br /&gt;
/* Counting semaphore and data queue related problems */&lt;br /&gt;
#define  STATUS_SEMAPHORE_JOBS_FULL  0x400U    // Attempt to add job to semaphore pending list when list full&lt;br /&gt;
#define  STATUS_DATAQ_JOBS_FULL      0x800U    // Attempt to add job to data queue pending list when list full&lt;br /&gt;
#define  STATUS_DATAQ_FULL          0x1000U    // Data queue write when queue already full&lt;br /&gt;
&lt;br /&gt;
/* Timed actions related problems */&lt;br /&gt;
#define  STATUS_TIMED_JOBS_FULL     0x2000U    // Timed actions queue already full for timed task start&lt;br /&gt;
#define  STATUS_TIMED_OUTPUT_FULL   0x4000U    // Timed actions queue already full for timed output&lt;br /&gt;
#define  STATUS_TIMED_ACTION_LATE   0x8000U    // Timed action late                          YES&lt;br /&gt;
&lt;br /&gt;
/* Default trap handler should have been replaced&lt;br /&gt;
 * NOT USED AT THE MOMENT*/&lt;br /&gt;
#define  STATUS_SYSTEM_ERROR       0x10000U    // ERROR was handled by default trap handler  YES&lt;br /&gt;
&lt;br /&gt;
/* Flag to indicate problem with Stack Pointer&lt;br /&gt;
 * NOT USED AT THE MOMENT*/&lt;br /&gt;
#define  STATUS_SP_WARNING         0x20000U    // SP not in expected range&lt;br /&gt;
/* Log system error */&lt;br /&gt;
#define  STATUS_BAD_LOG            0x40000U    // System log problem&lt;br /&gt;
#define  STATUS_SPIN_FAILED        0x80000U    // Get SPIN lock failed&lt;br /&gt;
/* Not using next few bits */&lt;br /&gt;
&lt;br /&gt;
/* Will have to exit */&lt;br /&gt;
#define  STATUS_BAD_SENTINEL     0x40000000U    // Area sentinel corrupt&lt;br /&gt;
#define  STATUS_BAD_META_PTR     0x80000000U    // Null meta pointer&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_system_state_get()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''system_log.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns of the system state variable.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Returns the value of the system state variable&lt;br /&gt;
 *&lt;br /&gt;
 * @param state  pointer to state holder&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_LOG_DATA_PTR_BAD        Data holder pointer is null&lt;br /&gt;
 *          ERR_SYS_LOG_CORRUPT         LOG dynamic pointer is null&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_system_state_get(&lt;br /&gt;
    U32_t *state // pointer to state holder&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| state || U32_t pointer to state holder&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit  !! Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_LOG_DATA_PTR_BAD        || Data holder pointer is null&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_LOG_CORRUPT         || LOG dynamic pointer is null&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, state;&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
// Get the system state&lt;br /&gt;
status = oceos_system_state_get(&amp;amp;state);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_system_state_set()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''system_log.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function sets system state variable.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Sets system state variable&lt;br /&gt;
 *&lt;br /&gt;
 * @param new_state&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_LOG_CORRUPT         LOG dynamic pointer is null&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_system_state_set(&lt;br /&gt;
    U32_t new_state   // new value of system state variable&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| new_state || U32_t containing new system state&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit  !! Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_LOG_CORRUPT         || LOG dynamic pointer is null&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, new_state;&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
// Set new system state&lt;br /&gt;
status = oceos_system_state_set(new_state);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_system_state_copy_get()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''system_log.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the value of the system state copy variable.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Returns the value of the copy of system state variable&lt;br /&gt;
 *&lt;br /&gt;
 * @param state  pointer to state holder&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_LOG_DATA_PTR_BAD        Data holder pointer is null&lt;br /&gt;
 *          ERR_SYS_LOG_CORRUPT         LOG dynamic pointer is null&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_system_state_copy_get(&lt;br /&gt;
    U32_t *state // pointer to state copy holder&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| state || U32_t pointer to state copy holder&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit  !! Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_LOG_DATA_PTR_BAD        || Data holder pointer is null&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_LOG_CORRUPT         || LOG dynamic pointer is null&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, copy_state;&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
// Get the system state copy&lt;br /&gt;
status = oceos_system_state_copy_get(&amp;amp;copy_state);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_system_state_copy_set()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''system_log.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function loads a value to tha system state copy variable.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Sets system state copy variable&lt;br /&gt;
 *&lt;br /&gt;
 * @param new_state&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_LOG_CORRUPT         LOG dynamic pointer is null&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_system_state_copy_set(&lt;br /&gt;
    U32_t new_state   // new value of system state variable&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| new_state || U32_t containing new system state copy&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit  !! Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_LOG_CORRUPT         || LOG dynamic pointer is null&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, new_state;&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
// Set new system state copy&lt;br /&gt;
status = oceos_system_state_copy_set(new_state);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Timing directives ==&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;Introduction&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
SPARC:&lt;br /&gt;
&lt;br /&gt;
In OCEOS system time is based on two chained 32-bit timers.&lt;br /&gt;
&lt;br /&gt;
No interrupts are involved, the current system time is obtained by reading the two timer counter registers (in an atomic way) and then inverting the&lt;br /&gt;
values since the timers count down.&lt;br /&gt;
&lt;br /&gt;
The scaler associated with the timers is configured based on the system clock frequency to decrement the low order timer every microsecond. This&lt;br /&gt;
decrements the high order timer when it rolls over, every 71.6 minutes approximately. The 64-bit time range is very long, over 584,000 years.&lt;br /&gt;
&lt;br /&gt;
ARM Cortex-M:&lt;br /&gt;
&lt;br /&gt;
In OCEOS for ARM Cortex-M, system time is based on SysTick. The processor has a 24-bit system timer, SysTick, that counts down from the reload value to zero, reloads (wraps to) the value in the LOAD register on the next clock edge, then counts down on subsequent clocks.&lt;br /&gt;
&lt;br /&gt;
Note: When the processor is halted for debugging the counter does not decrement.&lt;br /&gt;
&lt;br /&gt;
OCEOS initializes the timer to be driven from MCK and counting down to zero asserts SysTick exception request.&lt;br /&gt;
OCEOS has 64 bit counter which is increased by 0xFFFFFF value every time timer reloads.&lt;br /&gt;
&lt;br /&gt;
RISC-V:&lt;br /&gt;
&lt;br /&gt;
TBD&lt;br /&gt;
&lt;br /&gt;
The units of OCEOS system time are microseconds on SPARC and ARM and on RISC-V the period of the clock cycle.&lt;br /&gt;
&lt;br /&gt;
The system time is reset to 0 by oceos_init()&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_time_sys_get64()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''oceos_timer.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the current system time as a 64-bit number.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
**&lt;br /&gt;
 * Get the current system time (64-bit)&lt;br /&gt;
 *&lt;br /&gt;
 * @return U64_t&lt;br /&gt;
 */&lt;br /&gt;
U64_t oceos_time_sys_get64(void);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There are no parameters to this function.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S64_t with the current system time.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S64_t now;&lt;br /&gt;
...&lt;br /&gt;
// Get the time&lt;br /&gt;
now = oceos_time_sys_get64();&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_time_sys_get32()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''oceos_timer.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the low 32 bits of the system time.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Get the current system time (low 32 bits of 64 bit value)&lt;br /&gt;
 *&lt;br /&gt;
 * @return U32_t&lt;br /&gt;
 */&lt;br /&gt;
U32_t oceos_time_sys_get32(void);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
There are no parameters to this function.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with the current system time.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t now;&lt;br /&gt;
...&lt;br /&gt;
// Get the time&lt;br /&gt;
now = oceos_time_sys_get32();&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:backup]]&lt;/div&gt;</summary>
		<author><name>Bkavanagh</name></author>
	</entry>
	<entry>
		<id>https://wiki.ocetechnology.com/mediawiki/index.php?title=OCEOSmp/directive_reference&amp;diff=1680</id>
		<title>OCEOSmp/directive reference</title>
		<link rel="alternate" type="text/html" href="https://wiki.ocetechnology.com/mediawiki/index.php?title=OCEOSmp/directive_reference&amp;diff=1680"/>
		<updated>2024-05-03T14:11:52Z</updated>

		<summary type="html">&lt;p&gt;Bkavanagh: /* oceos_system_state_copy_set() */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt;'''This section is under construction'''&amp;lt;/span&amp;gt; =&lt;br /&gt;
&lt;br /&gt;
= Introduction =&lt;br /&gt;
&lt;br /&gt;
To be added&lt;br /&gt;
&lt;br /&gt;
= Directives =&lt;br /&gt;
&lt;br /&gt;
== Initialisation directives ==&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_init()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''initialisation.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Initialises OCEOS and  must be the first directive used.&lt;br /&gt;
&lt;br /&gt;
Initialises the OCEOS system meta data using the information supplied in the application configuration and prepares for creation of tasks etc.&lt;br /&gt;
&lt;br /&gt;
The values provided in the application configuration are checked as much as possible before being used.&lt;br /&gt;
&lt;br /&gt;
The system log also is created here.&lt;br /&gt;
&lt;br /&gt;
This function sets up sysMetaPtr and init_meta_ptr and must have completed successfully before tasks etc. can be created.&lt;br /&gt;
&lt;br /&gt;
It disables interrupts and leaves them disabled, they will be re-enabled to the previous level after all tasks etc. have been created and [[OCEOSmp/directive_reference#oceos_init_finish()|oceos_init_finish()]] has completed successfully.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Initialises OCEOS and  must be the first directive used.&lt;br /&gt;
 *&lt;br /&gt;
 * Initialises the OCEOS system meta data using the information supplied in&lt;br /&gt;
 * the application configuration and prepares for creation of tasks etc.&lt;br /&gt;
 *&lt;br /&gt;
 * The values provided in the application configuration are checked as much&lt;br /&gt;
 * as possible before being used.&lt;br /&gt;
 *&lt;br /&gt;
 * The system log also is created here.&lt;br /&gt;
 *&lt;br /&gt;
 * This function sets up sysMetaPtr and init_meta_ptr and must have completed&lt;br /&gt;
 * successfully before tasks etc. can be created.&lt;br /&gt;
 *&lt;br /&gt;
 * It disables interrupts and leaves them disabled, they will be re-enabled to&lt;br /&gt;
 * the previous level after all tasks etc. have been created and&lt;br /&gt;
 * oceos_init_finish() has completed successfully.&lt;br /&gt;
 *&lt;br /&gt;
 * @param app_config Pointer to configuration struct&lt;br /&gt;
 * @return SUCCESSFUL                        All OK&lt;br /&gt;
 *         WARN_LOG_SIZE_DEFAULT             Warning, log size is set to default value of 64 entries&lt;br /&gt;
 *         WARN_NO_ERROR_FUNCTION            Warning, user defined function for ERROR handling is not provided&lt;br /&gt;
 *         ERR_CPU_FIRST_CORE_INVALID        Start CPU not in a range of available cores for this target; or greater than end CPU&lt;br /&gt;
 *         ERR_CPU_LAST_CORE_INVALID         Last CPU not in a range of available cores for this target&lt;br /&gt;
 *         ERR_NOT_START_CPU_CORE            Executing oceos_init on wrong CPU&lt;br /&gt;
 *         ERR_STACK_START_MISALIGNED        Stack start address is not set by user misaligned&lt;br /&gt;
 *         ERR_STACK_PER_CORE_INVALID        Stack per CPU size is zero, or not 8byte aligned, or less then min require&lt;br /&gt;
 *         ERR_LOG_ADDR_MISALIGNED           Log start address is not 8 byte aligned&lt;br /&gt;
 *         ERR_FIX_ADDR_MISALIGNED           Fixed area start address is not 8 byte aligned&lt;br /&gt;
 *         ERR_DYN_ADDR_MISALIGNED           Dynamic area start address is not 8 byte aligned&lt;br /&gt;
 *         ERR_CPU_CORE_RANGE_WRONG          CPU cores in use exceed available CPUs on the SoC&lt;br /&gt;
 *         ERR_STACK_SPACE_WRONG             Current CPU SP is not within user provided stack range&lt;br /&gt;
 *         ERR_LOG_SIZE_INVALID              Log size outside expected range&lt;br /&gt;
 *         ERR_CS_LOG_SIZE_INVALID           Context switch log size invalid&lt;br /&gt;
 *         ERR_TASK_NUMBER_INVALID           Number of tasks invalid&lt;br /&gt;
 *         ERR_MUTEX_NUMBER_INVALID          Number of mutexes invalid&lt;br /&gt;
 *         ERR_RWMUTEX_NUMBER_INVALID        Number of rwmutexes invalid&lt;br /&gt;
 *         ERR_SEM_NUMBER_INVALID            Number of semaphores invalid&lt;br /&gt;
 *         ERR_DATAQ_NUMBER_INVALID          Number of datqs invalid&lt;br /&gt;
 *         ERR_TIMED_ACTIONS_NUMBER_INVALID  Number of timed actions invalid&lt;br /&gt;
 *         ERR_OVERLAP_STACK                 Overlap stack end address with (two overlap areas are set)&lt;br /&gt;
 *         ERR_OVERLAP_LOG                   Overlap log with (two overlap areas are set)&lt;br /&gt;
 *         ERR_OVERLAP_FIXED                 Overlap fixed area with (two overlap areas are set)&lt;br /&gt;
 *         ERR_OVERLAP_DYNAMIC               Overlap dynamic area with (two overlap areas are set)&lt;br /&gt;
 *         ERR_FIXED_MEMORY_FAILED           Fixed area memory write fail&lt;br /&gt;
 *         ERR_DYNAMIC_MEMORY_FAILED         Dynamic area memory write fail&lt;br /&gt;
 *         ERR_TIMER_ADDR_INVALID            Timer address not provided by user (null). SPARC only&lt;br /&gt;
 *         ERR_SYS_TIMER_INDEX_INVALID       System timer index of subtimer invalid; SPARC only; Subtimers start from index 1; Need index of subtimer plus one in front&lt;br /&gt;
 *         ERR_PERIPHERAL_CLOCK_INVALID      System peripheral code invalid&lt;br /&gt;
 *&lt;br /&gt;
 */&lt;br /&gt;
S32_t   oceos_init(&lt;br /&gt;
    const struct application_configuration app_config&lt;br /&gt;
);&lt;br /&gt;
 &amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| app_config || Pointer to configuration struct.  struct application_configuration defined in '''''basic_structs.h'''''&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| WARN_LOG_SIZE_DEFAULT             || Warning, log size is set to default value of 64 entries&lt;br /&gt;
|-&lt;br /&gt;
| WARN_NO_ERROR_FUNCTION            || Warning, user defined function for ERROR handling is not provided&lt;br /&gt;
|-&lt;br /&gt;
| ERR_CPU_FIRST_CORE_INVALID        || Start CPU not in a range of available cores for this target; or greater than end CPU&lt;br /&gt;
|-&lt;br /&gt;
| ERR_CPU_LAST_CORE_INVALID         || Last CPU not in a range of available cores for this target&lt;br /&gt;
|-&lt;br /&gt;
| ERR_NOT_START_CPU_CORE            || Executing oceos_init on wrong CPU&lt;br /&gt;
|-&lt;br /&gt;
| ERR_STACK_START_MISALIGNED        || Stack start address is not set by user misaligned&lt;br /&gt;
|-&lt;br /&gt;
| ERR_STACK_PER_CORE_INVALID        || Stack per CPU size is zero, or not 8byte aligned, or less then min require&lt;br /&gt;
|-&lt;br /&gt;
| ERR_LOG_ADDR_MISALIGNED           || Log start address is not 8 byte aligned&lt;br /&gt;
|-&lt;br /&gt;
| ERR_FIX_ADDR_MISALIGNED           || Fixed area start address is not 8 byte aligned&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DYN_ADDR_MISALIGNED           || Dynamic area start address is not 8 byte aligned&lt;br /&gt;
|-&lt;br /&gt;
| ERR_CPU_CORE_RANGE_WRONG          || CPU cores in use exceed available CPUs on the SoC&lt;br /&gt;
|-&lt;br /&gt;
| ERR_STACK_SPACE_WRONG             || Current CPU SP is not within user provided stack range&lt;br /&gt;
|-&lt;br /&gt;
| ERR_LOG_SIZE_INVALID              || Log size outside expected range&lt;br /&gt;
|-&lt;br /&gt;
| ERR_CS_LOG_SIZE_INVALID           || Context switch log size invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TASK_NUMBER_INVALID           || Number of tasks invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_MUTEX_NUMBER_INVALID          || Number of mutexes invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_RWMUTEX_NUMBER_INVALID        || Number of rwmutexes invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SEM_NUMBER_INVALID            || Number of semaphores invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DATAQ_NUMBER_INVALID          || Number of datqs invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TIMED_ACTIONS_NUMBER_INVALID  || Number of timed actions invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_OVERLAP_STACK                 || Overlap stack end address with (two overlap areas are set)&lt;br /&gt;
|-&lt;br /&gt;
| ERR_OVERLAP_LOG                   || Overlap log with (two overlap areas are set)&lt;br /&gt;
|-&lt;br /&gt;
| ERR_OVERLAP_FIXED                 || Overlap fixed area with (two overlap areas are set)&lt;br /&gt;
|-&lt;br /&gt;
| ERR_OVERLAP_DYNAMIC               || Overlap dynamic area with (two overlap areas are set)&lt;br /&gt;
|-&lt;br /&gt;
| ERR_FIXED_MEMORY_FAILED           || Fixed area memory write fail&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DYNAMIC_MEMORY_FAILED         || Dynamic area memory write fail&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TIMER_ADDR_INVALID            || Timer address not provided by user (null). SPARC only&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_TIMER_INDEX_INVALID       || System timer index of subtimer invalid; SPARC only; Subtimers start from index 1; Need index of subtimer plus one in front&lt;br /&gt;
|-&lt;br /&gt;
| ERR_PERIPHERAL_CLOCK_INVALID      || System peripheral code invalid&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
    /*&lt;br /&gt;
     * Create the application configuration structure&lt;br /&gt;
     */&lt;br /&gt;
    struct application_configuration           app_config = {0};&lt;br /&gt;
&lt;br /&gt;
    /*&lt;br /&gt;
     * Fill in the application parameters&lt;br /&gt;
     */&lt;br /&gt;
    app_config.log_address                   = (log_t)log_data;              // required&lt;br /&gt;
    app_config.fixed_data_address            = (adrs_t)fixed_data;            // required&lt;br /&gt;
    app_config.dynamic_data_address          = (adrs_t)dynamic_data;          // required&lt;br /&gt;
&lt;br /&gt;
    app_config.stack_start_address           = start_stack_array[OCEOS_START_CPU_INDEX];// OCEOSMP_STACK_START_ADDRESS;&lt;br /&gt;
    app_config.stack_size_per_cpu            = (U32_t)&amp;amp;__oceos_stack_size_per_cpu;  // OCEOSMP_STACK_LOW_BOUND_ADDRESS;&lt;br /&gt;
&lt;br /&gt;
    app_config.system_error_function         = oceosmp_on_error;               // NULL =&amp;gt; ignore&lt;br /&gt;
    app_config.log_full_function             = oceosmp_on_full_log;            // NULL =&amp;gt; ignore&lt;br /&gt;
&lt;br /&gt;
    // used in setting up system log and fixed data array&lt;br /&gt;
    app_config.log_number_of_entries         = NUMBER_OF_LOG_ENTRIES;          // 0 =&amp;gt; use default&lt;br /&gt;
&lt;br /&gt;
    app_config.number_of_tasks               = NUMBER_OF_TASKS;                // &amp;gt;= 1&lt;br /&gt;
&lt;br /&gt;
    app_config.number_of_mutexes             = NUMBER_OF_MUTEXES;&lt;br /&gt;
	app_config.number_of_rwmutexes			 = NUMBER_OF_RWMUTEXES;&lt;br /&gt;
    app_config.number_of_counting_semaphores = NUMBER_OF_SEMAPHORES;&lt;br /&gt;
    app_config.number_of_data_queues         = NUMBER_OF_DATAQS;&lt;br /&gt;
&lt;br /&gt;
    /**&lt;br /&gt;
     * FOR SPARC TARGET ONLY.&lt;br /&gt;
     */&lt;br /&gt;
    app_config.sys_time_timer_index          = SYS_TIME_TIMER_INDEX;           // 0 =&amp;gt; invalid index&lt;br /&gt;
    /**&lt;br /&gt;
     * FOR SPARC TARGET ONLY.&lt;br /&gt;
     * Not Used for ARM. Always Nested&lt;br /&gt;
     */&lt;br /&gt;
    app_config.interrupt_nesting_enabled     = TRUE;                           // TRUE =&amp;gt; single vector&lt;br /&gt;
    app_config.oceos_cpu_switch_int_number   = OCEOS_CPU_INTER_COM_INT_NUMBER; // User should provide SGI ID (0-15)&lt;br /&gt;
&lt;br /&gt;
    app_config.timed_actions_queue_size      = NUMBER_OF_ACTION_ENTRIES;&lt;br /&gt;
    app_config.CS_log_entries_base2          = CS_LOG_DEF_ENTRIES_BASE2;&lt;br /&gt;
    /**&lt;br /&gt;
     * Set starting index of CPU that will be used by OCEOSMP&lt;br /&gt;
     */&lt;br /&gt;
    app_config.oceos_cpu_start_index         = OCEOS_START_CPU_INDEX;&lt;br /&gt;
    /**&lt;br /&gt;
     * Set last index of CPU that will be used by OCEOSMP&lt;br /&gt;
     */&lt;br /&gt;
    app_config.oceos_cpu_last_index          = OCEOS_LAST_CPU_INDEX;&lt;br /&gt;
    /*&lt;br /&gt;
     * Set system/peripheral clock used to initialise system timer&lt;br /&gt;
     */&lt;br /&gt;
    app_config.soc_peripheral_clck           = BSP_SYSFREQ * 1000 * 1000;&lt;br /&gt;
&lt;br /&gt;
    // initialise OCEOSMP&lt;br /&gt;
    S32_t status;&lt;br /&gt;
    status = oceos_init(app_config);&lt;br /&gt;
    if (OCEOS_SUCCESS &amp;gt; status) {&lt;br /&gt;
      oceosmp_print(&amp;quot;\n oceos_init failure\n\r&amp;quot;);&lt;br /&gt;
      return 0;&lt;br /&gt;
    } else {&lt;br /&gt;
      return 1;&lt;br /&gt;
    }   // else&lt;br /&gt;
 &amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_init_finish()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''initialisation.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Finalizes the fixed data array after all tasks etc. have been created&lt;br /&gt;
&lt;br /&gt;
All information needed to start OCEOS can be found in the fixed data area&lt;br /&gt;
when oceos_init_finish() has completed.&lt;br /&gt;
&lt;br /&gt;
Once all tasks etc. have been created oceos_init_finish() checks the&lt;br /&gt;
accumulated information against the application configuration data&lt;br /&gt;
stored in the fixed meta structure.&lt;br /&gt;
&lt;br /&gt;
oceos_init_finish also calculates the size of the dynamic data area and&lt;br /&gt;
checks it does not overlap with the system stack, the system log, or the&lt;br /&gt;
fixed data, and if all ok sets up pointers to the various dynamic area&lt;br /&gt;
components in the fixed data.&lt;br /&gt;
&lt;br /&gt;
It then adds an XOR checksum to the fixed data area, and checks that this&lt;br /&gt;
is followed by FILLER, which it replaces with the end sentinel.&lt;br /&gt;
&lt;br /&gt;
On successful completion it restores the interrupt level to its value&lt;br /&gt;
before oceos_init() was called, otherwise interrupts remain disabled.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Finalizes the fixed data array after all tasks etc. have been created&lt;br /&gt;
 *&lt;br /&gt;
 * All information needed to start OCEOS can be found in the fixed data area&lt;br /&gt;
 * when oceos_init_finish() has completed.&lt;br /&gt;
 *&lt;br /&gt;
 * Once all tasks etc. have been created oceos_init_finish() checks the&lt;br /&gt;
 * accumulated information against the application configuration data&lt;br /&gt;
 * stored in the fixed meta structure.&lt;br /&gt;
 *&lt;br /&gt;
 * oceos_init_finish also calculates the size of the dynamic data area and&lt;br /&gt;
 * checks it does not overlap with the system stack, the system log, or the&lt;br /&gt;
 * fixed data, and if all ok sets up pointers to the various dynamic area&lt;br /&gt;
 * components in the fixed data.&lt;br /&gt;
 *&lt;br /&gt;
 * It then adds an XOR checksum to the fixed data area, and checks that this&lt;br /&gt;
 * is followed by FILLER, which it replaces with the end sentinel.&lt;br /&gt;
 *&lt;br /&gt;
 * On successful completion it restores the interrupt level to its value&lt;br /&gt;
 * before oceos_init() was called, otherwise interrupts remain disabled.&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS                             All OK&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT               System Meta data is NULL or corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT                 System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_CPU_CORE                  Executing directive on wrong CPU&lt;br /&gt;
 *          ERR_WRONG_PHASE                     Called before oceos_init()&lt;br /&gt;
 *          ERR_TASKS_INCOMPLETE                Created wrong number of tasks&lt;br /&gt;
 *          ERR_MUTEX_INCOMPLETE                Created wrong number of mutexes&lt;br /&gt;
 *          ERR_RWMUTEX_INCOMPLETE              Created wrong number of rwmutexes&lt;br /&gt;
 *          ERR_SEM_INCOMPLETE                  Created wrong number of semaphores&lt;br /&gt;
 *          ERR_DATAQ_INCOMPLETE                Created wrong number of dataqs&lt;br /&gt;
 *          ERR_TASK_MAX_ID_INVALID             Task's max id invalid&lt;br /&gt;
 *          ERR_MUTEX_MAX_ID_INVALID            Mutexe's max id invalid&lt;br /&gt;
 *          ERR_RWMUTEX_MAX_ID_INVALID          Rwmutexe's max id invalid&lt;br /&gt;
 *          ERR_SEM_MAX_ID_INVALID              Semaphore's max id invalid&lt;br /&gt;
 *          ERR_DATAQ_MAX_ID_INVALID            Dataq's max id invalid&lt;br /&gt;
 *          ERR_TOTAL_JOBS_NUMBER_WRONG         Wrong number of total jobs created&lt;br /&gt;
 *          ERR_ORDER_ARRAY_PTR_INVALID         Order array pointer is NULL or mis-aligned&lt;br /&gt;
 *          ERR_FIXED_AREA_TOO_SMALL            Not enough space for fixed data area&lt;br /&gt;
 */&lt;br /&gt;
S32_t   oceos_init_finish(void);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
There are no input parameters to this function.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit  || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT               || System Meta data is NULL or corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT                 || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_CPU_CORE                  || Executing directive on wrong CPU&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE                     || Called before oceos_init()&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TASKS_INCOMPLETE                || Created wrong number of tasks&lt;br /&gt;
|-&lt;br /&gt;
| ERR_MUTEX_INCOMPLETE                || Created wrong number of mutexes&lt;br /&gt;
|-&lt;br /&gt;
| ERR_RWMUTEX_INCOMPLETE              || Created wrong number of rwmutexes&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SEM_INCOMPLETE                  || Created wrong number of semaphores&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DATAQ_INCOMPLETE                || Created wrong number of dataqs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TASK_MAX_ID_INVALID             || Task's max id invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_MUTEX_MAX_ID_INVALID            || Mutexe's max id invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_RWMUTEX_MAX_ID_INVALID          || Rwmutexe's max id invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SEM_MAX_ID_INVALID              || Semaphore's max id invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DATAQ_MAX_ID_INVALID            || Dataq's max id invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TOTAL_JOBS_NUMBER_WRONG         || Wrong number of total jobs created&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ORDER_ARRAY_PTR_INVALID         || Order array pointer is NULL or mis-aligned&lt;br /&gt;
|-&lt;br /&gt;
| ERR_FIXED_AREA_TOO_SMALL            || Not enough space for fixed data area&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
    /*&lt;br /&gt;
     * Finish initialising OCEOS and setting up the fixed data&lt;br /&gt;
     */&lt;br /&gt;
    status = oceos_init_finish();&lt;br /&gt;
    if(OCEOS_SUCCESS &amp;gt; status){&lt;br /&gt;
        // LOG&lt;br /&gt;
      oceosmp_print(&amp;quot;\nAbandoning, problem ending OCEOS initialisation\n\r&amp;quot;);&lt;br /&gt;
        return -1;&lt;br /&gt;
    }   // if&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_start()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''initialisation.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Starts OCEOS scheduling.&amp;lt;br&amp;gt;&lt;br /&gt;
Create dynamic OCEOS structures and start scheduling.&amp;lt;br&amp;gt;&lt;br /&gt;
This function should only be called once and only after [[OCEOSmp/directive_reference#oceos_init()|oceos_init()]] and [[OCEOSmp/directive_reference#oceos_init_finish()|oceos_init_finish()]] have been called successfully.&amp;lt;br&amp;gt;&lt;br /&gt;
Normally this function does not return. &amp;lt;br&amp;gt;&lt;br /&gt;
If a problem is detected the function terminates and returns an appropriate DIRECTIVE_STATUS code, with interrupts disabled.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Starts OCEOS scheduling&lt;br /&gt;
 *&lt;br /&gt;
 * Create dynamic OCEOS structures and start scheduling&lt;br /&gt;
 *&lt;br /&gt;
 * This function should only be called once&lt;br /&gt;
 * and only after oceos_init()&lt;br /&gt;
 * and oceos_init_finish() have&lt;br /&gt;
 *  been called successfully.&lt;br /&gt;
 * Normally this function does not return.&lt;br /&gt;
 * If a problem is detected the function&lt;br /&gt;
 * terminates and returns an appropriate&lt;br /&gt;
 * DIRECTIVE_STATUS code, with interrupts disabled.&lt;br /&gt;
 *&lt;br /&gt;
 * @param fixed_array_ptr   Pointer to fixed data array&lt;br /&gt;
 * @param start_task        Task ID&lt;br /&gt;
 * @param data_ptr          Pointer to data to be passed to the task&lt;br /&gt;
 * @return  OCEOSMP_EXIT                        OCEOSMP return from scheduling and exit&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT               Fixed area pointer is null or bad sentinel&lt;br /&gt;
 *          ERR_FIXED_AREA_SIZE_WRONG           Fixed area size is zero&lt;br /&gt;
 *          ERR_FIXED_AREA_END_SENTINEL_BAD     Fixed data end sentinel corrupt&lt;br /&gt;
 *          ERR_FIXED_AREA_BAD_XOR              Fixed area bad checksum or checksum mis-match&lt;br /&gt;
 *          ERR_INIT_NOT_DONE                   oceos_start() called without initialisation&lt;br /&gt;
 *          ERR_DYN_AREA_PTR_BAD                Dynamic area pointer invalid in sysMetaPtr&lt;br /&gt;
 *          ERR_INT_HANDLER_BAD                 IRQ controller pointer provided by BCC is NULL;or OCEOS handler is not set&lt;br /&gt;
 *          ERR_DYN_JOB_PTR_BAD                 Job array pointer is NULL&lt;br /&gt;
 *          ERR_FIXED_TASK_PTR_BAD              Tasks array pointer is NULL&lt;br /&gt;
 *          ERR_JOB_COUNT_WRONG                 Total job count inconsistent&lt;br /&gt;
 *          ERR_DYN_MUTEX_PTR_BAD               Mutex dynamic pointer is NULL&lt;br /&gt;
 *          ERR_DYN_LOCK_PTR_BAD                Mutex lock array pointer is NULL&lt;br /&gt;
 *          ERR_DYN_RWMUTEX_PTR_BAD             Rwmutex dynamic pointer is NULL&lt;br /&gt;
 *          ERR_DYN_RWLOCK_PTR_BAD              Rwmutex lock array pointer is NULL&lt;br /&gt;
 *          ERR_FIXED_SEM_PTR_BAD               Semaphore fixed pointer is NULL&lt;br /&gt;
 *          ERR_DYN_SEM_PTR_BAD                 Semaphore dynamic pointer is NULL&lt;br /&gt;
 *          ERR_SEM_PEND_PTR_BAD                Semaphore pending queue pointer is NULL&lt;br /&gt;
 *          ERR_FIXED_DATAQ_PTR_BAD             Dataq fixed pointer is NULL&lt;br /&gt;
 *          ERR_DYN_DATAQ_PTR_BAD               Dataq dynamic pointer is NULL&lt;br /&gt;
 *          ERR_DATAQ_PEND_PTR_BAD              Dataq pending queue pointer is NULL&lt;br /&gt;
 *          ERR_DATAQ_DATA_PTR_BAD              Dataq data pointer is NULL&lt;br /&gt;
 *          ERR_CPU_INT_NUMBER_INVALID          SPARC only.IRQ number for CPU inter-comunication invalid(zero or used by timer)&lt;br /&gt;
 *          ERR_REGISTER_CPU_IRQ_FAILED         SPARC only. Failed to set CPU IRQ handler in BCC&lt;br /&gt;
 *          ERR_CPU_STACK_INVALID               Current CPU stack not within specified range&lt;br /&gt;
 *          ERR_CPU_PRIORITY_STACK_INVALID      Per CPU priority stack invalid&lt;br /&gt;
 *          ERR_LOG_AREA_END_SENTINEL_BAD       Log area end sentinel override&lt;br /&gt;
 *          ERR_TA_CONFIG_PTR_BAD               SPARC only; Timed action configuration data pointer is NULL&lt;br /&gt;
 *          ERR_TA_TIMER_INDEX_INVALID          SPARC only; Timed action sub-timer index in timer unit is invalid&lt;br /&gt;
 *          ERR_TA_IRQ_NUMBER_INVALID           SPARC only; Timer action timer IRQ number is invalid&lt;br /&gt;
 *          ERR_TA_BCC_IRQ_REGISTER_FAILED      SPARC only; Timed action timer IRQ handler failed to register&lt;br /&gt;
 */&lt;br /&gt;
S32_t   oceos_start(&lt;br /&gt;
    const U32_t * const fixed_array_ptr,// pointer to fixed data array&lt;br /&gt;
    const U32_t start_task,             // taskID&lt;br /&gt;
    void * const data_ptr               // pointer to data to be passed to task&lt;br /&gt;
);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| fixed_array_ptr || Pointer to fixed data array&lt;br /&gt;
|-&lt;br /&gt;
| start_task      || Task ID&lt;br /&gt;
|-&lt;br /&gt;
| data_ptr        || Pointer to data to be passed to the task&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit  || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT               || Fixed area pointer is null or bad sentinel&lt;br /&gt;
|-&lt;br /&gt;
| ERR_FIXED_AREA_SIZE_WRONG           || Fixed area size is zero&lt;br /&gt;
|-&lt;br /&gt;
| ERR_FIXED_AREA_END_SENTINEL_BAD     || Fixed data end sentinel corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_FIXED_AREA_BAD_XOR              || Fixed area bad checksum or checksum mis-match&lt;br /&gt;
|-&lt;br /&gt;
| ERR_INIT_NOT_DONE                   || oceos_start() called without initialisation&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DYN_AREA_PTR_BAD                || Dynamic area pointer invalid in sysMetaPtr&lt;br /&gt;
|-&lt;br /&gt;
| ERR_INT_HANDLER_BAD                 || IRQ controller pointer provided by BCC is NULL;or OCEOS handler is not set&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DYN_JOB_PTR_BAD                 || Job array pointer is NULL&lt;br /&gt;
|-&lt;br /&gt;
| ERR_FIXED_TASK_PTR_BAD              || Tasks array pointer is NULL&lt;br /&gt;
|-&lt;br /&gt;
| ERR_JOB_COUNT_WRONG                 || Total job count inconsistent&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DYN_MUTEX_PTR_BAD               || Mutex dynamic pointer is NULL&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DYN_LOCK_PTR_BAD                || Mutex lock array pointer is NULL&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DYN_RWMUTEX_PTR_BAD             || Rwmutex dynamic pointer is NULL&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DYN_RWLOCK_PTR_BAD              || Rwmutex lock array pointer is NULL&lt;br /&gt;
|-&lt;br /&gt;
| ERR_FIXED_SEM_PTR_BAD               || Semaphore fixed pointer is NULL&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DYN_SEM_PTR_BAD                 || Semaphore dynamic pointer is NULL&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SEM_PEND_PTR_BAD                || Semaphore pending queue pointer is NULL&lt;br /&gt;
|-&lt;br /&gt;
| ERR_FIXED_DATAQ_PTR_BAD             || Dataq fixed pointer is NULL&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DYN_DATAQ_PTR_BAD               || Dataq dynamic pointer is NULL&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DATAQ_PEND_PTR_BAD              || Dataq pending queue pointer is NULL&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DATAQ_DATA_PTR_BAD              || Dataq data pointer is NULL&lt;br /&gt;
|-&lt;br /&gt;
| ERR_CPU_INT_NUMBER_INVALID          || SPARC only.IRQ number for CPU inter-comunication invalid(zero or used by timer)&lt;br /&gt;
|-&lt;br /&gt;
| ERR_REGISTER_CPU_IRQ_FAILED         || SPARC only. Failed to set CPU IRQ handler in BCC&lt;br /&gt;
|-&lt;br /&gt;
| ERR_CPU_STACK_INVALID               || Current CPU stack not within specified range&lt;br /&gt;
|-&lt;br /&gt;
| ERR_CPU_PRIORITY_STACK_INVALID      || Per CPU priority stack invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_LOG_AREA_END_SENTINEL_BAD       || Log area end sentinel override&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_CONFIG_PTR_BAD               || SPARC only; Timed action configuration data pointer is NULL&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_TIMER_INDEX_INVALID          || SPARC only; Timed action sub-timer index in timer unit is invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_IRQ_NUMBER_INVALID           || SPARC only; Timer action timer IRQ number is invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_BCC_IRQ_REGISTER_FAILED      || SPARC only; Timed action timer IRQ handler failed to register&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/* Sample Task names - all here start with t_ to help avoid name confusion */&lt;br /&gt;
enum TASK_NAME{&lt;br /&gt;
    t_tom,                      // will have task ID 0&lt;br /&gt;
    t_dick,                     // will have task ID 1&lt;br /&gt;
};&lt;br /&gt;
extern U32_t fixed_data[];&lt;br /&gt;
...&lt;br /&gt;
S32_t status;&lt;br /&gt;
&lt;br /&gt;
status = oceos_start(fixed_data, t_tom, NULL);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_exit()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''initialisation.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Ends scheduling and exit from [[OCEOSmp/directive_reference#oceos_start()|oceos_start()]].&lt;br /&gt;
No task can be started after this.&amp;lt;br&amp;gt;&lt;br /&gt;
OCEOS will exit when the current job ends.&amp;lt;br&amp;gt;&lt;br /&gt;
An idle task in an endless loop should check that scheduling is enabled.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Ends scheduling and exit from oceos_start.&lt;br /&gt;
 * No task can be started after this.&lt;br /&gt;
 * OCEOS will exit when the current job ends.&lt;br /&gt;
 * An idle task in an endless loop should check that scheduling is enabled.&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Called before scheduling started&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_exit(void);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
There are no input parameters to this function.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit  || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Called before scheduling started&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
// Exit OCEOS&lt;br /&gt;
oceos_exit();&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_CPU_sleep()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''initialisation.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
 Puts CPU in sleep mode.&amp;lt;br&amp;gt;&lt;br /&gt;
 User must to be sure that interrupts are enabled.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Puts CPU in sleep mode.&lt;br /&gt;
 * User must to be sure that interrupts are enabled.&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_CPU_sleep(void);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
There are no input parameters to this function.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
// Put CPU to sleep&lt;br /&gt;
oceos_CPU_sleep();&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceosmp_cpu_disable()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''initialisation.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function ends execution of all tasks running on particular CPU and removes the CPU from scheduling.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Ends execution of all tasks running on particular CPU and removes this CPU from scheduling.&lt;br /&gt;
 * @param cpu_id&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              CPU ID outside allowed range 0 to 254&lt;br /&gt;
 *          ERR_ID_WRONG                CPU ID &amp;gt;= number of available CPUs&lt;br /&gt;
 *          ERR_CPU_ALREADY_DISABLED    CPU already disabled&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceosmp_cpu_disable(&lt;br /&gt;
    U32_t cpu_id&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| cpu_id || ID of CPU core to be disabled.&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit  || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || CPU ID outside allowed range 0 to 254&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || CPU ID &amp;gt;= number of available CPUs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_CPU_ALREADY_DISABLED    || CPU already disabled&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, faulty_cpu;&lt;br /&gt;
...&lt;br /&gt;
// Disable faulty CPU core&lt;br /&gt;
status = oceosmp_cpu_disable(faulty_cpu));&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceosmp_cpu_enable()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''initialisation.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function adds a disabled CPU core to the OCEOSmp scheduler. It should only be called after scheduling has started&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 *  Adds disabled CPU to OCEOSmp scheduler&lt;br /&gt;
 *&lt;br /&gt;
 *  N.B. This function should only be called after scheduling has started&lt;br /&gt;
 *&lt;br /&gt;
 * @param cpu_id&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              CPU ID outside allowed range 0 to 254&lt;br /&gt;
 *          ERR_ID_WRONG                CPU ID &amp;gt;= number of available CPUs; or the same as currently running&lt;br /&gt;
 *          ERR_CPU_ALREADY_ENABLED     CPU already enabled&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceosmp_cpu_enable(&lt;br /&gt;
    U32_t cpu_id&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| cpu_id || ID of CPU core to be enabled.&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit  || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || CPU ID outside allowed range 0 to 254&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || CPU ID &amp;gt;= number of available CPUs; or the same as currently running&lt;br /&gt;
|-&lt;br /&gt;
| ERR_CPU_ALREADY_ENABLED     || CPU already enabled&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, good_cpu;&lt;br /&gt;
...&lt;br /&gt;
// Enable CPU core&lt;br /&gt;
status = oceosmp_cpu_enable(good_cpu));&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceosmp_cpu_terminate()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''initialisation.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function removes a CPU core from the OCEOSmp scheduler and marks it so it cannot be restarted. It puts CPU to sleep with interrupts disabled. It should only be called after scheduling has started.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 *  Removes CPU from OCEOSMP scheduler and terminates, cannot be restarted.&lt;br /&gt;
 *  Puts CPU to sleep with interrupts disabled&lt;br /&gt;
 *&lt;br /&gt;
 *  N.B. This function should only be called after scheduling has started&lt;br /&gt;
 *  Steps:&lt;br /&gt;
 *     1. Set terminate flag on this CPU;&lt;br /&gt;
 *     2. Trigger software interrupt to transfer execution to IRQ handler;&lt;br /&gt;
 *     3. Check flag and if set =&amp;gt; put CPU to sleep in while loop with interrupts disabled;&lt;br /&gt;
 *     4. Set MAX priority on this CPU priority stack;&lt;br /&gt;
 *     5. Remove CPU from scheduling;&lt;br /&gt;
 *     6. Clean up all the tasks by calling task terminate function and free up all the&lt;br /&gt;
 *        preempted jobs by this CPU;&lt;br /&gt;
 *&lt;br /&gt;
 * @param cpu_id&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              CPU ID outside allowed range 0 to 254&lt;br /&gt;
 *          ERR_ID_WRONG                CPU ID &amp;gt;= number of available CPUs; or the same as currently running&lt;br /&gt;
 *          ERR_CPU_ALREADY_TERMINATED  CPU already terminated&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceosmp_cpu_terminate(&lt;br /&gt;
    U32_t cpu_id&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| cpu_id || ID of CPU core to be terminated.&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit  || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || CPU ID outside allowed range 0 to 254&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || CPU ID &amp;gt;= number of available CPUs; or the same as currently running&lt;br /&gt;
|-&lt;br /&gt;
| ERR_CPU_ALREADY_TERMINATED  || CPU already terminated&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, faulty_cpu;&lt;br /&gt;
...&lt;br /&gt;
// Terminate CPU core&lt;br /&gt;
status = oceosmp_cpu_terminate(faulty_cpu));&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;Task directives&amp;lt;/span&amp;gt;==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ API Functions&lt;br /&gt;
|-&lt;br /&gt;
| Directive                                                                     || Description                          || main || task || IRQ handler&lt;br /&gt;
|-&lt;br /&gt;
| [[OCEOSmp/directive reference#oceos_task_create()| oceos_task_create()]]             || Create Task                        || *    ||      || &lt;br /&gt;
|-&lt;br /&gt;
| [[OCEOSmp/directive reference#oceos_task_start()| oceos_task_start()]]               || Start Task                         ||      ||  *   || *&lt;br /&gt;
|-&lt;br /&gt;
| [[OCEOSmp/directive reference#oceos_task_timed_start()| oceos_task_timed_start()]]   || Schedule a task to start execution at a given system time||      ||  *   || *&lt;br /&gt;
|-&lt;br /&gt;
| [[OCEOSmp/directive reference#oceos_task_disable()| oceos_task_disable()]]           || Disable Task                       ||      ||  *   || *&lt;br /&gt;
|-&lt;br /&gt;
| [[OCEOSmp/directive reference#oceos_task_enable()| oceos_task_enable()]]             || Enable Task                        ||      ||  *   || *&lt;br /&gt;
|-&lt;br /&gt;
| [[OCEOSmp/directive reference#oceos_task_self()| oceos_task_self()]]                 || Returns the task ID of the currently executing task ||    ||  *   || *&lt;br /&gt;
|-&lt;br /&gt;
| [[OCEOSmp/directive reference#oceos_task_get_priority()| oceos_task_get_priority()]] || Get priority of a task             ||      ||  *   || *&lt;br /&gt;
|-&lt;br /&gt;
| [[OCEOSmp/directive reference#oceos_task_get_status()| oceos_task_get_status()]]     || Get status of a task               ||      ||  *   || *&lt;br /&gt;
|-&lt;br /&gt;
| [[OCEOSmp/directive reference#oceos_task_kill()| oceos_task_kill()]]                 || Directive to terminate current task||      ||  *   || *&lt;br /&gt;
|-&lt;br /&gt;
| [[OCEOSmp/directive reference#oceos_task_get_info()| oceos_task_get_info()]]         || Get task information               ||      ||  *   || *&lt;br /&gt;
|-&lt;br /&gt;
| [[OCEOSmp/directive reference#oceosmp_task_kill()| oceosmp_task_kill()]]                 || Directive to terminate current task||      ||  *   || *&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;Task data structures&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''tasks.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The following data structures are used by some of the task directives.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Data structures'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * A pointer to this structure is passed to oceos_task_create().&lt;br /&gt;
 * The structure is first initialised according to a tasks's parameters,&lt;br /&gt;
 * and is not used again after the task is created and may then be discarded.&lt;br /&gt;
 */&lt;br /&gt;
struct task_descriptor {&lt;br /&gt;
&lt;br /&gt;
	void (*function_start)(void*);	// name of task start function&lt;br /&gt;
	void (*function_end)(void*);	// optional, NULL or task end function&lt;br /&gt;
&lt;br /&gt;
	U32_t task_id;					// 0 to 254, usually an enum&lt;br /&gt;
	U32_t task_jobs_max;			// 1 to 15, max concurrent 'jobs'&lt;br /&gt;
	U32_t task_priority;			// 1 (highest) to 254 (lowest)&lt;br /&gt;
	U32_t task_threshold;			// &amp;gt;=1, &amp;lt;= task_priority (higher or same priority)&lt;br /&gt;
	U32_t task_turned_on_initially;	// 0: disabled initially, else enabled&lt;br /&gt;
&lt;br /&gt;
	U32_t time_deadline_microsecs;	// start request to finish, 0 to ignore&lt;br /&gt;
	U32_t time_min_interval_microsecs;	// between start requests, 0 to ignore&lt;br /&gt;
&lt;br /&gt;
	U32_t uses_cpu_affinity;		// 0: not restricted, else core restricted&lt;br /&gt;
	U32_t uses_cpu_affinity_core_id;// core ID to which restricted if affinity used&lt;br /&gt;
}__attribute__ ((aligned (8)));&lt;br /&gt;
&lt;br /&gt;
/**&lt;br /&gt;
 * Task info used with oceos_task_get_info&lt;br /&gt;
 */&lt;br /&gt;
struct task_info {&lt;br /&gt;
  U64_t           time_max_delay;               // maximum time job is waiting on ready queue before becoming active&lt;br /&gt;
  U64_t           time_max_finish;              // maximum time to finish job execution after starting&lt;br /&gt;
  U64_t           time_max_exec;                // maximum time spent executing&lt;br /&gt;
  U64_t           time_total_exec;              // total CPU time used by this task&lt;br /&gt;
  U64_t           time_min_gap_starts;          // minimum time between job creations, can be reset&lt;br /&gt;
  U64_t           time_min_gap_finish_start;    // minimum time between job ending and new job creation, can be reset&lt;br /&gt;
&lt;br /&gt;
  U64_t           time_last_start;              // time of most recent job creation&lt;br /&gt;
  U64_t           time_last_finish;             // time of most recent job finish&lt;br /&gt;
&lt;br /&gt;
  unsigned int    jobs_current_max  :16;        // maximum number of current jobs for this task, no roll over, can be reset&lt;br /&gt;
  unsigned int    jobs_total        :16;        // number of times this task was started, no roll-over, can be reset&lt;br /&gt;
  U32_t           jobs_current;                 // Number of task instances currently in use by oceos&lt;br /&gt;
&lt;br /&gt;
  U32_t           preempt_max;                  // maximum times any job was pre-empted, no roll-over, can be reset&lt;br /&gt;
}__attribute__ ((aligned (8)));&lt;br /&gt;
&lt;br /&gt;
/* A task's status is returned as below if queried */&lt;br /&gt;
enum TASK_STATUS {&lt;br /&gt;
    TASK_DISABLED,      // cannot be scheduled, and no current jobs&lt;br /&gt;
    TASK_ENABLED,       // can be scheduled, but no current jobs&lt;br /&gt;
    TASK_INVALID,       // task does not exist&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_task_create()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''tasks.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Create a task.&lt;br /&gt;
Can only be use before OCEOS starts. Stores the task information in the OCEOS fixed data area.&lt;br /&gt;
This directive populates the data structures for a task. It should be called after [[OCEOSmp/directive_reference#oceos_init()|oceos_init()]] and before [[OCEOSmp/directive_reference#oceos_init_finish()|oceos_init_finish()]].&amp;lt;br&amp;gt;&lt;br /&gt;
It must be called for each task otherwise [[OCEOSmp/directive_reference#oceos_start()|oceos_start()]] will return an error.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Create a task using a task descriptor structure&lt;br /&gt;
 *&lt;br /&gt;
 * Can only be used in Initialisation Phase.&lt;br /&gt;
 *&lt;br /&gt;
 * A task has twelve constant parameters set when the task is created.&lt;br /&gt;
 * Rather than setting a list of these parameters the named fields of a&lt;br /&gt;
 * task_descriptor structure are set and a pointer to it passed here.&lt;br /&gt;
 *&lt;br /&gt;
 * The task_descriptor structure fields are described above.&lt;br /&gt;
 * Once the task has been created the structure can be discarded.&lt;br /&gt;
 *&lt;br /&gt;
 * To create a task:&lt;br /&gt;
 *		set up a task_descriptor structure,&lt;br /&gt;
 *		set its fields to the parameter values for the task,&lt;br /&gt;
 *		pass a pointer to the structure to this directive.&lt;br /&gt;
 *&lt;br /&gt;
 * The structure is checked for validity by oceos_task_create and its&lt;br /&gt;
 * information used to set the task details in the OCEOS fixed data area.&lt;br /&gt;
 *&lt;br /&gt;
 * @param  struct task_descriptor *	fields give task characteristics&lt;br /&gt;
 *&lt;br /&gt;
 * @return OCEOS_SUCCESS            No errors or warnings&lt;br /&gt;
 *         WARN_NO_END_FUNCTION     Warning, no end task function specified&lt;br /&gt;
 *&lt;br /&gt;
 *         ERR_SYS_FIXED_CORRUPT    System Fixed area corrupt&lt;br /&gt;
 *         ERR_WRONG_CPU_CORE       Executing directive on wrong CPU&lt;br /&gt;
 *         ERR_WRONG_PHASE          Called before oceos_init() is done&lt;br /&gt;
 *         ERR_TOO_MANY             MAX number of tasks already created&lt;br /&gt;
 *         ERR_ID_INVALID           Task ID outside allowed range 0 to 254&lt;br /&gt;
 *         ERR_ID_WRONG             Task ID outside &amp;gt;= number of tasks&lt;br /&gt;
 *         ERR_T_ALREADY_ALLOCATED  Task ID already in use&lt;br /&gt;
 *         ERR_T_PRIORITY_INVALID   Task priority outside allowed range 1 to 254&lt;br /&gt;
 *         ERR_THRESHOLD_INVALID    Task threshold outside range 1 to 254&lt;br /&gt;
 *         ERR_THRESHOLD_WRONG      Task threshold  higher priority than task priority&lt;br /&gt;
 *         ERR_JOBS_MAX_INVALID     Job number outside range 1 to 15&lt;br /&gt;
 *         ERR_JOBS_TOO_MANY        System capacity exceeded&lt;br /&gt;
 *         ERR_AFFINITY_WRONG       CPU core specified is outside chosen range&lt;br /&gt;
 *         ERR_START_FUNCTION_BAD   Task start function address either NULL or misaligned&lt;br /&gt;
 */&lt;br /&gt;
S32_t   oceos_task_create(&lt;br /&gt;
    const struct task_descriptor * const task_description_ptr&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter           || Description&lt;br /&gt;
|-&lt;br /&gt;
|struct task_descriptor * || Pointer to task descriptor which contains task attributes&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit     || Description&lt;br /&gt;
|-&lt;br /&gt;
|WARN_NO_END_FUNCTION     || Warning, no end task function specified&lt;br /&gt;
|-&lt;br /&gt;
|ERR_SYS_FIXED_CORRUPT    || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
|ERR_WRONG_CPU_CORE       || Executing directive on wrong CPU&lt;br /&gt;
|-&lt;br /&gt;
|ERR_WRONG_PHASE          || Called before oceos_init() is done&lt;br /&gt;
|-&lt;br /&gt;
|ERR_TOO_MANY             || MAX number of tasks already created&lt;br /&gt;
|-&lt;br /&gt;
|ERR_ID_INVALID           || Task ID outside allowed range 0 to 254&lt;br /&gt;
|-&lt;br /&gt;
|ERR_ID_WRONG             || Task ID outside &amp;gt;= number of tasks&lt;br /&gt;
|-&lt;br /&gt;
|ERR_T_ALREADY_ALLOCATED  || Task ID already in use&lt;br /&gt;
|-&lt;br /&gt;
|ERR_T_PRIORITY_INVALID   || Task priority outside allowed range 1 to 254&lt;br /&gt;
|-&lt;br /&gt;
|ERR_THRESHOLD_INVALID    || Task threshold outside range 1 to 254&lt;br /&gt;
|-&lt;br /&gt;
|ERR_THRESHOLD_WRONG      || Task threshold  higher priority than task priority&lt;br /&gt;
|-&lt;br /&gt;
|ERR_JOBS_MAX_INVALID     || Job number outside range 1 to 15&lt;br /&gt;
|-&lt;br /&gt;
|ERR_JOBS_TOO_MANY        || System capacity exceeded&lt;br /&gt;
|-&lt;br /&gt;
|ERR_AFFINITY_WRONG       || CPU core specified is outside chosen range&lt;br /&gt;
|-&lt;br /&gt;
|ERR_START_FUNCTION_BAD   || Task start function address either NULL or misaligned&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
/* Sample Task names - all here start with t_ to help avoid name confusion */&lt;br /&gt;
enum TASK_NAME{&lt;br /&gt;
      t_0,&lt;br /&gt;
      t_1,&lt;br /&gt;
      t_2&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
/*&lt;br /&gt;
 * APPLICATION FUNCTION DECLARATIONS&lt;br /&gt;
 */&lt;br /&gt;
void fun0(void *);&lt;br /&gt;
void fun1(void *);&lt;br /&gt;
void fun2(void *);&lt;br /&gt;
void end_function(void *);&lt;br /&gt;
&lt;br /&gt;
const struct task_descriptor tasks_data[NUMBER_OF_TASKS] = {&lt;br /&gt;
    {fun0, end_function, t_0, 2, 10, 8, TASK_ENABLED, 0, 0, 0, 0},&lt;br /&gt;
    {fun1, end_function, t_1, 2, 10, 8, TASK_ENABLED, 0, 0, 0, 0},&lt;br /&gt;
    {fun2, end_function, t_2, 2, 10, 8, TASK_ENABLED, 0, 0, 0, 0}&lt;br /&gt;
}; &lt;br /&gt;
&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
    // create tasks (names are defined in the application header)&lt;br /&gt;
    for (i=0; i&amp;lt;NUMBER_OF_TASKS; i++){&lt;br /&gt;
        if ( oceos_task_create(&amp;amp;tasks_data[i]) != OCEOS_SUCCESS ){&lt;br /&gt;
        	oceosmp_print(&amp;quot;\nFailed to create task\n\r&amp;quot;);&lt;br /&gt;
        	return -i;&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_task_start()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''tasks.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function starts an instance of a task. An instance of a task is called a job in OCEOS terminology.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 *  Starting a task involves three main stages&lt;br /&gt;
 *      1 setting up a job&lt;br /&gt;
 *          finding a free job entry if available&lt;br /&gt;
 *          setting up this entry including passing it the data void *&lt;br /&gt;
 *&lt;br /&gt;
 *      2 placing the job on readyQ&lt;br /&gt;
 *&lt;br /&gt;
 *      3 doing a context switch&lt;br /&gt;
 * This function should only be called after OCEOS is initialised&lt;br /&gt;
 *       and the dynamic task and job structures set up&lt;br /&gt;
 *&lt;br /&gt;
 *  When used from an interrupt handler,&lt;br /&gt;
 *  the context switch is only done&lt;br /&gt;
 *  after all nested interrupts have unwound&lt;br /&gt;
 *&lt;br /&gt;
 * @param task_id Task ID must be in range 0 to 254&lt;br /&gt;
 * @param ptr     Pointer to task data&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT    System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT      System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE          Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID           Task ID is invalid&lt;br /&gt;
 *          ERR_ID_WRONG             Task ID is wrong&lt;br /&gt;
 *          ERR_START_TASK_DISABLED  Starting task is disabled&lt;br /&gt;
 *          ERR_TOO_MANY             There is no free job&lt;br /&gt;
 *          ERR_SYS_BUSY             Failed to grab the lock&lt;br /&gt;
 */&lt;br /&gt;
S32_t   oceos_task_start(&lt;br /&gt;
    const U32_t task_id, // task ID, must be in range 0 to 254&lt;br /&gt;
    void * const ptr    // pointer to data&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| task_id || U32_t with Task ID in range 0 to 254.&lt;br /&gt;
|-&lt;br /&gt;
| ptr    || void * pointer to task data&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit  || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT    || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT      || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE          || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID           || Task ID is invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG             || Task ID is wrong&lt;br /&gt;
|-&lt;br /&gt;
| ERR_START_TASK_DISABLED  || Starting task is disabled&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TOO_MANY             || There is no free job&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY             || Failed to grab the lock&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
void *ptr;&lt;br /&gt;
...&lt;br /&gt;
// Start instance of task T_1 passing pointer ptr&lt;br /&gt;
status = oceos_task_start(t_1,ptr);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_task_timed_start()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''tasks.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function schedules a task to start execution at a given system time.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 *  Schedule a task to start execution at a given system time&lt;br /&gt;
 *&lt;br /&gt;
 *  The before and after offsets define a window around the selected time&lt;br /&gt;
 *  in which the task may be started.&lt;br /&gt;
 *&lt;br /&gt;
 *  If the current system time is before the start window a job is created&lt;br /&gt;
 *  and a corresponding action put on the timed action queue.&lt;br /&gt;
 *&lt;br /&gt;
 *  If the current system time is within the time window for starting the task,&lt;br /&gt;
 *  it is started immediately.&lt;br /&gt;
 *&lt;br /&gt;
 *  If the current system time is after the window, an error is reported.&lt;br /&gt;
 *&lt;br /&gt;
 *  Times are in microseconds.&lt;br /&gt;
 *&lt;br /&gt;
 *  This function should only be called after OCEOS is initialised&lt;br /&gt;
 *  and the dynamic task and job structures set up&lt;br /&gt;
 *&lt;br /&gt;
 * @param taskID        Task ID must be in range 0 to 254&lt;br /&gt;
 * @param ptr           Pointer to data&lt;br /&gt;
 * @param start_time    System time at which job should start&lt;br /&gt;
 * @param before        Forward tolerance for time&lt;br /&gt;
 * @param after         Backward tolerance for time&lt;br /&gt;
 * @param return_job_id Return job_id to the user, to remove this job from timed action if needed&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              Task ID invalid&lt;br /&gt;
 *          ERR_ID_WRONG                Task ID is wrong&lt;br /&gt;
 *          ERR_TA_NOT_INIT             Timed action inialisation is not done and tried to be used&lt;br /&gt;
 *          ERR_START_TASK_DISABLED     Starting task is disabled&lt;br /&gt;
 *          ERR_TOO_MANY                There is no free job&lt;br /&gt;
 *          ERR_TOO_LATE                Starting task is too late(out of time frame)&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to grab the lock&lt;br /&gt;
 *          ERR_TA_Q_FULL               Timed action queue is full&lt;br /&gt;
 *          ERR_TA_START_FAILED         Timed action execute failed; See log&lt;br /&gt;
 */&lt;br /&gt;
S32_t   oceos_task_timed_start(&lt;br /&gt;
    const U32_t task_id,     // task ID, must be in range 0 to 254&lt;br /&gt;
    void * const ptr,        // pointer to data&lt;br /&gt;
    const U64_t start_time,  // system time at which job should start&lt;br /&gt;
    const U32_t before,      // forward tolerance for time&lt;br /&gt;
    const U32_t after,       // backward tolerance for time&lt;br /&gt;
    U32_t * return_job_id    // return job_id to the user, to remove this job from timed action if needed&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| taskID        || U32_t task ID must be in range 0 to 254&lt;br /&gt;
|-&lt;br /&gt;
| ptr           || void * pointer to data&lt;br /&gt;
|-&lt;br /&gt;
| start_time    || U64_t system time at which job should start&lt;br /&gt;
|-&lt;br /&gt;
| before        || U32_t forward tolerance for time&lt;br /&gt;
|-&lt;br /&gt;
| after         || U32_t backward tolerance for time&lt;br /&gt;
|-&lt;br /&gt;
| return_job_id || U32_t return job_id to the user, to remove this job from timed action if needed&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit  || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || Task ID invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || Task ID is wrong&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_NOT_INIT             || Timed action inialisation is not done and tried to be used&lt;br /&gt;
|-&lt;br /&gt;
| ERR_START_TASK_DISABLED     || Starting task is disabled&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TOO_MANY                || There is no free job&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TOO_LATE                || Starting task is too late(out of time frame)&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to grab the lock&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_Q_FULL               || Timed action queue is full&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_START_FAILED         || Timed action execute failed; See log&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
U32_t job_id;&lt;br /&gt;
U64_t cur_sys_time;&lt;br /&gt;
...&lt;br /&gt;
  cur_sys_time = oceos_time_sys_get64();&lt;br /&gt;
&lt;br /&gt;
  // Start task 10,000 microseconds (us) from now and advise if started more than 1,000 us before or 2,000 us after.&lt;br /&gt;
  status = oceos_task_timed_start(t_2, ptr, cur_sys_time + 10000, 1000, 2000, &amp;amp;job_id);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_task_disable()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''initialisation.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function disables a task and removes any current pending jobs from the readyQ.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 *  Disable a task and remove any current pending jobs on readyQ.&lt;br /&gt;
 *&lt;br /&gt;
 *  A disabled task's jobs  will not be put into execution nor put on readyQ.&lt;br /&gt;
 *&lt;br /&gt;
 *  Note that where execution of a task has already commenced,&lt;br /&gt;
 *  disabling the task will not prevent it from completing.&lt;br /&gt;
 *&lt;br /&gt;
 *  This function should only be called after OCEOS is initialised&lt;br /&gt;
 *  and the dynamic task and job structures set up&lt;br /&gt;
 *&lt;br /&gt;
 * @param taskID  Task ID must be in range 0 to 254&lt;br /&gt;
 * @return: OCEOS_SUCCESS&lt;br /&gt;
 *          WARN_ALREADY_DISABLED        Task already disabled&lt;br /&gt;
 *          WARN_SEM_PEND_REMOVE_FAILED  Failed to remove job from semaphore pending queue&lt;br /&gt;
 *          WARN_DQ_PEND_REMOVE_FAILED   Failed to remove job from dataq pending queue&lt;br /&gt;
 *&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT        System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT          System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE              Directive was called before OCEOS init is finished&lt;br /&gt;
 *          ERR_ID_INVALID               Task ID is invalid&lt;br /&gt;
 *          ERR_ID_WRONG                 Task ID is wrong&lt;br /&gt;
 *          ERR_SYS_BUSY                 Failed to grab the lock&lt;br /&gt;
 */&lt;br /&gt;
S32_t   oceos_task_disable(&lt;br /&gt;
    const U32_t task_id // task ID, must be in range 0 to 254&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| taskID || U32_t task ID must be in range 0 to 254&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit  || Description&lt;br /&gt;
|-&lt;br /&gt;
| WARN_ALREADY_DISABLED        || Task already disabled&lt;br /&gt;
|-&lt;br /&gt;
| WARN_SEM_PEND_REMOVE_FAILED  || Failed to remove job from semaphore pending queue&lt;br /&gt;
|-&lt;br /&gt;
| WARN_DQ_PEND_REMOVE_FAILED   || Failed to remove job from dataq pending queue&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT        || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT          || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE              || Directive was called before OCEOS init is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID               || Task ID is invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                 || Task ID is wrong&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                 || Failed to grab the lock&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Disable task t_1&lt;br /&gt;
status = oceos_task_disable(t_1);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_task_enable()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''tasks.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function enables a task. Only enabled tasks may be started.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 *  Enable a task - only enabled tasks are placed on readyQ or started.&lt;br /&gt;
 *&lt;br /&gt;
 *  This function should only be called after OCEOS is initialised&lt;br /&gt;
 *  and the dynamic task and job structures set up&lt;br /&gt;
 *&lt;br /&gt;
 * @param taskID   Task ID must be in range 0 to 254&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          WARN_ALREADY_ENABLED     Task already enabled&lt;br /&gt;
 *&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT    System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT      System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE          Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID           Task ID is invalid&lt;br /&gt;
 *          ERR_ID_WRONG             Task ID is wrong&lt;br /&gt;
 *          ERR_SYS_BUSY             Failed to grab the lock&lt;br /&gt;
 */&lt;br /&gt;
S32_t   oceos_task_enable(&lt;br /&gt;
    const U32_t task_id // task ID, must be in range 0 to 254&lt;br /&gt;
);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| taskID  || U32_t task ID must be in range 0 to 254&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit  || Description&lt;br /&gt;
|-&lt;br /&gt;
| WARN_ALREADY_ENABLED     || Task already enabled&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT    || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT      || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE          || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID           || Task ID is invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG             || Task ID is wrong&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY             || Failed to grab the lock&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Enable task t_2&lt;br /&gt;
status = oceos_task_enable(t_2);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_task_self()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''tasks.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the task number of the currently running task on the calling CPU.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Get currently running task on calling CPU&lt;br /&gt;
 *&lt;br /&gt;
 * @param t_id  Task ID holder&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT        System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT          System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE              Directive was called before OCEOS init is finished&lt;br /&gt;
 *          ERR_CPU_DYN_PTR_BAD          CPU dynamic area pointer corrupt&lt;br /&gt;
 */&lt;br /&gt;
S32_t  oceos_task_self(&lt;br /&gt;
    U32_t *t_id&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| t_id || S32_t * pointer to variable where task ID will be written.&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit  || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT        || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT          || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE              || Directive was called before OCEOS init is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_CPU_DYN_PTR_BAD          || CPU dynamic area pointer corrupt&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, task_running;&lt;br /&gt;
...&lt;br /&gt;
// Return task ID that's running on this core&lt;br /&gt;
status = oceos_task_self(&amp;amp;task_running);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_task_get_priority()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''tasks.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the priority of the task ID passed to it.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Get priority of the task&lt;br /&gt;
 *&lt;br /&gt;
 * @param taskID        ID of task, must be in range 0 to 254&lt;br /&gt;
 * @param t_priority    Pointer to task priority holder&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT        System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT          System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE              Directive was called before OCEOS init is finished&lt;br /&gt;
 *          ERR_ID_INVALID               Task ID is invalid&lt;br /&gt;
 *          ERR_ID_WRONG                 Task ID is wrong&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_task_get_priority(&lt;br /&gt;
    const U32_t task_id, // task ID, must be in range 0 to 254&lt;br /&gt;
    U32_t *t_priority   // Pointer to task priority holder&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| task_id || S32_t task ID of task whose priority is required&lt;br /&gt;
|-&lt;br /&gt;
| t_priority || S32_t * pointer to variable where priority will be written&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit  || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT        || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT          || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE              || Directive was called before OCEOS init is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID               || Task ID is invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                 || Task ID is wrong&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
U32_t t_priority;&lt;br /&gt;
...&lt;br /&gt;
// Return the priority of task ID t_4 &lt;br /&gt;
status = oceos_task_get_priority(t_4, &amp;amp;t_priority);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_task_get_status()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''tasks.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the status of the task ID passed to it.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Get status of the task;&lt;br /&gt;
 * if OK t_status holds enum TASK_STATUS&lt;br /&gt;
 *&lt;br /&gt;
 * @param taskID    ID of task, must be in range 0 to 254&lt;br /&gt;
 * @param t_status  enum TASK_STATUS holder&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT        System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT          System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE              Directive was called before OCEOS init is finished&lt;br /&gt;
 *          ERR_ID_INVALID               Task ID is invalid&lt;br /&gt;
 *          ERR_ID_WRONG                 Task ID is wrong&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_task_get_status(&lt;br /&gt;
    const U32_t task_id,&lt;br /&gt;
    U32_t *t_status&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| task_id || S32_t task ID of task whose priority is required&lt;br /&gt;
|-&lt;br /&gt;
| t_status || S32_t * pointer to variable where status will be written&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit  || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT        || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT          || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE              || Directive was called before OCEOS init is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID               || Task ID is invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                 || Task ID is wrong&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
U32_t t_status;&lt;br /&gt;
...&lt;br /&gt;
// Return the status of task ID t_4 &lt;br /&gt;
status = oceos_task_get_status(t_4, &amp;amp;t_status);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_task_get_info()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''tasks.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the task information for the specified task.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Get task information for task with ID.&lt;br /&gt;
 *&lt;br /&gt;
 * User must pass pointer to struct task_info in order to retrieve data.&lt;br /&gt;
 *&lt;br /&gt;
 * @param task_id  Task ID&lt;br /&gt;
 * @param info     Pointer to struct task_info&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT    System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT      System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE          Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID           Task ID invalid&lt;br /&gt;
 *          ERR_ID_WRONG             Task ID wrong&lt;br /&gt;
 *          ERR_TASK_INFO_PTR_BAD    Task info pointer provided by user is NULL&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_task_get_info (&lt;br /&gt;
    const U32_t task_id,   // Task ID&lt;br /&gt;
    struct task_info *info // Pointer to struct task_info&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| task_id || ID of task for which information is required&lt;br /&gt;
|-&lt;br /&gt;
| task_info || struct task_info * pointer to the structure where task information is to be written&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit  || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT    || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT      || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE          || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID           || Task ID invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG             || Task ID wrong&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TASK_INFO_PTR_BAD    || Task info pointer provided by user is NULL&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
struct task_info info;&lt;br /&gt;
...&lt;br /&gt;
// Get information for task T3&lt;br /&gt;
status = oceos_task_get_info(t_3, &amp;amp;info);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceosmp_task_kill()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''tasks.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function kills the specified task running on the specified CPU.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 *  Function to kill currently running task on CPU;&lt;br /&gt;
 *  Can be used:&lt;br /&gt;
 *      From Mode_SVC  =&amp;gt; normal running mode for application&lt;br /&gt;
 *          If nesting level is zero and Mode_SVC&lt;br /&gt;
 *      From Mode_IRQ  =&amp;gt; from IRQ handler&lt;br /&gt;
 *          If nesting level is not zero, set flag to call this function within IRQ handler&lt;br /&gt;
 *      From Exception =&amp;gt; Mode_ABT and Mode_UND&lt;br /&gt;
 *          If nesting level is zero and NOT Mode_SVC, it is exception;&lt;br /&gt;
 *              Disable IRQs on current CPU;&lt;br /&gt;
 *              Set kill current task flag to TRUE;&lt;br /&gt;
 *              Issue SGI on current CPU, will be interrupted on return from Exception and&lt;br /&gt;
 *              this function will be called within IRQ handler&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT    System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT      System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE          Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_CPU_DYN_PTR_BAD      CPU dynamic area pointer corrupt&lt;br /&gt;
 *          ERR_ID_INVALID           Task ID invalid&lt;br /&gt;
 *          ERR_ID_WRONG             Task ID wrong&lt;br /&gt;
 *          ERR_CPU_ID_WRONG         CPU ID wrong&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceosmp_task_kill(&lt;br /&gt;
    U32_t task_id,&lt;br /&gt;
    U32_t cpu_id&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| task_id  || U32_t task ID to be killed (must be in range 0 to 254)&lt;br /&gt;
|-&lt;br /&gt;
| cpu_id  || U32_t CPU ID where task_id is to be killed&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT    || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT      || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE          || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_CPU_DYN_PTR_BAD      || CPU dynamic area pointer corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID           || Task ID invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG             || Task ID wrong&lt;br /&gt;
|-&lt;br /&gt;
| ERR_CPU_ID_WRONG         || CPU ID wrong&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Kill task t_2 on CPU cpu_1&lt;br /&gt;
status = oceosmp_task_kill(t_2, cpu_1);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;Mutex directives&amp;lt;/span&amp;gt;==&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_mutex_create()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''mutex.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function creates a mutex of specified ID with a specified priority ceiling.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Creates a mutex with priority ceiling&lt;br /&gt;
 *&lt;br /&gt;
 * NOTE: This function should only be called after OCEOSmp is initialised with&lt;br /&gt;
 *  oceos_init() and before initialisation ends with oceos_init_finish()&lt;br /&gt;
 *  and scheduling starts with oceos_start()&lt;br /&gt;
 *&lt;br /&gt;
 * @param mutex_id  mutex ID value 0 to 62&lt;br /&gt;
 * @param priority  mutex priority ceiling 1 to 254 (high to low task priority)&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_WRONG_CPU_CORE          Executing directive on wrong CPU&lt;br /&gt;
 *          ERR_WRONG_PHASE             Called before oceos_init() is done&lt;br /&gt;
 *          ERR_TOO_MANY                MAX number of MUTEXs already created&lt;br /&gt;
 *          ERR_ID_INVALID              MUTEX ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                MUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
 *          ERR_MX_ALREADY_ALLOCATED    MUTEX ID already used&lt;br /&gt;
 *          ERR_MX_PRIORITY_WRONG       MUTEX priority ceiling outside allowed range 1 to 254&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_mutex_create(&lt;br /&gt;
    const U32_t mutex_id,  // mutex ID, must be in range 0 to 62&lt;br /&gt;
    const U8_t  priority  // mutex priority ceiling&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| mutex_id  || u32_t mutex ID to be created (value 0 to 62).&lt;br /&gt;
|-&lt;br /&gt;
| priority_ceiling ||  U32_t mutex priority ceiling 1 to 254 (high to low task priority)&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_CPU_CORE          || Executing directive on wrong CPU&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Called before oceos_init() is done&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TOO_MANY                || MAX number of MUTEXs already created&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || MUTEX ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || MUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_MX_ALREADY_ALLOCATED    || MUTEX ID already used&lt;br /&gt;
|-&lt;br /&gt;
| ERR_MX_PRIORITY_WRONG       || MUTEX priority ceiling outside allowed range 1 to 254&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Create mutex with ID print_mutex and priority ceiling of 5&lt;br /&gt;
status = oceos_mutex_create(print_mutex, 5);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_mutex_wait()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''mutex.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function makes the task wait until the specified mutex is available.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
 /*&lt;br /&gt;
  * Wait on mutex with ID.&lt;br /&gt;
  * If task succeeds in grabbing mutex, system level priority rises to&lt;br /&gt;
  * priority of this mutex, so tasks with lower or equal priority will&lt;br /&gt;
  * not be able to start till mutex is released.&lt;br /&gt;
  *&lt;br /&gt;
  * This should only be called after OCEOSmp scheduling has started.&lt;br /&gt;
  *&lt;br /&gt;
  * @param mutex_id     const U32_t  : value 0 to 62&lt;br /&gt;
  *&lt;br /&gt;
  * @return  OCEOS_SUCCESS&lt;br /&gt;
  *          WARN_MX_INCORRECT_ORDER     MUTEX acquired in incorrect order&lt;br /&gt;
  *&lt;br /&gt;
  *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
  *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
  *          ERR_WRONG_PHASE             Directive was called before OCEOSmp initialisation is finished&lt;br /&gt;
  *          ERR_ID_INVALID              MUTEX ID outside allowed range 0 to 62&lt;br /&gt;
  *           ERR_ID_WRONG                MUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
  *          ERR_MX_CEILING_BAD          MUTEX ceiling not lower priority than job priority&lt;br /&gt;
  *          ERR_MX_ALREADY_HELD         MUTEX already held by this job&lt;br /&gt;
  *          ERR_SYS_BUSY                Failed to grab context switch guard&lt;br /&gt;
  */&lt;br /&gt;
S32_t oceos_mutex_wait(&lt;br /&gt;
    const U32_t  mutex_id      // mutex ID, must be in range 0 to 62&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| mutex_id  || u32_t mutex ID to be waited on (value 0 to 62).&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| WARN_MX_INCORRECT_ORDER     || MUTEX acquired in incorrect order&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOSmp initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || MUTEX ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || MUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_MX_CEILING_BAD          || MUTEX ceiling not lower priority than job priority&lt;br /&gt;
|-&lt;br /&gt;
| ERR_MX_ALREADY_HELD         || MUTEX already held by this job&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to grab context switch guard&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Wait on mutex m_2&lt;br /&gt;
status = oceos_mutex_wait(m_2);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_mutex_signal()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''mutex.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function signals the specified mutex.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Signal a mutex with ID&lt;br /&gt;
 *&lt;br /&gt;
 * N.B. :&lt;br /&gt;
 *      This function should not be called from an interrupt handler&lt;br /&gt;
 *      This should only be called after OCEOSmp scheduling has started.&lt;br /&gt;
 *&lt;br /&gt;
 * @param mutex_id     const U32_t  : value 0 to 62&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          WARN_MX_ALREADY_FREE        MUTEX is free already&lt;br /&gt;
 *          WARN_MX_NESTING_BAD         MUTEX nesting incorrect&lt;br /&gt;
 *&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOSmp initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              MUTEX ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                MUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
 *          ERR_MX_WRONG_JOB            MUTEX not held by this job&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to grab context switch guard&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_mutex_signal(&lt;br /&gt;
    const U32_t  mutex_id     // mutex ID, must be in range 0 to 62&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| mutex_id  || u32_t mutex ID to be signalled (value 0 to 62).&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| WARN_MX_ALREADY_FREE        || MUTEX is free already&lt;br /&gt;
|-&lt;br /&gt;
| WARN_MX_NESTING_BAD         || MUTEX nesting incorrect&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOSmp initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || MUTEX ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || MUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_MX_WRONG_JOB            || MUTEX not held by this job&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to grab context switch guard&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Signal mutex m_2&lt;br /&gt;
status = oceos_mutex_signal(m_2);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_mutex_get_value()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''mutex.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the value of the specified mutex.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Get current value of mutex with ID&lt;br /&gt;
 *&lt;br /&gt;
 * @param mutex_id      const U32_t  : value 0 to 62&lt;br /&gt;
 * @param m_value       pointer to MUTEX value holder&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOSmp initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              MUTEX ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                MUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
 *          ERR_MX_DATA_PTR_BAD         Pointer to MUTEX value return holder is null&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_mutex_get_value(&lt;br /&gt;
    const U32_t  mutex_id,      // mutex ID, must be in range 0 to 62&lt;br /&gt;
    U32_t *m_value              // Pointer to MUTEX value holder&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| mutex_id  || u32_t mutex ID to be signalled (value 0 to 62)&lt;br /&gt;
|-&lt;br /&gt;
| m_value  || u32_t * pointer where mutex value is to be written&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOSmp initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || MUTEX ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || MUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_MX_DATA_PTR_BAD         || Pointer to MUTEX value return holder is null&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
U32_t value;&lt;br /&gt;
...&lt;br /&gt;
// Get value of mutex m_2&lt;br /&gt;
status = oceos_mutex_get_value(m_2, &amp;amp;value);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;Read/write mutex directives&amp;lt;/span&amp;gt;==&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;Read/write mutex overview&amp;lt;/span&amp;gt;===&lt;br /&gt;
&lt;br /&gt;
Contents:&lt;br /&gt;
&lt;br /&gt;
 1.  Read/Write Mutex features&lt;br /&gt;
 2.  Read/Write Mutex data structures&lt;br /&gt;
 3.  Read/Write Mutex constants&lt;br /&gt;
 4.  Read/Write Mutex manager Directives&lt;br /&gt;
&lt;br /&gt;
==== Read/Write Mutex Features ====&lt;br /&gt;
&lt;br /&gt;
Read/Write Mutexes (rwmutexes) can be held for 'read' at the same time&lt;br /&gt;
by multiple jobs on different CPUs, but once held for 'write' by any job&lt;br /&gt;
cannot be obtained for 'read' or for 'write' by another job until released.&lt;br /&gt;
&lt;br /&gt;
They can be used to allow data be read simultaneously by multiple jobs when&lt;br /&gt;
the data is not being updated while ensuring that no updating can take&lt;br /&gt;
place while any job is reading the data.&lt;br /&gt;
&lt;br /&gt;
Pending write requests take precedence over pending read requests and are&lt;br /&gt;
done on a first come, first served basis. Once any job on a CPU has a&lt;br /&gt;
rwmutex for 'read' no other job on that CPU can acquire it so as to avoid&lt;br /&gt;
potential problems and minimise delays in servicing write requests by other&lt;br /&gt;
CPUs.&lt;br /&gt;
&lt;br /&gt;
While any job holds a rwmutex for reading any job on another CPU can also&lt;br /&gt;
acquire it for reading. Other jobs on the same CPU that may attempt to&lt;br /&gt;
acquire the rwmutex are delayed in starting until return of the rwmutex.&lt;br /&gt;
No job can acquire the rwmutex for writing until all read acquisitions&lt;br /&gt;
have been returned.&lt;br /&gt;
&lt;br /&gt;
No job will acquire a rwmutex for reading if any job is trying to acquire&lt;br /&gt;
it for writing, giving write precedence over read. Multiple write requests&lt;br /&gt;
waiting for existing read acquisitions to complete are serviced in the&lt;br /&gt;
order in which they were made when the current read acquisitions complete.&lt;br /&gt;
&lt;br /&gt;
If a task waits on a rwmutex that it already holds a system log entry is&lt;br /&gt;
made (LOG_RWMUTEX_ALREADY_HELD) and an INTERNAL_ERROR status code returned.&lt;br /&gt;
&lt;br /&gt;
If a task attempts to release a rwmutex it does not hold a system log entry&lt;br /&gt;
is made (LOG_RWMUTEX_ALREADY_FREE) and an INTERNAL_ERROR status code returned.&lt;br /&gt;
&lt;br /&gt;
If a job holds more than one rwmutex at the same time these must be&lt;br /&gt;
acquired and released in a nested manner&lt;br /&gt;
(e.g. wait 1, wait 2, wait 3, signal 3, signal 2, signal 1).&lt;br /&gt;
&lt;br /&gt;
If a task exits while holding one or more rwmutexes these are returned and&lt;br /&gt;
a system log entry made (LOG_RWMUTEX_NOT_RETURNED).&lt;br /&gt;
&lt;br /&gt;
==== Read/Write Mutex data structures ====&lt;br /&gt;
&lt;br /&gt;
In OCEOSmp each rwmutex has a priority ceiling, the priority of the highest&lt;br /&gt;
priority task that acquires the rwmutex for read or for write.&lt;br /&gt;
OCEOSmp uses this to ensure that once a job on a particular CPU has the&lt;br /&gt;
rwmutex for reading or for writing no other job on that CPU can be started&lt;br /&gt;
that might try to obtain that rwmutex.&lt;br /&gt;
&lt;br /&gt;
The priority ceiling of a rwmutex is specified when the rwmutex is created&lt;br /&gt;
and does not change subsequently. Priority ceilings are stored in the&lt;br /&gt;
fixed data area as an array U8_t rwmutexCeilings[] indexed by mutex ID.&lt;br /&gt;
This array is extended to be a whole number of 32-bit words.&lt;br /&gt;
&lt;br /&gt;
A rwmutex has a unique rwmutex ID, an unsigned integer usually defined in&lt;br /&gt;
the application header file as an enum RWMUTEX_NAME{} thus allowing a&lt;br /&gt;
user-friendly name be associated with each rwmutex ID.&lt;br /&gt;
&lt;br /&gt;
Using an enum is strongly recommended as it allows a user-friendly name be&lt;br /&gt;
associated with each ID, and helps ensure IDs are contiguous from 0.&lt;br /&gt;
&lt;br /&gt;
These rwmutex IDs are used as indices into both fixed and dynamic data&lt;br /&gt;
arrays and must cover the range 0 to ((number of rwmutexes) -1). Using&lt;br /&gt;
enum RWMUTEX_NAME{} automatically assigns names to IDs 0, 1, 2...&lt;br /&gt;
&lt;br /&gt;
Read write mutex dynamic data such as the current write requests and&lt;br /&gt;
current read count are stored in the dynamic data area in an array of&lt;br /&gt;
struct rwmutex_dyn_block also indexed by the rwmutex ID.&lt;br /&gt;
&lt;br /&gt;
A further dynamic area array of guard_t is used in providing mutual&lt;br /&gt;
exclusion when updating the rwmutex dynamic data.&lt;br /&gt;
&lt;br /&gt;
==== Read/Write Mutex constants ====&lt;br /&gt;
&lt;br /&gt;
In OCEOSmp there can be a maximum of 63 rwmutexes,&lt;br /&gt;
with IDs from 0 to 62 (the value 63 is used as an invalid ID).&lt;br /&gt;
&lt;br /&gt;
The rwmutexes can be created in any order, but OCEOSmp will return an error&lt;br /&gt;
and fail to start if the resulting IDs fail to be contiguous from 0 as IDs&lt;br /&gt;
are used by OCEOS as indices into arrays.&lt;br /&gt;
&lt;br /&gt;
Each rwmutex has a priority ceiling, the priority of the highest priority&lt;br /&gt;
task that uses the rwmutex for reading or for writing. This is specified&lt;br /&gt;
when the rwmutex is created, does not change subsequently, and must be in&lt;br /&gt;
the range 1 (TASK_MAX_PRIORITY) to 254 (TASK_MIN_PRIORITY).&lt;br /&gt;
The application developer must ensure that the correct rwmutex ceiling&lt;br /&gt;
is used. OCEOSmp will detect an attempt to acquire a rwmutex by a task&lt;br /&gt;
with higher priority than that rwmutex's priority ceiling, make a&lt;br /&gt;
system log entry (LOG_RWMUTEX_BAD_CEILING) and return an INTERNAL_ERROR&lt;br /&gt;
status code.&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_rwmutex_create()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''rwmutex.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function ees a read/write mutex.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Creates a Read/Write Mutex (RWMUTEX)&lt;br /&gt;
 *&lt;br /&gt;
 * This function should only be called after OCEOSmp is initialised with&lt;br /&gt;
 * oceos_init() and before initialisation ends with oceos_init_finish()&lt;br /&gt;
 * and scheduling starts with oceos_start()&lt;br /&gt;
 *&lt;br /&gt;
 * @param rwm_id    Read/Write RWMUTEX ID, must be in range 0 to 62&lt;br /&gt;
 * @param priority  Priority ceiling of highest priority task that uses the RWMUTEX&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_WRONG_CPU_CORE          Executing directive on wrong CPU&lt;br /&gt;
 *          ERR_WRONG_PHASE             Called before oceos_init() is done&lt;br /&gt;
 *          ERR_TOO_MANY                MAX number of RWMUTEXs already created&lt;br /&gt;
 *          ERR_ID_INVALID              RWMUTEX ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                RWMUTEX ID &amp;gt;= number of RWMUTEXs&lt;br /&gt;
 *          ERR_RWMX_ALREADY_ALLOCATED  RWMUTEX ID already used&lt;br /&gt;
 *          ERR_RWMX_PRIORITY_WRONG     RWMUTEX priority ceiling outside allowed range 1 to 254&lt;br /&gt;
 */&lt;br /&gt;
S32_t   oceos_rwmutex_create(&lt;br /&gt;
    const U32_t rwm_id,   // RWMUTEX ID, must be in range 0 to max rwm&lt;br /&gt;
    const U8_t priority   // RWMUTEX priority ceiling&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| rwm_id || Read/Write RWMUTEX ID, must be in range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| priority || Priority ceiling of highest priority task that uses the RWMUTEX&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_CPU_CORE          || Executing directive on wrong CPU&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Called before oceos_init() is done&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TOO_MANY                || MAX number of RWMUTEXs already created&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || RWMUTEX ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || RWMUTEX ID &amp;gt;= number of RWMUTEXs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_RWMX_ALREADY_ALLOCATED  || RWMUTEX ID already used&lt;br /&gt;
|-&lt;br /&gt;
| ERR_RWMX_PRIORITY_WRONG     || RWMUTEX priority ceiling outside allowed range 1 to 254&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Create read/write mutex with ID rwm_2 and priority ceiling of 100 &lt;br /&gt;
status = oceos_rwmutex_create(rwm_1, 100);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_rwmutex_read_wait()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''rwmutex.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function acquires a read/write mutex for read. If successful, jobs on other CPUs can also acquire it for read, but no job will be able to acquire it for write while any read is under way. If job already holds RWMUTEX for read or for write the appropriate status code is returned, a system log entry made, and the job continues. It will not succeed while any job is waiting to obtain RWMUTEX for write, and will loop waiting for all pending writes on this RWMUTEX to complete.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Read wait on RWMUTEX.&lt;br /&gt;
 *&lt;br /&gt;
 * If successful jobs on other CPUs can also acquire it for read, but no job&lt;br /&gt;
 * will be able to acquire it for write while any read is under way.&lt;br /&gt;
 * If job already holds RWMUTEX for read or for write appropriate status code&lt;br /&gt;
 * is returned, a system log entry made, and the job continues.&lt;br /&gt;
 * Will not succeed while any job is waiting to obtain RWMUTEX for write,&lt;br /&gt;
 * will loop waiting for all pending writes on this RWMUTEX to complete.&lt;br /&gt;
 *&lt;br /&gt;
 * This should only be called after OCEOS scheduling has started.&lt;br /&gt;
 *&lt;br /&gt;
 * N.B.	The returned status code must be checked and appropriate action&lt;br /&gt;
 * 		taken.&lt;br /&gt;
 *&lt;br /&gt;
 * @param rwm_id    const U32_t  : value 0 to 62&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          WARN_RWMX_NOT_HIGHEST       Already holds a RWMUTEX higher in the RWMUTEX order&lt;br /&gt;
 *                                      (there then may be a risk of deadlock)&lt;br /&gt;
 *&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              RWMUTEX ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                RWMUTEX ID &amp;gt;= number of RWMUTEXs&lt;br /&gt;
 *          ERR_RWMX_CEILING_BAD        RWMUTEX ceiling not lower priority than job priority&lt;br /&gt;
 *          ERR_RWMX_ALREADY_HELD       RWMUTEX already held by this job&lt;br /&gt;
 *          ERR_RWMX_CPU_STACK_FULL     CPU priority ceiling stack full&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_rwmutex_read_wait(&lt;br /&gt;
    const U32_t rwm_id  // RWMUTEX ID, must be in range 0 to 62&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| rwm_id || U32_t rwmutex to be acquired for read (value 0 to 62)&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| WARN_RWMX_NOT_HIGHEST       || Already holds a RWMUTEX higher in the RWMUTEX order (deadlock risk)&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || RWMUTEX ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || RWMUTEX ID &amp;gt;= number of RWMUTEXs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_RWMX_CEILING_BAD        || RWMUTEX ceiling not lower priority than job priority&lt;br /&gt;
|-&lt;br /&gt;
| ERR_RWMX_ALREADY_HELD       || RWMUTEX already held by this job&lt;br /&gt;
|-&lt;br /&gt;
| ERR_RWMX_CPU_STACK_FULL     || CPU priority ceiling stack full&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Acquire read/write mutex rwm_1 for read&lt;br /&gt;
status = oceos_rwmutex_read_wait(rwm_1);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_rwmutex_write_wait()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''rwmutex.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function acquires the specified read/write mutex for write.&lt;br /&gt;
If successful, no other job can also obtain it for reading or for writing. Will not succeed while any other job has acquired RWMUTEX for write,&lt;br /&gt;
or any jobs have obtained RWMUTEX for read. Will then loop until the RWMUTEX is released and for its turn in the sequence of jobs that have tried to acquire the RWMUTEX for writing. If already holds the RWMUTEX for writing or reading an appropriate status code is returned, a system log entry made, and the job continues. While there are any outstanding attempts to obtain the RWMUTEX for write no job will be able to acquire it for reading.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Write wait on RWMUTEX.&lt;br /&gt;
 *&lt;br /&gt;
 * If successful no other job can also obtain it for reading or for writing.&lt;br /&gt;
 * Will not succeed while any other job has acquired RWMUTEX for write,&lt;br /&gt;
 * or any jobs have obtained RWMUTEX for read. Will then loop until the&lt;br /&gt;
 * RWMUTEX is released and for its turn in the sequence of jobs that have&lt;br /&gt;
 * tried to acquire the RWMUTEX for writing.&lt;br /&gt;
 * If already holds the RWMUTEX for writing or reading an appropriate status&lt;br /&gt;
 * code is returned, a system log entry made, and the job continues.&lt;br /&gt;
 * While there are any outstanding attempts to obtain the RWMUTEX for write&lt;br /&gt;
 * no job will be able to acquire it for reading.&lt;br /&gt;
 *&lt;br /&gt;
 * This should only be called after OCEOS scheduling has started.&lt;br /&gt;
 *&lt;br /&gt;
 * N.B.	The returned status code must be checked and appropriate action&lt;br /&gt;
 * 		taken.&lt;br /&gt;
 *&lt;br /&gt;
 * @param rwm_id     const U32_t  : value 0 to 62&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          WARN_RWMX_NOT_HIGHEST       Already holds a RWMUTEX higher in the RWMUTEX order&lt;br /&gt;
 *                                      (there then may be a risk of deadlock)&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              RWMUTEX ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                RWMUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
 *          ERR_RWMX_CEILING_BAD        RWMUTEX ceiling not lower priority than job priority&lt;br /&gt;
 *          ERR_RWMX_ALREADY_HELD       RWMUTEX already held by this job&lt;br /&gt;
 *          ERR_RWMX_CPU_STACK_FULL     CPU priority ceiling stack full&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_rwmutex_write_wait(&lt;br /&gt;
    const U32_t rwm_id  // RWMUTEX ID, must be in range 0 to 62&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| rwm_id || U32_t rwmutex to be acquired for write(value 0 to 62)&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| WARN_RWMX_NOT_HIGHEST       || Already holds a RWMUTEX higher in the RWMUTEX order (deadlock risk)&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || RWMUTEX ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || RWMUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_RWMX_CEILING_BAD        || RWMUTEX ceiling not lower priority than job priority&lt;br /&gt;
|-&lt;br /&gt;
| ERR_RWMX_ALREADY_HELD       || RWMUTEX already held by this job&lt;br /&gt;
|-&lt;br /&gt;
| ERR_RWMX_CPU_STACK_FULL     || CPU priority ceiling stack full&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Acquire read/write mutex rwm_1 for write&lt;br /&gt;
status = oceos_rwmutex_read_wait(rwm_1);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_rwmutex_signal()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''rwmutex.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function signals the specified read/write mutex.&lt;br /&gt;
It frees the RWMUTEX for use by other jobs, irrespective of whether the RWMUTEX is held for reading or for writing. If the RWMUTEX is not held by the job then it returns an appropriate status code. It does not take into account how many times a job has obtained the RWMUTEX for read or for write.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Signal a RWMUTEX&lt;br /&gt;
 *&lt;br /&gt;
 * Frees the RWMUTEX for use by other jobs, irrespective of whether&lt;br /&gt;
 * RWMUTEX is held for reading or for writing.&lt;br /&gt;
 * if the RWMUTEX is not held by the job returns an appropriate status code.&lt;br /&gt;
 * Does not take into account how many times a job has obtained the RWMUTEX&lt;br /&gt;
 * for read or for write.&lt;br /&gt;
 *&lt;br /&gt;
 * This should only be called after OCEOS scheduling has started.&lt;br /&gt;
 *&lt;br /&gt;
 * N.B. The returned status code must be checked and appropriate action taken.&lt;br /&gt;
 *&lt;br /&gt;
 * @param rwm_id    const U32_t  : value 0 to 62&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          WARN_RWMX_ALREADY_FREE      RWMUTEX is free already&lt;br /&gt;
 *&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              RWMUTEX ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                RWMUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
 *          ERR_RWMX_CEILING_BAD        RWMUTEX ceiling not lower priority than job priority&lt;br /&gt;
 *          ERR_RWMX_CPU_STACK_EMPTY    CPU priority ceiling stack empty&lt;br /&gt;
 *          ERR_RWMX_CEILING_INVALID    CPU current priority ceiling on the priority stack is invalid&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_rwmutex_signal(&lt;br /&gt;
    const U32_t rwm_id // RWMUTEX ID, must be in range 0 to 62&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| rwm_id || U32_t rwmutex to be signaled(value 0 to 62)&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| WARN_RWMX_ALREADY_FREE      || RWMUTEX is free already&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || RWMUTEX ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || RWMUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_RWMX_CEILING_BAD        || RWMUTEX ceiling not lower priority than job priority&lt;br /&gt;
|-&lt;br /&gt;
| ERR_RWMX_CPU_STACK_EMPTY    || CPU priority ceiling stack empty&lt;br /&gt;
|-&lt;br /&gt;
| ERR_RWMX_CEILING_INVALID    || CPU current priority ceiling on the priority stack is invalid&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Signal read/write mutex number rwm_4&lt;br /&gt;
status = oceos_rwmutex_signal(rwm_4);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_rwmutex_check_status()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''rwmutex.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function checks the status of a read/write mutex. The possible states are free, in-use for read, and in-use for write.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Check whether RWMUTEX is free&lt;br /&gt;
 *&lt;br /&gt;
 * @param rwm_id        must be in range 0 to 62&lt;br /&gt;
 * @param m_status      pointer to RWMUTEX status holder;&lt;br /&gt;
 *                      if return code OCEOS_SUCCESS RWMUTEX status:&lt;br /&gt;
 *                          0 =&amp;gt; Free for use&lt;br /&gt;
 *                          1 =&amp;gt; In use for read&lt;br /&gt;
 *                          2 =&amp;gt; In use for write&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              RWMUTEX ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                RWMUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
 *          ERR_RWMX_DATA_PTR_BAD       Pointer to RWMUTEX status return holder is null&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_rwmutex_check_status(&lt;br /&gt;
    const U32_t rwm_id, // RWMUTEX ID, must be in range 0 to 62&lt;br /&gt;
    U32_t *m_status&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| rwm_id || read/write mutex number in range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| m_status || U32_t pointer to RWMUTEX status holder (0 = free, 1 = in-use for read, 2 = in-use for write &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || RWMUTEX ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || RWMUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_RWMX_DATA_PTR_BAD       || Pointer to RWMUTEX status return holder is null&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, rwm_status;&lt;br /&gt;
...&lt;br /&gt;
// Check the status of read/write mutex rwm_2&lt;br /&gt;
status = oceos_rwmutex_check_status(rwm_2, &amp;amp;rwm_status);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_rwmutex_reading_count()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''rwmutex.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the current number of jobs holding a specified read/write mutex for read.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 *&lt;br /&gt;
 * Get current number of jobs holding RWMUTEX for read&lt;br /&gt;
 *&lt;br /&gt;
 * @param rwm_id    must be in range 0 to 62&lt;br /&gt;
 * @param m_count   pointer to RWMUTEX count holder&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              RWMUTEX ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                RWMUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
 *          ERR_RWMX_DATA_PTR_BAD       Pointer to RWMUTEX count return holder is null&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_rwmutex_reading_count(&lt;br /&gt;
    const U32_t rwm_id, // RWMUTEX ID, must be in range 0 to 62&lt;br /&gt;
    U32_t *m_count&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| rwm_id || U32 value of read/write mutex (in range 0 to 62)&lt;br /&gt;
|-&lt;br /&gt;
| m_count || U32_t pointer to read/write mutex count holder&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || RWMUTEX ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || RWMUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_RWMX_DATA_PTR_BAD       || Pointer to RWMUTEX count return holder is null&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, rwm_count;&lt;br /&gt;
...&lt;br /&gt;
// Get the number of jobs holding the read/write mutex rwm_2 for read&lt;br /&gt;
status = oceos_rwmutex_reading_count(rwm_2, &amp;amp;rwm_count);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_rwmutex_write_reqs_count()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''header.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the current number of write requests for the specified read/write mutex .&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Get current RWMUTEX write requests count&lt;br /&gt;
 *&lt;br /&gt;
 * @param rwm_id    must be in range 0 to 62&lt;br /&gt;
 * @param m_count   pointer to RWMUTEX count holder&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              RWMUTEX ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                RWMUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
 *          ERR_RWMX_DATA_PTR_BAD       Pointer to RWMUTEX count return holder is null&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_rwmutex_write_reqs_count(&lt;br /&gt;
    const U32_t rwm_id, // RWMUTEX ID, must be in range 0 to 62&lt;br /&gt;
    U32_t *m_count&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| rwm_id || U32_t value of read/write mutex (must be in range 0 to 62)&lt;br /&gt;
|-&lt;br /&gt;
| m_count || U32_t pointer to read/write mutex count holder&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || RWMUTEX ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || RWMUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_RWMX_DATA_PTR_BAD       || Pointer to RWMUTEX count return holder is null&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, rwm_count;&lt;br /&gt;
...&lt;br /&gt;
// Get the count of cuurent write requests for read/write mutex rwm_1&lt;br /&gt;
status = oceos_rwmutex_write_reqs_count(rwm_1, &amp;amp;rwm_count);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_rwmutex_writes_pending_count()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''rwmutex.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the current number of pending writes for the specified read/write mutex.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Get current RWMUTEX writes pending count&lt;br /&gt;
 *&lt;br /&gt;
 * @param rwm_id    must be in range 0 to 62&lt;br /&gt;
 * @param m_count   pointer to RWMUTEX count holder&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              RWMUTEX ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                RWMUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
 *          ERR_RWMX_DATA_PTR_BAD       Pointer to RWMUTEX pending count return holder is null&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_rwmutex_writes_pending_count(&lt;br /&gt;
    const U32_t rwm_id, // RWMUTEX ID, must be in range 0 to 62&lt;br /&gt;
    U32_t *m_count&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| rwm_id || U32_t value of read/write mutex (must be in range 0 to 62)&lt;br /&gt;
|-&lt;br /&gt;
| m_count || U32_t pointer to read/write mutex count holder&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || RWMUTEX ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || RWMUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_RWMX_DATA_PTR_BAD       || Pointer to RWMUTEX count return holder is null&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, rwm_count;&lt;br /&gt;
...&lt;br /&gt;
// Get the count of cuurent write requests for read/write mutex rwm_1&lt;br /&gt;
status = oceos_rwmutex_writes_pending_count(rwm_1, &amp;amp;rwm_count);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_rwmutex_holding()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''header.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the read/write mutexes currently held by this instance of this task (job).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Get RWMUTEXs currently held by this instance of the task (job)&lt;br /&gt;
 *&lt;br /&gt;
 * @param m_data    U64_t pointer, each bit indicating RWMUTEX held by current task&lt;br /&gt;
 *                          0 =&amp;gt; Not held by job&lt;br /&gt;
 *                          1 =&amp;gt; Held by job&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_RWMX_DATA_PTR_BAD       Pointer to RWMUTEX status return holder is null&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_rwmutex_holding(&lt;br /&gt;
    U64_t *m_data&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| m_data || U64_t pointer, each bit indicating RWMUTEX held by current task, 0 =&amp;gt; not held, 1 =&amp;gt; held &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_RWMX_DATA_PTR_BAD       || Pointer to RWMUTEX status return holder is null&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
U64_t rwm_held;&lt;br /&gt;
...&lt;br /&gt;
// Which read/write mutexes does this job hold&lt;br /&gt;
status = oceos_rwmutex_holding(&amp;amp;rwm_held);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Semaphores directives ==&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_sem_create()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''semaphore.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function creates a semaphore.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Create a counting semaphore&lt;br /&gt;
 *&lt;br /&gt;
 * @param sem_id            SEMAPHORE ID (from 0 to 62)&lt;br /&gt;
 * @param max_permits       number of max permits allowed for this SEMAPHORE, 1 to 4095&lt;br /&gt;
 * @param count_permits     starting number of permits available 0 to 4095&lt;br /&gt;
 * @param pending_q_size    MAX Number of tasks on SEMAPHORE pending queue 1 to 253&lt;br /&gt;
 * @param use_timeout       if TRUE, directive oceos_sem_wait_restart_timeout can be used&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_WRONG_CPU_CORE          Executing directive on wrong CPU&lt;br /&gt;
 *          ERR_WRONG_PHASE             Called before oceos_init() is done&lt;br /&gt;
 *          ERR_TOO_MANY                MAX number of SEMAPHOREs already created&lt;br /&gt;
 *          ERR_ID_INVALID              SEMAPHORE ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                SEMAPHORE ID &amp;gt;= number of SEMAPHOREs&lt;br /&gt;
 *          ERR_SM_ALREADY_ALLOCATED    SEMAPHORE ID already used&lt;br /&gt;
 *          ERR_SM_MAX_PERMIT_WRONG     MAX permits outside allowed range 1 to 4095&lt;br /&gt;
 *          ERR_SM_COUNT_PERMIT_WRONG   Count permits outside allowed range 0 to 4095&lt;br /&gt;
 *          ERR_SM_COUNT_PERMIT_INVALID Count permits is greater than MAX permits for this SEMAPHORE&lt;br /&gt;
 *          ERR_SM_PENQ_SIZE_WRONG      SEMAPHORE pending queue size outside allowed range 1 to 253&lt;br /&gt;
 *          ERR_SM_TA_MAX_NUM_REACHED   Number of timed actions exceeds MAX allowed 255,&lt;br /&gt;
 *                                      each task on SEMAPHORE pending queue is timed action&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_sem_create(&lt;br /&gt;
    sem_t sem_id,         // counting semaphore ID (MAX 63)&lt;br /&gt;
    U16_t max_permits,    // max number of permits (MAX 4095)&lt;br /&gt;
    U16_t count_permits,  // initial number of permits (MAX 4095)&lt;br /&gt;
    U8_t  pending_q_size, // max number of pending queue jobs (MAX 253)&lt;br /&gt;
    BOOLE_t use_timeout   // whether timeout is used in oceos_sem_wait_restart_timeout&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| sem_id || Semaphore ID to be created (from 0 to 62)&lt;br /&gt;
|-&lt;br /&gt;
| max_permits || number of max permits allowed for this semaphore, 1 to 4095&lt;br /&gt;
|-&lt;br /&gt;
| count_permits || starting number of permits available 0 to 4095&lt;br /&gt;
|-&lt;br /&gt;
| pending_q_size || Maximum Number of tasks on SEMAPHORE pending queue 1 to 253&lt;br /&gt;
|-&lt;br /&gt;
| use_timeout || if TRUE, directive oceos_sem_wait_restart_timeout can be used&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_CPU_CORE          || Executing directive on wrong CPU&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Called before oceos_init() is done&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TOO_MANY                || MAX number of SEMAPHOREs already created&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || SEMAPHORE ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || SEMAPHORE ID &amp;gt;= number of SEMAPHOREs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SM_ALREADY_ALLOCATED    || SEMAPHORE ID already used&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SM_MAX_PERMIT_WRONG     || MAX permits outside allowed range 1 to 4095&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SM_COUNT_PERMIT_WRONG   || Count permits outside allowed range 0 to 4095&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SM_COUNT_PERMIT_INVALID || Count permits is greater than MAX permits for this SEMAPHORE&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SM_PENQ_SIZE_WRONG      || SEMAPHORE pending queue size outside allowed range 1 to 253&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SM_TA_MAX_NUM_REACHED   || Number of timed actions exceeds MAX allowed 255&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, param;&lt;br /&gt;
...&lt;br /&gt;
// Create semaphore called s_audi with max permits of 1000, starting permits of zero, max of 10 tasks on pending queue, and no timeouts &lt;br /&gt;
status = oceos_sem_create(s_audi, 1000, 0, 10, FALSE);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_sem_signal()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''semaphore.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function signals a semaphore, increments its count and transfers pending jobs to the ready queue.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Signals a semaphore, increments and transfers pending jobs to ready queue&lt;br /&gt;
 *&lt;br /&gt;
 * @param sem_id counting SEM ID&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          WARN_JOB_NOT_GUARDED&lt;br /&gt;
 *&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              SEM ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                SEM ID &amp;gt;= number of SEMs&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to grab SEM guard&lt;br /&gt;
 *          ERR_TOO_MANY                SEM max permits count already reached&lt;br /&gt;
 *          ERR_SM_JOB_ID_WRONG         Job ID of the task on SEM pending queue is wrong&lt;br /&gt;
 *          ERR_TA_NOT_FOUND            Timed action index to be removed for job not found&lt;br /&gt;
 *          ERR_TA_START_FAILED         Timed action re-start failed after job remove from timed action queue&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_sem_signal(&lt;br /&gt;
    sem_t sem_id // counting SEM ID&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| sem_id || U32_t value of semaphore to be signalled (incremented)&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| WARN_JOB_NOT_GUARDED        || job not guarded, application should check system log&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || SEM ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || SEM ID &amp;gt;= number of SEMs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to grab SEM guard&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TOO_MANY                || SEM max permits count already reached&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SM_JOB_ID_WRONG         || Job ID of the task on SEM pending queue is wrong&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_NOT_FOUND            || Timed action index to be removed for job not found&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_START_FAILED         || Timed action re-start failed after job remove from timed action queue&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Signal s_audi semaphore (increment its count)&lt;br /&gt;
status = oceos_sem_signal(s_audi);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_sem_wait_continue()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''semaphore.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function decrements the available permits of a sempahore otherwise returns an unsuccessful status code.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Wait on semaphore,&lt;br /&gt;
 * decrement the number of available permits for semaphore,&lt;br /&gt;
 * if no permits continue and task should handle unsuccessful result&lt;br /&gt;
 *&lt;br /&gt;
 * @param sem_id SEM ID&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              SEM ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                SEM ID &amp;gt;= number of SEMs&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to grab SEM guard&lt;br /&gt;
 *          ERR_SM_NOT_AVAILABLE        No more permits available for this SEM&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_sem_wait_continue(&lt;br /&gt;
    sem_t sem_id // counting SEM ID&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| sem_id || U32_t value of semaphore to be decremented&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || SEM ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || SEM ID &amp;gt;= number of SEMs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to grab SEM guard&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SM_NOT_AVAILABLE        || No more permits available for this SEM&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Decrement available permits on semaphore s_1&lt;br /&gt;
status = oceos_sem_wait_continue(s_1);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_sem_wait_restart()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''semaphore.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function decrements the available permits of a sempahore and if none available, the job is put on the pending queue.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Waits on semaphore,&lt;br /&gt;
 * if fail, put job on pending queue and exit task&lt;br /&gt;
 *&lt;br /&gt;
 * @param sem_id SEM ID&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              SEM ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                SEM ID &amp;gt;= number of SEMs&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to grab SEM guard&lt;br /&gt;
 *          ERR_SM_J_START_FROM_TIMOUT  Task started from timeout already, SEM no permits available second time&lt;br /&gt;
 *          ERR_FAILED                  Should never return this&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_sem_wait_restart(&lt;br /&gt;
    sem_t sem_id  // counting SEM ID&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| sem_id || U32_t value of semaphore to be decremented&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || SEM ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || SEM ID &amp;gt;= number of SEMs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to grab SEM guard&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SM_J_START_FROM_TIMOUT  || Task started from timeout already, SEM no permits available second time&lt;br /&gt;
|-&lt;br /&gt;
| ERR_FAILED                  || Should never return this&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Decrement available permits on semaphore s_1 otherwise job is put on pending queue&lt;br /&gt;
status = oceos_sem_wait_restart(s_1);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_sem_wait_restart_timeout()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''semaphore.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function decrements the available permits of a sempahore and if none available, the job is put on the pending queue with a timeout enabled. The job is restarted either when a permit is available to be decremented or when the timeout has expired. In order to use this directive, semaphore must be created with flag use_timeout is set to TRUE.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Waits on semaphore,&lt;br /&gt;
 * if fail, put job on pending queue with optional timeout.&lt;br /&gt;
 * In order to use this directive, semaphore must be created with&lt;br /&gt;
 * flag use_timeout is set to TRUE&lt;br /&gt;
 *&lt;br /&gt;
 * @param sem_id         SEM ID&lt;br /&gt;
 * @param U64_t timeout  Restart time if no permits, 0 =&amp;gt; ignore&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_TA_NOT_INIT             Timed action intialisation is not done and tried to be used; or SEM created without timeouts&lt;br /&gt;
 *          ERR_ID_INVALID              SEM ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                SEM ID &amp;gt;= number of SEMs&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to grab SEM guard&lt;br /&gt;
 *          ERR_SM_J_START_FROM_TIMOUT  Task started from timeout already, SEM no permits available second time&lt;br /&gt;
 *          ERR_TOO_MANY                SEM pending queue is full&lt;br /&gt;
 *          ERR_FAILED                  Should never return this&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_sem_wait_restart_timeout(&lt;br /&gt;
    sem_t sem_id, // counting SEM ID&lt;br /&gt;
    U64_t timeout // timeout, restart time if no permits, 0 =&amp;gt; ignore&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| sem_id || U32_t value of semaphore to be decremented&lt;br /&gt;
|-&lt;br /&gt;
| timeout | U64_t timeout in time units. A value of 0 causes timeout to be ignored.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_NOT_INIT             || Timed action intialisation is not done and tried to be used; or SEM created without&lt;br /&gt;
timeouts&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || SEM ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || SEM ID &amp;gt;= number of SEMs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to grab SEM guard&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SM_J_START_FROM_TIMOUT  || Task started from timeout already, SEM no permits available second time&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TOO_MANY                || SEM pending queue is full&lt;br /&gt;
|-&lt;br /&gt;
| ERR_FAILED                  || Should never return this&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Decrement available permits on semaphore s_1 otherwise job is put on pending queue with timeout of 10,000 time units (usually usecs)&lt;br /&gt;
status = oceos_sem_wait_restart_timeout(s_1);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_sem_get_value()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''semaphore.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the number of available permits for the specified semaphore.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Returns number of available permits&lt;br /&gt;
 * for SEM ID&lt;br /&gt;
 *&lt;br /&gt;
 * @param sem_id        SEM id&lt;br /&gt;
 * @param s_permits     pointer to permits count holder&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              SEM ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                SEM ID &amp;gt;= number of SEMs&lt;br /&gt;
 *          ERR_SM_DATA_BAD             Data holder pointer is null&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_sem_get_value(&lt;br /&gt;
    sem_t sem_id,    // counting SEM ID&lt;br /&gt;
    U32_t *s_permits // pointer to permits count holder&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| sem_id || U32_t value of semaphore whose permit count is required&lt;br /&gt;
|-&lt;br /&gt;
| s_permits || U32_t pointer to permits count holder&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || SEM ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || SEM ID &amp;gt;= number of SEMs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SM_DATA_BAD             || Data holder pointer is null&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, permit_count;&lt;br /&gt;
...&lt;br /&gt;
// Get the available permits for semaphore s_1&lt;br /&gt;
status = oceos_sem_get_value(s_1, &amp;amp;permit_count);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_sem_penq_get_size()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''semaphore.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the number of jobs on the specified semaphore pending queue.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Returns number of jobs on semaphore pending queue&lt;br /&gt;
 * for semaphore ID&lt;br /&gt;
 *&lt;br /&gt;
 * @param sem_id    SEM id&lt;br /&gt;
 * @param s_size    pointer to pending queue size holder&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              SEM ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                SEM ID &amp;gt;= number of SEMs&lt;br /&gt;
 *          ERR_SM_DATA_BAD             Data holder pointer is null&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_sem_penq_get_size(&lt;br /&gt;
    sem_t sem_id,   // counting SEM ID&lt;br /&gt;
    U32_t *s_size   // pointer to pending queue size holder&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| sem_id || U32_t value of semaphore whose permit count is required&lt;br /&gt;
|-&lt;br /&gt;
| s_size || U32_t pointer to pending queue jobs count holder&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || SEM ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || SEM ID &amp;gt;= number of SEMs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SM_DATA_BAD             || Data holder pointer is null&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, job_count;&lt;br /&gt;
...&lt;br /&gt;
// Get the available permits for semaphore s_1&lt;br /&gt;
status = oceos_sem_penq_get_size(s_1, &amp;amp;job_count);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_sem_reset()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''semaphore.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function restores the permits to the original semaphore initial value and removes any jobs from the pending queue.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Restore permits to original value and&lt;br /&gt;
 * remove jobs from pending queue&lt;br /&gt;
 *&lt;br /&gt;
 * @param sem_id    SEM ID&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              SEM ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                SEM ID &amp;gt;= number of SEMs&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to grab SEM guard&lt;br /&gt;
 *          ERR_SM_JOB_ID_WRONG         Job ID of the task on SEM pending queue is wrong&lt;br /&gt;
 *          ERR_TA_NOT_FOUND            Timed action index to be removed for job not found&lt;br /&gt;
 *          ERR_TA_START_FAILED         Timed action re-start failed after job remove from timed action queue&lt;br /&gt;
 */&lt;br /&gt;
S32_t   oceos_sem_reset(&lt;br /&gt;
    sem_t sem_id   // counting SEM ID&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| sem_id || U32_t value of semaphore to be reset&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || SEM ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || SEM ID &amp;gt;= number of SEMs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to grab SEM guard&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SM_JOB_ID_WRONG         || Job ID of the task on SEM pending queue is wrong&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_NOT_FOUND            || Timed action index to be removed for job not found&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_START_FAILED         || Timed action re-start failed after job remove from timed action queue&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Reset semaphore s_1&lt;br /&gt;
status = oceos_sem_reset(s_1);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Data Queues ==&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_dataq_create()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''dataq.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function creates a data queue with the specified characteristics.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Create data queue&lt;br /&gt;
 * If use_timeout = TRUE, timed actions must be initialised&lt;br /&gt;
 *&lt;br /&gt;
 * @param dataq_id      data queue ID&lt;br /&gt;
 * @param dataq_size    data queue size&lt;br /&gt;
 * @param pen_q_size    pending jobs queue size&lt;br /&gt;
 * @param roll_over     whether to roll over when full&lt;br /&gt;
 * @param use_timeout   if TRUE, directive oceos_dataq_read_restart_timeout can be used&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_WRONG_CPU_CORE          Executing directive on wrong CPU&lt;br /&gt;
 *          ERR_WRONG_PHASE             Called before oceos_init() is done&lt;br /&gt;
 *          ERR_TOO_MANY                MAX number of DATAQs already created&lt;br /&gt;
 *          ERR_ID_INVALID              DATAQ ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                DATAQ ID &amp;gt;= number of DATAQs&lt;br /&gt;
 *          ERR_DQ_ALREADY_ALLOCATED    DATAQ ID already used&lt;br /&gt;
 *          ERR_DQ_SIZE_WRONG           DATAQ size outside allowed range 1 to 255&lt;br /&gt;
 *          ERR_DQ_PENQ_SIZE_WRONG      DATAQ pending queue size outside allowed range 1 to 253&lt;br /&gt;
 *          ERR_DQ_TA_MAX_NUM_REACHED   Number of timed actions exceeds MAX allowed 255,&lt;br /&gt;
 *                                      each task on DATAQ pending queue is timed action&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_dataq_create(&lt;br /&gt;
                         dataq_t dataq_id,    // data queue ID&lt;br /&gt;
                         U16_t dataq_size,    // data queue size&lt;br /&gt;
                         U16_t pen_q_size,    // pending jobs queue size&lt;br /&gt;
                         BOOLE_t roll_over,   // whether to roll over when full&lt;br /&gt;
                         BOOLE_t use_timeout  // whether timeout is used oceos_dataq_read_restart_timeout&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| dataq_id ||   dataq_t data queue ID (number between 0 and 62)&lt;br /&gt;
|-&lt;br /&gt;
| dataq_size ||   data queue size (max number of pointers than can be added to the queue)&lt;br /&gt;
|-&lt;br /&gt;
| pen_q_size ||   pending jobs queue size&lt;br /&gt;
|-&lt;br /&gt;
| roll_over ||    whether to roll over when full (0 =&amp;gt; disabled, 1 =&amp;gt; enabled)&lt;br /&gt;
|-&lt;br /&gt;
| use_timeout ||  if TRUE, directive oceos_dataq_read_restart_timeout can be used&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_CPU_CORE          || Executing directive on wrong CPU&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Called before oceos_init() is done&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TOO_MANY                || MAX number of DATAQs already created&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || DATAQ ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || DATAQ ID &amp;gt;= number of DATAQs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DQ_ALREADY_ALLOCATED    || DATAQ ID already used&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DQ_SIZE_WRONG           || DATAQ size outside allowed range 1 to 255&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DQ_PENQ_SIZE_WRONG      || DATAQ pending queue size outside allowed range 1 to 253&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DQ_TA_MAX_NUM_REACHED   || Number of timed actions exceeds MAX allowed 255, each task on DATAQ pending queue is timed action&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Create data queue d_3 with size 20, max pending jobs of 10, rollover enabled, timeouts disabled &lt;br /&gt;
status = oceos_dataq_create(d_3, 20, 10, 1, 0));&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_dataq_write()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''dataq.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function puts a non-null pointer on the specified data queue.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Puts pointer to the data on data queue.&lt;br /&gt;
 * Pointer to the data must not be NULL&lt;br /&gt;
 *&lt;br /&gt;
 * @param dataq_t dataq_id Data queue ID&lt;br /&gt;
 * @param void* data       Non-null pointer to data&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          WARN_DQ_NOW_FULL            Warning, DATAQ is full now&lt;br /&gt;
 *          WARN_JOB_NOT_GUARDED&lt;br /&gt;
 *&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              DATAQ ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                DATAQ ID &amp;gt;= number of DATAQs&lt;br /&gt;
 *          ERR_DQ_DATA_BAD             Data pointer is null&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to acquire guard&lt;br /&gt;
 *          ERR_TOO_MANY                DATAQ is full&lt;br /&gt;
 *          ERR_DQ_JOB_ID_WRONG         Job ID of the task on pending queue is wrong&lt;br /&gt;
 *          ERR_TA_NOT_FOUND            Timed action index to be removed for job not found&lt;br /&gt;
 *          ERR_TA_START_FAILED         Timed action re-start failed after job remove from timed action queue&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_dataq_write(&lt;br /&gt;
    dataq_t dataq_id, // data queue ID&lt;br /&gt;
    void *data        // non-null pointer to data&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| dataq_id || dataq_t with value of Data queue ID&lt;br /&gt;
|-&lt;br /&gt;
| ptr || void* pointer to application data (non-null pointer)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| WARN_DQ_NOW_FULL            || Warning, DATAQ is full now&lt;br /&gt;
|-&lt;br /&gt;
| WARN_JOB_NOT_GUARDED        || &lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || DATAQ ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || DATAQ ID &amp;gt;= number of DATAQs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DQ_DATA_BAD             || Data pointer is null&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to acquire guard&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TOO_MANY                || DATAQ is full&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DQ_JOB_ID_WRONG         || Job ID of the task on pending queue is wrong&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_NOT_FOUND            || Timed action index to be removed for job not found&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_START_FAILED         || Timed action re-start failed after job remove from timed action queue&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
char[100] message_in;&lt;br /&gt;
...&lt;br /&gt;
// Put pointer to message_in on data queue s_2 &lt;br /&gt;
status = oceos_dataq_write(s_2, (void *)message_in);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_dataq_read_continue()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''dataq.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns a pointer from the specified data queue.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Read data queue&lt;br /&gt;
 *&lt;br /&gt;
 * @param dataq_t dataq_id  Data queue ID&lt;br /&gt;
 * @param void*   data      Pointer to data&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              DATAQ ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                DATAQ ID &amp;gt;= number of DATAQs&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to acquire guard&lt;br /&gt;
 *          ERR_DQ_EMPTY                DATAQ empty(count zero)&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_dataq_read_continue(&lt;br /&gt;
    dataq_t dataq_id, // data queue ID&lt;br /&gt;
    void* *data        // return data&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Descriptionn&lt;br /&gt;
|-&lt;br /&gt;
| dataq_id || dataq_t with value of Data queue ID&lt;br /&gt;
|-&lt;br /&gt;
| ptr || void* pointer to store returned data queue pointer removed from the queue&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || DATAQ ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || DATAQ ID &amp;gt;= number of DATAQs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to acquire guard&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DQ_EMPTY                || DATAQ empty(count zero)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
char *data_ptr;&lt;br /&gt;
...&lt;br /&gt;
// Read pointer from data queue s_2 &lt;br /&gt;
status = oceos_dataq_read_continue(s_2, (void *)data_ptr);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_dataq_read_restart()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''dataq.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns a pointer from the specified data queue. If the queue is empty, the job is added top the dataq pending queue. The job will be restarted when data is available. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Read data queue next item.&lt;br /&gt;
 * If dataq is empty, task is put on pending Q for dataq and&lt;br /&gt;
 * restarted by oceos_dataq_write&lt;br /&gt;
 *&lt;br /&gt;
 * @param dataq_id Data queue ID&lt;br /&gt;
 * @param data     Pointer to return data&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              DATAQ ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                DATAQ ID &amp;gt;= number of DATAQs&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to acquire guard&lt;br /&gt;
 *          ERR_DQ_J_START_FROM_TIMOUT  Job started from timeout already, DATAQ empty second time&lt;br /&gt;
 *          ERR_FAILED                  Should never return this&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_dataq_read_restart(&lt;br /&gt;
    dataq_t dataq_id,    // data queue ID&lt;br /&gt;
    void* *data           // pointer to return data&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| dataq_id || dataq_t with value of Data queue ID&lt;br /&gt;
|-&lt;br /&gt;
| ptr || void* pointer to store returned data queue pointer removed from the queue&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || DATAQ ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || DATAQ ID &amp;gt;= number of DATAQs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to acquire guard&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DQ_J_START_FROM_TIMOUT  || Job started from timeout already, DATAQ empty second time&lt;br /&gt;
|-&lt;br /&gt;
| ERR_FAILED                  || Should never return this&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
char *data_ptr;&lt;br /&gt;
...&lt;br /&gt;
// Read pointer from data queue s_2 with restart when data is available&lt;br /&gt;
status = oceos_dataq_read_restart(s_2, (void *)data_ptr);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_dataq_read_restart_timeout()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''dataq.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns a pointer from the specified data queue. If the queue is empty, the job is added top the dataq pending queue. The job will be restarted either when data is available or the timeout has expired. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Read data queue next item.&lt;br /&gt;
 * If dataq is empty, task is put on pending Q for dataq and&lt;br /&gt;
 * restarted by oceos_dataq_write or by timeout if timeout != 0&lt;br /&gt;
 * In order to use this feature timed actions must be configured and&lt;br /&gt;
 * dataq created with use timeout set to true&lt;br /&gt;
 *&lt;br /&gt;
 * @param dataq_id          Data queue ID&lt;br /&gt;
 * @param data              Pointer to return data&lt;br /&gt;
 * @param timeout           Timeout, restart time if no entry, 0 =&amp;gt; ignore&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_TA_NOT_INIT             Timed action intialisation is not done and tried to be used; or DATAQ created without timeouts&lt;br /&gt;
 *          ERR_ID_INVALID              DATAQ ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                DATAQ ID &amp;gt;= number of DATAQs&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to acquire guard&lt;br /&gt;
 *          ERR_DQ_EMPTY                DATAQ empty(count zero)&lt;br /&gt;
 *          ERR_DQ_J_START_FROM_TIMOUT  Job started from timeout already, DATAQ empty second time&lt;br /&gt;
 *          ERR_TOO_MANY                DATAQ pending queue is full&lt;br /&gt;
 *          ERR_FAILED                  Should never return this&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_dataq_read_restart_timeout(&lt;br /&gt;
    dataq_t dataq_id,   // data queue ID&lt;br /&gt;
    void* *data,         // Pointer to return data&lt;br /&gt;
    U64_t timeout       // timeout, restart time if no entry, 0 =&amp;gt; ignore&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| dataq_id || dataq_t with value of Data queue ID&lt;br /&gt;
|-&lt;br /&gt;
| ptr || void* pointer to store returned data queue pointer removed from the queue&lt;br /&gt;
|-&lt;br /&gt;
| timeout || U64_t containing timeout value, restart time if no entry, 0 =&amp;gt; ignore&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_NOT_INIT             || Timed action intialisation is not done and tried to be used; or DATAQ created without timeouts&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || DATAQ ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || DATAQ ID &amp;gt;= number of DATAQs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to acquire guard&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DQ_EMPTY                || DATAQ empty(count zero)&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DQ_J_START_FROM_TIMOUT  || Job started from timeout already, DATAQ empty second time&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TOO_MANY                || DATAQ pending queue is full&lt;br /&gt;
|-&lt;br /&gt;
| ERR_FAILED                  || Should never return this&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
char *data_ptr;&lt;br /&gt;
...&lt;br /&gt;
// Read pointer from data queue s_2 with timeout after 10,000 time units if no data is available&lt;br /&gt;
status = oceos_dataq_read_restart_timeout(s_2, (void *)data_ptr, 10000ull);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_dataq_get_size()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''dataq.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the number of items on the specified data queue.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Returns number of items on the data queue with ID&lt;br /&gt;
 *&lt;br /&gt;
 * @param dataq_id   DATAQ Id&lt;br /&gt;
 * @param d_size     Pointer to size holder&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              DATAQ ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                DATAQ ID &amp;gt;= number of DATAQs&lt;br /&gt;
 *          ERR_DQ_DATA_BAD             DATAQ size holder pointer is null&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_dataq_get_size(&lt;br /&gt;
    dataq_t dataq_id,   // data queue ID&lt;br /&gt;
    U32_t *d_size&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| dataq_id ||  dataq_t with the ID of the data queue (value between 0 and 62)&lt;br /&gt;
|-&lt;br /&gt;
| d_size || U32_t *d_size pointer to the variable to store the size&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || DATAQ ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || DATAQ ID &amp;gt;= number of DATAQs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DQ_DATA_BAD             || DATAQ size holder pointer is null&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, d_size;&lt;br /&gt;
...&lt;br /&gt;
// Get the number of entries on data queue d_0&lt;br /&gt;
status = oceos_dataq_get_size(d_0, &amp;amp;d_size);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_dataq_penq_get_size()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''dataq.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns number of jobs on the specified data queue pending job's queue.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Returns number of jobs on the dataq pending job's queue&lt;br /&gt;
 *&lt;br /&gt;
 * @param dataq_id  DATAQ Id&lt;br /&gt;
 * @param d_size    Pointer to pending queue size holder&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              DATAQ ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                DATAQ ID &amp;gt;= number of DATAQs&lt;br /&gt;
 *          ERR_DQ_DATA_BAD             DATAQ pending size holder pointer is null&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_dataq_penq_get_size(&lt;br /&gt;
    dataq_t dataq_id,&lt;br /&gt;
    U32_t *d_size&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| dataq_id ||  dataq_t with the ID of the data queue (value between 0 and 62)&lt;br /&gt;
|-&lt;br /&gt;
| d_jobs || U32_t *d_jobs pointer to the variable to store the number of jobs on the pending queue&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || DATAQ ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || DATAQ ID &amp;gt;= number of DATAQs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DQ_DATA_BAD             || DATAQ pending size holder pointer is null&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, d_jobs;&lt;br /&gt;
...&lt;br /&gt;
// Get the number of jobs the the pending jubs queue for data queue d_1&lt;br /&gt;
status = oceos_dataq_penq_get_size(d_1, &amp;amp;d_jobs);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_dataq_clear()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''dataq.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function clears the specified data queue including pending jobs for that queue.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Clears data queue and&lt;br /&gt;
 * frees tasks on pending queue&lt;br /&gt;
 *&lt;br /&gt;
 * @param dataq_t dataq_id Data queue ID&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              DATAQ ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                DATAQ ID &amp;gt;= number of DATAQs&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to acquire guard&lt;br /&gt;
 *          ERR_DQ_JOB_ID_WRONG         Job ID of the task on DATAQ pending queue is wrong&lt;br /&gt;
 *          ERR_TA_NOT_FOUND            Timed action index to be removed for job not found&lt;br /&gt;
 *          ERR_TA_START_FAILED         Timed action re-start failed after job remove from timed action queue&lt;br /&gt;
 */&lt;br /&gt;
S32_t  oceos_dataq_clear(&lt;br /&gt;
    dataq_t dataq_id    // data queue ID&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| dataq_id ||  dataq_t with the ID of the data queue to be cleared (value between 0 and 62)&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || DATAQ ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || DATAQ ID &amp;gt;= number of DATAQs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to acquire guard&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DQ_JOB_ID_WRONG         || Job ID of the task on DATAQ pending queue is wrong&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_NOT_FOUND            || Timed action index to be removed for job not found&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_START_FAILED         || Timed action re-start failed after job remove from timed action queue&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Clear data queue d_1&lt;br /&gt;
status = oceos_dataq_penq_get_size(d_1);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Timed Actions ==&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_timed_output_add()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''timed_action.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function adds a timed action to the timed action queue. It writes a value to an address at a specified system time. An optional mask can be applied so that only those bits are changed.&lt;br /&gt;
The action types are WRITE_ACTION, RMW_ACTION. WRITE_ACTION writes the value to the address. RMW_ACTION reads the values at the address and modifies the bits specified by the mask and value.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Add output action to timed actions queue :&lt;br /&gt;
 *  1. Create timed output action&lt;br /&gt;
 *  2. Stop timer&lt;br /&gt;
 *  3. Add action to action_array&lt;br /&gt;
 *  4. Start timer or execute if time is right&lt;br /&gt;
 *&lt;br /&gt;
 * Returns timed action ID that can be used later to remove&lt;br /&gt;
 * if need by oceos_timed_output_remove&lt;br /&gt;
 *&lt;br /&gt;
 * @param enum ACTION_TYPE action_type  Action type&lt;br /&gt;
 * @param U64_t act_time                System time at which action should be done&lt;br /&gt;
 * @param U32_t before_time             Forward tolerance for time&lt;br /&gt;
 * @param U32_t after_time              Backward tolerance for time&lt;br /&gt;
 * @param adrs_t address                Output address&lt;br /&gt;
 * @param U32_t value                   Output value&lt;br /&gt;
 * @param U32_t mask                    Output mask&lt;br /&gt;
 * @param U32_ *ta_index                Pointer to store timed action index&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_TA_NOT_INIT             Timed action inialisation is not done and tried to be used&lt;br /&gt;
 *          ERR_TA_PTR_BAD              Timed action pointer is null&lt;br /&gt;
 *          ERR_TA_TYPE_WRONG           Timed action type is wrong&lt;br /&gt;
 *          ERR_TOO_LATE                Timed action time is too late&lt;br /&gt;
 *          ERR_SYS_BUSY                Timed action guard failed to acquire&lt;br /&gt;
 *          ERR_TA_Q_FULL               Timed action queue is full&lt;br /&gt;
 *          ERR_TA_START_FAILED         Timed action execute failed; See log&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_timed_output_add(&lt;br /&gt;
    const enum ACTION_TYPE action_type,// Action type&lt;br /&gt;
    U64_t act_time,                    // system time at which action should be done&lt;br /&gt;
    U32_t before_time,                 // forward tolerance for time&lt;br /&gt;
    U32_t after_time,                  // backward tolerance for time&lt;br /&gt;
    const adrs_t address,              // output address&lt;br /&gt;
    const U32_t value,                 // output value&lt;br /&gt;
    const U32_t mask,                  // output mask&lt;br /&gt;
    U32_t *ta_index                    // Pointer to store timed action index&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| enum ACTION_TYPE action_type  || Action type&lt;br /&gt;
|-&lt;br /&gt;
| U64_t act_time                || System time at which action should be done&lt;br /&gt;
|-&lt;br /&gt;
| U32_t before_time             || Forward tolerance for time&lt;br /&gt;
|-&lt;br /&gt;
| U32_t after_time              || Backward tolerance for time&lt;br /&gt;
|-&lt;br /&gt;
| adrs_t address                || Output address&lt;br /&gt;
|-&lt;br /&gt;
| U32_t value                   || Output value&lt;br /&gt;
|-&lt;br /&gt;
| U32_t mask                    || Output mask&lt;br /&gt;
|-&lt;br /&gt;
| U32_ *ta_index                || Pointer to store timed action index&lt;br /&gt;
|-&lt;br /&gt;
| param || parameter to function&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_NOT_INIT             || Timed action inialisation is not done and tried to be used&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_PTR_BAD              || Timed action pointer is null&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_TYPE_WRONG           || Timed action type is wrong&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TOO_LATE                || Timed action time is too late&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Timed action guard failed to acquire&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_Q_FULL               || Timed action queue is full&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_START_FAILED         || Timed action execute failed; See log&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
#define OUTPUT_TIMED_VAL    0xDEADBEEF&lt;br /&gt;
#define OUTPUT_TIMED_MASK   0x1000001&lt;br /&gt;
#define OUTPUT_TIME         0xfffff&lt;br /&gt;
#define OUTPUT_TIME_FW      0x1000&lt;br /&gt;
#define OUTPUT_TIME_BW      0x1000&lt;br /&gt;
&lt;br /&gt;
static U32_t test_data[16] = { 0 };&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Write OUTPUT_TIMED_VAL to test_data[0] at 0xfffff time units from now with a tolerance of 0x1000 before and after the specified time   &lt;br /&gt;
status = oceos_timed_output_add(&lt;br /&gt;
                                       WRITE_ACTION,&lt;br /&gt;
                                       OUTPUT_TIME,&lt;br /&gt;
                                       OUTPUT_TIME_FW,&lt;br /&gt;
                                       OUTPUT_TIME_BW,&lt;br /&gt;
                                       (adrs_t) &amp;amp;test_data[0],&lt;br /&gt;
                                       OUTPUT_TIMED_VAL,&lt;br /&gt;
                                       0,&lt;br /&gt;
                                       &amp;amp;timed_action_index));&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_timed_jobs_number()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''timed_action.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the number of jobs on the timed actions queue.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Get number of Jobs (request to start the task) waiting on timed action queue.&lt;br /&gt;
 * These jobs are added by oceos_task_timed_start() or&lt;br /&gt;
 * oceos_dataq_read_restart_timeout when data is not available (NULL) or&lt;br /&gt;
 * oceos_sem_wait_restart_timeout when counting semaphore is 0&lt;br /&gt;
 *&lt;br /&gt;
 * @param total_jobs    Pointer to store total jobs number waiting on timed action Q&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_TA_NOT_INIT             Timed action inialisation is not done and tried to be used&lt;br /&gt;
 *          ERR_TA_PTR_BAD              Timed action pointer is null&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_timed_jobs_number(U32_t *total_jobs);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| total_jobs || s32_t pointer to store total jobs number waiting on timed action Q&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_NOT_INIT             || Timed action inialisation is not done and tried to be used&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_PTR_BAD              || Timed action pointer is null&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, no_of_jobs;&lt;br /&gt;
...&lt;br /&gt;
// Get the number of jobs on the timed actions queue&lt;br /&gt;
status = oceos_timed_jobs_number(&amp;amp;no_of_jobs);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_timed_jobs_remove()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''timed_action.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function removes the specified timed action from the queue.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Remove job from timed action queue&lt;br /&gt;
 * When task started using oceos_task_timed_start(),&lt;br /&gt;
 * this directive requires pointer to store ID&lt;br /&gt;
 * of job that put on the timed action queue.&lt;br /&gt;
 * This job can be removed later using this directive and stored job ID.&lt;br /&gt;
 *&lt;br /&gt;
 * @param U32_t job_id  Job ID&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_TA_NOT_INIT             Timed action intialisation is not done and tried to be used&lt;br /&gt;
 *          ERR_TA_PTR_BAD              Timed action pointer corrupt&lt;br /&gt;
 *          ERR_ID_WRONG                Job ID is wrong&lt;br /&gt;
 *          ERR_TA_NOT_FOUND            Timed action ID not found for action with job_id or removed already&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to acquire timed action guard&lt;br /&gt;
 *          WARN_TA_Q_EMPTY             Timed action queue is empty&lt;br /&gt;
 *          ERR_TA_START_FAILED         Timed action execute failed; See log&lt;br /&gt;
 */&lt;br /&gt;
S32_t   oceos_timed_jobs_remove(&lt;br /&gt;
    U32_t job_id                             // Job ID&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| job_id || U32_t Job ID to be removed from the timed actions queue&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_NOT_INIT             || Timed action intialisation is not done and tried to be used&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_PTR_BAD              || Timed action pointer corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || Job ID is wrong&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_NOT_FOUND            || Timed action ID not found for action with job_id or removed already&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to acquire timed action guard&lt;br /&gt;
|-&lt;br /&gt;
| WARN_TA_Q_EMPTY             || Timed action queue is empty&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_START_FAILED         || Timed action execute failed; See log&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, job_id;&lt;br /&gt;
...&lt;br /&gt;
// Remove job_id from the timed actions queue&lt;br /&gt;
status = oceos_timed_jobs_remove(job_id);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_timed_jobs_reset()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''timed_action.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function removes all jobs from timed actions queue.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Remove all jobs (requests to start a task) from timed actions queue&lt;br /&gt;
 * These jobs were added by oceos_task_timed_start() or&lt;br /&gt;
 * oceos_dataq_read_restart_timeout when data is not available (NULL) or&lt;br /&gt;
 * oceos_sem_wait_restart_timeout when counting semaphore is 0&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_TA_NOT_INIT             Timed action intialisation is not done and tried to be used&lt;br /&gt;
 *          ERR_TA_PTR_BAD              Timed action pointer is null&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to acquire timed action guard&lt;br /&gt;
 *          WARN_TA_Q_EMPTY             Timed action queue is empty&lt;br /&gt;
 *          ERR_TA_NOT_FOUND            Timed action index not found&lt;br /&gt;
 *          ERR_TA_START_FAILED         Timed action execute failed; See log&lt;br /&gt;
 */&lt;br /&gt;
S32_t   oceos_timed_jobs_reset(void);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
There are no input parameters to this function&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_NOT_INIT             || Timed action intialisation is not done and tried to be used&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_PTR_BAD              || Timed action pointer is null&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to acquire timed action guard&lt;br /&gt;
|-&lt;br /&gt;
| WARN_TA_Q_EMPTY             || Timed action queue is empty&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_NOT_FOUND            || Timed action index not found&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_START_FAILED         || Timed action execute failed; See log&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Remove all jobs from the timed actions queue&lt;br /&gt;
status = oceos_timed_jobs_reset(job_id);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_timed_output_remove()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''timed_action.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function removes the specified timed output action from timed actions queue.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Remove timed output action from timed actions queue.&lt;br /&gt;
 * When action is created, action index should be stored&lt;br /&gt;
 * to remove if need&lt;br /&gt;
 *&lt;br /&gt;
 * @param action_index&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_TA_NOT_INIT             Timed action intialisation is not done and tried to be used&lt;br /&gt;
 *          ERR_TA_PTR_BAD              Timed action pointer is null&lt;br /&gt;
 *          ERR_ID_WRONG                Timed action id is wrong&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to acquire timed action guard&lt;br /&gt;
 *          ERR_TA_NOT_FOUND            Timed action index not found&lt;br /&gt;
 *          ERR_TA_START_FAILED         Timed action execute failed&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_timed_output_remove(&lt;br /&gt;
    const U8_t  action_index    // Index in action array, returned when action was created&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| action_index|| S32_t specifying the timed output action index returned when the timed output was added.&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| Error bit  || Description&lt;br /&gt;
|&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_NOT_INIT             || Timed action intialisation is not done and tried to be used&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_PTR_BAD              || Timed action pointer is null&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || Timed action id is wrong&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to acquire timed action guard&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_NOT_FOUND            || Timed action index not found&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_START_FAILED         || Timed action execute failed&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
U8_t action_index;&lt;br /&gt;
...&lt;br /&gt;
// Remove timed output with specified action_index&lt;br /&gt;
status = oceos_timed_output_remove(action_index);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_timed_output_reset()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''timed_action.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function removes all timed output actions from timed actions queue.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Remove all timed output actions from timed actions queue&lt;br /&gt;
 * These timed output actions were created by oceos_timed_output_add&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_TA_NOT_INIT             Timed action intialisation is not done and tried to be used&lt;br /&gt;
 *          ERR_TA_PTR_BAD              Timed action pointer is null&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to acquire timed action guard&lt;br /&gt;
 *          WARN_TA_Q_EMPTY             Timed action queue is empty&lt;br /&gt;
 *          ERR_TA_NOT_FOUND            Timed action index not found&lt;br /&gt;
 *          ERR_TA_START_FAILED         Timed action execute failed; See log&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_timed_output_reset(void);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
There are no input parameters to this function. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| Error bit  || Description&lt;br /&gt;
|&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_NOT_INIT             || Timed action intialisation is not done and tried to be used&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_PTR_BAD              || Timed action pointer is null&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to acquire timed action guard&lt;br /&gt;
|-&lt;br /&gt;
| WARN_TA_Q_EMPTY             || Timed action queue is empty&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_NOT_FOUND            || Timed action index not found&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_START_FAILED         || Timed action execute failed; See log&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Remove all timed outputs from the timed actions queue&lt;br /&gt;
status = oceos_timed_output_reset();&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Logging directives ==&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;Introduction&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Log Area Features  (for details of other areas see oceos_areas.h)&lt;br /&gt;
&lt;br /&gt;
The system log area holds the system log and the records of the present and previous values of the system state variable.&lt;br /&gt;
&lt;br /&gt;
It is set up initially as an array of 32-bit words that starts at a 32-bit aligned address provided by the application developer.&lt;br /&gt;
&lt;br /&gt;
It is recommended that this address be in non-volatile RAM memory if this is available to allow information be preserved across power-up cycles.&lt;br /&gt;
&lt;br /&gt;
OCEOS preserves log area information across resets as far as possible.&lt;br /&gt;
&lt;br /&gt;
The system log itself is a circular buffer of struct log entry. Older entries are overwritten by new entries once all entries are in use.&lt;br /&gt;
&lt;br /&gt;
The application developer can specify a function to be called when 3/4 of log entries are in use. This function is called again only after 3/4 of log entries have been read and the log has again become 3/4 full.&lt;br /&gt;
&lt;br /&gt;
The read and write indices are stored in the log area and if equal indicate that the log is empty.&lt;br /&gt;
&lt;br /&gt;
As with other OCEOS data areas, the log area starts with a header&lt;br /&gt;
*a 32-bit word holding a constant OCEOS_VERSION&lt;br /&gt;
*a 32-bit word holding the log area size in 32-bit words&lt;br /&gt;
*a 32-bit word, the system status variable&lt;br /&gt;
*a 32-bit word, the system status mask&lt;br /&gt;
*a 32-bit word, the accumulated system status&lt;br /&gt;
*a 32-bit word, the previous system status mask&lt;br /&gt;
*a 32-bit word, the log control, that gives whether the log full function was called&lt;br /&gt;
*the read index&lt;br /&gt;
*the write index&lt;br /&gt;
*an array of struct log_entry making up the system log itself&lt;br /&gt;
*ending with a 32-bit constant END_SENTINEL&lt;br /&gt;
&lt;br /&gt;
The system fixed meta structure at sysMetaPtr provides&lt;br /&gt;
&lt;br /&gt;
*system_log_ptr      the start address of the log area&lt;br /&gt;
*logEntries          the number of log entries&lt;br /&gt;
*logCreated          flag indicating log was created successfully&lt;br /&gt;
*logFullFunction     user defined function, called when the log becomes 3/4 full (or NULL if not used)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Log Entry Types and Structure'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/*****************************************************************************&lt;br /&gt;
 * LOG ENTRY TYPES&lt;br /&gt;
 *&lt;br /&gt;
 * A log entry type is an 8-bit number.&lt;br /&gt;
 * Values from 0 to 127 can be defined by the application.&lt;br /&gt;
 * Values from 128 to 255 are used by OCEOS as below.&lt;br /&gt;
 *&lt;br /&gt;
 *&lt;br /&gt;
 * NOTE: Add new log types at the end for backward compatibility&lt;br /&gt;
 */&lt;br /&gt;
enum LOG_ENTRY_TYPE{&lt;br /&gt;
  LOG_SYS_OK = 0x80U,&lt;br /&gt;
  LOG_OCEOS_ABORT,				// when exiting from oceos_start&lt;br /&gt;
  LOG_LOG_NOT_VALID_ENTRY,		// used to initialise log and when log empty&lt;br /&gt;
  LOG_INIT_TASK_START_FAIL,		// initial task passed to oceos_start failed&lt;br /&gt;
  LOG_DEADLINE_MISSED,			// task deadline missed&lt;br /&gt;
  LOG_JOB_NOT_ACTIVE,			// cpu_terminate but job not active, absurd&lt;br /&gt;
  LOG_JOB_NOT_FREE,				// job guarded but not free&lt;br /&gt;
  LOG_JOBS_INC_FAILED, 			// pending jobs increment failed&lt;br /&gt;
  LOG_JOB_NOT_GUARDED,			// paranoia&lt;br /&gt;
  LOG_CS_LOG_SPIN_FAIL,			// oceos_CPU_sleep, trying to update CS log&lt;br /&gt;
  LOG_MUTEX_ALREADY_HELD,		// oceos_mutex_wait, code returned, not needed&lt;br /&gt;
  LOG_MUTEX_INCORRECT_ORDER,	// oceos_mutex_wait&lt;br /&gt;
  LOG_MUTEX_EXIT_HOLDING,		// task exits holding one or more mutexes&lt;br /&gt;
  LOG_MUTEX_EXIT_NONE,			// __oceos_tasks_remove_mutexes called but no mutex held&lt;br /&gt;
  LOG_SEMAPHORE_PENDING_REMOVE_FAIL,	// timed_action.c&lt;br /&gt;
  LOG_SEMAPHORE_PENDING_QUEUE_FULL,		// __oceos_semaphore_add_pend&lt;br /&gt;
  LOG_SEMAPHORE_SPIN_FAILED,			// trying to access semaphore&lt;br /&gt;
  LOG_DATAQ_PENDING_QUEUE_FULL,&lt;br /&gt;
  LOG_DATAQ_PENDING_REMOVE_FAIL,&lt;br /&gt;
  LOG_DATAQ_SPIN_FAILED,&lt;br /&gt;
  LOG_TIMED_ACTION_TIMER_NULL,&lt;br /&gt;
  LOG_TIMED_ACTION_INVALID,&lt;br /&gt;
  LOG_TIMED_ACTION_BAD_INDEX,&lt;br /&gt;
  LOG_TIMED_ACTION_MISSED,&lt;br /&gt;
  LOG_TIMED_ACTION_Q_EMPTY,&lt;br /&gt;
  LOG_TIMED_ACTION_REMOVE_FAIL,&lt;br /&gt;
  LOG_TIMED_ACTION_BAD_JOB_ID,&lt;br /&gt;
  LOG_TIMED_Q_SPIN_FAIL,&lt;br /&gt;
  LOG_SYSTEM_ERROR,&lt;br /&gt;
  LOG_ATOMICINC_FAILED,&lt;br /&gt;
  LOG_PENDING_PRI_UPDATE_FAILED,&lt;br /&gt;
  LOG_KILL_TASK_INVALID_ID,      // Tried to kill task with invalid ID&lt;br /&gt;
  LOG_OCEOS_EXIT_REQUEST,         // oceos_exit command was called&lt;br /&gt;
  LOG_RWMUTEX_NOT_RETURNED,&lt;br /&gt;
  LOG_RWMUTEX_NOT_HIGHEST&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
/*****************************************************************************&lt;br /&gt;
 * Structures&lt;br /&gt;
 */&lt;br /&gt;
/**&lt;br /&gt;
 * Log entry structure&lt;br /&gt;
 */&lt;br /&gt;
struct log_entry{&lt;br /&gt;
  U64_t             time64;&lt;br /&gt;
&lt;br /&gt;
  unsigned int      entry_cpu          :8;&lt;br /&gt;
  unsigned int      entry_type         :8;&lt;br /&gt;
  unsigned int      entry_note         :16;	// not used at present&lt;br /&gt;
&lt;br /&gt;
  U32_t             entry_comment;&lt;br /&gt;
}__attribute__ ((aligned (8)));&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_log_add_entry()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''system_log.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function adds an entry to the log. The entry overwrites the oldest unread entry if the log is full.&lt;br /&gt;
Custom log entries can be added to enum LOG_ENTRY from 0 to 128.&lt;br /&gt;
The indices are incremented in a circular fashion. If the write index reaches the read_index the read index is moved on, as read and write indices equal would indicate an empty log.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Add an entry to the log.&lt;br /&gt;
 * this overwrites the oldest unread entry if the log is full.&lt;br /&gt;
 * Custom log entries can be added to enum LOG_ENTRY from 0 to 128&lt;br /&gt;
 *&lt;br /&gt;
 * N.B. The indices are incremented in a circular fashion.&lt;br /&gt;
 *      If the write index reaches the read_index the read index is moved on,&lt;br /&gt;
 *      as read and write indices equal would indicate an empty log.&lt;br /&gt;
 *&lt;br /&gt;
 * @param type  enum LOG_ENTRY_TYPE&lt;br /&gt;
 * @param info  extra information to be logged&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_LOG_CORRUPT         System Log area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Log directive called in wrong phase; can be used after oceos_init() called&lt;br /&gt;
 *          ERR_ID_INVALID              Log type invalid&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to acquire log guard&lt;br /&gt;
 *          ERR_LOG_INDEX_WRONG         Read/write log index is wrong&lt;br /&gt;
 */&lt;br /&gt;
S32_t   oceos_log_add_entry(&lt;br /&gt;
    enum LOG_ENTRY_TYPE type,   // 8 bits enum LOG_ENTRY_TYPE&lt;br /&gt;
    const U32_t        info     // information&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| enum LOG_ENTRY_TYPE || Log entry type (see previous section for a list)&lt;br /&gt;
|-&lt;br /&gt;
| info | U32_t with the log information&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit  !! Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_LOG_CORRUPT         || System Log area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Log directive called in wrong phase; can be used after oceos_init() called&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || Log type invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to acquire log guard&lt;br /&gt;
|-&lt;br /&gt;
| ERR_LOG_INDEX_WRONG         || Read/write log index is wrong&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, info;&lt;br /&gt;
...&lt;br /&gt;
// Log LOG_APP_COMMS__ERROR (defined in enum LOG_ENTRY_TYPE) and info with more details&lt;br /&gt;
status = oceos_log_add_entry(LOG_APP_COMMS__ERROR, info);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_log_get_indexed_entry()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''system_log.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the entry at the specified position in the log. The entry is not removed and the log and log indices are not changed.&lt;br /&gt;
One use of this function is to allow the log be examined after a reset.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Returns the entry at the specified position in the log.&lt;br /&gt;
 * The entry is not removed and the log and log indices are not changed.&lt;br /&gt;
 * (intended to allow the log be examined for example after reset)&lt;br /&gt;
 *&lt;br /&gt;
 * @param index         position in the log&lt;br /&gt;
 * @param outputPtr     pointer to return log entry&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_LOG_CORRUPT         System Log area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Log directive called in wrong phase; can be used after oceos_init() called&lt;br /&gt;
 *          ERR_LOG_INDEX_WRONG         Read log index is wrong&lt;br /&gt;
 *          ERR_LOG_DATA_PTR_BAD        Data holder pointer is null&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_log_get_indexed_entry(&lt;br /&gt;
    const unsigned int index,&lt;br /&gt;
    struct log_entry * const outputPtr&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| index || U32_t with position in the log&lt;br /&gt;
|-&lt;br /&gt;
| outputPtr || pointer to struct log_entry to hold the returned entry&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit  !! Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_LOG_CORRUPT         || System Log area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Log directive called in wrong phase; can be used after oceos_init() called&lt;br /&gt;
|-&lt;br /&gt;
| ERR_LOG_INDEX_WRONG         || Read log index is wrong&lt;br /&gt;
|-&lt;br /&gt;
| ERR_LOG_DATA_PTR_BAD        || Data holder pointer is null&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, index;&lt;br /&gt;
struct log_entry store_entry;&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
// Read log_entry at specified index into outputPtr&lt;br /&gt;
status = oceos_log_get_indexed_entry(index, &amp;amp;store_entry);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_log_remove_entry()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''system_log.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function reads and removes the oldest unread log entry. &lt;br /&gt;
If the log is not empty use the entry at the read index to update the value at the output pointer, returning OCEOS_SUCCESS.&lt;br /&gt;
If outputPtr is NULL, entry is removed but no returned.&lt;br /&gt;
If the log is empty, set the value at the output pointer to LOG_LOG_NOT_VALID_ENTRY and return ERR_LOG_EMPTY.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Read and remove the oldest unread log entry&lt;br /&gt;
 *&lt;br /&gt;
 * If the log is not empty use the entry at the read index to update the value&lt;br /&gt;
 * at the output pointer, returning OCEOS_SUCCESS.&lt;br /&gt;
 *&lt;br /&gt;
 * If outputPtr is NULL, entry is removed but no returned&lt;br /&gt;
 *&lt;br /&gt;
 * If the log is empty, set the value at the output pointer to LOG_LOG_NOT_VALID_ENTRY&lt;br /&gt;
 * and return ERR_LOG_EMPTY&lt;br /&gt;
 *&lt;br /&gt;
 * @param outputPtr   pointer to struct log_entry&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_LOG_CORRUPT         System Log area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Log directive called in wrong phase; can be used after oceos_init() called&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to acquire log guard&lt;br /&gt;
 *          ERR_LOG_INDEX_WRONG         Read/write log index is wrong&lt;br /&gt;
 *          ERR_LOG_EMPTY               Log is empty&lt;br /&gt;
 */&lt;br /&gt;
S32_t   oceos_log_remove_entry(&lt;br /&gt;
    struct log_entry * const outputPtr&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| outputPtr || pointer to struct log_entry&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit  !! Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_LOG_CORRUPT         || System Log area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Log directive called in wrong phase; can be used after oceos_init() called&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to acquire log guard&lt;br /&gt;
|-&lt;br /&gt;
| ERR_LOG_INDEX_WRONG         || Read/write log index is wrong&lt;br /&gt;
|-&lt;br /&gt;
| ERR_LOG_EMPTY               || Log is empty&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
struct log_entry *outputPtr;&lt;br /&gt;
...&lt;br /&gt;
// Read log_entry into outputPtr and remove the oldest unread log entry&lt;br /&gt;
status = oceos_log_remove_entry(outputPtr);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_log_reset()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''system_log.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function sets all log entries to LOG_LOG_NOT_VALID_ENTRY and the log to empty, with the read and write indices set to 0.&lt;br /&gt;
The log is empty if the index of the next write is the same as the index of the next read. It does not affect the system status variable. It does not affect the context switch log.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * oceos_log_reset()&lt;br /&gt;
 *&lt;br /&gt;
 * Set all log entries to LOG_LOG_NOT_VALID_ENTRY and the log to empty, with the&lt;br /&gt;
 * read and write indices set to 0. and function called flag 0&lt;br /&gt;
 *&lt;br /&gt;
 * The log is empty if the index of the next write&lt;br /&gt;
 * is the same as the index of the next read.&lt;br /&gt;
 *&lt;br /&gt;
 * Does not affect the system status variable&lt;br /&gt;
 * Does not affect the context switch log&lt;br /&gt;
 *&lt;br /&gt;
 * N.B The fixed data area may no longer be writable&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_LOG_CORRUPT         System Log area corrupt; reset failed&lt;br /&gt;
 *          ERR_WRONG_PHASE             Log directive called in wrong phase; can be used after oceos_init() called&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to acquire log guard&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_log_reset(void);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
There are no input parameters to this function.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit  !! Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_LOG_CORRUPT         || System Log area corrupt; reset failed&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Log directive called in wrong phase; can be used after oceos_init() called&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to acquire log guard&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
// Clear down the system log&lt;br /&gt;
status = oceos_log_reset();&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_log_get_size()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''system_log.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the number of entries in the log according to the current values of the read and write indices.&lt;br /&gt;
The value will be zero if the current values of the read and write indices are the same. There may still be useful information in the log, e.g. after system reset, this can be accessed using oceos_log_get_indexed_entry().&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Return the number of entries in the log&lt;br /&gt;
 * according to the current values of the read and write indices.&lt;br /&gt;
 *&lt;br /&gt;
 * The value will be zero if the current values of the read and write indices&lt;br /&gt;
 * are the same.&lt;br /&gt;
 *&lt;br /&gt;
 * There may still be useful information in the log, e.g. after system reset,&lt;br /&gt;
 * this can be accessed using oceos_log_get_indexed_entry()&lt;br /&gt;
 *&lt;br /&gt;
 * @param l_size        pointer to log size holder&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_LOG_CORRUPT         System Log area corrupt;&lt;br /&gt;
 *          ERR_WRONG_PHASE             Log directive called in wrong phase; can be used after oceos_init() called&lt;br /&gt;
 *          ERR_LOG_DATA_PTR_BAD        Pointer to log size holder is NULL&lt;br /&gt;
 *          ERR_LOG_INDEX_WRONG         Read/write log index is wrong&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_log_get_size(&lt;br /&gt;
    U32_t *l_size&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| l_size|| U32_t pointer where size will be written.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit  !! Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_LOG_CORRUPT         || System Log area corrupt;&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Log directive called in wrong phase; can be used after oceos_init() called&lt;br /&gt;
|-&lt;br /&gt;
| ERR_LOG_DATA_PTR_BAD        || Pointer to log size holder is NULL&lt;br /&gt;
|-&lt;br /&gt;
| ERR_LOG_INDEX_WRONG         || Read/write log index is wrong&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, size;&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
// Clear down the system log&lt;br /&gt;
status = oceos_log_get_size(&amp;amp;size);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;System State Variable and System State Mask&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The System State variable provides a record of anomalies or problems detected by OCEOSmp's automatic consistency checks. An application handler for these can be set to be called automatically.&lt;br /&gt;
&lt;br /&gt;
An anomaly or problem results in a flag bit being set in the 32-bit word used to store the system state variable. The flags are identified below.&lt;br /&gt;
&lt;br /&gt;
All flags are reset to zero by oceos_init() when OCEOSmp is initialised, and may also be reset by the application using the directive provided.&lt;br /&gt;
&lt;br /&gt;
To provide a record across OCEOSmp restarts a copy is updated automatically whenever the state variable is updated. This is not cleared by oceos_init() but may be cleared by the application using a directive.&lt;br /&gt;
&lt;br /&gt;
Application software can define a problem handling function to be called automatically when specified system state flags are set. The flags are specified by setting the corresponding bits in the system state mask. The function and the state mask are defined in the system configuration.&lt;br /&gt;
&lt;br /&gt;
Changing a state flag from clear to set results in the function being called (if defined). Subsequent settings of that flag have no effect until after it has been cleared using the directive provided.&lt;br /&gt;
&lt;br /&gt;
N.B. In many cases when OCEOSmp sets a System State flag it also makes an entry in the system log that provides further information.&lt;br /&gt;
&lt;br /&gt;
SYSTEM STATE VARIABLE FLAGS&lt;br /&gt;
&lt;br /&gt;
These flags are updated by OCEOSmp using inclusive 'OR' when a consistency check detects a problem or anomaly. A copy of the system state variable is updated also and accumulates a record of flag settings that is preserved across restarts of OCEOSmp. OCEOSmp restarts reset the system state variable but not the copy.&lt;br /&gt;
&lt;br /&gt;
Resetting the state variables is the responsibility of the application (except for the state variable reset done when OCEOSmp is restarted).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''System Status Bits'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
#define  STATUS_NORMAL                    0u    // No flag set                              YES&lt;br /&gt;
#define  STATUS_INVALID          0xffffffffu    // System status is invalid                 YES BUT NO DETAIL!!!&lt;br /&gt;
&lt;br /&gt;
#define  STATUS_MASK_NORMAL      0xffffffffu    // Always call user def fn                  YES&lt;br /&gt;
&lt;br /&gt;
/* Task related problems */&lt;br /&gt;
#define  STATUS_DISABLED_TASK_START    0x1U    // An attempt to start a disabled task&lt;br /&gt;
#define  STATUS_TASK_JOB_LIMIT_OVER    0x2U    // An attempt to execute a task when its jobs limit is already reached.&lt;br /&gt;
#define  STATUS_JOB_OVER_TIME          0x4U    // Job time from creation to completion exceeds allowed maximum for task. YES&lt;br /&gt;
#define  STATUS_JOB_INTERVAL_SHORT     0x8U    // Minimum time between job creations is less than the allowed minimum for task&lt;br /&gt;
#define  STATUS_READYQ_FULL           0x10U    // Ready queue unable to accept job as result of being full&lt;br /&gt;
#define  STATUS_READYQ_NO_REMOVE      0x20U    // Remove job from ready queue failed&lt;br /&gt;
&lt;br /&gt;
/* Mutex related problems */&lt;br /&gt;
#define  STATUS_MUTEX_ALREADY_HELD    0x40U    // Mutex wait() when mutex already held&lt;br /&gt;
#define  STATUS_MUTEX_NOT_HELD        0x80U    // Mutex signal() when not already held&lt;br /&gt;
#define  STATUS_MUTEX_NOT_RETURNED   0x100U    // Mutex not returned before job terminates&lt;br /&gt;
#define  STATUS_MUTEX_NOT_NESTED     0x200U    // Use of multiple mutexes not nested&lt;br /&gt;
&lt;br /&gt;
/* Counting semaphore and data queue related problems */&lt;br /&gt;
#define  STATUS_SEMAPHORE_JOBS_FULL  0x400U    // Attempt to add job to semaphore pending list when list full&lt;br /&gt;
#define  STATUS_DATAQ_JOBS_FULL      0x800U    // Attempt to add job to data queue pending list when list full&lt;br /&gt;
#define  STATUS_DATAQ_FULL          0x1000U    // Data queue write when queue already full&lt;br /&gt;
&lt;br /&gt;
/* Timed actions related problems */&lt;br /&gt;
#define  STATUS_TIMED_JOBS_FULL     0x2000U    // Timed actions queue already full for timed task start&lt;br /&gt;
#define  STATUS_TIMED_OUTPUT_FULL   0x4000U    // Timed actions queue already full for timed output&lt;br /&gt;
#define  STATUS_TIMED_ACTION_LATE   0x8000U    // Timed action late                          YES&lt;br /&gt;
&lt;br /&gt;
/* Default trap handler should have been replaced&lt;br /&gt;
 * NOT USED AT THE MOMENT*/&lt;br /&gt;
#define  STATUS_SYSTEM_ERROR       0x10000U    // ERROR was handled by default trap handler  YES&lt;br /&gt;
&lt;br /&gt;
/* Flag to indicate problem with Stack Pointer&lt;br /&gt;
 * NOT USED AT THE MOMENT*/&lt;br /&gt;
#define  STATUS_SP_WARNING         0x20000U    // SP not in expected range&lt;br /&gt;
/* Log system error */&lt;br /&gt;
#define  STATUS_BAD_LOG            0x40000U    // System log problem&lt;br /&gt;
#define  STATUS_SPIN_FAILED        0x80000U    // Get SPIN lock failed&lt;br /&gt;
/* Not using next few bits */&lt;br /&gt;
&lt;br /&gt;
/* Will have to exit */&lt;br /&gt;
#define  STATUS_BAD_SENTINEL     0x40000000U    // Area sentinel corrupt&lt;br /&gt;
#define  STATUS_BAD_META_PTR     0x80000000U    // Null meta pointer&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_system_state_get()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''system_log.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns of the system state variable.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Returns the value of the system state variable&lt;br /&gt;
 *&lt;br /&gt;
 * @param state  pointer to state holder&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_LOG_DATA_PTR_BAD        Data holder pointer is null&lt;br /&gt;
 *          ERR_SYS_LOG_CORRUPT         LOG dynamic pointer is null&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_system_state_get(&lt;br /&gt;
    U32_t *state // pointer to state holder&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| state || U32_t pointer to state holder&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit  !! Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_LOG_DATA_PTR_BAD        || Data holder pointer is null&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_LOG_CORRUPT         || LOG dynamic pointer is null&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, state;&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
// Get the system state&lt;br /&gt;
status = oceos_system_state_get(&amp;amp;state);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_system_state_set()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''system_log.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function sets system state variable.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Sets system state variable&lt;br /&gt;
 *&lt;br /&gt;
 * @param new_state&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_LOG_CORRUPT         LOG dynamic pointer is null&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_system_state_set(&lt;br /&gt;
    U32_t new_state   // new value of system state variable&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| new_state || U32_t containing new system state&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit  !! Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_LOG_CORRUPT         || LOG dynamic pointer is null&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, new_state;&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
// Set new system state&lt;br /&gt;
status = oceos_system_state_set(new_state);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_system_state_copy_get()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''system_log.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the value of the system state copy variable.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Returns the value of the copy of system state variable&lt;br /&gt;
 *&lt;br /&gt;
 * @param state  pointer to state holder&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_LOG_DATA_PTR_BAD        Data holder pointer is null&lt;br /&gt;
 *          ERR_SYS_LOG_CORRUPT         LOG dynamic pointer is null&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_system_state_copy_get(&lt;br /&gt;
    U32_t *state // pointer to state copy holder&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| state || U32_t pointer to state copy holder&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit  !! Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_LOG_DATA_PTR_BAD        || Data holder pointer is null&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_LOG_CORRUPT         || LOG dynamic pointer is null&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, copy_state;&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
// Get the system state copy&lt;br /&gt;
status = oceos_system_state_copy_get(&amp;amp;copy_state);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_system_state_copy_set()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''system_log.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function loads a value to tha system state copy variable.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Sets system state copy variable&lt;br /&gt;
 *&lt;br /&gt;
 * @param new_state&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_LOG_CORRUPT         LOG dynamic pointer is null&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_system_state_copy_set(&lt;br /&gt;
    U32_t new_state   // new value of system state variable&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| new_state || U32_t containing new system state copy&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit  !! Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_LOG_CORRUPT         || LOG dynamic pointer is null&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, new_state;&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
// Set new system state copy&lt;br /&gt;
status = oceos_system_state_copy_set(new_state);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Timing directives =&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;Introduction&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
SPARC:&lt;br /&gt;
&lt;br /&gt;
In OCEOS system time is based on two chained 32-bit timers.&lt;br /&gt;
&lt;br /&gt;
No interrupts are involved, the current system time is obtained by reading the two timer counter registers (in an atomic way) and then inverting the&lt;br /&gt;
values since the timers count down.&lt;br /&gt;
&lt;br /&gt;
The scaler associated with the timers is configured based on the system clock frequency to decrement the low order timer every microsecond. This&lt;br /&gt;
decrements the high order timer when it rolls over, every 71.6 minutes approximately. The 64-bit time range is very long, over 584,000 years.&lt;br /&gt;
&lt;br /&gt;
ARM Cortex-M:&lt;br /&gt;
&lt;br /&gt;
In OCEOS for ARM Cortex-M, system time is based on SysTick. The processor has a 24-bit system timer, SysTick, that counts down from the reload value to zero, reloads (wraps to) the value in the LOAD register on the next clock edge, then counts down on subsequent clocks.&lt;br /&gt;
&lt;br /&gt;
Note: When the processor is halted for debugging the counter does not decrement.&lt;br /&gt;
&lt;br /&gt;
OCEOS initializes the timer to be driven from MCK and counting down to zero asserts SysTick exception request.&lt;br /&gt;
OCEOS has 64 bit counter which is increased by 0xFFFFFF value every time timer reloads.&lt;br /&gt;
&lt;br /&gt;
RISC-V:&lt;br /&gt;
&lt;br /&gt;
TBD&lt;br /&gt;
&lt;br /&gt;
The units of OCEOS system time are microseconds on SPARC and ARM and on RISC-V the period of the clock cycle.&lt;br /&gt;
&lt;br /&gt;
The system time is reset to 0 by oceos_init()&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_time_sys_get64()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''oceos_timer.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the current system time as a 64-bit number.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
**&lt;br /&gt;
 * Get the current system time (64-bit)&lt;br /&gt;
 *&lt;br /&gt;
 * @return U64_t&lt;br /&gt;
 */&lt;br /&gt;
U64_t oceos_time_sys_get64(void);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There are no parameters to this function.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S64_t with the current system time.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S64_t now;&lt;br /&gt;
...&lt;br /&gt;
// Get the time&lt;br /&gt;
now = oceos_time_sys_get64();&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_time_sys_get32()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''oceos_timer.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the low 32 bits of the system time.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Get the current system time (low 32 bits of 64 bit value)&lt;br /&gt;
 *&lt;br /&gt;
 * @return U32_t&lt;br /&gt;
 */&lt;br /&gt;
U32_t oceos_time_sys_get32(void);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
There are no parameters to this function.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with the current system time.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t now;&lt;br /&gt;
...&lt;br /&gt;
// Get the time&lt;br /&gt;
now = oceos_time_sys_get32();&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:backup]]&lt;/div&gt;</summary>
		<author><name>Bkavanagh</name></author>
	</entry>
	<entry>
		<id>https://wiki.ocetechnology.com/mediawiki/index.php?title=OCEOSmp/blank&amp;diff=1679</id>
		<title>OCEOSmp/blank</title>
		<link rel="alternate" type="text/html" href="https://wiki.ocetechnology.com/mediawiki/index.php?title=OCEOSmp/blank&amp;diff=1679"/>
		<updated>2024-05-03T14:11:23Z</updated>

		<summary type="html">&lt;p&gt;Bkavanagh: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Next Section ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;blank_function()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''header.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function does xyz...&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t oceosmp_blank(&lt;br /&gt;
    U32_t param&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| param || parameter to function&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit  !! Description&lt;br /&gt;
|-&lt;br /&gt;
| Error_name|| description&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, param;&lt;br /&gt;
...&lt;br /&gt;
// Do xyz&lt;br /&gt;
status = oceosmp_blank(param));&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:backup]]&lt;/div&gt;</summary>
		<author><name>Bkavanagh</name></author>
	</entry>
	<entry>
		<id>https://wiki.ocetechnology.com/mediawiki/index.php?title=OCEOSmp/blank&amp;diff=1678</id>
		<title>OCEOSmp/blank</title>
		<link rel="alternate" type="text/html" href="https://wiki.ocetechnology.com/mediawiki/index.php?title=OCEOSmp/blank&amp;diff=1678"/>
		<updated>2024-05-03T14:06:40Z</updated>

		<summary type="html">&lt;p&gt;Bkavanagh: /* Introduction */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Next Section ==&lt;br /&gt;
&lt;br /&gt;
= Timing directives =&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;Introduction&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
SPARC:&lt;br /&gt;
&lt;br /&gt;
In OCEOS system time is based on two chained 32-bit timers.&lt;br /&gt;
&lt;br /&gt;
No interrupts are involved, the current system time is obtained by reading the two timer counter registers (in an atomic way) and then inverting the&lt;br /&gt;
values since the timers count down.&lt;br /&gt;
&lt;br /&gt;
The scaler associated with the timers is configured based on the system clock frequency to decrement the low order timer every microsecond. This&lt;br /&gt;
decrements the high order timer when it rolls over, every 71.6 minutes approximately. The 64-bit time range is very long, over 584,000 years.&lt;br /&gt;
&lt;br /&gt;
ARM Cortex-M:&lt;br /&gt;
&lt;br /&gt;
In OCEOS for ARM Cortex-M, system time is based on SysTick. The processor has a 24-bit system timer, SysTick, that counts down from the reload value to zero, reloads (wraps to) the value in the LOAD register on the next clock edge, then counts down on subsequent clocks.&lt;br /&gt;
&lt;br /&gt;
Note: When the processor is halted for debugging the counter does not decrement.&lt;br /&gt;
&lt;br /&gt;
OCEOS initializes the timer to be driven from MCK and counting down to zero asserts SysTick exception request.&lt;br /&gt;
OCEOS has 64 bit counter which is increased by 0xFFFFFF value every time timer reloads.&lt;br /&gt;
&lt;br /&gt;
RISC-V:&lt;br /&gt;
&lt;br /&gt;
TBD&lt;br /&gt;
&lt;br /&gt;
The units of OCEOS system time are microseconds on SPARC and ARM and on RISC-V the period of the clock cycle.&lt;br /&gt;
&lt;br /&gt;
The system time is reset to 0 by oceos_init()&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_time_sys_get64()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''oceos_timer.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the current system time as a 64-bit number.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
**&lt;br /&gt;
 * Get the current system time (64-bit)&lt;br /&gt;
 *&lt;br /&gt;
 * @return U64_t&lt;br /&gt;
 */&lt;br /&gt;
U64_t oceos_time_sys_get64(void);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There are no parameters to this function.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S64_t with the current system time.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S64_t now;&lt;br /&gt;
...&lt;br /&gt;
// Get the time&lt;br /&gt;
now = oceos_time_sys_get64();&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_time_sys_get32()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''oceos_timer.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the low 32 bits of the system time.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Get the current system time (low 32 bits of 64 bit value)&lt;br /&gt;
 *&lt;br /&gt;
 * @return U32_t&lt;br /&gt;
 */&lt;br /&gt;
U32_t oceos_time_sys_get32(void);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
There are no parameters to this function.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with the current system time.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t now;&lt;br /&gt;
...&lt;br /&gt;
// Get the time&lt;br /&gt;
now = oceos_time_sys_get32();&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;blank_function()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''header.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function does xyz...&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t oceosmp_blank(&lt;br /&gt;
    U32_t param&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| param || parameter to function&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit  !! Description&lt;br /&gt;
|-&lt;br /&gt;
| Error_name|| description&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, param;&lt;br /&gt;
...&lt;br /&gt;
// Do xyz&lt;br /&gt;
status = oceosmp_blank(param));&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:backup]]&lt;/div&gt;</summary>
		<author><name>Bkavanagh</name></author>
	</entry>
	<entry>
		<id>https://wiki.ocetechnology.com/mediawiki/index.php?title=OCEOSmp/blank&amp;diff=1677</id>
		<title>OCEOSmp/blank</title>
		<link rel="alternate" type="text/html" href="https://wiki.ocetechnology.com/mediawiki/index.php?title=OCEOSmp/blank&amp;diff=1677"/>
		<updated>2024-05-03T14:05:11Z</updated>

		<summary type="html">&lt;p&gt;Bkavanagh: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Next Section ==&lt;br /&gt;
&lt;br /&gt;
= Timing directives =&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;Introduction&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
SPARC:&lt;br /&gt;
In OCEOS system time is based on two chained 32-bit timers.&lt;br /&gt;
&lt;br /&gt;
No interrupts are involved, the current system time is obtained by reading the two timer counter registers (in an atomic way) and then inverting the&lt;br /&gt;
values since the timers count down.&lt;br /&gt;
&lt;br /&gt;
The scaler associated with the timers is configured based on the system clock frequency to decrement the low order timer every microsecond. This&lt;br /&gt;
decrements the high order timer when it rolls over, every 71.6 minutes approximately. The 64-bit time range is very long, over 584,000 years.&lt;br /&gt;
&lt;br /&gt;
ARM Cortex-M:&lt;br /&gt;
In OCEOS for ARM Cortex-M, system time is based on SysTick. The processor has a 24-bit system timer, SysTick, that counts down from the reload value to zero, reloads (wraps to) the value in the LOAD register on the next clock edge, then counts down on subsequent clocks.&lt;br /&gt;
&lt;br /&gt;
Note: When the processor is halted for debugging the counter does not decrement.&lt;br /&gt;
&lt;br /&gt;
OCEOS initializes the timer to be driven from MCK and counting down to zero asserts SysTick exception request.&lt;br /&gt;
OCEOS has 64 bit counter which is increased by 0xFFFFFF value every time timer reloads.&lt;br /&gt;
&lt;br /&gt;
RISC-V:&lt;br /&gt;
TBD&lt;br /&gt;
&lt;br /&gt;
The units of OCEOS system time are microseconds on SPARC and ARM and on RISC-V the period of the clock cycle.&lt;br /&gt;
&lt;br /&gt;
The system time is reset to 0 by oceos_init()&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_time_sys_get64()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''oceos_timer.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the current system time as a 64-bit number.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
**&lt;br /&gt;
 * Get the current system time (64-bit)&lt;br /&gt;
 *&lt;br /&gt;
 * @return U64_t&lt;br /&gt;
 */&lt;br /&gt;
U64_t oceos_time_sys_get64(void);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There are no parameters to this function.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S64_t with the current system time.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S64_t now;&lt;br /&gt;
...&lt;br /&gt;
// Get the time&lt;br /&gt;
now = oceos_time_sys_get64();&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_time_sys_get32()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''oceos_timer.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the low 32 bits of the system time.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Get the current system time (low 32 bits of 64 bit value)&lt;br /&gt;
 *&lt;br /&gt;
 * @return U32_t&lt;br /&gt;
 */&lt;br /&gt;
U32_t oceos_time_sys_get32(void);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
There are no parameters to this function.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with the current system time.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t now;&lt;br /&gt;
...&lt;br /&gt;
// Get the time&lt;br /&gt;
now = oceos_time_sys_get32();&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;blank_function()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''header.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function does xyz...&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t oceosmp_blank(&lt;br /&gt;
    U32_t param&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| param || parameter to function&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit  !! Description&lt;br /&gt;
|-&lt;br /&gt;
| Error_name|| description&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, param;&lt;br /&gt;
...&lt;br /&gt;
// Do xyz&lt;br /&gt;
status = oceosmp_blank(param));&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:backup]]&lt;/div&gt;</summary>
		<author><name>Bkavanagh</name></author>
	</entry>
	<entry>
		<id>https://wiki.ocetechnology.com/mediawiki/index.php?title=OCEOSmp/directive_reference&amp;diff=1676</id>
		<title>OCEOSmp/directive reference</title>
		<link rel="alternate" type="text/html" href="https://wiki.ocetechnology.com/mediawiki/index.php?title=OCEOSmp/directive_reference&amp;diff=1676"/>
		<updated>2024-05-03T09:41:49Z</updated>

		<summary type="html">&lt;p&gt;Bkavanagh: /* oceos_timed_output_reset() */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt;'''This section is under construction'''&amp;lt;/span&amp;gt; =&lt;br /&gt;
&lt;br /&gt;
= Introduction =&lt;br /&gt;
&lt;br /&gt;
To be added&lt;br /&gt;
&lt;br /&gt;
= Directives =&lt;br /&gt;
&lt;br /&gt;
== Initialisation directives ==&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_init()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''initialisation.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Initialises OCEOS and  must be the first directive used.&lt;br /&gt;
&lt;br /&gt;
Initialises the OCEOS system meta data using the information supplied in the application configuration and prepares for creation of tasks etc.&lt;br /&gt;
&lt;br /&gt;
The values provided in the application configuration are checked as much as possible before being used.&lt;br /&gt;
&lt;br /&gt;
The system log also is created here.&lt;br /&gt;
&lt;br /&gt;
This function sets up sysMetaPtr and init_meta_ptr and must have completed successfully before tasks etc. can be created.&lt;br /&gt;
&lt;br /&gt;
It disables interrupts and leaves them disabled, they will be re-enabled to the previous level after all tasks etc. have been created and [[OCEOSmp/directive_reference#oceos_init_finish()|oceos_init_finish()]] has completed successfully.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Initialises OCEOS and  must be the first directive used.&lt;br /&gt;
 *&lt;br /&gt;
 * Initialises the OCEOS system meta data using the information supplied in&lt;br /&gt;
 * the application configuration and prepares for creation of tasks etc.&lt;br /&gt;
 *&lt;br /&gt;
 * The values provided in the application configuration are checked as much&lt;br /&gt;
 * as possible before being used.&lt;br /&gt;
 *&lt;br /&gt;
 * The system log also is created here.&lt;br /&gt;
 *&lt;br /&gt;
 * This function sets up sysMetaPtr and init_meta_ptr and must have completed&lt;br /&gt;
 * successfully before tasks etc. can be created.&lt;br /&gt;
 *&lt;br /&gt;
 * It disables interrupts and leaves them disabled, they will be re-enabled to&lt;br /&gt;
 * the previous level after all tasks etc. have been created and&lt;br /&gt;
 * oceos_init_finish() has completed successfully.&lt;br /&gt;
 *&lt;br /&gt;
 * @param app_config Pointer to configuration struct&lt;br /&gt;
 * @return SUCCESSFUL                        All OK&lt;br /&gt;
 *         WARN_LOG_SIZE_DEFAULT             Warning, log size is set to default value of 64 entries&lt;br /&gt;
 *         WARN_NO_ERROR_FUNCTION            Warning, user defined function for ERROR handling is not provided&lt;br /&gt;
 *         ERR_CPU_FIRST_CORE_INVALID        Start CPU not in a range of available cores for this target; or greater than end CPU&lt;br /&gt;
 *         ERR_CPU_LAST_CORE_INVALID         Last CPU not in a range of available cores for this target&lt;br /&gt;
 *         ERR_NOT_START_CPU_CORE            Executing oceos_init on wrong CPU&lt;br /&gt;
 *         ERR_STACK_START_MISALIGNED        Stack start address is not set by user misaligned&lt;br /&gt;
 *         ERR_STACK_PER_CORE_INVALID        Stack per CPU size is zero, or not 8byte aligned, or less then min require&lt;br /&gt;
 *         ERR_LOG_ADDR_MISALIGNED           Log start address is not 8 byte aligned&lt;br /&gt;
 *         ERR_FIX_ADDR_MISALIGNED           Fixed area start address is not 8 byte aligned&lt;br /&gt;
 *         ERR_DYN_ADDR_MISALIGNED           Dynamic area start address is not 8 byte aligned&lt;br /&gt;
 *         ERR_CPU_CORE_RANGE_WRONG          CPU cores in use exceed available CPUs on the SoC&lt;br /&gt;
 *         ERR_STACK_SPACE_WRONG             Current CPU SP is not within user provided stack range&lt;br /&gt;
 *         ERR_LOG_SIZE_INVALID              Log size outside expected range&lt;br /&gt;
 *         ERR_CS_LOG_SIZE_INVALID           Context switch log size invalid&lt;br /&gt;
 *         ERR_TASK_NUMBER_INVALID           Number of tasks invalid&lt;br /&gt;
 *         ERR_MUTEX_NUMBER_INVALID          Number of mutexes invalid&lt;br /&gt;
 *         ERR_RWMUTEX_NUMBER_INVALID        Number of rwmutexes invalid&lt;br /&gt;
 *         ERR_SEM_NUMBER_INVALID            Number of semaphores invalid&lt;br /&gt;
 *         ERR_DATAQ_NUMBER_INVALID          Number of datqs invalid&lt;br /&gt;
 *         ERR_TIMED_ACTIONS_NUMBER_INVALID  Number of timed actions invalid&lt;br /&gt;
 *         ERR_OVERLAP_STACK                 Overlap stack end address with (two overlap areas are set)&lt;br /&gt;
 *         ERR_OVERLAP_LOG                   Overlap log with (two overlap areas are set)&lt;br /&gt;
 *         ERR_OVERLAP_FIXED                 Overlap fixed area with (two overlap areas are set)&lt;br /&gt;
 *         ERR_OVERLAP_DYNAMIC               Overlap dynamic area with (two overlap areas are set)&lt;br /&gt;
 *         ERR_FIXED_MEMORY_FAILED           Fixed area memory write fail&lt;br /&gt;
 *         ERR_DYNAMIC_MEMORY_FAILED         Dynamic area memory write fail&lt;br /&gt;
 *         ERR_TIMER_ADDR_INVALID            Timer address not provided by user (null). SPARC only&lt;br /&gt;
 *         ERR_SYS_TIMER_INDEX_INVALID       System timer index of subtimer invalid; SPARC only; Subtimers start from index 1; Need index of subtimer plus one in front&lt;br /&gt;
 *         ERR_PERIPHERAL_CLOCK_INVALID      System peripheral code invalid&lt;br /&gt;
 *&lt;br /&gt;
 */&lt;br /&gt;
S32_t   oceos_init(&lt;br /&gt;
    const struct application_configuration app_config&lt;br /&gt;
);&lt;br /&gt;
 &amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| app_config || Pointer to configuration struct.  struct application_configuration defined in '''''basic_structs.h'''''&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| WARN_LOG_SIZE_DEFAULT             || Warning, log size is set to default value of 64 entries&lt;br /&gt;
|-&lt;br /&gt;
| WARN_NO_ERROR_FUNCTION            || Warning, user defined function for ERROR handling is not provided&lt;br /&gt;
|-&lt;br /&gt;
| ERR_CPU_FIRST_CORE_INVALID        || Start CPU not in a range of available cores for this target; or greater than end CPU&lt;br /&gt;
|-&lt;br /&gt;
| ERR_CPU_LAST_CORE_INVALID         || Last CPU not in a range of available cores for this target&lt;br /&gt;
|-&lt;br /&gt;
| ERR_NOT_START_CPU_CORE            || Executing oceos_init on wrong CPU&lt;br /&gt;
|-&lt;br /&gt;
| ERR_STACK_START_MISALIGNED        || Stack start address is not set by user misaligned&lt;br /&gt;
|-&lt;br /&gt;
| ERR_STACK_PER_CORE_INVALID        || Stack per CPU size is zero, or not 8byte aligned, or less then min require&lt;br /&gt;
|-&lt;br /&gt;
| ERR_LOG_ADDR_MISALIGNED           || Log start address is not 8 byte aligned&lt;br /&gt;
|-&lt;br /&gt;
| ERR_FIX_ADDR_MISALIGNED           || Fixed area start address is not 8 byte aligned&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DYN_ADDR_MISALIGNED           || Dynamic area start address is not 8 byte aligned&lt;br /&gt;
|-&lt;br /&gt;
| ERR_CPU_CORE_RANGE_WRONG          || CPU cores in use exceed available CPUs on the SoC&lt;br /&gt;
|-&lt;br /&gt;
| ERR_STACK_SPACE_WRONG             || Current CPU SP is not within user provided stack range&lt;br /&gt;
|-&lt;br /&gt;
| ERR_LOG_SIZE_INVALID              || Log size outside expected range&lt;br /&gt;
|-&lt;br /&gt;
| ERR_CS_LOG_SIZE_INVALID           || Context switch log size invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TASK_NUMBER_INVALID           || Number of tasks invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_MUTEX_NUMBER_INVALID          || Number of mutexes invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_RWMUTEX_NUMBER_INVALID        || Number of rwmutexes invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SEM_NUMBER_INVALID            || Number of semaphores invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DATAQ_NUMBER_INVALID          || Number of datqs invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TIMED_ACTIONS_NUMBER_INVALID  || Number of timed actions invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_OVERLAP_STACK                 || Overlap stack end address with (two overlap areas are set)&lt;br /&gt;
|-&lt;br /&gt;
| ERR_OVERLAP_LOG                   || Overlap log with (two overlap areas are set)&lt;br /&gt;
|-&lt;br /&gt;
| ERR_OVERLAP_FIXED                 || Overlap fixed area with (two overlap areas are set)&lt;br /&gt;
|-&lt;br /&gt;
| ERR_OVERLAP_DYNAMIC               || Overlap dynamic area with (two overlap areas are set)&lt;br /&gt;
|-&lt;br /&gt;
| ERR_FIXED_MEMORY_FAILED           || Fixed area memory write fail&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DYNAMIC_MEMORY_FAILED         || Dynamic area memory write fail&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TIMER_ADDR_INVALID            || Timer address not provided by user (null). SPARC only&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_TIMER_INDEX_INVALID       || System timer index of subtimer invalid; SPARC only; Subtimers start from index 1; Need index of subtimer plus one in front&lt;br /&gt;
|-&lt;br /&gt;
| ERR_PERIPHERAL_CLOCK_INVALID      || System peripheral code invalid&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
    /*&lt;br /&gt;
     * Create the application configuration structure&lt;br /&gt;
     */&lt;br /&gt;
    struct application_configuration           app_config = {0};&lt;br /&gt;
&lt;br /&gt;
    /*&lt;br /&gt;
     * Fill in the application parameters&lt;br /&gt;
     */&lt;br /&gt;
    app_config.log_address                   = (log_t)log_data;              // required&lt;br /&gt;
    app_config.fixed_data_address            = (adrs_t)fixed_data;            // required&lt;br /&gt;
    app_config.dynamic_data_address          = (adrs_t)dynamic_data;          // required&lt;br /&gt;
&lt;br /&gt;
    app_config.stack_start_address           = start_stack_array[OCEOS_START_CPU_INDEX];// OCEOSMP_STACK_START_ADDRESS;&lt;br /&gt;
    app_config.stack_size_per_cpu            = (U32_t)&amp;amp;__oceos_stack_size_per_cpu;  // OCEOSMP_STACK_LOW_BOUND_ADDRESS;&lt;br /&gt;
&lt;br /&gt;
    app_config.system_error_function         = oceosmp_on_error;               // NULL =&amp;gt; ignore&lt;br /&gt;
    app_config.log_full_function             = oceosmp_on_full_log;            // NULL =&amp;gt; ignore&lt;br /&gt;
&lt;br /&gt;
    // used in setting up system log and fixed data array&lt;br /&gt;
    app_config.log_number_of_entries         = NUMBER_OF_LOG_ENTRIES;          // 0 =&amp;gt; use default&lt;br /&gt;
&lt;br /&gt;
    app_config.number_of_tasks               = NUMBER_OF_TASKS;                // &amp;gt;= 1&lt;br /&gt;
&lt;br /&gt;
    app_config.number_of_mutexes             = NUMBER_OF_MUTEXES;&lt;br /&gt;
	app_config.number_of_rwmutexes			 = NUMBER_OF_RWMUTEXES;&lt;br /&gt;
    app_config.number_of_counting_semaphores = NUMBER_OF_SEMAPHORES;&lt;br /&gt;
    app_config.number_of_data_queues         = NUMBER_OF_DATAQS;&lt;br /&gt;
&lt;br /&gt;
    /**&lt;br /&gt;
     * FOR SPARC TARGET ONLY.&lt;br /&gt;
     */&lt;br /&gt;
    app_config.sys_time_timer_index          = SYS_TIME_TIMER_INDEX;           // 0 =&amp;gt; invalid index&lt;br /&gt;
    /**&lt;br /&gt;
     * FOR SPARC TARGET ONLY.&lt;br /&gt;
     * Not Used for ARM. Always Nested&lt;br /&gt;
     */&lt;br /&gt;
    app_config.interrupt_nesting_enabled     = TRUE;                           // TRUE =&amp;gt; single vector&lt;br /&gt;
    app_config.oceos_cpu_switch_int_number   = OCEOS_CPU_INTER_COM_INT_NUMBER; // User should provide SGI ID (0-15)&lt;br /&gt;
&lt;br /&gt;
    app_config.timed_actions_queue_size      = NUMBER_OF_ACTION_ENTRIES;&lt;br /&gt;
    app_config.CS_log_entries_base2          = CS_LOG_DEF_ENTRIES_BASE2;&lt;br /&gt;
    /**&lt;br /&gt;
     * Set starting index of CPU that will be used by OCEOSMP&lt;br /&gt;
     */&lt;br /&gt;
    app_config.oceos_cpu_start_index         = OCEOS_START_CPU_INDEX;&lt;br /&gt;
    /**&lt;br /&gt;
     * Set last index of CPU that will be used by OCEOSMP&lt;br /&gt;
     */&lt;br /&gt;
    app_config.oceos_cpu_last_index          = OCEOS_LAST_CPU_INDEX;&lt;br /&gt;
    /*&lt;br /&gt;
     * Set system/peripheral clock used to initialise system timer&lt;br /&gt;
     */&lt;br /&gt;
    app_config.soc_peripheral_clck           = BSP_SYSFREQ * 1000 * 1000;&lt;br /&gt;
&lt;br /&gt;
    // initialise OCEOSMP&lt;br /&gt;
    S32_t status;&lt;br /&gt;
    status = oceos_init(app_config);&lt;br /&gt;
    if (OCEOS_SUCCESS &amp;gt; status) {&lt;br /&gt;
      oceosmp_print(&amp;quot;\n oceos_init failure\n\r&amp;quot;);&lt;br /&gt;
      return 0;&lt;br /&gt;
    } else {&lt;br /&gt;
      return 1;&lt;br /&gt;
    }   // else&lt;br /&gt;
 &amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_init_finish()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''initialisation.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Finalizes the fixed data array after all tasks etc. have been created&lt;br /&gt;
&lt;br /&gt;
All information needed to start OCEOS can be found in the fixed data area&lt;br /&gt;
when oceos_init_finish() has completed.&lt;br /&gt;
&lt;br /&gt;
Once all tasks etc. have been created oceos_init_finish() checks the&lt;br /&gt;
accumulated information against the application configuration data&lt;br /&gt;
stored in the fixed meta structure.&lt;br /&gt;
&lt;br /&gt;
oceos_init_finish also calculates the size of the dynamic data area and&lt;br /&gt;
checks it does not overlap with the system stack, the system log, or the&lt;br /&gt;
fixed data, and if all ok sets up pointers to the various dynamic area&lt;br /&gt;
components in the fixed data.&lt;br /&gt;
&lt;br /&gt;
It then adds an XOR checksum to the fixed data area, and checks that this&lt;br /&gt;
is followed by FILLER, which it replaces with the end sentinel.&lt;br /&gt;
&lt;br /&gt;
On successful completion it restores the interrupt level to its value&lt;br /&gt;
before oceos_init() was called, otherwise interrupts remain disabled.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Finalizes the fixed data array after all tasks etc. have been created&lt;br /&gt;
 *&lt;br /&gt;
 * All information needed to start OCEOS can be found in the fixed data area&lt;br /&gt;
 * when oceos_init_finish() has completed.&lt;br /&gt;
 *&lt;br /&gt;
 * Once all tasks etc. have been created oceos_init_finish() checks the&lt;br /&gt;
 * accumulated information against the application configuration data&lt;br /&gt;
 * stored in the fixed meta structure.&lt;br /&gt;
 *&lt;br /&gt;
 * oceos_init_finish also calculates the size of the dynamic data area and&lt;br /&gt;
 * checks it does not overlap with the system stack, the system log, or the&lt;br /&gt;
 * fixed data, and if all ok sets up pointers to the various dynamic area&lt;br /&gt;
 * components in the fixed data.&lt;br /&gt;
 *&lt;br /&gt;
 * It then adds an XOR checksum to the fixed data area, and checks that this&lt;br /&gt;
 * is followed by FILLER, which it replaces with the end sentinel.&lt;br /&gt;
 *&lt;br /&gt;
 * On successful completion it restores the interrupt level to its value&lt;br /&gt;
 * before oceos_init() was called, otherwise interrupts remain disabled.&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS                             All OK&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT               System Meta data is NULL or corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT                 System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_CPU_CORE                  Executing directive on wrong CPU&lt;br /&gt;
 *          ERR_WRONG_PHASE                     Called before oceos_init()&lt;br /&gt;
 *          ERR_TASKS_INCOMPLETE                Created wrong number of tasks&lt;br /&gt;
 *          ERR_MUTEX_INCOMPLETE                Created wrong number of mutexes&lt;br /&gt;
 *          ERR_RWMUTEX_INCOMPLETE              Created wrong number of rwmutexes&lt;br /&gt;
 *          ERR_SEM_INCOMPLETE                  Created wrong number of semaphores&lt;br /&gt;
 *          ERR_DATAQ_INCOMPLETE                Created wrong number of dataqs&lt;br /&gt;
 *          ERR_TASK_MAX_ID_INVALID             Task's max id invalid&lt;br /&gt;
 *          ERR_MUTEX_MAX_ID_INVALID            Mutexe's max id invalid&lt;br /&gt;
 *          ERR_RWMUTEX_MAX_ID_INVALID          Rwmutexe's max id invalid&lt;br /&gt;
 *          ERR_SEM_MAX_ID_INVALID              Semaphore's max id invalid&lt;br /&gt;
 *          ERR_DATAQ_MAX_ID_INVALID            Dataq's max id invalid&lt;br /&gt;
 *          ERR_TOTAL_JOBS_NUMBER_WRONG         Wrong number of total jobs created&lt;br /&gt;
 *          ERR_ORDER_ARRAY_PTR_INVALID         Order array pointer is NULL or mis-aligned&lt;br /&gt;
 *          ERR_FIXED_AREA_TOO_SMALL            Not enough space for fixed data area&lt;br /&gt;
 */&lt;br /&gt;
S32_t   oceos_init_finish(void);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
There are no input parameters to this function.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit  || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT               || System Meta data is NULL or corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT                 || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_CPU_CORE                  || Executing directive on wrong CPU&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE                     || Called before oceos_init()&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TASKS_INCOMPLETE                || Created wrong number of tasks&lt;br /&gt;
|-&lt;br /&gt;
| ERR_MUTEX_INCOMPLETE                || Created wrong number of mutexes&lt;br /&gt;
|-&lt;br /&gt;
| ERR_RWMUTEX_INCOMPLETE              || Created wrong number of rwmutexes&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SEM_INCOMPLETE                  || Created wrong number of semaphores&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DATAQ_INCOMPLETE                || Created wrong number of dataqs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TASK_MAX_ID_INVALID             || Task's max id invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_MUTEX_MAX_ID_INVALID            || Mutexe's max id invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_RWMUTEX_MAX_ID_INVALID          || Rwmutexe's max id invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SEM_MAX_ID_INVALID              || Semaphore's max id invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DATAQ_MAX_ID_INVALID            || Dataq's max id invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TOTAL_JOBS_NUMBER_WRONG         || Wrong number of total jobs created&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ORDER_ARRAY_PTR_INVALID         || Order array pointer is NULL or mis-aligned&lt;br /&gt;
|-&lt;br /&gt;
| ERR_FIXED_AREA_TOO_SMALL            || Not enough space for fixed data area&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
    /*&lt;br /&gt;
     * Finish initialising OCEOS and setting up the fixed data&lt;br /&gt;
     */&lt;br /&gt;
    status = oceos_init_finish();&lt;br /&gt;
    if(OCEOS_SUCCESS &amp;gt; status){&lt;br /&gt;
        // LOG&lt;br /&gt;
      oceosmp_print(&amp;quot;\nAbandoning, problem ending OCEOS initialisation\n\r&amp;quot;);&lt;br /&gt;
        return -1;&lt;br /&gt;
    }   // if&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_start()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''initialisation.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Starts OCEOS scheduling.&amp;lt;br&amp;gt;&lt;br /&gt;
Create dynamic OCEOS structures and start scheduling.&amp;lt;br&amp;gt;&lt;br /&gt;
This function should only be called once and only after [[OCEOSmp/directive_reference#oceos_init()|oceos_init()]] and [[OCEOSmp/directive_reference#oceos_init_finish()|oceos_init_finish()]] have been called successfully.&amp;lt;br&amp;gt;&lt;br /&gt;
Normally this function does not return. &amp;lt;br&amp;gt;&lt;br /&gt;
If a problem is detected the function terminates and returns an appropriate DIRECTIVE_STATUS code, with interrupts disabled.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Starts OCEOS scheduling&lt;br /&gt;
 *&lt;br /&gt;
 * Create dynamic OCEOS structures and start scheduling&lt;br /&gt;
 *&lt;br /&gt;
 * This function should only be called once&lt;br /&gt;
 * and only after oceos_init()&lt;br /&gt;
 * and oceos_init_finish() have&lt;br /&gt;
 *  been called successfully.&lt;br /&gt;
 * Normally this function does not return.&lt;br /&gt;
 * If a problem is detected the function&lt;br /&gt;
 * terminates and returns an appropriate&lt;br /&gt;
 * DIRECTIVE_STATUS code, with interrupts disabled.&lt;br /&gt;
 *&lt;br /&gt;
 * @param fixed_array_ptr   Pointer to fixed data array&lt;br /&gt;
 * @param start_task        Task ID&lt;br /&gt;
 * @param data_ptr          Pointer to data to be passed to the task&lt;br /&gt;
 * @return  OCEOSMP_EXIT                        OCEOSMP return from scheduling and exit&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT               Fixed area pointer is null or bad sentinel&lt;br /&gt;
 *          ERR_FIXED_AREA_SIZE_WRONG           Fixed area size is zero&lt;br /&gt;
 *          ERR_FIXED_AREA_END_SENTINEL_BAD     Fixed data end sentinel corrupt&lt;br /&gt;
 *          ERR_FIXED_AREA_BAD_XOR              Fixed area bad checksum or checksum mis-match&lt;br /&gt;
 *          ERR_INIT_NOT_DONE                   oceos_start() called without initialisation&lt;br /&gt;
 *          ERR_DYN_AREA_PTR_BAD                Dynamic area pointer invalid in sysMetaPtr&lt;br /&gt;
 *          ERR_INT_HANDLER_BAD                 IRQ controller pointer provided by BCC is NULL;or OCEOS handler is not set&lt;br /&gt;
 *          ERR_DYN_JOB_PTR_BAD                 Job array pointer is NULL&lt;br /&gt;
 *          ERR_FIXED_TASK_PTR_BAD              Tasks array pointer is NULL&lt;br /&gt;
 *          ERR_JOB_COUNT_WRONG                 Total job count inconsistent&lt;br /&gt;
 *          ERR_DYN_MUTEX_PTR_BAD               Mutex dynamic pointer is NULL&lt;br /&gt;
 *          ERR_DYN_LOCK_PTR_BAD                Mutex lock array pointer is NULL&lt;br /&gt;
 *          ERR_DYN_RWMUTEX_PTR_BAD             Rwmutex dynamic pointer is NULL&lt;br /&gt;
 *          ERR_DYN_RWLOCK_PTR_BAD              Rwmutex lock array pointer is NULL&lt;br /&gt;
 *          ERR_FIXED_SEM_PTR_BAD               Semaphore fixed pointer is NULL&lt;br /&gt;
 *          ERR_DYN_SEM_PTR_BAD                 Semaphore dynamic pointer is NULL&lt;br /&gt;
 *          ERR_SEM_PEND_PTR_BAD                Semaphore pending queue pointer is NULL&lt;br /&gt;
 *          ERR_FIXED_DATAQ_PTR_BAD             Dataq fixed pointer is NULL&lt;br /&gt;
 *          ERR_DYN_DATAQ_PTR_BAD               Dataq dynamic pointer is NULL&lt;br /&gt;
 *          ERR_DATAQ_PEND_PTR_BAD              Dataq pending queue pointer is NULL&lt;br /&gt;
 *          ERR_DATAQ_DATA_PTR_BAD              Dataq data pointer is NULL&lt;br /&gt;
 *          ERR_CPU_INT_NUMBER_INVALID          SPARC only.IRQ number for CPU inter-comunication invalid(zero or used by timer)&lt;br /&gt;
 *          ERR_REGISTER_CPU_IRQ_FAILED         SPARC only. Failed to set CPU IRQ handler in BCC&lt;br /&gt;
 *          ERR_CPU_STACK_INVALID               Current CPU stack not within specified range&lt;br /&gt;
 *          ERR_CPU_PRIORITY_STACK_INVALID      Per CPU priority stack invalid&lt;br /&gt;
 *          ERR_LOG_AREA_END_SENTINEL_BAD       Log area end sentinel override&lt;br /&gt;
 *          ERR_TA_CONFIG_PTR_BAD               SPARC only; Timed action configuration data pointer is NULL&lt;br /&gt;
 *          ERR_TA_TIMER_INDEX_INVALID          SPARC only; Timed action sub-timer index in timer unit is invalid&lt;br /&gt;
 *          ERR_TA_IRQ_NUMBER_INVALID           SPARC only; Timer action timer IRQ number is invalid&lt;br /&gt;
 *          ERR_TA_BCC_IRQ_REGISTER_FAILED      SPARC only; Timed action timer IRQ handler failed to register&lt;br /&gt;
 */&lt;br /&gt;
S32_t   oceos_start(&lt;br /&gt;
    const U32_t * const fixed_array_ptr,// pointer to fixed data array&lt;br /&gt;
    const U32_t start_task,             // taskID&lt;br /&gt;
    void * const data_ptr               // pointer to data to be passed to task&lt;br /&gt;
);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| fixed_array_ptr || Pointer to fixed data array&lt;br /&gt;
|-&lt;br /&gt;
| start_task      || Task ID&lt;br /&gt;
|-&lt;br /&gt;
| data_ptr        || Pointer to data to be passed to the task&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit  || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT               || Fixed area pointer is null or bad sentinel&lt;br /&gt;
|-&lt;br /&gt;
| ERR_FIXED_AREA_SIZE_WRONG           || Fixed area size is zero&lt;br /&gt;
|-&lt;br /&gt;
| ERR_FIXED_AREA_END_SENTINEL_BAD     || Fixed data end sentinel corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_FIXED_AREA_BAD_XOR              || Fixed area bad checksum or checksum mis-match&lt;br /&gt;
|-&lt;br /&gt;
| ERR_INIT_NOT_DONE                   || oceos_start() called without initialisation&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DYN_AREA_PTR_BAD                || Dynamic area pointer invalid in sysMetaPtr&lt;br /&gt;
|-&lt;br /&gt;
| ERR_INT_HANDLER_BAD                 || IRQ controller pointer provided by BCC is NULL;or OCEOS handler is not set&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DYN_JOB_PTR_BAD                 || Job array pointer is NULL&lt;br /&gt;
|-&lt;br /&gt;
| ERR_FIXED_TASK_PTR_BAD              || Tasks array pointer is NULL&lt;br /&gt;
|-&lt;br /&gt;
| ERR_JOB_COUNT_WRONG                 || Total job count inconsistent&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DYN_MUTEX_PTR_BAD               || Mutex dynamic pointer is NULL&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DYN_LOCK_PTR_BAD                || Mutex lock array pointer is NULL&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DYN_RWMUTEX_PTR_BAD             || Rwmutex dynamic pointer is NULL&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DYN_RWLOCK_PTR_BAD              || Rwmutex lock array pointer is NULL&lt;br /&gt;
|-&lt;br /&gt;
| ERR_FIXED_SEM_PTR_BAD               || Semaphore fixed pointer is NULL&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DYN_SEM_PTR_BAD                 || Semaphore dynamic pointer is NULL&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SEM_PEND_PTR_BAD                || Semaphore pending queue pointer is NULL&lt;br /&gt;
|-&lt;br /&gt;
| ERR_FIXED_DATAQ_PTR_BAD             || Dataq fixed pointer is NULL&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DYN_DATAQ_PTR_BAD               || Dataq dynamic pointer is NULL&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DATAQ_PEND_PTR_BAD              || Dataq pending queue pointer is NULL&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DATAQ_DATA_PTR_BAD              || Dataq data pointer is NULL&lt;br /&gt;
|-&lt;br /&gt;
| ERR_CPU_INT_NUMBER_INVALID          || SPARC only.IRQ number for CPU inter-comunication invalid(zero or used by timer)&lt;br /&gt;
|-&lt;br /&gt;
| ERR_REGISTER_CPU_IRQ_FAILED         || SPARC only. Failed to set CPU IRQ handler in BCC&lt;br /&gt;
|-&lt;br /&gt;
| ERR_CPU_STACK_INVALID               || Current CPU stack not within specified range&lt;br /&gt;
|-&lt;br /&gt;
| ERR_CPU_PRIORITY_STACK_INVALID      || Per CPU priority stack invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_LOG_AREA_END_SENTINEL_BAD       || Log area end sentinel override&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_CONFIG_PTR_BAD               || SPARC only; Timed action configuration data pointer is NULL&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_TIMER_INDEX_INVALID          || SPARC only; Timed action sub-timer index in timer unit is invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_IRQ_NUMBER_INVALID           || SPARC only; Timer action timer IRQ number is invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_BCC_IRQ_REGISTER_FAILED      || SPARC only; Timed action timer IRQ handler failed to register&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/* Sample Task names - all here start with t_ to help avoid name confusion */&lt;br /&gt;
enum TASK_NAME{&lt;br /&gt;
    t_tom,                      // will have task ID 0&lt;br /&gt;
    t_dick,                     // will have task ID 1&lt;br /&gt;
};&lt;br /&gt;
extern U32_t fixed_data[];&lt;br /&gt;
...&lt;br /&gt;
S32_t status;&lt;br /&gt;
&lt;br /&gt;
status = oceos_start(fixed_data, t_tom, NULL);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_exit()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''initialisation.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Ends scheduling and exit from [[OCEOSmp/directive_reference#oceos_start()|oceos_start()]].&lt;br /&gt;
No task can be started after this.&amp;lt;br&amp;gt;&lt;br /&gt;
OCEOS will exit when the current job ends.&amp;lt;br&amp;gt;&lt;br /&gt;
An idle task in an endless loop should check that scheduling is enabled.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Ends scheduling and exit from oceos_start.&lt;br /&gt;
 * No task can be started after this.&lt;br /&gt;
 * OCEOS will exit when the current job ends.&lt;br /&gt;
 * An idle task in an endless loop should check that scheduling is enabled.&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Called before scheduling started&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_exit(void);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
There are no input parameters to this function.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit  || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Called before scheduling started&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
// Exit OCEOS&lt;br /&gt;
oceos_exit();&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_CPU_sleep()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''initialisation.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
 Puts CPU in sleep mode.&amp;lt;br&amp;gt;&lt;br /&gt;
 User must to be sure that interrupts are enabled.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Puts CPU in sleep mode.&lt;br /&gt;
 * User must to be sure that interrupts are enabled.&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_CPU_sleep(void);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
There are no input parameters to this function.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
// Put CPU to sleep&lt;br /&gt;
oceos_CPU_sleep();&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceosmp_cpu_disable()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''initialisation.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function ends execution of all tasks running on particular CPU and removes the CPU from scheduling.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Ends execution of all tasks running on particular CPU and removes this CPU from scheduling.&lt;br /&gt;
 * @param cpu_id&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              CPU ID outside allowed range 0 to 254&lt;br /&gt;
 *          ERR_ID_WRONG                CPU ID &amp;gt;= number of available CPUs&lt;br /&gt;
 *          ERR_CPU_ALREADY_DISABLED    CPU already disabled&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceosmp_cpu_disable(&lt;br /&gt;
    U32_t cpu_id&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| cpu_id || ID of CPU core to be disabled.&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit  || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || CPU ID outside allowed range 0 to 254&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || CPU ID &amp;gt;= number of available CPUs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_CPU_ALREADY_DISABLED    || CPU already disabled&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, faulty_cpu;&lt;br /&gt;
...&lt;br /&gt;
// Disable faulty CPU core&lt;br /&gt;
status = oceosmp_cpu_disable(faulty_cpu));&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceosmp_cpu_enable()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''initialisation.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function adds a disabled CPU core to the OCEOSmp scheduler. It should only be called after scheduling has started&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 *  Adds disabled CPU to OCEOSmp scheduler&lt;br /&gt;
 *&lt;br /&gt;
 *  N.B. This function should only be called after scheduling has started&lt;br /&gt;
 *&lt;br /&gt;
 * @param cpu_id&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              CPU ID outside allowed range 0 to 254&lt;br /&gt;
 *          ERR_ID_WRONG                CPU ID &amp;gt;= number of available CPUs; or the same as currently running&lt;br /&gt;
 *          ERR_CPU_ALREADY_ENABLED     CPU already enabled&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceosmp_cpu_enable(&lt;br /&gt;
    U32_t cpu_id&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| cpu_id || ID of CPU core to be enabled.&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit  || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || CPU ID outside allowed range 0 to 254&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || CPU ID &amp;gt;= number of available CPUs; or the same as currently running&lt;br /&gt;
|-&lt;br /&gt;
| ERR_CPU_ALREADY_ENABLED     || CPU already enabled&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, good_cpu;&lt;br /&gt;
...&lt;br /&gt;
// Enable CPU core&lt;br /&gt;
status = oceosmp_cpu_enable(good_cpu));&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceosmp_cpu_terminate()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''initialisation.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function removes a CPU core from the OCEOSmp scheduler and marks it so it cannot be restarted. It puts CPU to sleep with interrupts disabled. It should only be called after scheduling has started.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 *  Removes CPU from OCEOSMP scheduler and terminates, cannot be restarted.&lt;br /&gt;
 *  Puts CPU to sleep with interrupts disabled&lt;br /&gt;
 *&lt;br /&gt;
 *  N.B. This function should only be called after scheduling has started&lt;br /&gt;
 *  Steps:&lt;br /&gt;
 *     1. Set terminate flag on this CPU;&lt;br /&gt;
 *     2. Trigger software interrupt to transfer execution to IRQ handler;&lt;br /&gt;
 *     3. Check flag and if set =&amp;gt; put CPU to sleep in while loop with interrupts disabled;&lt;br /&gt;
 *     4. Set MAX priority on this CPU priority stack;&lt;br /&gt;
 *     5. Remove CPU from scheduling;&lt;br /&gt;
 *     6. Clean up all the tasks by calling task terminate function and free up all the&lt;br /&gt;
 *        preempted jobs by this CPU;&lt;br /&gt;
 *&lt;br /&gt;
 * @param cpu_id&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              CPU ID outside allowed range 0 to 254&lt;br /&gt;
 *          ERR_ID_WRONG                CPU ID &amp;gt;= number of available CPUs; or the same as currently running&lt;br /&gt;
 *          ERR_CPU_ALREADY_TERMINATED  CPU already terminated&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceosmp_cpu_terminate(&lt;br /&gt;
    U32_t cpu_id&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| cpu_id || ID of CPU core to be terminated.&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit  || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || CPU ID outside allowed range 0 to 254&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || CPU ID &amp;gt;= number of available CPUs; or the same as currently running&lt;br /&gt;
|-&lt;br /&gt;
| ERR_CPU_ALREADY_TERMINATED  || CPU already terminated&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, faulty_cpu;&lt;br /&gt;
...&lt;br /&gt;
// Terminate CPU core&lt;br /&gt;
status = oceosmp_cpu_terminate(faulty_cpu));&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;Task directives&amp;lt;/span&amp;gt;==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ API Functions&lt;br /&gt;
|-&lt;br /&gt;
| Directive                                                                     || Description                          || main || task || IRQ handler&lt;br /&gt;
|-&lt;br /&gt;
| [[OCEOSmp/directive reference#oceos_task_create()| oceos_task_create()]]             || Create Task                        || *    ||      || &lt;br /&gt;
|-&lt;br /&gt;
| [[OCEOSmp/directive reference#oceos_task_start()| oceos_task_start()]]               || Start Task                         ||      ||  *   || *&lt;br /&gt;
|-&lt;br /&gt;
| [[OCEOSmp/directive reference#oceos_task_timed_start()| oceos_task_timed_start()]]   || Schedule a task to start execution at a given system time||      ||  *   || *&lt;br /&gt;
|-&lt;br /&gt;
| [[OCEOSmp/directive reference#oceos_task_disable()| oceos_task_disable()]]           || Disable Task                       ||      ||  *   || *&lt;br /&gt;
|-&lt;br /&gt;
| [[OCEOSmp/directive reference#oceos_task_enable()| oceos_task_enable()]]             || Enable Task                        ||      ||  *   || *&lt;br /&gt;
|-&lt;br /&gt;
| [[OCEOSmp/directive reference#oceos_task_self()| oceos_task_self()]]                 || Returns the task ID of the currently executing task ||    ||  *   || *&lt;br /&gt;
|-&lt;br /&gt;
| [[OCEOSmp/directive reference#oceos_task_get_priority()| oceos_task_get_priority()]] || Get priority of a task             ||      ||  *   || *&lt;br /&gt;
|-&lt;br /&gt;
| [[OCEOSmp/directive reference#oceos_task_get_status()| oceos_task_get_status()]]     || Get status of a task               ||      ||  *   || *&lt;br /&gt;
|-&lt;br /&gt;
| [[OCEOSmp/directive reference#oceos_task_kill()| oceos_task_kill()]]                 || Directive to terminate current task||      ||  *   || *&lt;br /&gt;
|-&lt;br /&gt;
| [[OCEOSmp/directive reference#oceos_task_get_info()| oceos_task_get_info()]]         || Get task information               ||      ||  *   || *&lt;br /&gt;
|-&lt;br /&gt;
| [[OCEOSmp/directive reference#oceosmp_task_kill()| oceosmp_task_kill()]]                 || Directive to terminate current task||      ||  *   || *&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;Task data structures&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''tasks.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The following data structures are used by some of the task directives.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Data structures'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * A pointer to this structure is passed to oceos_task_create().&lt;br /&gt;
 * The structure is first initialised according to a tasks's parameters,&lt;br /&gt;
 * and is not used again after the task is created and may then be discarded.&lt;br /&gt;
 */&lt;br /&gt;
struct task_descriptor {&lt;br /&gt;
&lt;br /&gt;
	void (*function_start)(void*);	// name of task start function&lt;br /&gt;
	void (*function_end)(void*);	// optional, NULL or task end function&lt;br /&gt;
&lt;br /&gt;
	U32_t task_id;					// 0 to 254, usually an enum&lt;br /&gt;
	U32_t task_jobs_max;			// 1 to 15, max concurrent 'jobs'&lt;br /&gt;
	U32_t task_priority;			// 1 (highest) to 254 (lowest)&lt;br /&gt;
	U32_t task_threshold;			// &amp;gt;=1, &amp;lt;= task_priority (higher or same priority)&lt;br /&gt;
	U32_t task_turned_on_initially;	// 0: disabled initially, else enabled&lt;br /&gt;
&lt;br /&gt;
	U32_t time_deadline_microsecs;	// start request to finish, 0 to ignore&lt;br /&gt;
	U32_t time_min_interval_microsecs;	// between start requests, 0 to ignore&lt;br /&gt;
&lt;br /&gt;
	U32_t uses_cpu_affinity;		// 0: not restricted, else core restricted&lt;br /&gt;
	U32_t uses_cpu_affinity_core_id;// core ID to which restricted if affinity used&lt;br /&gt;
}__attribute__ ((aligned (8)));&lt;br /&gt;
&lt;br /&gt;
/**&lt;br /&gt;
 * Task info used with oceos_task_get_info&lt;br /&gt;
 */&lt;br /&gt;
struct task_info {&lt;br /&gt;
  U64_t           time_max_delay;               // maximum time job is waiting on ready queue before becoming active&lt;br /&gt;
  U64_t           time_max_finish;              // maximum time to finish job execution after starting&lt;br /&gt;
  U64_t           time_max_exec;                // maximum time spent executing&lt;br /&gt;
  U64_t           time_total_exec;              // total CPU time used by this task&lt;br /&gt;
  U64_t           time_min_gap_starts;          // minimum time between job creations, can be reset&lt;br /&gt;
  U64_t           time_min_gap_finish_start;    // minimum time between job ending and new job creation, can be reset&lt;br /&gt;
&lt;br /&gt;
  U64_t           time_last_start;              // time of most recent job creation&lt;br /&gt;
  U64_t           time_last_finish;             // time of most recent job finish&lt;br /&gt;
&lt;br /&gt;
  unsigned int    jobs_current_max  :16;        // maximum number of current jobs for this task, no roll over, can be reset&lt;br /&gt;
  unsigned int    jobs_total        :16;        // number of times this task was started, no roll-over, can be reset&lt;br /&gt;
  U32_t           jobs_current;                 // Number of task instances currently in use by oceos&lt;br /&gt;
&lt;br /&gt;
  U32_t           preempt_max;                  // maximum times any job was pre-empted, no roll-over, can be reset&lt;br /&gt;
}__attribute__ ((aligned (8)));&lt;br /&gt;
&lt;br /&gt;
/* A task's status is returned as below if queried */&lt;br /&gt;
enum TASK_STATUS {&lt;br /&gt;
    TASK_DISABLED,      // cannot be scheduled, and no current jobs&lt;br /&gt;
    TASK_ENABLED,       // can be scheduled, but no current jobs&lt;br /&gt;
    TASK_INVALID,       // task does not exist&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_task_create()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''tasks.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Create a task.&lt;br /&gt;
Can only be use before OCEOS starts. Stores the task information in the OCEOS fixed data area.&lt;br /&gt;
This directive populates the data structures for a task. It should be called after [[OCEOSmp/directive_reference#oceos_init()|oceos_init()]] and before [[OCEOSmp/directive_reference#oceos_init_finish()|oceos_init_finish()]].&amp;lt;br&amp;gt;&lt;br /&gt;
It must be called for each task otherwise [[OCEOSmp/directive_reference#oceos_start()|oceos_start()]] will return an error.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Create a task using a task descriptor structure&lt;br /&gt;
 *&lt;br /&gt;
 * Can only be used in Initialisation Phase.&lt;br /&gt;
 *&lt;br /&gt;
 * A task has twelve constant parameters set when the task is created.&lt;br /&gt;
 * Rather than setting a list of these parameters the named fields of a&lt;br /&gt;
 * task_descriptor structure are set and a pointer to it passed here.&lt;br /&gt;
 *&lt;br /&gt;
 * The task_descriptor structure fields are described above.&lt;br /&gt;
 * Once the task has been created the structure can be discarded.&lt;br /&gt;
 *&lt;br /&gt;
 * To create a task:&lt;br /&gt;
 *		set up a task_descriptor structure,&lt;br /&gt;
 *		set its fields to the parameter values for the task,&lt;br /&gt;
 *		pass a pointer to the structure to this directive.&lt;br /&gt;
 *&lt;br /&gt;
 * The structure is checked for validity by oceos_task_create and its&lt;br /&gt;
 * information used to set the task details in the OCEOS fixed data area.&lt;br /&gt;
 *&lt;br /&gt;
 * @param  struct task_descriptor *	fields give task characteristics&lt;br /&gt;
 *&lt;br /&gt;
 * @return OCEOS_SUCCESS            No errors or warnings&lt;br /&gt;
 *         WARN_NO_END_FUNCTION     Warning, no end task function specified&lt;br /&gt;
 *&lt;br /&gt;
 *         ERR_SYS_FIXED_CORRUPT    System Fixed area corrupt&lt;br /&gt;
 *         ERR_WRONG_CPU_CORE       Executing directive on wrong CPU&lt;br /&gt;
 *         ERR_WRONG_PHASE          Called before oceos_init() is done&lt;br /&gt;
 *         ERR_TOO_MANY             MAX number of tasks already created&lt;br /&gt;
 *         ERR_ID_INVALID           Task ID outside allowed range 0 to 254&lt;br /&gt;
 *         ERR_ID_WRONG             Task ID outside &amp;gt;= number of tasks&lt;br /&gt;
 *         ERR_T_ALREADY_ALLOCATED  Task ID already in use&lt;br /&gt;
 *         ERR_T_PRIORITY_INVALID   Task priority outside allowed range 1 to 254&lt;br /&gt;
 *         ERR_THRESHOLD_INVALID    Task threshold outside range 1 to 254&lt;br /&gt;
 *         ERR_THRESHOLD_WRONG      Task threshold  higher priority than task priority&lt;br /&gt;
 *         ERR_JOBS_MAX_INVALID     Job number outside range 1 to 15&lt;br /&gt;
 *         ERR_JOBS_TOO_MANY        System capacity exceeded&lt;br /&gt;
 *         ERR_AFFINITY_WRONG       CPU core specified is outside chosen range&lt;br /&gt;
 *         ERR_START_FUNCTION_BAD   Task start function address either NULL or misaligned&lt;br /&gt;
 */&lt;br /&gt;
S32_t   oceos_task_create(&lt;br /&gt;
    const struct task_descriptor * const task_description_ptr&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter           || Description&lt;br /&gt;
|-&lt;br /&gt;
|struct task_descriptor * || Pointer to task descriptor which contains task attributes&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit     || Description&lt;br /&gt;
|-&lt;br /&gt;
|WARN_NO_END_FUNCTION     || Warning, no end task function specified&lt;br /&gt;
|-&lt;br /&gt;
|ERR_SYS_FIXED_CORRUPT    || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
|ERR_WRONG_CPU_CORE       || Executing directive on wrong CPU&lt;br /&gt;
|-&lt;br /&gt;
|ERR_WRONG_PHASE          || Called before oceos_init() is done&lt;br /&gt;
|-&lt;br /&gt;
|ERR_TOO_MANY             || MAX number of tasks already created&lt;br /&gt;
|-&lt;br /&gt;
|ERR_ID_INVALID           || Task ID outside allowed range 0 to 254&lt;br /&gt;
|-&lt;br /&gt;
|ERR_ID_WRONG             || Task ID outside &amp;gt;= number of tasks&lt;br /&gt;
|-&lt;br /&gt;
|ERR_T_ALREADY_ALLOCATED  || Task ID already in use&lt;br /&gt;
|-&lt;br /&gt;
|ERR_T_PRIORITY_INVALID   || Task priority outside allowed range 1 to 254&lt;br /&gt;
|-&lt;br /&gt;
|ERR_THRESHOLD_INVALID    || Task threshold outside range 1 to 254&lt;br /&gt;
|-&lt;br /&gt;
|ERR_THRESHOLD_WRONG      || Task threshold  higher priority than task priority&lt;br /&gt;
|-&lt;br /&gt;
|ERR_JOBS_MAX_INVALID     || Job number outside range 1 to 15&lt;br /&gt;
|-&lt;br /&gt;
|ERR_JOBS_TOO_MANY        || System capacity exceeded&lt;br /&gt;
|-&lt;br /&gt;
|ERR_AFFINITY_WRONG       || CPU core specified is outside chosen range&lt;br /&gt;
|-&lt;br /&gt;
|ERR_START_FUNCTION_BAD   || Task start function address either NULL or misaligned&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
/* Sample Task names - all here start with t_ to help avoid name confusion */&lt;br /&gt;
enum TASK_NAME{&lt;br /&gt;
      t_0,&lt;br /&gt;
      t_1,&lt;br /&gt;
      t_2&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
/*&lt;br /&gt;
 * APPLICATION FUNCTION DECLARATIONS&lt;br /&gt;
 */&lt;br /&gt;
void fun0(void *);&lt;br /&gt;
void fun1(void *);&lt;br /&gt;
void fun2(void *);&lt;br /&gt;
void end_function(void *);&lt;br /&gt;
&lt;br /&gt;
const struct task_descriptor tasks_data[NUMBER_OF_TASKS] = {&lt;br /&gt;
    {fun0, end_function, t_0, 2, 10, 8, TASK_ENABLED, 0, 0, 0, 0},&lt;br /&gt;
    {fun1, end_function, t_1, 2, 10, 8, TASK_ENABLED, 0, 0, 0, 0},&lt;br /&gt;
    {fun2, end_function, t_2, 2, 10, 8, TASK_ENABLED, 0, 0, 0, 0}&lt;br /&gt;
}; &lt;br /&gt;
&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
    // create tasks (names are defined in the application header)&lt;br /&gt;
    for (i=0; i&amp;lt;NUMBER_OF_TASKS; i++){&lt;br /&gt;
        if ( oceos_task_create(&amp;amp;tasks_data[i]) != OCEOS_SUCCESS ){&lt;br /&gt;
        	oceosmp_print(&amp;quot;\nFailed to create task\n\r&amp;quot;);&lt;br /&gt;
        	return -i;&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_task_start()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''tasks.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function starts an instance of a task. An instance of a task is called a job in OCEOS terminology.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 *  Starting a task involves three main stages&lt;br /&gt;
 *      1 setting up a job&lt;br /&gt;
 *          finding a free job entry if available&lt;br /&gt;
 *          setting up this entry including passing it the data void *&lt;br /&gt;
 *&lt;br /&gt;
 *      2 placing the job on readyQ&lt;br /&gt;
 *&lt;br /&gt;
 *      3 doing a context switch&lt;br /&gt;
 * This function should only be called after OCEOS is initialised&lt;br /&gt;
 *       and the dynamic task and job structures set up&lt;br /&gt;
 *&lt;br /&gt;
 *  When used from an interrupt handler,&lt;br /&gt;
 *  the context switch is only done&lt;br /&gt;
 *  after all nested interrupts have unwound&lt;br /&gt;
 *&lt;br /&gt;
 * @param task_id Task ID must be in range 0 to 254&lt;br /&gt;
 * @param ptr     Pointer to task data&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT    System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT      System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE          Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID           Task ID is invalid&lt;br /&gt;
 *          ERR_ID_WRONG             Task ID is wrong&lt;br /&gt;
 *          ERR_START_TASK_DISABLED  Starting task is disabled&lt;br /&gt;
 *          ERR_TOO_MANY             There is no free job&lt;br /&gt;
 *          ERR_SYS_BUSY             Failed to grab the lock&lt;br /&gt;
 */&lt;br /&gt;
S32_t   oceos_task_start(&lt;br /&gt;
    const U32_t task_id, // task ID, must be in range 0 to 254&lt;br /&gt;
    void * const ptr    // pointer to data&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| task_id || U32_t with Task ID in range 0 to 254.&lt;br /&gt;
|-&lt;br /&gt;
| ptr    || void * pointer to task data&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit  || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT    || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT      || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE          || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID           || Task ID is invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG             || Task ID is wrong&lt;br /&gt;
|-&lt;br /&gt;
| ERR_START_TASK_DISABLED  || Starting task is disabled&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TOO_MANY             || There is no free job&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY             || Failed to grab the lock&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
void *ptr;&lt;br /&gt;
...&lt;br /&gt;
// Start instance of task T_1 passing pointer ptr&lt;br /&gt;
status = oceos_task_start(t_1,ptr);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_task_timed_start()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''tasks.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function schedules a task to start execution at a given system time.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 *  Schedule a task to start execution at a given system time&lt;br /&gt;
 *&lt;br /&gt;
 *  The before and after offsets define a window around the selected time&lt;br /&gt;
 *  in which the task may be started.&lt;br /&gt;
 *&lt;br /&gt;
 *  If the current system time is before the start window a job is created&lt;br /&gt;
 *  and a corresponding action put on the timed action queue.&lt;br /&gt;
 *&lt;br /&gt;
 *  If the current system time is within the time window for starting the task,&lt;br /&gt;
 *  it is started immediately.&lt;br /&gt;
 *&lt;br /&gt;
 *  If the current system time is after the window, an error is reported.&lt;br /&gt;
 *&lt;br /&gt;
 *  Times are in microseconds.&lt;br /&gt;
 *&lt;br /&gt;
 *  This function should only be called after OCEOS is initialised&lt;br /&gt;
 *  and the dynamic task and job structures set up&lt;br /&gt;
 *&lt;br /&gt;
 * @param taskID        Task ID must be in range 0 to 254&lt;br /&gt;
 * @param ptr           Pointer to data&lt;br /&gt;
 * @param start_time    System time at which job should start&lt;br /&gt;
 * @param before        Forward tolerance for time&lt;br /&gt;
 * @param after         Backward tolerance for time&lt;br /&gt;
 * @param return_job_id Return job_id to the user, to remove this job from timed action if needed&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              Task ID invalid&lt;br /&gt;
 *          ERR_ID_WRONG                Task ID is wrong&lt;br /&gt;
 *          ERR_TA_NOT_INIT             Timed action inialisation is not done and tried to be used&lt;br /&gt;
 *          ERR_START_TASK_DISABLED     Starting task is disabled&lt;br /&gt;
 *          ERR_TOO_MANY                There is no free job&lt;br /&gt;
 *          ERR_TOO_LATE                Starting task is too late(out of time frame)&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to grab the lock&lt;br /&gt;
 *          ERR_TA_Q_FULL               Timed action queue is full&lt;br /&gt;
 *          ERR_TA_START_FAILED         Timed action execute failed; See log&lt;br /&gt;
 */&lt;br /&gt;
S32_t   oceos_task_timed_start(&lt;br /&gt;
    const U32_t task_id,     // task ID, must be in range 0 to 254&lt;br /&gt;
    void * const ptr,        // pointer to data&lt;br /&gt;
    const U64_t start_time,  // system time at which job should start&lt;br /&gt;
    const U32_t before,      // forward tolerance for time&lt;br /&gt;
    const U32_t after,       // backward tolerance for time&lt;br /&gt;
    U32_t * return_job_id    // return job_id to the user, to remove this job from timed action if needed&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| taskID        || U32_t task ID must be in range 0 to 254&lt;br /&gt;
|-&lt;br /&gt;
| ptr           || void * pointer to data&lt;br /&gt;
|-&lt;br /&gt;
| start_time    || U64_t system time at which job should start&lt;br /&gt;
|-&lt;br /&gt;
| before        || U32_t forward tolerance for time&lt;br /&gt;
|-&lt;br /&gt;
| after         || U32_t backward tolerance for time&lt;br /&gt;
|-&lt;br /&gt;
| return_job_id || U32_t return job_id to the user, to remove this job from timed action if needed&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit  || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || Task ID invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || Task ID is wrong&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_NOT_INIT             || Timed action inialisation is not done and tried to be used&lt;br /&gt;
|-&lt;br /&gt;
| ERR_START_TASK_DISABLED     || Starting task is disabled&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TOO_MANY                || There is no free job&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TOO_LATE                || Starting task is too late(out of time frame)&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to grab the lock&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_Q_FULL               || Timed action queue is full&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_START_FAILED         || Timed action execute failed; See log&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
U32_t job_id;&lt;br /&gt;
U64_t cur_sys_time;&lt;br /&gt;
...&lt;br /&gt;
  cur_sys_time = oceos_time_sys_get64();&lt;br /&gt;
&lt;br /&gt;
  // Start task 10,000 microseconds (us) from now and advise if started more than 1,000 us before or 2,000 us after.&lt;br /&gt;
  status = oceos_task_timed_start(t_2, ptr, cur_sys_time + 10000, 1000, 2000, &amp;amp;job_id);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_task_disable()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''initialisation.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function disables a task and removes any current pending jobs from the readyQ.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 *  Disable a task and remove any current pending jobs on readyQ.&lt;br /&gt;
 *&lt;br /&gt;
 *  A disabled task's jobs  will not be put into execution nor put on readyQ.&lt;br /&gt;
 *&lt;br /&gt;
 *  Note that where execution of a task has already commenced,&lt;br /&gt;
 *  disabling the task will not prevent it from completing.&lt;br /&gt;
 *&lt;br /&gt;
 *  This function should only be called after OCEOS is initialised&lt;br /&gt;
 *  and the dynamic task and job structures set up&lt;br /&gt;
 *&lt;br /&gt;
 * @param taskID  Task ID must be in range 0 to 254&lt;br /&gt;
 * @return: OCEOS_SUCCESS&lt;br /&gt;
 *          WARN_ALREADY_DISABLED        Task already disabled&lt;br /&gt;
 *          WARN_SEM_PEND_REMOVE_FAILED  Failed to remove job from semaphore pending queue&lt;br /&gt;
 *          WARN_DQ_PEND_REMOVE_FAILED   Failed to remove job from dataq pending queue&lt;br /&gt;
 *&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT        System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT          System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE              Directive was called before OCEOS init is finished&lt;br /&gt;
 *          ERR_ID_INVALID               Task ID is invalid&lt;br /&gt;
 *          ERR_ID_WRONG                 Task ID is wrong&lt;br /&gt;
 *          ERR_SYS_BUSY                 Failed to grab the lock&lt;br /&gt;
 */&lt;br /&gt;
S32_t   oceos_task_disable(&lt;br /&gt;
    const U32_t task_id // task ID, must be in range 0 to 254&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| taskID || U32_t task ID must be in range 0 to 254&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit  || Description&lt;br /&gt;
|-&lt;br /&gt;
| WARN_ALREADY_DISABLED        || Task already disabled&lt;br /&gt;
|-&lt;br /&gt;
| WARN_SEM_PEND_REMOVE_FAILED  || Failed to remove job from semaphore pending queue&lt;br /&gt;
|-&lt;br /&gt;
| WARN_DQ_PEND_REMOVE_FAILED   || Failed to remove job from dataq pending queue&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT        || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT          || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE              || Directive was called before OCEOS init is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID               || Task ID is invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                 || Task ID is wrong&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                 || Failed to grab the lock&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Disable task t_1&lt;br /&gt;
status = oceos_task_disable(t_1);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_task_enable()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''tasks.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function enables a task. Only enabled tasks may be started.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 *  Enable a task - only enabled tasks are placed on readyQ or started.&lt;br /&gt;
 *&lt;br /&gt;
 *  This function should only be called after OCEOS is initialised&lt;br /&gt;
 *  and the dynamic task and job structures set up&lt;br /&gt;
 *&lt;br /&gt;
 * @param taskID   Task ID must be in range 0 to 254&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          WARN_ALREADY_ENABLED     Task already enabled&lt;br /&gt;
 *&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT    System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT      System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE          Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID           Task ID is invalid&lt;br /&gt;
 *          ERR_ID_WRONG             Task ID is wrong&lt;br /&gt;
 *          ERR_SYS_BUSY             Failed to grab the lock&lt;br /&gt;
 */&lt;br /&gt;
S32_t   oceos_task_enable(&lt;br /&gt;
    const U32_t task_id // task ID, must be in range 0 to 254&lt;br /&gt;
);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| taskID  || U32_t task ID must be in range 0 to 254&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit  || Description&lt;br /&gt;
|-&lt;br /&gt;
| WARN_ALREADY_ENABLED     || Task already enabled&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT    || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT      || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE          || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID           || Task ID is invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG             || Task ID is wrong&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY             || Failed to grab the lock&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Enable task t_2&lt;br /&gt;
status = oceos_task_enable(t_2);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_task_self()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''tasks.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the task number of the currently running task on the calling CPU.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Get currently running task on calling CPU&lt;br /&gt;
 *&lt;br /&gt;
 * @param t_id  Task ID holder&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT        System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT          System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE              Directive was called before OCEOS init is finished&lt;br /&gt;
 *          ERR_CPU_DYN_PTR_BAD          CPU dynamic area pointer corrupt&lt;br /&gt;
 */&lt;br /&gt;
S32_t  oceos_task_self(&lt;br /&gt;
    U32_t *t_id&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| t_id || S32_t * pointer to variable where task ID will be written.&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit  || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT        || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT          || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE              || Directive was called before OCEOS init is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_CPU_DYN_PTR_BAD          || CPU dynamic area pointer corrupt&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, task_running;&lt;br /&gt;
...&lt;br /&gt;
// Return task ID that's running on this core&lt;br /&gt;
status = oceos_task_self(&amp;amp;task_running);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_task_get_priority()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''tasks.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the priority of the task ID passed to it.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Get priority of the task&lt;br /&gt;
 *&lt;br /&gt;
 * @param taskID        ID of task, must be in range 0 to 254&lt;br /&gt;
 * @param t_priority    Pointer to task priority holder&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT        System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT          System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE              Directive was called before OCEOS init is finished&lt;br /&gt;
 *          ERR_ID_INVALID               Task ID is invalid&lt;br /&gt;
 *          ERR_ID_WRONG                 Task ID is wrong&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_task_get_priority(&lt;br /&gt;
    const U32_t task_id, // task ID, must be in range 0 to 254&lt;br /&gt;
    U32_t *t_priority   // Pointer to task priority holder&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| task_id || S32_t task ID of task whose priority is required&lt;br /&gt;
|-&lt;br /&gt;
| t_priority || S32_t * pointer to variable where priority will be written&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit  || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT        || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT          || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE              || Directive was called before OCEOS init is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID               || Task ID is invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                 || Task ID is wrong&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
U32_t t_priority;&lt;br /&gt;
...&lt;br /&gt;
// Return the priority of task ID t_4 &lt;br /&gt;
status = oceos_task_get_priority(t_4, &amp;amp;t_priority);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_task_get_status()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''tasks.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the status of the task ID passed to it.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Get status of the task;&lt;br /&gt;
 * if OK t_status holds enum TASK_STATUS&lt;br /&gt;
 *&lt;br /&gt;
 * @param taskID    ID of task, must be in range 0 to 254&lt;br /&gt;
 * @param t_status  enum TASK_STATUS holder&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT        System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT          System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE              Directive was called before OCEOS init is finished&lt;br /&gt;
 *          ERR_ID_INVALID               Task ID is invalid&lt;br /&gt;
 *          ERR_ID_WRONG                 Task ID is wrong&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_task_get_status(&lt;br /&gt;
    const U32_t task_id,&lt;br /&gt;
    U32_t *t_status&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| task_id || S32_t task ID of task whose priority is required&lt;br /&gt;
|-&lt;br /&gt;
| t_status || S32_t * pointer to variable where status will be written&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit  || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT        || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT          || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE              || Directive was called before OCEOS init is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID               || Task ID is invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                 || Task ID is wrong&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
U32_t t_status;&lt;br /&gt;
...&lt;br /&gt;
// Return the status of task ID t_4 &lt;br /&gt;
status = oceos_task_get_status(t_4, &amp;amp;t_status);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_task_get_info()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''tasks.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the task information for the specified task.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Get task information for task with ID.&lt;br /&gt;
 *&lt;br /&gt;
 * User must pass pointer to struct task_info in order to retrieve data.&lt;br /&gt;
 *&lt;br /&gt;
 * @param task_id  Task ID&lt;br /&gt;
 * @param info     Pointer to struct task_info&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT    System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT      System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE          Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID           Task ID invalid&lt;br /&gt;
 *          ERR_ID_WRONG             Task ID wrong&lt;br /&gt;
 *          ERR_TASK_INFO_PTR_BAD    Task info pointer provided by user is NULL&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_task_get_info (&lt;br /&gt;
    const U32_t task_id,   // Task ID&lt;br /&gt;
    struct task_info *info // Pointer to struct task_info&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| task_id || ID of task for which information is required&lt;br /&gt;
|-&lt;br /&gt;
| task_info || struct task_info * pointer to the structure where task information is to be written&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit  || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT    || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT      || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE          || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID           || Task ID invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG             || Task ID wrong&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TASK_INFO_PTR_BAD    || Task info pointer provided by user is NULL&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
struct task_info info;&lt;br /&gt;
...&lt;br /&gt;
// Get information for task T3&lt;br /&gt;
status = oceos_task_get_info(t_3, &amp;amp;info);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceosmp_task_kill()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''tasks.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function kills the specified task running on the specified CPU.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 *  Function to kill currently running task on CPU;&lt;br /&gt;
 *  Can be used:&lt;br /&gt;
 *      From Mode_SVC  =&amp;gt; normal running mode for application&lt;br /&gt;
 *          If nesting level is zero and Mode_SVC&lt;br /&gt;
 *      From Mode_IRQ  =&amp;gt; from IRQ handler&lt;br /&gt;
 *          If nesting level is not zero, set flag to call this function within IRQ handler&lt;br /&gt;
 *      From Exception =&amp;gt; Mode_ABT and Mode_UND&lt;br /&gt;
 *          If nesting level is zero and NOT Mode_SVC, it is exception;&lt;br /&gt;
 *              Disable IRQs on current CPU;&lt;br /&gt;
 *              Set kill current task flag to TRUE;&lt;br /&gt;
 *              Issue SGI on current CPU, will be interrupted on return from Exception and&lt;br /&gt;
 *              this function will be called within IRQ handler&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT    System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT      System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE          Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_CPU_DYN_PTR_BAD      CPU dynamic area pointer corrupt&lt;br /&gt;
 *          ERR_ID_INVALID           Task ID invalid&lt;br /&gt;
 *          ERR_ID_WRONG             Task ID wrong&lt;br /&gt;
 *          ERR_CPU_ID_WRONG         CPU ID wrong&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceosmp_task_kill(&lt;br /&gt;
    U32_t task_id,&lt;br /&gt;
    U32_t cpu_id&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| task_id  || U32_t task ID to be killed (must be in range 0 to 254)&lt;br /&gt;
|-&lt;br /&gt;
| cpu_id  || U32_t CPU ID where task_id is to be killed&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT    || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT      || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE          || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_CPU_DYN_PTR_BAD      || CPU dynamic area pointer corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID           || Task ID invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG             || Task ID wrong&lt;br /&gt;
|-&lt;br /&gt;
| ERR_CPU_ID_WRONG         || CPU ID wrong&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Kill task t_2 on CPU cpu_1&lt;br /&gt;
status = oceosmp_task_kill(t_2, cpu_1);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;Mutex directives&amp;lt;/span&amp;gt;==&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_mutex_create()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''mutex.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function creates a mutex of specified ID with a specified priority ceiling.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Creates a mutex with priority ceiling&lt;br /&gt;
 *&lt;br /&gt;
 * NOTE: This function should only be called after OCEOSmp is initialised with&lt;br /&gt;
 *  oceos_init() and before initialisation ends with oceos_init_finish()&lt;br /&gt;
 *  and scheduling starts with oceos_start()&lt;br /&gt;
 *&lt;br /&gt;
 * @param mutex_id  mutex ID value 0 to 62&lt;br /&gt;
 * @param priority  mutex priority ceiling 1 to 254 (high to low task priority)&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_WRONG_CPU_CORE          Executing directive on wrong CPU&lt;br /&gt;
 *          ERR_WRONG_PHASE             Called before oceos_init() is done&lt;br /&gt;
 *          ERR_TOO_MANY                MAX number of MUTEXs already created&lt;br /&gt;
 *          ERR_ID_INVALID              MUTEX ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                MUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
 *          ERR_MX_ALREADY_ALLOCATED    MUTEX ID already used&lt;br /&gt;
 *          ERR_MX_PRIORITY_WRONG       MUTEX priority ceiling outside allowed range 1 to 254&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_mutex_create(&lt;br /&gt;
    const U32_t mutex_id,  // mutex ID, must be in range 0 to 62&lt;br /&gt;
    const U8_t  priority  // mutex priority ceiling&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| mutex_id  || u32_t mutex ID to be created (value 0 to 62).&lt;br /&gt;
|-&lt;br /&gt;
| priority_ceiling ||  U32_t mutex priority ceiling 1 to 254 (high to low task priority)&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_CPU_CORE          || Executing directive on wrong CPU&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Called before oceos_init() is done&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TOO_MANY                || MAX number of MUTEXs already created&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || MUTEX ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || MUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_MX_ALREADY_ALLOCATED    || MUTEX ID already used&lt;br /&gt;
|-&lt;br /&gt;
| ERR_MX_PRIORITY_WRONG       || MUTEX priority ceiling outside allowed range 1 to 254&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Create mutex with ID print_mutex and priority ceiling of 5&lt;br /&gt;
status = oceos_mutex_create(print_mutex, 5);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_mutex_wait()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''mutex.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function makes the task wait until the specified mutex is available.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
 /*&lt;br /&gt;
  * Wait on mutex with ID.&lt;br /&gt;
  * If task succeeds in grabbing mutex, system level priority rises to&lt;br /&gt;
  * priority of this mutex, so tasks with lower or equal priority will&lt;br /&gt;
  * not be able to start till mutex is released.&lt;br /&gt;
  *&lt;br /&gt;
  * This should only be called after OCEOSmp scheduling has started.&lt;br /&gt;
  *&lt;br /&gt;
  * @param mutex_id     const U32_t  : value 0 to 62&lt;br /&gt;
  *&lt;br /&gt;
  * @return  OCEOS_SUCCESS&lt;br /&gt;
  *          WARN_MX_INCORRECT_ORDER     MUTEX acquired in incorrect order&lt;br /&gt;
  *&lt;br /&gt;
  *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
  *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
  *          ERR_WRONG_PHASE             Directive was called before OCEOSmp initialisation is finished&lt;br /&gt;
  *          ERR_ID_INVALID              MUTEX ID outside allowed range 0 to 62&lt;br /&gt;
  *           ERR_ID_WRONG                MUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
  *          ERR_MX_CEILING_BAD          MUTEX ceiling not lower priority than job priority&lt;br /&gt;
  *          ERR_MX_ALREADY_HELD         MUTEX already held by this job&lt;br /&gt;
  *          ERR_SYS_BUSY                Failed to grab context switch guard&lt;br /&gt;
  */&lt;br /&gt;
S32_t oceos_mutex_wait(&lt;br /&gt;
    const U32_t  mutex_id      // mutex ID, must be in range 0 to 62&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| mutex_id  || u32_t mutex ID to be waited on (value 0 to 62).&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| WARN_MX_INCORRECT_ORDER     || MUTEX acquired in incorrect order&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOSmp initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || MUTEX ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || MUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_MX_CEILING_BAD          || MUTEX ceiling not lower priority than job priority&lt;br /&gt;
|-&lt;br /&gt;
| ERR_MX_ALREADY_HELD         || MUTEX already held by this job&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to grab context switch guard&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Wait on mutex m_2&lt;br /&gt;
status = oceos_mutex_wait(m_2);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_mutex_signal()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''mutex.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function signals the specified mutex.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Signal a mutex with ID&lt;br /&gt;
 *&lt;br /&gt;
 * N.B. :&lt;br /&gt;
 *      This function should not be called from an interrupt handler&lt;br /&gt;
 *      This should only be called after OCEOSmp scheduling has started.&lt;br /&gt;
 *&lt;br /&gt;
 * @param mutex_id     const U32_t  : value 0 to 62&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          WARN_MX_ALREADY_FREE        MUTEX is free already&lt;br /&gt;
 *          WARN_MX_NESTING_BAD         MUTEX nesting incorrect&lt;br /&gt;
 *&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOSmp initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              MUTEX ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                MUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
 *          ERR_MX_WRONG_JOB            MUTEX not held by this job&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to grab context switch guard&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_mutex_signal(&lt;br /&gt;
    const U32_t  mutex_id     // mutex ID, must be in range 0 to 62&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| mutex_id  || u32_t mutex ID to be signalled (value 0 to 62).&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| WARN_MX_ALREADY_FREE        || MUTEX is free already&lt;br /&gt;
|-&lt;br /&gt;
| WARN_MX_NESTING_BAD         || MUTEX nesting incorrect&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOSmp initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || MUTEX ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || MUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_MX_WRONG_JOB            || MUTEX not held by this job&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to grab context switch guard&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Signal mutex m_2&lt;br /&gt;
status = oceos_mutex_signal(m_2);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_mutex_get_value()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''mutex.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the value of the specified mutex.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Get current value of mutex with ID&lt;br /&gt;
 *&lt;br /&gt;
 * @param mutex_id      const U32_t  : value 0 to 62&lt;br /&gt;
 * @param m_value       pointer to MUTEX value holder&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOSmp initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              MUTEX ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                MUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
 *          ERR_MX_DATA_PTR_BAD         Pointer to MUTEX value return holder is null&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_mutex_get_value(&lt;br /&gt;
    const U32_t  mutex_id,      // mutex ID, must be in range 0 to 62&lt;br /&gt;
    U32_t *m_value              // Pointer to MUTEX value holder&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| mutex_id  || u32_t mutex ID to be signalled (value 0 to 62)&lt;br /&gt;
|-&lt;br /&gt;
| m_value  || u32_t * pointer where mutex value is to be written&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOSmp initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || MUTEX ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || MUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_MX_DATA_PTR_BAD         || Pointer to MUTEX value return holder is null&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
U32_t value;&lt;br /&gt;
...&lt;br /&gt;
// Get value of mutex m_2&lt;br /&gt;
status = oceos_mutex_get_value(m_2, &amp;amp;value);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;Read/write mutex directives&amp;lt;/span&amp;gt;==&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;Read/write mutex overview&amp;lt;/span&amp;gt;===&lt;br /&gt;
&lt;br /&gt;
Contents:&lt;br /&gt;
&lt;br /&gt;
 1.  Read/Write Mutex features&lt;br /&gt;
 2.  Read/Write Mutex data structures&lt;br /&gt;
 3.  Read/Write Mutex constants&lt;br /&gt;
 4.  Read/Write Mutex manager Directives&lt;br /&gt;
&lt;br /&gt;
==== Read/Write Mutex Features ====&lt;br /&gt;
&lt;br /&gt;
Read/Write Mutexes (rwmutexes) can be held for 'read' at the same time&lt;br /&gt;
by multiple jobs on different CPUs, but once held for 'write' by any job&lt;br /&gt;
cannot be obtained for 'read' or for 'write' by another job until released.&lt;br /&gt;
&lt;br /&gt;
They can be used to allow data be read simultaneously by multiple jobs when&lt;br /&gt;
the data is not being updated while ensuring that no updating can take&lt;br /&gt;
place while any job is reading the data.&lt;br /&gt;
&lt;br /&gt;
Pending write requests take precedence over pending read requests and are&lt;br /&gt;
done on a first come, first served basis. Once any job on a CPU has a&lt;br /&gt;
rwmutex for 'read' no other job on that CPU can acquire it so as to avoid&lt;br /&gt;
potential problems and minimise delays in servicing write requests by other&lt;br /&gt;
CPUs.&lt;br /&gt;
&lt;br /&gt;
While any job holds a rwmutex for reading any job on another CPU can also&lt;br /&gt;
acquire it for reading. Other jobs on the same CPU that may attempt to&lt;br /&gt;
acquire the rwmutex are delayed in starting until return of the rwmutex.&lt;br /&gt;
No job can acquire the rwmutex for writing until all read acquisitions&lt;br /&gt;
have been returned.&lt;br /&gt;
&lt;br /&gt;
No job will acquire a rwmutex for reading if any job is trying to acquire&lt;br /&gt;
it for writing, giving write precedence over read. Multiple write requests&lt;br /&gt;
waiting for existing read acquisitions to complete are serviced in the&lt;br /&gt;
order in which they were made when the current read acquisitions complete.&lt;br /&gt;
&lt;br /&gt;
If a task waits on a rwmutex that it already holds a system log entry is&lt;br /&gt;
made (LOG_RWMUTEX_ALREADY_HELD) and an INTERNAL_ERROR status code returned.&lt;br /&gt;
&lt;br /&gt;
If a task attempts to release a rwmutex it does not hold a system log entry&lt;br /&gt;
is made (LOG_RWMUTEX_ALREADY_FREE) and an INTERNAL_ERROR status code returned.&lt;br /&gt;
&lt;br /&gt;
If a job holds more than one rwmutex at the same time these must be&lt;br /&gt;
acquired and released in a nested manner&lt;br /&gt;
(e.g. wait 1, wait 2, wait 3, signal 3, signal 2, signal 1).&lt;br /&gt;
&lt;br /&gt;
If a task exits while holding one or more rwmutexes these are returned and&lt;br /&gt;
a system log entry made (LOG_RWMUTEX_NOT_RETURNED).&lt;br /&gt;
&lt;br /&gt;
==== Read/Write Mutex data structures ====&lt;br /&gt;
&lt;br /&gt;
In OCEOSmp each rwmutex has a priority ceiling, the priority of the highest&lt;br /&gt;
priority task that acquires the rwmutex for read or for write.&lt;br /&gt;
OCEOSmp uses this to ensure that once a job on a particular CPU has the&lt;br /&gt;
rwmutex for reading or for writing no other job on that CPU can be started&lt;br /&gt;
that might try to obtain that rwmutex.&lt;br /&gt;
&lt;br /&gt;
The priority ceiling of a rwmutex is specified when the rwmutex is created&lt;br /&gt;
and does not change subsequently. Priority ceilings are stored in the&lt;br /&gt;
fixed data area as an array U8_t rwmutexCeilings[] indexed by mutex ID.&lt;br /&gt;
This array is extended to be a whole number of 32-bit words.&lt;br /&gt;
&lt;br /&gt;
A rwmutex has a unique rwmutex ID, an unsigned integer usually defined in&lt;br /&gt;
the application header file as an enum RWMUTEX_NAME{} thus allowing a&lt;br /&gt;
user-friendly name be associated with each rwmutex ID.&lt;br /&gt;
&lt;br /&gt;
Using an enum is strongly recommended as it allows a user-friendly name be&lt;br /&gt;
associated with each ID, and helps ensure IDs are contiguous from 0.&lt;br /&gt;
&lt;br /&gt;
These rwmutex IDs are used as indices into both fixed and dynamic data&lt;br /&gt;
arrays and must cover the range 0 to ((number of rwmutexes) -1). Using&lt;br /&gt;
enum RWMUTEX_NAME{} automatically assigns names to IDs 0, 1, 2...&lt;br /&gt;
&lt;br /&gt;
Read write mutex dynamic data such as the current write requests and&lt;br /&gt;
current read count are stored in the dynamic data area in an array of&lt;br /&gt;
struct rwmutex_dyn_block also indexed by the rwmutex ID.&lt;br /&gt;
&lt;br /&gt;
A further dynamic area array of guard_t is used in providing mutual&lt;br /&gt;
exclusion when updating the rwmutex dynamic data.&lt;br /&gt;
&lt;br /&gt;
==== Read/Write Mutex constants ====&lt;br /&gt;
&lt;br /&gt;
In OCEOSmp there can be a maximum of 63 rwmutexes,&lt;br /&gt;
with IDs from 0 to 62 (the value 63 is used as an invalid ID).&lt;br /&gt;
&lt;br /&gt;
The rwmutexes can be created in any order, but OCEOSmp will return an error&lt;br /&gt;
and fail to start if the resulting IDs fail to be contiguous from 0 as IDs&lt;br /&gt;
are used by OCEOS as indices into arrays.&lt;br /&gt;
&lt;br /&gt;
Each rwmutex has a priority ceiling, the priority of the highest priority&lt;br /&gt;
task that uses the rwmutex for reading or for writing. This is specified&lt;br /&gt;
when the rwmutex is created, does not change subsequently, and must be in&lt;br /&gt;
the range 1 (TASK_MAX_PRIORITY) to 254 (TASK_MIN_PRIORITY).&lt;br /&gt;
The application developer must ensure that the correct rwmutex ceiling&lt;br /&gt;
is used. OCEOSmp will detect an attempt to acquire a rwmutex by a task&lt;br /&gt;
with higher priority than that rwmutex's priority ceiling, make a&lt;br /&gt;
system log entry (LOG_RWMUTEX_BAD_CEILING) and return an INTERNAL_ERROR&lt;br /&gt;
status code.&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_rwmutex_create()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''rwmutex.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function ees a read/write mutex.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Creates a Read/Write Mutex (RWMUTEX)&lt;br /&gt;
 *&lt;br /&gt;
 * This function should only be called after OCEOSmp is initialised with&lt;br /&gt;
 * oceos_init() and before initialisation ends with oceos_init_finish()&lt;br /&gt;
 * and scheduling starts with oceos_start()&lt;br /&gt;
 *&lt;br /&gt;
 * @param rwm_id    Read/Write RWMUTEX ID, must be in range 0 to 62&lt;br /&gt;
 * @param priority  Priority ceiling of highest priority task that uses the RWMUTEX&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_WRONG_CPU_CORE          Executing directive on wrong CPU&lt;br /&gt;
 *          ERR_WRONG_PHASE             Called before oceos_init() is done&lt;br /&gt;
 *          ERR_TOO_MANY                MAX number of RWMUTEXs already created&lt;br /&gt;
 *          ERR_ID_INVALID              RWMUTEX ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                RWMUTEX ID &amp;gt;= number of RWMUTEXs&lt;br /&gt;
 *          ERR_RWMX_ALREADY_ALLOCATED  RWMUTEX ID already used&lt;br /&gt;
 *          ERR_RWMX_PRIORITY_WRONG     RWMUTEX priority ceiling outside allowed range 1 to 254&lt;br /&gt;
 */&lt;br /&gt;
S32_t   oceos_rwmutex_create(&lt;br /&gt;
    const U32_t rwm_id,   // RWMUTEX ID, must be in range 0 to max rwm&lt;br /&gt;
    const U8_t priority   // RWMUTEX priority ceiling&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| rwm_id || Read/Write RWMUTEX ID, must be in range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| priority || Priority ceiling of highest priority task that uses the RWMUTEX&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_CPU_CORE          || Executing directive on wrong CPU&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Called before oceos_init() is done&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TOO_MANY                || MAX number of RWMUTEXs already created&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || RWMUTEX ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || RWMUTEX ID &amp;gt;= number of RWMUTEXs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_RWMX_ALREADY_ALLOCATED  || RWMUTEX ID already used&lt;br /&gt;
|-&lt;br /&gt;
| ERR_RWMX_PRIORITY_WRONG     || RWMUTEX priority ceiling outside allowed range 1 to 254&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Create read/write mutex with ID rwm_2 and priority ceiling of 100 &lt;br /&gt;
status = oceos_rwmutex_create(rwm_1, 100);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_rwmutex_read_wait()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''rwmutex.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function acquires a read/write mutex for read. If successful, jobs on other CPUs can also acquire it for read, but no job will be able to acquire it for write while any read is under way. If job already holds RWMUTEX for read or for write the appropriate status code is returned, a system log entry made, and the job continues. It will not succeed while any job is waiting to obtain RWMUTEX for write, and will loop waiting for all pending writes on this RWMUTEX to complete.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Read wait on RWMUTEX.&lt;br /&gt;
 *&lt;br /&gt;
 * If successful jobs on other CPUs can also acquire it for read, but no job&lt;br /&gt;
 * will be able to acquire it for write while any read is under way.&lt;br /&gt;
 * If job already holds RWMUTEX for read or for write appropriate status code&lt;br /&gt;
 * is returned, a system log entry made, and the job continues.&lt;br /&gt;
 * Will not succeed while any job is waiting to obtain RWMUTEX for write,&lt;br /&gt;
 * will loop waiting for all pending writes on this RWMUTEX to complete.&lt;br /&gt;
 *&lt;br /&gt;
 * This should only be called after OCEOS scheduling has started.&lt;br /&gt;
 *&lt;br /&gt;
 * N.B.	The returned status code must be checked and appropriate action&lt;br /&gt;
 * 		taken.&lt;br /&gt;
 *&lt;br /&gt;
 * @param rwm_id    const U32_t  : value 0 to 62&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          WARN_RWMX_NOT_HIGHEST       Already holds a RWMUTEX higher in the RWMUTEX order&lt;br /&gt;
 *                                      (there then may be a risk of deadlock)&lt;br /&gt;
 *&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              RWMUTEX ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                RWMUTEX ID &amp;gt;= number of RWMUTEXs&lt;br /&gt;
 *          ERR_RWMX_CEILING_BAD        RWMUTEX ceiling not lower priority than job priority&lt;br /&gt;
 *          ERR_RWMX_ALREADY_HELD       RWMUTEX already held by this job&lt;br /&gt;
 *          ERR_RWMX_CPU_STACK_FULL     CPU priority ceiling stack full&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_rwmutex_read_wait(&lt;br /&gt;
    const U32_t rwm_id  // RWMUTEX ID, must be in range 0 to 62&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| rwm_id || U32_t rwmutex to be acquired for read (value 0 to 62)&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| WARN_RWMX_NOT_HIGHEST       || Already holds a RWMUTEX higher in the RWMUTEX order (deadlock risk)&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || RWMUTEX ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || RWMUTEX ID &amp;gt;= number of RWMUTEXs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_RWMX_CEILING_BAD        || RWMUTEX ceiling not lower priority than job priority&lt;br /&gt;
|-&lt;br /&gt;
| ERR_RWMX_ALREADY_HELD       || RWMUTEX already held by this job&lt;br /&gt;
|-&lt;br /&gt;
| ERR_RWMX_CPU_STACK_FULL     || CPU priority ceiling stack full&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Acquire read/write mutex rwm_1 for read&lt;br /&gt;
status = oceos_rwmutex_read_wait(rwm_1);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_rwmutex_write_wait()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''rwmutex.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function acquires the specified read/write mutex for write.&lt;br /&gt;
If successful, no other job can also obtain it for reading or for writing. Will not succeed while any other job has acquired RWMUTEX for write,&lt;br /&gt;
or any jobs have obtained RWMUTEX for read. Will then loop until the RWMUTEX is released and for its turn in the sequence of jobs that have tried to acquire the RWMUTEX for writing. If already holds the RWMUTEX for writing or reading an appropriate status code is returned, a system log entry made, and the job continues. While there are any outstanding attempts to obtain the RWMUTEX for write no job will be able to acquire it for reading.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Write wait on RWMUTEX.&lt;br /&gt;
 *&lt;br /&gt;
 * If successful no other job can also obtain it for reading or for writing.&lt;br /&gt;
 * Will not succeed while any other job has acquired RWMUTEX for write,&lt;br /&gt;
 * or any jobs have obtained RWMUTEX for read. Will then loop until the&lt;br /&gt;
 * RWMUTEX is released and for its turn in the sequence of jobs that have&lt;br /&gt;
 * tried to acquire the RWMUTEX for writing.&lt;br /&gt;
 * If already holds the RWMUTEX for writing or reading an appropriate status&lt;br /&gt;
 * code is returned, a system log entry made, and the job continues.&lt;br /&gt;
 * While there are any outstanding attempts to obtain the RWMUTEX for write&lt;br /&gt;
 * no job will be able to acquire it for reading.&lt;br /&gt;
 *&lt;br /&gt;
 * This should only be called after OCEOS scheduling has started.&lt;br /&gt;
 *&lt;br /&gt;
 * N.B.	The returned status code must be checked and appropriate action&lt;br /&gt;
 * 		taken.&lt;br /&gt;
 *&lt;br /&gt;
 * @param rwm_id     const U32_t  : value 0 to 62&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          WARN_RWMX_NOT_HIGHEST       Already holds a RWMUTEX higher in the RWMUTEX order&lt;br /&gt;
 *                                      (there then may be a risk of deadlock)&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              RWMUTEX ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                RWMUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
 *          ERR_RWMX_CEILING_BAD        RWMUTEX ceiling not lower priority than job priority&lt;br /&gt;
 *          ERR_RWMX_ALREADY_HELD       RWMUTEX already held by this job&lt;br /&gt;
 *          ERR_RWMX_CPU_STACK_FULL     CPU priority ceiling stack full&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_rwmutex_write_wait(&lt;br /&gt;
    const U32_t rwm_id  // RWMUTEX ID, must be in range 0 to 62&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| rwm_id || U32_t rwmutex to be acquired for write(value 0 to 62)&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| WARN_RWMX_NOT_HIGHEST       || Already holds a RWMUTEX higher in the RWMUTEX order (deadlock risk)&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || RWMUTEX ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || RWMUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_RWMX_CEILING_BAD        || RWMUTEX ceiling not lower priority than job priority&lt;br /&gt;
|-&lt;br /&gt;
| ERR_RWMX_ALREADY_HELD       || RWMUTEX already held by this job&lt;br /&gt;
|-&lt;br /&gt;
| ERR_RWMX_CPU_STACK_FULL     || CPU priority ceiling stack full&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Acquire read/write mutex rwm_1 for write&lt;br /&gt;
status = oceos_rwmutex_read_wait(rwm_1);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_rwmutex_signal()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''rwmutex.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function signals the specified read/write mutex.&lt;br /&gt;
It frees the RWMUTEX for use by other jobs, irrespective of whether the RWMUTEX is held for reading or for writing. If the RWMUTEX is not held by the job then it returns an appropriate status code. It does not take into account how many times a job has obtained the RWMUTEX for read or for write.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Signal a RWMUTEX&lt;br /&gt;
 *&lt;br /&gt;
 * Frees the RWMUTEX for use by other jobs, irrespective of whether&lt;br /&gt;
 * RWMUTEX is held for reading or for writing.&lt;br /&gt;
 * if the RWMUTEX is not held by the job returns an appropriate status code.&lt;br /&gt;
 * Does not take into account how many times a job has obtained the RWMUTEX&lt;br /&gt;
 * for read or for write.&lt;br /&gt;
 *&lt;br /&gt;
 * This should only be called after OCEOS scheduling has started.&lt;br /&gt;
 *&lt;br /&gt;
 * N.B. The returned status code must be checked and appropriate action taken.&lt;br /&gt;
 *&lt;br /&gt;
 * @param rwm_id    const U32_t  : value 0 to 62&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          WARN_RWMX_ALREADY_FREE      RWMUTEX is free already&lt;br /&gt;
 *&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              RWMUTEX ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                RWMUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
 *          ERR_RWMX_CEILING_BAD        RWMUTEX ceiling not lower priority than job priority&lt;br /&gt;
 *          ERR_RWMX_CPU_STACK_EMPTY    CPU priority ceiling stack empty&lt;br /&gt;
 *          ERR_RWMX_CEILING_INVALID    CPU current priority ceiling on the priority stack is invalid&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_rwmutex_signal(&lt;br /&gt;
    const U32_t rwm_id // RWMUTEX ID, must be in range 0 to 62&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| rwm_id || U32_t rwmutex to be signaled(value 0 to 62)&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| WARN_RWMX_ALREADY_FREE      || RWMUTEX is free already&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || RWMUTEX ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || RWMUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_RWMX_CEILING_BAD        || RWMUTEX ceiling not lower priority than job priority&lt;br /&gt;
|-&lt;br /&gt;
| ERR_RWMX_CPU_STACK_EMPTY    || CPU priority ceiling stack empty&lt;br /&gt;
|-&lt;br /&gt;
| ERR_RWMX_CEILING_INVALID    || CPU current priority ceiling on the priority stack is invalid&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Signal read/write mutex number rwm_4&lt;br /&gt;
status = oceos_rwmutex_signal(rwm_4);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_rwmutex_check_status()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''rwmutex.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function checks the status of a read/write mutex. The possible states are free, in-use for read, and in-use for write.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Check whether RWMUTEX is free&lt;br /&gt;
 *&lt;br /&gt;
 * @param rwm_id        must be in range 0 to 62&lt;br /&gt;
 * @param m_status      pointer to RWMUTEX status holder;&lt;br /&gt;
 *                      if return code OCEOS_SUCCESS RWMUTEX status:&lt;br /&gt;
 *                          0 =&amp;gt; Free for use&lt;br /&gt;
 *                          1 =&amp;gt; In use for read&lt;br /&gt;
 *                          2 =&amp;gt; In use for write&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              RWMUTEX ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                RWMUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
 *          ERR_RWMX_DATA_PTR_BAD       Pointer to RWMUTEX status return holder is null&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_rwmutex_check_status(&lt;br /&gt;
    const U32_t rwm_id, // RWMUTEX ID, must be in range 0 to 62&lt;br /&gt;
    U32_t *m_status&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| rwm_id || read/write mutex number in range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| m_status || U32_t pointer to RWMUTEX status holder (0 = free, 1 = in-use for read, 2 = in-use for write &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || RWMUTEX ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || RWMUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_RWMX_DATA_PTR_BAD       || Pointer to RWMUTEX status return holder is null&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, rwm_status;&lt;br /&gt;
...&lt;br /&gt;
// Check the status of read/write mutex rwm_2&lt;br /&gt;
status = oceos_rwmutex_check_status(rwm_2, &amp;amp;rwm_status);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_rwmutex_reading_count()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''rwmutex.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the current number of jobs holding a specified read/write mutex for read.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 *&lt;br /&gt;
 * Get current number of jobs holding RWMUTEX for read&lt;br /&gt;
 *&lt;br /&gt;
 * @param rwm_id    must be in range 0 to 62&lt;br /&gt;
 * @param m_count   pointer to RWMUTEX count holder&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              RWMUTEX ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                RWMUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
 *          ERR_RWMX_DATA_PTR_BAD       Pointer to RWMUTEX count return holder is null&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_rwmutex_reading_count(&lt;br /&gt;
    const U32_t rwm_id, // RWMUTEX ID, must be in range 0 to 62&lt;br /&gt;
    U32_t *m_count&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| rwm_id || U32 value of read/write mutex (in range 0 to 62)&lt;br /&gt;
|-&lt;br /&gt;
| m_count || U32_t pointer to read/write mutex count holder&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || RWMUTEX ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || RWMUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_RWMX_DATA_PTR_BAD       || Pointer to RWMUTEX count return holder is null&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, rwm_count;&lt;br /&gt;
...&lt;br /&gt;
// Get the number of jobs holding the read/write mutex rwm_2 for read&lt;br /&gt;
status = oceos_rwmutex_reading_count(rwm_2, &amp;amp;rwm_count);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_rwmutex_write_reqs_count()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''header.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the current number of write requests for the specified read/write mutex .&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Get current RWMUTEX write requests count&lt;br /&gt;
 *&lt;br /&gt;
 * @param rwm_id    must be in range 0 to 62&lt;br /&gt;
 * @param m_count   pointer to RWMUTEX count holder&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              RWMUTEX ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                RWMUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
 *          ERR_RWMX_DATA_PTR_BAD       Pointer to RWMUTEX count return holder is null&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_rwmutex_write_reqs_count(&lt;br /&gt;
    const U32_t rwm_id, // RWMUTEX ID, must be in range 0 to 62&lt;br /&gt;
    U32_t *m_count&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| rwm_id || U32_t value of read/write mutex (must be in range 0 to 62)&lt;br /&gt;
|-&lt;br /&gt;
| m_count || U32_t pointer to read/write mutex count holder&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || RWMUTEX ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || RWMUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_RWMX_DATA_PTR_BAD       || Pointer to RWMUTEX count return holder is null&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, rwm_count;&lt;br /&gt;
...&lt;br /&gt;
// Get the count of cuurent write requests for read/write mutex rwm_1&lt;br /&gt;
status = oceos_rwmutex_write_reqs_count(rwm_1, &amp;amp;rwm_count);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_rwmutex_writes_pending_count()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''rwmutex.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the current number of pending writes for the specified read/write mutex.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Get current RWMUTEX writes pending count&lt;br /&gt;
 *&lt;br /&gt;
 * @param rwm_id    must be in range 0 to 62&lt;br /&gt;
 * @param m_count   pointer to RWMUTEX count holder&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              RWMUTEX ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                RWMUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
 *          ERR_RWMX_DATA_PTR_BAD       Pointer to RWMUTEX pending count return holder is null&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_rwmutex_writes_pending_count(&lt;br /&gt;
    const U32_t rwm_id, // RWMUTEX ID, must be in range 0 to 62&lt;br /&gt;
    U32_t *m_count&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| rwm_id || U32_t value of read/write mutex (must be in range 0 to 62)&lt;br /&gt;
|-&lt;br /&gt;
| m_count || U32_t pointer to read/write mutex count holder&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || RWMUTEX ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || RWMUTEX ID &amp;gt;= number of MUTEXs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_RWMX_DATA_PTR_BAD       || Pointer to RWMUTEX count return holder is null&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, rwm_count;&lt;br /&gt;
...&lt;br /&gt;
// Get the count of cuurent write requests for read/write mutex rwm_1&lt;br /&gt;
status = oceos_rwmutex_writes_pending_count(rwm_1, &amp;amp;rwm_count);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_rwmutex_holding()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''header.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the read/write mutexes currently held by this instance of this task (job).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Get RWMUTEXs currently held by this instance of the task (job)&lt;br /&gt;
 *&lt;br /&gt;
 * @param m_data    U64_t pointer, each bit indicating RWMUTEX held by current task&lt;br /&gt;
 *                          0 =&amp;gt; Not held by job&lt;br /&gt;
 *                          1 =&amp;gt; Held by job&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_RWMX_DATA_PTR_BAD       Pointer to RWMUTEX status return holder is null&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_rwmutex_holding(&lt;br /&gt;
    U64_t *m_data&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| m_data || U64_t pointer, each bit indicating RWMUTEX held by current task, 0 =&amp;gt; not held, 1 =&amp;gt; held &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_RWMX_DATA_PTR_BAD       || Pointer to RWMUTEX status return holder is null&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
U64_t rwm_held;&lt;br /&gt;
...&lt;br /&gt;
// Which read/write mutexes does this job hold&lt;br /&gt;
status = oceos_rwmutex_holding(&amp;amp;rwm_held);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Semaphores directives ==&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_sem_create()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''semaphore.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function creates a semaphore.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Create a counting semaphore&lt;br /&gt;
 *&lt;br /&gt;
 * @param sem_id            SEMAPHORE ID (from 0 to 62)&lt;br /&gt;
 * @param max_permits       number of max permits allowed for this SEMAPHORE, 1 to 4095&lt;br /&gt;
 * @param count_permits     starting number of permits available 0 to 4095&lt;br /&gt;
 * @param pending_q_size    MAX Number of tasks on SEMAPHORE pending queue 1 to 253&lt;br /&gt;
 * @param use_timeout       if TRUE, directive oceos_sem_wait_restart_timeout can be used&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_WRONG_CPU_CORE          Executing directive on wrong CPU&lt;br /&gt;
 *          ERR_WRONG_PHASE             Called before oceos_init() is done&lt;br /&gt;
 *          ERR_TOO_MANY                MAX number of SEMAPHOREs already created&lt;br /&gt;
 *          ERR_ID_INVALID              SEMAPHORE ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                SEMAPHORE ID &amp;gt;= number of SEMAPHOREs&lt;br /&gt;
 *          ERR_SM_ALREADY_ALLOCATED    SEMAPHORE ID already used&lt;br /&gt;
 *          ERR_SM_MAX_PERMIT_WRONG     MAX permits outside allowed range 1 to 4095&lt;br /&gt;
 *          ERR_SM_COUNT_PERMIT_WRONG   Count permits outside allowed range 0 to 4095&lt;br /&gt;
 *          ERR_SM_COUNT_PERMIT_INVALID Count permits is greater than MAX permits for this SEMAPHORE&lt;br /&gt;
 *          ERR_SM_PENQ_SIZE_WRONG      SEMAPHORE pending queue size outside allowed range 1 to 253&lt;br /&gt;
 *          ERR_SM_TA_MAX_NUM_REACHED   Number of timed actions exceeds MAX allowed 255,&lt;br /&gt;
 *                                      each task on SEMAPHORE pending queue is timed action&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_sem_create(&lt;br /&gt;
    sem_t sem_id,         // counting semaphore ID (MAX 63)&lt;br /&gt;
    U16_t max_permits,    // max number of permits (MAX 4095)&lt;br /&gt;
    U16_t count_permits,  // initial number of permits (MAX 4095)&lt;br /&gt;
    U8_t  pending_q_size, // max number of pending queue jobs (MAX 253)&lt;br /&gt;
    BOOLE_t use_timeout   // whether timeout is used in oceos_sem_wait_restart_timeout&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| sem_id || Semaphore ID to be created (from 0 to 62)&lt;br /&gt;
|-&lt;br /&gt;
| max_permits || number of max permits allowed for this semaphore, 1 to 4095&lt;br /&gt;
|-&lt;br /&gt;
| count_permits || starting number of permits available 0 to 4095&lt;br /&gt;
|-&lt;br /&gt;
| pending_q_size || Maximum Number of tasks on SEMAPHORE pending queue 1 to 253&lt;br /&gt;
|-&lt;br /&gt;
| use_timeout || if TRUE, directive oceos_sem_wait_restart_timeout can be used&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_CPU_CORE          || Executing directive on wrong CPU&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Called before oceos_init() is done&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TOO_MANY                || MAX number of SEMAPHOREs already created&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || SEMAPHORE ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || SEMAPHORE ID &amp;gt;= number of SEMAPHOREs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SM_ALREADY_ALLOCATED    || SEMAPHORE ID already used&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SM_MAX_PERMIT_WRONG     || MAX permits outside allowed range 1 to 4095&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SM_COUNT_PERMIT_WRONG   || Count permits outside allowed range 0 to 4095&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SM_COUNT_PERMIT_INVALID || Count permits is greater than MAX permits for this SEMAPHORE&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SM_PENQ_SIZE_WRONG      || SEMAPHORE pending queue size outside allowed range 1 to 253&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SM_TA_MAX_NUM_REACHED   || Number of timed actions exceeds MAX allowed 255&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, param;&lt;br /&gt;
...&lt;br /&gt;
// Create semaphore called s_audi with max permits of 1000, starting permits of zero, max of 10 tasks on pending queue, and no timeouts &lt;br /&gt;
status = oceos_sem_create(s_audi, 1000, 0, 10, FALSE);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_sem_signal()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''semaphore.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function signals a semaphore, increments its count and transfers pending jobs to the ready queue.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Signals a semaphore, increments and transfers pending jobs to ready queue&lt;br /&gt;
 *&lt;br /&gt;
 * @param sem_id counting SEM ID&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          WARN_JOB_NOT_GUARDED&lt;br /&gt;
 *&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              SEM ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                SEM ID &amp;gt;= number of SEMs&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to grab SEM guard&lt;br /&gt;
 *          ERR_TOO_MANY                SEM max permits count already reached&lt;br /&gt;
 *          ERR_SM_JOB_ID_WRONG         Job ID of the task on SEM pending queue is wrong&lt;br /&gt;
 *          ERR_TA_NOT_FOUND            Timed action index to be removed for job not found&lt;br /&gt;
 *          ERR_TA_START_FAILED         Timed action re-start failed after job remove from timed action queue&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_sem_signal(&lt;br /&gt;
    sem_t sem_id // counting SEM ID&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| sem_id || U32_t value of semaphore to be signalled (incremented)&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| WARN_JOB_NOT_GUARDED        || job not guarded, application should check system log&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || SEM ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || SEM ID &amp;gt;= number of SEMs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to grab SEM guard&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TOO_MANY                || SEM max permits count already reached&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SM_JOB_ID_WRONG         || Job ID of the task on SEM pending queue is wrong&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_NOT_FOUND            || Timed action index to be removed for job not found&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_START_FAILED         || Timed action re-start failed after job remove from timed action queue&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Signal s_audi semaphore (increment its count)&lt;br /&gt;
status = oceos_sem_signal(s_audi);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_sem_wait_continue()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''semaphore.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function decrements the available permits of a sempahore otherwise returns an unsuccessful status code.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Wait on semaphore,&lt;br /&gt;
 * decrement the number of available permits for semaphore,&lt;br /&gt;
 * if no permits continue and task should handle unsuccessful result&lt;br /&gt;
 *&lt;br /&gt;
 * @param sem_id SEM ID&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              SEM ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                SEM ID &amp;gt;= number of SEMs&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to grab SEM guard&lt;br /&gt;
 *          ERR_SM_NOT_AVAILABLE        No more permits available for this SEM&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_sem_wait_continue(&lt;br /&gt;
    sem_t sem_id // counting SEM ID&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| sem_id || U32_t value of semaphore to be decremented&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || SEM ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || SEM ID &amp;gt;= number of SEMs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to grab SEM guard&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SM_NOT_AVAILABLE        || No more permits available for this SEM&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Decrement available permits on semaphore s_1&lt;br /&gt;
status = oceos_sem_wait_continue(s_1);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_sem_wait_restart()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''semaphore.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function decrements the available permits of a sempahore and if none available, the job is put on the pending queue.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Waits on semaphore,&lt;br /&gt;
 * if fail, put job on pending queue and exit task&lt;br /&gt;
 *&lt;br /&gt;
 * @param sem_id SEM ID&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              SEM ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                SEM ID &amp;gt;= number of SEMs&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to grab SEM guard&lt;br /&gt;
 *          ERR_SM_J_START_FROM_TIMOUT  Task started from timeout already, SEM no permits available second time&lt;br /&gt;
 *          ERR_FAILED                  Should never return this&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_sem_wait_restart(&lt;br /&gt;
    sem_t sem_id  // counting SEM ID&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| sem_id || U32_t value of semaphore to be decremented&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || SEM ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || SEM ID &amp;gt;= number of SEMs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to grab SEM guard&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SM_J_START_FROM_TIMOUT  || Task started from timeout already, SEM no permits available second time&lt;br /&gt;
|-&lt;br /&gt;
| ERR_FAILED                  || Should never return this&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Decrement available permits on semaphore s_1 otherwise job is put on pending queue&lt;br /&gt;
status = oceos_sem_wait_restart(s_1);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_sem_wait_restart_timeout()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''semaphore.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function decrements the available permits of a sempahore and if none available, the job is put on the pending queue with a timeout enabled. The job is restarted either when a permit is available to be decremented or when the timeout has expired. In order to use this directive, semaphore must be created with flag use_timeout is set to TRUE.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Waits on semaphore,&lt;br /&gt;
 * if fail, put job on pending queue with optional timeout.&lt;br /&gt;
 * In order to use this directive, semaphore must be created with&lt;br /&gt;
 * flag use_timeout is set to TRUE&lt;br /&gt;
 *&lt;br /&gt;
 * @param sem_id         SEM ID&lt;br /&gt;
 * @param U64_t timeout  Restart time if no permits, 0 =&amp;gt; ignore&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_TA_NOT_INIT             Timed action intialisation is not done and tried to be used; or SEM created without timeouts&lt;br /&gt;
 *          ERR_ID_INVALID              SEM ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                SEM ID &amp;gt;= number of SEMs&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to grab SEM guard&lt;br /&gt;
 *          ERR_SM_J_START_FROM_TIMOUT  Task started from timeout already, SEM no permits available second time&lt;br /&gt;
 *          ERR_TOO_MANY                SEM pending queue is full&lt;br /&gt;
 *          ERR_FAILED                  Should never return this&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_sem_wait_restart_timeout(&lt;br /&gt;
    sem_t sem_id, // counting SEM ID&lt;br /&gt;
    U64_t timeout // timeout, restart time if no permits, 0 =&amp;gt; ignore&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| sem_id || U32_t value of semaphore to be decremented&lt;br /&gt;
|-&lt;br /&gt;
| timeout | U64_t timeout in time units. A value of 0 causes timeout to be ignored.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_NOT_INIT             || Timed action intialisation is not done and tried to be used; or SEM created without&lt;br /&gt;
timeouts&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || SEM ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || SEM ID &amp;gt;= number of SEMs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to grab SEM guard&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SM_J_START_FROM_TIMOUT  || Task started from timeout already, SEM no permits available second time&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TOO_MANY                || SEM pending queue is full&lt;br /&gt;
|-&lt;br /&gt;
| ERR_FAILED                  || Should never return this&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Decrement available permits on semaphore s_1 otherwise job is put on pending queue with timeout of 10,000 time units (usually usecs)&lt;br /&gt;
status = oceos_sem_wait_restart_timeout(s_1);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_sem_get_value()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''semaphore.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the number of available permits for the specified semaphore.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Returns number of available permits&lt;br /&gt;
 * for SEM ID&lt;br /&gt;
 *&lt;br /&gt;
 * @param sem_id        SEM id&lt;br /&gt;
 * @param s_permits     pointer to permits count holder&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              SEM ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                SEM ID &amp;gt;= number of SEMs&lt;br /&gt;
 *          ERR_SM_DATA_BAD             Data holder pointer is null&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_sem_get_value(&lt;br /&gt;
    sem_t sem_id,    // counting SEM ID&lt;br /&gt;
    U32_t *s_permits // pointer to permits count holder&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| sem_id || U32_t value of semaphore whose permit count is required&lt;br /&gt;
|-&lt;br /&gt;
| s_permits || U32_t pointer to permits count holder&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || SEM ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || SEM ID &amp;gt;= number of SEMs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SM_DATA_BAD             || Data holder pointer is null&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, permit_count;&lt;br /&gt;
...&lt;br /&gt;
// Get the available permits for semaphore s_1&lt;br /&gt;
status = oceos_sem_get_value(s_1, &amp;amp;permit_count);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_sem_penq_get_size()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''semaphore.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the number of jobs on the specified semaphore pending queue.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Returns number of jobs on semaphore pending queue&lt;br /&gt;
 * for semaphore ID&lt;br /&gt;
 *&lt;br /&gt;
 * @param sem_id    SEM id&lt;br /&gt;
 * @param s_size    pointer to pending queue size holder&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              SEM ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                SEM ID &amp;gt;= number of SEMs&lt;br /&gt;
 *          ERR_SM_DATA_BAD             Data holder pointer is null&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_sem_penq_get_size(&lt;br /&gt;
    sem_t sem_id,   // counting SEM ID&lt;br /&gt;
    U32_t *s_size   // pointer to pending queue size holder&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| sem_id || U32_t value of semaphore whose permit count is required&lt;br /&gt;
|-&lt;br /&gt;
| s_size || U32_t pointer to pending queue jobs count holder&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || SEM ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || SEM ID &amp;gt;= number of SEMs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SM_DATA_BAD             || Data holder pointer is null&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, job_count;&lt;br /&gt;
...&lt;br /&gt;
// Get the available permits for semaphore s_1&lt;br /&gt;
status = oceos_sem_penq_get_size(s_1, &amp;amp;job_count);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_sem_reset()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''semaphore.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function restores the permits to the original semaphore initial value and removes any jobs from the pending queue.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Restore permits to original value and&lt;br /&gt;
 * remove jobs from pending queue&lt;br /&gt;
 *&lt;br /&gt;
 * @param sem_id    SEM ID&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              SEM ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                SEM ID &amp;gt;= number of SEMs&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to grab SEM guard&lt;br /&gt;
 *          ERR_SM_JOB_ID_WRONG         Job ID of the task on SEM pending queue is wrong&lt;br /&gt;
 *          ERR_TA_NOT_FOUND            Timed action index to be removed for job not found&lt;br /&gt;
 *          ERR_TA_START_FAILED         Timed action re-start failed after job remove from timed action queue&lt;br /&gt;
 */&lt;br /&gt;
S32_t   oceos_sem_reset(&lt;br /&gt;
    sem_t sem_id   // counting SEM ID&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| sem_id || U32_t value of semaphore to be reset&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || SEM ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || SEM ID &amp;gt;= number of SEMs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to grab SEM guard&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SM_JOB_ID_WRONG         || Job ID of the task on SEM pending queue is wrong&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_NOT_FOUND            || Timed action index to be removed for job not found&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_START_FAILED         || Timed action re-start failed after job remove from timed action queue&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Reset semaphore s_1&lt;br /&gt;
status = oceos_sem_reset(s_1);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Data Queues ==&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_dataq_create()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''dataq.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function creates a data queue with the specified characteristics.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Create data queue&lt;br /&gt;
 * If use_timeout = TRUE, timed actions must be initialised&lt;br /&gt;
 *&lt;br /&gt;
 * @param dataq_id      data queue ID&lt;br /&gt;
 * @param dataq_size    data queue size&lt;br /&gt;
 * @param pen_q_size    pending jobs queue size&lt;br /&gt;
 * @param roll_over     whether to roll over when full&lt;br /&gt;
 * @param use_timeout   if TRUE, directive oceos_dataq_read_restart_timeout can be used&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_WRONG_CPU_CORE          Executing directive on wrong CPU&lt;br /&gt;
 *          ERR_WRONG_PHASE             Called before oceos_init() is done&lt;br /&gt;
 *          ERR_TOO_MANY                MAX number of DATAQs already created&lt;br /&gt;
 *          ERR_ID_INVALID              DATAQ ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                DATAQ ID &amp;gt;= number of DATAQs&lt;br /&gt;
 *          ERR_DQ_ALREADY_ALLOCATED    DATAQ ID already used&lt;br /&gt;
 *          ERR_DQ_SIZE_WRONG           DATAQ size outside allowed range 1 to 255&lt;br /&gt;
 *          ERR_DQ_PENQ_SIZE_WRONG      DATAQ pending queue size outside allowed range 1 to 253&lt;br /&gt;
 *          ERR_DQ_TA_MAX_NUM_REACHED   Number of timed actions exceeds MAX allowed 255,&lt;br /&gt;
 *                                      each task on DATAQ pending queue is timed action&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_dataq_create(&lt;br /&gt;
                         dataq_t dataq_id,    // data queue ID&lt;br /&gt;
                         U16_t dataq_size,    // data queue size&lt;br /&gt;
                         U16_t pen_q_size,    // pending jobs queue size&lt;br /&gt;
                         BOOLE_t roll_over,   // whether to roll over when full&lt;br /&gt;
                         BOOLE_t use_timeout  // whether timeout is used oceos_dataq_read_restart_timeout&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| dataq_id ||   dataq_t data queue ID (number between 0 and 62)&lt;br /&gt;
|-&lt;br /&gt;
| dataq_size ||   data queue size (max number of pointers than can be added to the queue)&lt;br /&gt;
|-&lt;br /&gt;
| pen_q_size ||   pending jobs queue size&lt;br /&gt;
|-&lt;br /&gt;
| roll_over ||    whether to roll over when full (0 =&amp;gt; disabled, 1 =&amp;gt; enabled)&lt;br /&gt;
|-&lt;br /&gt;
| use_timeout ||  if TRUE, directive oceos_dataq_read_restart_timeout can be used&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_CPU_CORE          || Executing directive on wrong CPU&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Called before oceos_init() is done&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TOO_MANY                || MAX number of DATAQs already created&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || DATAQ ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || DATAQ ID &amp;gt;= number of DATAQs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DQ_ALREADY_ALLOCATED    || DATAQ ID already used&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DQ_SIZE_WRONG           || DATAQ size outside allowed range 1 to 255&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DQ_PENQ_SIZE_WRONG      || DATAQ pending queue size outside allowed range 1 to 253&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DQ_TA_MAX_NUM_REACHED   || Number of timed actions exceeds MAX allowed 255, each task on DATAQ pending queue is timed action&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Create data queue d_3 with size 20, max pending jobs of 10, rollover enabled, timeouts disabled &lt;br /&gt;
status = oceos_dataq_create(d_3, 20, 10, 1, 0));&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_dataq_write()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''dataq.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function puts a non-null pointer on the specified data queue.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Puts pointer to the data on data queue.&lt;br /&gt;
 * Pointer to the data must not be NULL&lt;br /&gt;
 *&lt;br /&gt;
 * @param dataq_t dataq_id Data queue ID&lt;br /&gt;
 * @param void* data       Non-null pointer to data&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          WARN_DQ_NOW_FULL            Warning, DATAQ is full now&lt;br /&gt;
 *          WARN_JOB_NOT_GUARDED&lt;br /&gt;
 *&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              DATAQ ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                DATAQ ID &amp;gt;= number of DATAQs&lt;br /&gt;
 *          ERR_DQ_DATA_BAD             Data pointer is null&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to acquire guard&lt;br /&gt;
 *          ERR_TOO_MANY                DATAQ is full&lt;br /&gt;
 *          ERR_DQ_JOB_ID_WRONG         Job ID of the task on pending queue is wrong&lt;br /&gt;
 *          ERR_TA_NOT_FOUND            Timed action index to be removed for job not found&lt;br /&gt;
 *          ERR_TA_START_FAILED         Timed action re-start failed after job remove from timed action queue&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_dataq_write(&lt;br /&gt;
    dataq_t dataq_id, // data queue ID&lt;br /&gt;
    void *data        // non-null pointer to data&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| dataq_id || dataq_t with value of Data queue ID&lt;br /&gt;
|-&lt;br /&gt;
| ptr || void* pointer to application data (non-null pointer)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| WARN_DQ_NOW_FULL            || Warning, DATAQ is full now&lt;br /&gt;
|-&lt;br /&gt;
| WARN_JOB_NOT_GUARDED        || &lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || DATAQ ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || DATAQ ID &amp;gt;= number of DATAQs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DQ_DATA_BAD             || Data pointer is null&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to acquire guard&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TOO_MANY                || DATAQ is full&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DQ_JOB_ID_WRONG         || Job ID of the task on pending queue is wrong&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_NOT_FOUND            || Timed action index to be removed for job not found&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_START_FAILED         || Timed action re-start failed after job remove from timed action queue&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
char[100] message_in;&lt;br /&gt;
...&lt;br /&gt;
// Put pointer to message_in on data queue s_2 &lt;br /&gt;
status = oceos_dataq_write(s_2, (void *)message_in);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_dataq_read_continue()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''dataq.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns a pointer from the specified data queue.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Read data queue&lt;br /&gt;
 *&lt;br /&gt;
 * @param dataq_t dataq_id  Data queue ID&lt;br /&gt;
 * @param void*   data      Pointer to data&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              DATAQ ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                DATAQ ID &amp;gt;= number of DATAQs&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to acquire guard&lt;br /&gt;
 *          ERR_DQ_EMPTY                DATAQ empty(count zero)&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_dataq_read_continue(&lt;br /&gt;
    dataq_t dataq_id, // data queue ID&lt;br /&gt;
    void* *data        // return data&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Descriptionn&lt;br /&gt;
|-&lt;br /&gt;
| dataq_id || dataq_t with value of Data queue ID&lt;br /&gt;
|-&lt;br /&gt;
| ptr || void* pointer to store returned data queue pointer removed from the queue&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || DATAQ ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || DATAQ ID &amp;gt;= number of DATAQs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to acquire guard&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DQ_EMPTY                || DATAQ empty(count zero)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
char *data_ptr;&lt;br /&gt;
...&lt;br /&gt;
// Read pointer from data queue s_2 &lt;br /&gt;
status = oceos_dataq_read_continue(s_2, (void *)data_ptr);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_dataq_read_restart()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''dataq.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns a pointer from the specified data queue. If the queue is empty, the job is added top the dataq pending queue. The job will be restarted when data is available. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Read data queue next item.&lt;br /&gt;
 * If dataq is empty, task is put on pending Q for dataq and&lt;br /&gt;
 * restarted by oceos_dataq_write&lt;br /&gt;
 *&lt;br /&gt;
 * @param dataq_id Data queue ID&lt;br /&gt;
 * @param data     Pointer to return data&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              DATAQ ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                DATAQ ID &amp;gt;= number of DATAQs&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to acquire guard&lt;br /&gt;
 *          ERR_DQ_J_START_FROM_TIMOUT  Job started from timeout already, DATAQ empty second time&lt;br /&gt;
 *          ERR_FAILED                  Should never return this&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_dataq_read_restart(&lt;br /&gt;
    dataq_t dataq_id,    // data queue ID&lt;br /&gt;
    void* *data           // pointer to return data&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| dataq_id || dataq_t with value of Data queue ID&lt;br /&gt;
|-&lt;br /&gt;
| ptr || void* pointer to store returned data queue pointer removed from the queue&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || DATAQ ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || DATAQ ID &amp;gt;= number of DATAQs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to acquire guard&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DQ_J_START_FROM_TIMOUT  || Job started from timeout already, DATAQ empty second time&lt;br /&gt;
|-&lt;br /&gt;
| ERR_FAILED                  || Should never return this&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
char *data_ptr;&lt;br /&gt;
...&lt;br /&gt;
// Read pointer from data queue s_2 with restart when data is available&lt;br /&gt;
status = oceos_dataq_read_restart(s_2, (void *)data_ptr);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_dataq_read_restart_timeout()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''dataq.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns a pointer from the specified data queue. If the queue is empty, the job is added top the dataq pending queue. The job will be restarted either when data is available or the timeout has expired. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Read data queue next item.&lt;br /&gt;
 * If dataq is empty, task is put on pending Q for dataq and&lt;br /&gt;
 * restarted by oceos_dataq_write or by timeout if timeout != 0&lt;br /&gt;
 * In order to use this feature timed actions must be configured and&lt;br /&gt;
 * dataq created with use timeout set to true&lt;br /&gt;
 *&lt;br /&gt;
 * @param dataq_id          Data queue ID&lt;br /&gt;
 * @param data              Pointer to return data&lt;br /&gt;
 * @param timeout           Timeout, restart time if no entry, 0 =&amp;gt; ignore&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_TA_NOT_INIT             Timed action intialisation is not done and tried to be used; or DATAQ created without timeouts&lt;br /&gt;
 *          ERR_ID_INVALID              DATAQ ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                DATAQ ID &amp;gt;= number of DATAQs&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to acquire guard&lt;br /&gt;
 *          ERR_DQ_EMPTY                DATAQ empty(count zero)&lt;br /&gt;
 *          ERR_DQ_J_START_FROM_TIMOUT  Job started from timeout already, DATAQ empty second time&lt;br /&gt;
 *          ERR_TOO_MANY                DATAQ pending queue is full&lt;br /&gt;
 *          ERR_FAILED                  Should never return this&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_dataq_read_restart_timeout(&lt;br /&gt;
    dataq_t dataq_id,   // data queue ID&lt;br /&gt;
    void* *data,         // Pointer to return data&lt;br /&gt;
    U64_t timeout       // timeout, restart time if no entry, 0 =&amp;gt; ignore&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| dataq_id || dataq_t with value of Data queue ID&lt;br /&gt;
|-&lt;br /&gt;
| ptr || void* pointer to store returned data queue pointer removed from the queue&lt;br /&gt;
|-&lt;br /&gt;
| timeout || U64_t containing timeout value, restart time if no entry, 0 =&amp;gt; ignore&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_NOT_INIT             || Timed action intialisation is not done and tried to be used; or DATAQ created without timeouts&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || DATAQ ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || DATAQ ID &amp;gt;= number of DATAQs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to acquire guard&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DQ_EMPTY                || DATAQ empty(count zero)&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DQ_J_START_FROM_TIMOUT  || Job started from timeout already, DATAQ empty second time&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TOO_MANY                || DATAQ pending queue is full&lt;br /&gt;
|-&lt;br /&gt;
| ERR_FAILED                  || Should never return this&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
char *data_ptr;&lt;br /&gt;
...&lt;br /&gt;
// Read pointer from data queue s_2 with timeout after 10,000 time units if no data is available&lt;br /&gt;
status = oceos_dataq_read_restart_timeout(s_2, (void *)data_ptr, 10000ull);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_dataq_get_size()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''dataq.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the number of items on the specified data queue.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Returns number of items on the data queue with ID&lt;br /&gt;
 *&lt;br /&gt;
 * @param dataq_id   DATAQ Id&lt;br /&gt;
 * @param d_size     Pointer to size holder&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              DATAQ ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                DATAQ ID &amp;gt;= number of DATAQs&lt;br /&gt;
 *          ERR_DQ_DATA_BAD             DATAQ size holder pointer is null&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_dataq_get_size(&lt;br /&gt;
    dataq_t dataq_id,   // data queue ID&lt;br /&gt;
    U32_t *d_size&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| dataq_id ||  dataq_t with the ID of the data queue (value between 0 and 62)&lt;br /&gt;
|-&lt;br /&gt;
| d_size || U32_t *d_size pointer to the variable to store the size&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || DATAQ ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || DATAQ ID &amp;gt;= number of DATAQs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DQ_DATA_BAD             || DATAQ size holder pointer is null&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, d_size;&lt;br /&gt;
...&lt;br /&gt;
// Get the number of entries on data queue d_0&lt;br /&gt;
status = oceos_dataq_get_size(d_0, &amp;amp;d_size);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_dataq_penq_get_size()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''dataq.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns number of jobs on the specified data queue pending job's queue.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Returns number of jobs on the dataq pending job's queue&lt;br /&gt;
 *&lt;br /&gt;
 * @param dataq_id  DATAQ Id&lt;br /&gt;
 * @param d_size    Pointer to pending queue size holder&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              DATAQ ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                DATAQ ID &amp;gt;= number of DATAQs&lt;br /&gt;
 *          ERR_DQ_DATA_BAD             DATAQ pending size holder pointer is null&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_dataq_penq_get_size(&lt;br /&gt;
    dataq_t dataq_id,&lt;br /&gt;
    U32_t *d_size&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| dataq_id ||  dataq_t with the ID of the data queue (value between 0 and 62)&lt;br /&gt;
|-&lt;br /&gt;
| d_jobs || U32_t *d_jobs pointer to the variable to store the number of jobs on the pending queue&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || DATAQ ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || DATAQ ID &amp;gt;= number of DATAQs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DQ_DATA_BAD             || DATAQ pending size holder pointer is null&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, d_jobs;&lt;br /&gt;
...&lt;br /&gt;
// Get the number of jobs the the pending jubs queue for data queue d_1&lt;br /&gt;
status = oceos_dataq_penq_get_size(d_1, &amp;amp;d_jobs);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_dataq_clear()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''dataq.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function clears the specified data queue including pending jobs for that queue.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Clears data queue and&lt;br /&gt;
 * frees tasks on pending queue&lt;br /&gt;
 *&lt;br /&gt;
 * @param dataq_t dataq_id Data queue ID&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_ID_INVALID              DATAQ ID outside allowed range 0 to 62&lt;br /&gt;
 *          ERR_ID_WRONG                DATAQ ID &amp;gt;= number of DATAQs&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to acquire guard&lt;br /&gt;
 *          ERR_DQ_JOB_ID_WRONG         Job ID of the task on DATAQ pending queue is wrong&lt;br /&gt;
 *          ERR_TA_NOT_FOUND            Timed action index to be removed for job not found&lt;br /&gt;
 *          ERR_TA_START_FAILED         Timed action re-start failed after job remove from timed action queue&lt;br /&gt;
 */&lt;br /&gt;
S32_t  oceos_dataq_clear(&lt;br /&gt;
    dataq_t dataq_id    // data queue ID&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| dataq_id ||  dataq_t with the ID of the data queue to be cleared (value between 0 and 62)&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || DATAQ ID outside allowed range 0 to 62&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || DATAQ ID &amp;gt;= number of DATAQs&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to acquire guard&lt;br /&gt;
|-&lt;br /&gt;
| ERR_DQ_JOB_ID_WRONG         || Job ID of the task on DATAQ pending queue is wrong&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_NOT_FOUND            || Timed action index to be removed for job not found&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_START_FAILED         || Timed action re-start failed after job remove from timed action queue&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Clear data queue d_1&lt;br /&gt;
status = oceos_dataq_penq_get_size(d_1);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Timed Actions ==&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_timed_output_add()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''timed_action.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function adds a timed action to the timed action queue. It writes a value to an address at a specified system time. An optional mask can be applied so that only those bits are changed.&lt;br /&gt;
The action types are WRITE_ACTION, RMW_ACTION. WRITE_ACTION writes the value to the address. RMW_ACTION reads the values at the address and modifies the bits specified by the mask and value.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Add output action to timed actions queue :&lt;br /&gt;
 *  1. Create timed output action&lt;br /&gt;
 *  2. Stop timer&lt;br /&gt;
 *  3. Add action to action_array&lt;br /&gt;
 *  4. Start timer or execute if time is right&lt;br /&gt;
 *&lt;br /&gt;
 * Returns timed action ID that can be used later to remove&lt;br /&gt;
 * if need by oceos_timed_output_remove&lt;br /&gt;
 *&lt;br /&gt;
 * @param enum ACTION_TYPE action_type  Action type&lt;br /&gt;
 * @param U64_t act_time                System time at which action should be done&lt;br /&gt;
 * @param U32_t before_time             Forward tolerance for time&lt;br /&gt;
 * @param U32_t after_time              Backward tolerance for time&lt;br /&gt;
 * @param adrs_t address                Output address&lt;br /&gt;
 * @param U32_t value                   Output value&lt;br /&gt;
 * @param U32_t mask                    Output mask&lt;br /&gt;
 * @param U32_ *ta_index                Pointer to store timed action index&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_TA_NOT_INIT             Timed action inialisation is not done and tried to be used&lt;br /&gt;
 *          ERR_TA_PTR_BAD              Timed action pointer is null&lt;br /&gt;
 *          ERR_TA_TYPE_WRONG           Timed action type is wrong&lt;br /&gt;
 *          ERR_TOO_LATE                Timed action time is too late&lt;br /&gt;
 *          ERR_SYS_BUSY                Timed action guard failed to acquire&lt;br /&gt;
 *          ERR_TA_Q_FULL               Timed action queue is full&lt;br /&gt;
 *          ERR_TA_START_FAILED         Timed action execute failed; See log&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_timed_output_add(&lt;br /&gt;
    const enum ACTION_TYPE action_type,// Action type&lt;br /&gt;
    U64_t act_time,                    // system time at which action should be done&lt;br /&gt;
    U32_t before_time,                 // forward tolerance for time&lt;br /&gt;
    U32_t after_time,                  // backward tolerance for time&lt;br /&gt;
    const adrs_t address,              // output address&lt;br /&gt;
    const U32_t value,                 // output value&lt;br /&gt;
    const U32_t mask,                  // output mask&lt;br /&gt;
    U32_t *ta_index                    // Pointer to store timed action index&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| enum ACTION_TYPE action_type  || Action type&lt;br /&gt;
|-&lt;br /&gt;
| U64_t act_time                || System time at which action should be done&lt;br /&gt;
|-&lt;br /&gt;
| U32_t before_time             || Forward tolerance for time&lt;br /&gt;
|-&lt;br /&gt;
| U32_t after_time              || Backward tolerance for time&lt;br /&gt;
|-&lt;br /&gt;
| adrs_t address                || Output address&lt;br /&gt;
|-&lt;br /&gt;
| U32_t value                   || Output value&lt;br /&gt;
|-&lt;br /&gt;
| U32_t mask                    || Output mask&lt;br /&gt;
|-&lt;br /&gt;
| U32_ *ta_index                || Pointer to store timed action index&lt;br /&gt;
|-&lt;br /&gt;
| param || parameter to function&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_NOT_INIT             || Timed action inialisation is not done and tried to be used&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_PTR_BAD              || Timed action pointer is null&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_TYPE_WRONG           || Timed action type is wrong&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TOO_LATE                || Timed action time is too late&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Timed action guard failed to acquire&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_Q_FULL               || Timed action queue is full&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_START_FAILED         || Timed action execute failed; See log&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
#define OUTPUT_TIMED_VAL    0xDEADBEEF&lt;br /&gt;
#define OUTPUT_TIMED_MASK   0x1000001&lt;br /&gt;
#define OUTPUT_TIME         0xfffff&lt;br /&gt;
#define OUTPUT_TIME_FW      0x1000&lt;br /&gt;
#define OUTPUT_TIME_BW      0x1000&lt;br /&gt;
&lt;br /&gt;
static U32_t test_data[16] = { 0 };&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Write OUTPUT_TIMED_VAL to test_data[0] at 0xfffff time units from now with a tolerance of 0x1000 before and after the specified time   &lt;br /&gt;
status = oceos_timed_output_add(&lt;br /&gt;
                                       WRITE_ACTION,&lt;br /&gt;
                                       OUTPUT_TIME,&lt;br /&gt;
                                       OUTPUT_TIME_FW,&lt;br /&gt;
                                       OUTPUT_TIME_BW,&lt;br /&gt;
                                       (adrs_t) &amp;amp;test_data[0],&lt;br /&gt;
                                       OUTPUT_TIMED_VAL,&lt;br /&gt;
                                       0,&lt;br /&gt;
                                       &amp;amp;timed_action_index));&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_timed_jobs_number()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''timed_action.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the number of jobs on the timed actions queue.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Get number of Jobs (request to start the task) waiting on timed action queue.&lt;br /&gt;
 * These jobs are added by oceos_task_timed_start() or&lt;br /&gt;
 * oceos_dataq_read_restart_timeout when data is not available (NULL) or&lt;br /&gt;
 * oceos_sem_wait_restart_timeout when counting semaphore is 0&lt;br /&gt;
 *&lt;br /&gt;
 * @param total_jobs    Pointer to store total jobs number waiting on timed action Q&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_TA_NOT_INIT             Timed action inialisation is not done and tried to be used&lt;br /&gt;
 *          ERR_TA_PTR_BAD              Timed action pointer is null&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_timed_jobs_number(U32_t *total_jobs);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| total_jobs || s32_t pointer to store total jobs number waiting on timed action Q&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_NOT_INIT             || Timed action inialisation is not done and tried to be used&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_PTR_BAD              || Timed action pointer is null&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, no_of_jobs;&lt;br /&gt;
...&lt;br /&gt;
// Get the number of jobs on the timed actions queue&lt;br /&gt;
status = oceos_timed_jobs_number(&amp;amp;no_of_jobs);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_timed_jobs_remove()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''timed_action.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function removes the specified timed action from the queue.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Remove job from timed action queue&lt;br /&gt;
 * When task started using oceos_task_timed_start(),&lt;br /&gt;
 * this directive requires pointer to store ID&lt;br /&gt;
 * of job that put on the timed action queue.&lt;br /&gt;
 * This job can be removed later using this directive and stored job ID.&lt;br /&gt;
 *&lt;br /&gt;
 * @param U32_t job_id  Job ID&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_TA_NOT_INIT             Timed action intialisation is not done and tried to be used&lt;br /&gt;
 *          ERR_TA_PTR_BAD              Timed action pointer corrupt&lt;br /&gt;
 *          ERR_ID_WRONG                Job ID is wrong&lt;br /&gt;
 *          ERR_TA_NOT_FOUND            Timed action ID not found for action with job_id or removed already&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to acquire timed action guard&lt;br /&gt;
 *          WARN_TA_Q_EMPTY             Timed action queue is empty&lt;br /&gt;
 *          ERR_TA_START_FAILED         Timed action execute failed; See log&lt;br /&gt;
 */&lt;br /&gt;
S32_t   oceos_timed_jobs_remove(&lt;br /&gt;
    U32_t job_id                             // Job ID&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| job_id || U32_t Job ID to be removed from the timed actions queue&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_NOT_INIT             || Timed action intialisation is not done and tried to be used&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_PTR_BAD              || Timed action pointer corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || Job ID is wrong&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_NOT_FOUND            || Timed action ID not found for action with job_id or removed already&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to acquire timed action guard&lt;br /&gt;
|-&lt;br /&gt;
| WARN_TA_Q_EMPTY             || Timed action queue is empty&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_START_FAILED         || Timed action execute failed; See log&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, job_id;&lt;br /&gt;
...&lt;br /&gt;
// Remove job_id from the timed actions queue&lt;br /&gt;
status = oceos_timed_jobs_remove(job_id);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_timed_jobs_reset()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''timed_action.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function removes all jobs from timed actions queue.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Remove all jobs (requests to start a task) from timed actions queue&lt;br /&gt;
 * These jobs were added by oceos_task_timed_start() or&lt;br /&gt;
 * oceos_dataq_read_restart_timeout when data is not available (NULL) or&lt;br /&gt;
 * oceos_sem_wait_restart_timeout when counting semaphore is 0&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_TA_NOT_INIT             Timed action intialisation is not done and tried to be used&lt;br /&gt;
 *          ERR_TA_PTR_BAD              Timed action pointer is null&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to acquire timed action guard&lt;br /&gt;
 *          WARN_TA_Q_EMPTY             Timed action queue is empty&lt;br /&gt;
 *          ERR_TA_NOT_FOUND            Timed action index not found&lt;br /&gt;
 *          ERR_TA_START_FAILED         Timed action execute failed; See log&lt;br /&gt;
 */&lt;br /&gt;
S32_t   oceos_timed_jobs_reset(void);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
There are no input parameters to this function&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit || Description&lt;br /&gt;
|&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_NOT_INIT             || Timed action intialisation is not done and tried to be used&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_PTR_BAD              || Timed action pointer is null&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to acquire timed action guard&lt;br /&gt;
|-&lt;br /&gt;
| WARN_TA_Q_EMPTY             || Timed action queue is empty&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_NOT_FOUND            || Timed action index not found&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_START_FAILED         || Timed action execute failed; See log&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Remove all jobs from the timed actions queue&lt;br /&gt;
status = oceos_timed_jobs_reset(job_id);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_timed_output_remove()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''timed_action.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function removes the specified timed output action from timed actions queue.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Remove timed output action from timed actions queue.&lt;br /&gt;
 * When action is created, action index should be stored&lt;br /&gt;
 * to remove if need&lt;br /&gt;
 *&lt;br /&gt;
 * @param action_index&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_TA_NOT_INIT             Timed action intialisation is not done and tried to be used&lt;br /&gt;
 *          ERR_TA_PTR_BAD              Timed action pointer is null&lt;br /&gt;
 *          ERR_ID_WRONG                Timed action id is wrong&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to acquire timed action guard&lt;br /&gt;
 *          ERR_TA_NOT_FOUND            Timed action index not found&lt;br /&gt;
 *          ERR_TA_START_FAILED         Timed action execute failed&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_timed_output_remove(&lt;br /&gt;
    const U8_t  action_index    // Index in action array, returned when action was created&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| action_index|| S32_t specifying the timed output action index returned when the timed output was added.&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| Error bit  || Description&lt;br /&gt;
|&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_NOT_INIT             || Timed action intialisation is not done and tried to be used&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_PTR_BAD              || Timed action pointer is null&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_WRONG                || Timed action id is wrong&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to acquire timed action guard&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_NOT_FOUND            || Timed action index not found&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_START_FAILED         || Timed action execute failed&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
U8_t action_index;&lt;br /&gt;
...&lt;br /&gt;
// Remove timed output with specified action_index&lt;br /&gt;
status = oceos_timed_output_remove(action_index);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_timed_output_reset()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''timed_action.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function removes all timed output actions from timed actions queue.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Remove all timed output actions from timed actions queue&lt;br /&gt;
 * These timed output actions were created by oceos_timed_output_add&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_DYN_CORRUPT         System Dynamic area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Directive was called before OCEOS initialisation is finished&lt;br /&gt;
 *          ERR_TA_NOT_INIT             Timed action intialisation is not done and tried to be used&lt;br /&gt;
 *          ERR_TA_PTR_BAD              Timed action pointer is null&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to acquire timed action guard&lt;br /&gt;
 *          WARN_TA_Q_EMPTY             Timed action queue is empty&lt;br /&gt;
 *          ERR_TA_NOT_FOUND            Timed action index not found&lt;br /&gt;
 *          ERR_TA_START_FAILED         Timed action execute failed; See log&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_timed_output_reset(void);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
There are no input parameters to this function. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| Error bit  || Description&lt;br /&gt;
|&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_DYN_CORRUPT         || System Dynamic area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Directive was called before OCEOS initialisation is finished&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_NOT_INIT             || Timed action intialisation is not done and tried to be used&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_PTR_BAD              || Timed action pointer is null&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to acquire timed action guard&lt;br /&gt;
|-&lt;br /&gt;
| WARN_TA_Q_EMPTY             || Timed action queue is empty&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_NOT_FOUND            || Timed action index not found&lt;br /&gt;
|-&lt;br /&gt;
| ERR_TA_START_FAILED         || Timed action execute failed; See log&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
// Remove all timed outputs from the timed actions queue&lt;br /&gt;
status = oceos_timed_output_reset();&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Logging directives ==&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;Introduction&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Log Area Features  (for details of other areas see oceos_areas.h)&lt;br /&gt;
&lt;br /&gt;
The system log area holds the system log and the records of the present and previous values of the system state variable.&lt;br /&gt;
&lt;br /&gt;
It is set up initially as an array of 32-bit words that starts at a 32-bit aligned address provided by the application developer.&lt;br /&gt;
&lt;br /&gt;
It is recommended that this address be in non-volatile RAM memory if this is available to allow information be preserved across power-up cycles.&lt;br /&gt;
&lt;br /&gt;
OCEOS preserves log area information across resets as far as possible.&lt;br /&gt;
&lt;br /&gt;
The system log itself is a circular buffer of struct log entry. Older entries are overwritten by new entries once all entries are in use.&lt;br /&gt;
&lt;br /&gt;
The application developer can specify a function to be called when 3/4 of log entries are in use. This function is called again only after 3/4 of log entries have been read and the log has again become 3/4 full.&lt;br /&gt;
&lt;br /&gt;
The read and write indices are stored in the log area and if equal indicate that the log is empty.&lt;br /&gt;
&lt;br /&gt;
As with other OCEOS data areas, the log area starts with a header&lt;br /&gt;
*a 32-bit word holding a constant OCEOS_VERSION&lt;br /&gt;
*a 32-bit word holding the log area size in 32-bit words&lt;br /&gt;
*a 32-bit word, the system status variable&lt;br /&gt;
*a 32-bit word, the system status mask&lt;br /&gt;
*a 32-bit word, the accumulated system status&lt;br /&gt;
*a 32-bit word, the previous system status mask&lt;br /&gt;
*a 32-bit word, the log control, that gives whether the log full function was called&lt;br /&gt;
*the read index&lt;br /&gt;
*the write index&lt;br /&gt;
*an array of struct log_entry making up the system log itself&lt;br /&gt;
*ending with a 32-bit constant END_SENTINEL&lt;br /&gt;
&lt;br /&gt;
The system fixed meta structure at sysMetaPtr provides&lt;br /&gt;
&lt;br /&gt;
*system_log_ptr      the start address of the log area&lt;br /&gt;
*logEntries          the number of log entries&lt;br /&gt;
*logCreated          flag indicating log was created successfully&lt;br /&gt;
*logFullFunction     user defined function, called when the log becomes 3/4 full (or NULL if not used)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Log Entry Types and Structure'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/*****************************************************************************&lt;br /&gt;
 * LOG ENTRY TYPES&lt;br /&gt;
 *&lt;br /&gt;
 * A log entry type is an 8-bit number.&lt;br /&gt;
 * Values from 0 to 127 can be defined by the application.&lt;br /&gt;
 * Values from 128 to 255 are used by OCEOS as below.&lt;br /&gt;
 *&lt;br /&gt;
 *&lt;br /&gt;
 * NOTE: Add new log types at the end for backward compatibility&lt;br /&gt;
 */&lt;br /&gt;
enum LOG_ENTRY_TYPE{&lt;br /&gt;
  LOG_SYS_OK = 0x80U,&lt;br /&gt;
  LOG_OCEOS_ABORT,				// when exiting from oceos_start&lt;br /&gt;
  LOG_LOG_NOT_VALID_ENTRY,		// used to initialise log and when log empty&lt;br /&gt;
  LOG_INIT_TASK_START_FAIL,		// initial task passed to oceos_start failed&lt;br /&gt;
  LOG_DEADLINE_MISSED,			// task deadline missed&lt;br /&gt;
  LOG_JOB_NOT_ACTIVE,			// cpu_terminate but job not active, absurd&lt;br /&gt;
  LOG_JOB_NOT_FREE,				// job guarded but not free&lt;br /&gt;
  LOG_JOBS_INC_FAILED, 			// pending jobs increment failed&lt;br /&gt;
  LOG_JOB_NOT_GUARDED,			// paranoia&lt;br /&gt;
  LOG_CS_LOG_SPIN_FAIL,			// oceos_CPU_sleep, trying to update CS log&lt;br /&gt;
  LOG_MUTEX_ALREADY_HELD,		// oceos_mutex_wait, code returned, not needed&lt;br /&gt;
  LOG_MUTEX_INCORRECT_ORDER,	// oceos_mutex_wait&lt;br /&gt;
  LOG_MUTEX_EXIT_HOLDING,		// task exits holding one or more mutexes&lt;br /&gt;
  LOG_MUTEX_EXIT_NONE,			// __oceos_tasks_remove_mutexes called but no mutex held&lt;br /&gt;
  LOG_SEMAPHORE_PENDING_REMOVE_FAIL,	// timed_action.c&lt;br /&gt;
  LOG_SEMAPHORE_PENDING_QUEUE_FULL,		// __oceos_semaphore_add_pend&lt;br /&gt;
  LOG_SEMAPHORE_SPIN_FAILED,			// trying to access semaphore&lt;br /&gt;
  LOG_DATAQ_PENDING_QUEUE_FULL,&lt;br /&gt;
  LOG_DATAQ_PENDING_REMOVE_FAIL,&lt;br /&gt;
  LOG_DATAQ_SPIN_FAILED,&lt;br /&gt;
  LOG_TIMED_ACTION_TIMER_NULL,&lt;br /&gt;
  LOG_TIMED_ACTION_INVALID,&lt;br /&gt;
  LOG_TIMED_ACTION_BAD_INDEX,&lt;br /&gt;
  LOG_TIMED_ACTION_MISSED,&lt;br /&gt;
  LOG_TIMED_ACTION_Q_EMPTY,&lt;br /&gt;
  LOG_TIMED_ACTION_REMOVE_FAIL,&lt;br /&gt;
  LOG_TIMED_ACTION_BAD_JOB_ID,&lt;br /&gt;
  LOG_TIMED_Q_SPIN_FAIL,&lt;br /&gt;
  LOG_SYSTEM_ERROR,&lt;br /&gt;
  LOG_ATOMICINC_FAILED,&lt;br /&gt;
  LOG_PENDING_PRI_UPDATE_FAILED,&lt;br /&gt;
  LOG_KILL_TASK_INVALID_ID,      // Tried to kill task with invalid ID&lt;br /&gt;
  LOG_OCEOS_EXIT_REQUEST,         // oceos_exit command was called&lt;br /&gt;
  LOG_RWMUTEX_NOT_RETURNED,&lt;br /&gt;
  LOG_RWMUTEX_NOT_HIGHEST&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
/*****************************************************************************&lt;br /&gt;
 * Structures&lt;br /&gt;
 */&lt;br /&gt;
/**&lt;br /&gt;
 * Log entry structure&lt;br /&gt;
 */&lt;br /&gt;
struct log_entry{&lt;br /&gt;
  U64_t             time64;&lt;br /&gt;
&lt;br /&gt;
  unsigned int      entry_cpu          :8;&lt;br /&gt;
  unsigned int      entry_type         :8;&lt;br /&gt;
  unsigned int      entry_note         :16;	// not used at present&lt;br /&gt;
&lt;br /&gt;
  U32_t             entry_comment;&lt;br /&gt;
}__attribute__ ((aligned (8)));&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_log_add_entry()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''system_log.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function adds an entry to the log. The entry overwrites the oldest unread entry if the log is full.&lt;br /&gt;
Custom log entries can be added to enum LOG_ENTRY from 0 to 128.&lt;br /&gt;
The indices are incremented in a circular fashion. If the write index reaches the read_index the read index is moved on, as read and write indices equal would indicate an empty log.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Add an entry to the log.&lt;br /&gt;
 * this overwrites the oldest unread entry if the log is full.&lt;br /&gt;
 * Custom log entries can be added to enum LOG_ENTRY from 0 to 128&lt;br /&gt;
 *&lt;br /&gt;
 * N.B. The indices are incremented in a circular fashion.&lt;br /&gt;
 *      If the write index reaches the read_index the read index is moved on,&lt;br /&gt;
 *      as read and write indices equal would indicate an empty log.&lt;br /&gt;
 *&lt;br /&gt;
 * @param type  enum LOG_ENTRY_TYPE&lt;br /&gt;
 * @param info  extra information to be logged&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_LOG_CORRUPT         System Log area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Log directive called in wrong phase; can be used after oceos_init() called&lt;br /&gt;
 *          ERR_ID_INVALID              Log type invalid&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to acquire log guard&lt;br /&gt;
 *          ERR_LOG_INDEX_WRONG         Read/write log index is wrong&lt;br /&gt;
 */&lt;br /&gt;
S32_t   oceos_log_add_entry(&lt;br /&gt;
    enum LOG_ENTRY_TYPE type,   // 8 bits enum LOG_ENTRY_TYPE&lt;br /&gt;
    const U32_t        info     // information&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| enum LOG_ENTRY_TYPE || Log entry type (see previous section for a list)&lt;br /&gt;
|-&lt;br /&gt;
| info | U32_t with the log information&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit  !! Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_LOG_CORRUPT         || System Log area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Log directive called in wrong phase; can be used after oceos_init() called&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || Log type invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to acquire log guard&lt;br /&gt;
|-&lt;br /&gt;
| ERR_LOG_INDEX_WRONG         || Read/write log index is wrong&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, info;&lt;br /&gt;
...&lt;br /&gt;
// Log LOG_APP_COMMS__ERROR (defined in enum LOG_ENTRY_TYPE) and info with more details&lt;br /&gt;
status = oceos_log_add_entry(LOG_APP_COMMS__ERROR, info);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_log_get_indexed_entry()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''system_log.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the entry at the specified position in the log. The entry is not removed and the log and log indices are not changed.&lt;br /&gt;
One use of this function is to allow the log be examined after a reset.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Returns the entry at the specified position in the log.&lt;br /&gt;
 * The entry is not removed and the log and log indices are not changed.&lt;br /&gt;
 * (intended to allow the log be examined for example after reset)&lt;br /&gt;
 *&lt;br /&gt;
 * @param index         position in the log&lt;br /&gt;
 * @param outputPtr     pointer to return log entry&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_LOG_CORRUPT         System Log area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Log directive called in wrong phase; can be used after oceos_init() called&lt;br /&gt;
 *          ERR_LOG_INDEX_WRONG         Read log index is wrong&lt;br /&gt;
 *          ERR_LOG_DATA_PTR_BAD        Data holder pointer is null&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_log_get_indexed_entry(&lt;br /&gt;
    const unsigned int index,&lt;br /&gt;
    struct log_entry * const outputPtr&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| index || U32_t with position in the log&lt;br /&gt;
|-&lt;br /&gt;
| outputPtr || pointer to struct log_entry to hold the returned entry&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit  !! Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_LOG_CORRUPT         || System Log area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Log directive called in wrong phase; can be used after oceos_init() called&lt;br /&gt;
|-&lt;br /&gt;
| ERR_LOG_INDEX_WRONG         || Read log index is wrong&lt;br /&gt;
|-&lt;br /&gt;
| ERR_LOG_DATA_PTR_BAD        || Data holder pointer is null&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, index;&lt;br /&gt;
struct log_entry store_entry;&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
// Read log_entry at specified index into outputPtr&lt;br /&gt;
status = oceos_log_get_indexed_entry(index, &amp;amp;store_entry);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_log_remove_entry()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''system_log.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function reads and removes the oldest unread log entry. &lt;br /&gt;
If the log is not empty use the entry at the read index to update the value at the output pointer, returning OCEOS_SUCCESS.&lt;br /&gt;
If outputPtr is NULL, entry is removed but no returned.&lt;br /&gt;
If the log is empty, set the value at the output pointer to LOG_LOG_NOT_VALID_ENTRY and return ERR_LOG_EMPTY.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Read and remove the oldest unread log entry&lt;br /&gt;
 *&lt;br /&gt;
 * If the log is not empty use the entry at the read index to update the value&lt;br /&gt;
 * at the output pointer, returning OCEOS_SUCCESS.&lt;br /&gt;
 *&lt;br /&gt;
 * If outputPtr is NULL, entry is removed but no returned&lt;br /&gt;
 *&lt;br /&gt;
 * If the log is empty, set the value at the output pointer to LOG_LOG_NOT_VALID_ENTRY&lt;br /&gt;
 * and return ERR_LOG_EMPTY&lt;br /&gt;
 *&lt;br /&gt;
 * @param outputPtr   pointer to struct log_entry&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_LOG_CORRUPT         System Log area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Log directive called in wrong phase; can be used after oceos_init() called&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to acquire log guard&lt;br /&gt;
 *          ERR_LOG_INDEX_WRONG         Read/write log index is wrong&lt;br /&gt;
 *          ERR_LOG_EMPTY               Log is empty&lt;br /&gt;
 */&lt;br /&gt;
S32_t   oceos_log_remove_entry(&lt;br /&gt;
    struct log_entry * const outputPtr&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| outputPtr || pointer to struct log_entry&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit  !! Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_LOG_CORRUPT         || System Log area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Log directive called in wrong phase; can be used after oceos_init() called&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to acquire log guard&lt;br /&gt;
|-&lt;br /&gt;
| ERR_LOG_INDEX_WRONG         || Read/write log index is wrong&lt;br /&gt;
|-&lt;br /&gt;
| ERR_LOG_EMPTY               || Log is empty&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
struct log_entry *outputPtr;&lt;br /&gt;
...&lt;br /&gt;
// Read log_entry into outputPtr and remove the oldest unread log entry&lt;br /&gt;
status = oceos_log_remove_entry(outputPtr);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_log_reset()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''system_log.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function sets all log entries to LOG_LOG_NOT_VALID_ENTRY and the log to empty, with the read and write indices set to 0.&lt;br /&gt;
The log is empty if the index of the next write is the same as the index of the next read. It does not affect the system status variable. It does not affect the context switch log.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * oceos_log_reset()&lt;br /&gt;
 *&lt;br /&gt;
 * Set all log entries to LOG_LOG_NOT_VALID_ENTRY and the log to empty, with the&lt;br /&gt;
 * read and write indices set to 0. and function called flag 0&lt;br /&gt;
 *&lt;br /&gt;
 * The log is empty if the index of the next write&lt;br /&gt;
 * is the same as the index of the next read.&lt;br /&gt;
 *&lt;br /&gt;
 * Does not affect the system status variable&lt;br /&gt;
 * Does not affect the context switch log&lt;br /&gt;
 *&lt;br /&gt;
 * N.B The fixed data area may no longer be writable&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_LOG_CORRUPT         System Log area corrupt; reset failed&lt;br /&gt;
 *          ERR_WRONG_PHASE             Log directive called in wrong phase; can be used after oceos_init() called&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to acquire log guard&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_log_reset(void);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
There are no input parameters to this function.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit  !! Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_LOG_CORRUPT         || System Log area corrupt; reset failed&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Log directive called in wrong phase; can be used after oceos_init() called&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to acquire log guard&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
// Clear down the system log&lt;br /&gt;
status = oceos_log_reset();&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_log_get_size()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''system_log.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the number of entries in the log according to the current values of the read and write indices.&lt;br /&gt;
The value will be zero if the current values of the read and write indices are the same. There may still be useful information in the log, e.g. after system reset, this can be accessed using oceos_log_get_indexed_entry().&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Return the number of entries in the log&lt;br /&gt;
 * according to the current values of the read and write indices.&lt;br /&gt;
 *&lt;br /&gt;
 * The value will be zero if the current values of the read and write indices&lt;br /&gt;
 * are the same.&lt;br /&gt;
 *&lt;br /&gt;
 * There may still be useful information in the log, e.g. after system reset,&lt;br /&gt;
 * this can be accessed using oceos_log_get_indexed_entry()&lt;br /&gt;
 *&lt;br /&gt;
 * @param l_size        pointer to log size holder&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_LOG_CORRUPT         System Log area corrupt;&lt;br /&gt;
 *          ERR_WRONG_PHASE             Log directive called in wrong phase; can be used after oceos_init() called&lt;br /&gt;
 *          ERR_LOG_DATA_PTR_BAD        Pointer to log size holder is NULL&lt;br /&gt;
 *          ERR_LOG_INDEX_WRONG         Read/write log index is wrong&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_log_get_size(&lt;br /&gt;
    U32_t *l_size&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| l_size|| U32_t pointer where size will be written.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit  !! Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_LOG_CORRUPT         || System Log area corrupt;&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Log directive called in wrong phase; can be used after oceos_init() called&lt;br /&gt;
|-&lt;br /&gt;
| ERR_LOG_DATA_PTR_BAD        || Pointer to log size holder is NULL&lt;br /&gt;
|-&lt;br /&gt;
| ERR_LOG_INDEX_WRONG         || Read/write log index is wrong&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, size;&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
// Clear down the system log&lt;br /&gt;
status = oceos_log_get_size(&amp;amp;size);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;System State Variable and System State Mask&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The System State variable provides a record of anomalies or problems detected by OCEOSmp's automatic consistency checks. An application handler for these can be set to be called automatically.&lt;br /&gt;
&lt;br /&gt;
An anomaly or problem results in a flag bit being set in the 32-bit word used to store the system state variable. The flags are identified below.&lt;br /&gt;
&lt;br /&gt;
All flags are reset to zero by oceos_init() when OCEOSmp is initialised, and may also be reset by the application using the directive provided.&lt;br /&gt;
&lt;br /&gt;
To provide a record across OCEOSmp restarts a copy is updated automatically whenever the state variable is updated. This is not cleared by oceos_init() but may be cleared by the application using a directive.&lt;br /&gt;
&lt;br /&gt;
Application software can define a problem handling function to be called automatically when specified system state flags are set. The flags are specified by setting the corresponding bits in the system state mask. The function and the state mask are defined in the system configuration.&lt;br /&gt;
&lt;br /&gt;
Changing a state flag from clear to set results in the function being called (if defined). Subsequent settings of that flag have no effect until after it has been cleared using the directive provided.&lt;br /&gt;
&lt;br /&gt;
N.B. In many cases when OCEOSmp sets a System State flag it also makes an entry in the system log that provides further information.&lt;br /&gt;
&lt;br /&gt;
SYSTEM STATE VARIABLE FLAGS&lt;br /&gt;
&lt;br /&gt;
These flags are updated by OCEOSmp using inclusive 'OR' when a consistency check detects a problem or anomaly. A copy of the system state variable is updated also and accumulates a record of flag settings that is preserved across restarts of OCEOSmp. OCEOSmp restarts reset the system state variable but not the copy.&lt;br /&gt;
&lt;br /&gt;
Resetting the state variables is the responsibility of the application (except for the state variable reset done when OCEOSmp is restarted).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''System Status Bits'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
#define  STATUS_NORMAL                    0u    // No flag set                              YES&lt;br /&gt;
#define  STATUS_INVALID          0xffffffffu    // System status is invalid                 YES BUT NO DETAIL!!!&lt;br /&gt;
&lt;br /&gt;
#define  STATUS_MASK_NORMAL      0xffffffffu    // Always call user def fn                  YES&lt;br /&gt;
&lt;br /&gt;
/* Task related problems */&lt;br /&gt;
#define  STATUS_DISABLED_TASK_START    0x1U    // An attempt to start a disabled task&lt;br /&gt;
#define  STATUS_TASK_JOB_LIMIT_OVER    0x2U    // An attempt to execute a task when its jobs limit is already reached.&lt;br /&gt;
#define  STATUS_JOB_OVER_TIME          0x4U    // Job time from creation to completion exceeds allowed maximum for task. YES&lt;br /&gt;
#define  STATUS_JOB_INTERVAL_SHORT     0x8U    // Minimum time between job creations is less than the allowed minimum for task&lt;br /&gt;
#define  STATUS_READYQ_FULL           0x10U    // Ready queue unable to accept job as result of being full&lt;br /&gt;
#define  STATUS_READYQ_NO_REMOVE      0x20U    // Remove job from ready queue failed&lt;br /&gt;
&lt;br /&gt;
/* Mutex related problems */&lt;br /&gt;
#define  STATUS_MUTEX_ALREADY_HELD    0x40U    // Mutex wait() when mutex already held&lt;br /&gt;
#define  STATUS_MUTEX_NOT_HELD        0x80U    // Mutex signal() when not already held&lt;br /&gt;
#define  STATUS_MUTEX_NOT_RETURNED   0x100U    // Mutex not returned before job terminates&lt;br /&gt;
#define  STATUS_MUTEX_NOT_NESTED     0x200U    // Use of multiple mutexes not nested&lt;br /&gt;
&lt;br /&gt;
/* Counting semaphore and data queue related problems */&lt;br /&gt;
#define  STATUS_SEMAPHORE_JOBS_FULL  0x400U    // Attempt to add job to semaphore pending list when list full&lt;br /&gt;
#define  STATUS_DATAQ_JOBS_FULL      0x800U    // Attempt to add job to data queue pending list when list full&lt;br /&gt;
#define  STATUS_DATAQ_FULL          0x1000U    // Data queue write when queue already full&lt;br /&gt;
&lt;br /&gt;
/* Timed actions related problems */&lt;br /&gt;
#define  STATUS_TIMED_JOBS_FULL     0x2000U    // Timed actions queue already full for timed task start&lt;br /&gt;
#define  STATUS_TIMED_OUTPUT_FULL   0x4000U    // Timed actions queue already full for timed output&lt;br /&gt;
#define  STATUS_TIMED_ACTION_LATE   0x8000U    // Timed action late                          YES&lt;br /&gt;
&lt;br /&gt;
/* Default trap handler should have been replaced&lt;br /&gt;
 * NOT USED AT THE MOMENT*/&lt;br /&gt;
#define  STATUS_SYSTEM_ERROR       0x10000U    // ERROR was handled by default trap handler  YES&lt;br /&gt;
&lt;br /&gt;
/* Flag to indicate problem with Stack Pointer&lt;br /&gt;
 * NOT USED AT THE MOMENT*/&lt;br /&gt;
#define  STATUS_SP_WARNING         0x20000U    // SP not in expected range&lt;br /&gt;
/* Log system error */&lt;br /&gt;
#define  STATUS_BAD_LOG            0x40000U    // System log problem&lt;br /&gt;
#define  STATUS_SPIN_FAILED        0x80000U    // Get SPIN lock failed&lt;br /&gt;
/* Not using next few bits */&lt;br /&gt;
&lt;br /&gt;
/* Will have to exit */&lt;br /&gt;
#define  STATUS_BAD_SENTINEL     0x40000000U    // Area sentinel corrupt&lt;br /&gt;
#define  STATUS_BAD_META_PTR     0x80000000U    // Null meta pointer&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_system_state_get()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''system_log.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns of the system state variable.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Returns the value of the system state variable&lt;br /&gt;
 *&lt;br /&gt;
 * @param state  pointer to state holder&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_LOG_DATA_PTR_BAD        Data holder pointer is null&lt;br /&gt;
 *          ERR_SYS_LOG_CORRUPT         LOG dynamic pointer is null&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_system_state_get(&lt;br /&gt;
    U32_t *state // pointer to state holder&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| state || U32_t pointer to state holder&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit  !! Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_LOG_DATA_PTR_BAD        || Data holder pointer is null&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_LOG_CORRUPT         || LOG dynamic pointer is null&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, state;&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
// Get the system state&lt;br /&gt;
status = oceos_system_state_get(&amp;amp;state);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_system_state_set()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''system_log.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function sets system state variable.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Sets system state variable&lt;br /&gt;
 *&lt;br /&gt;
 * @param new_state&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_LOG_CORRUPT         LOG dynamic pointer is null&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_system_state_set(&lt;br /&gt;
    U32_t new_state   // new value of system state variable&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| new_state || U32_t containing new system state&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit  !! Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_LOG_CORRUPT         || LOG dynamic pointer is null&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, new_state;&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
// Set new system state&lt;br /&gt;
status = oceos_system_state_set(new_state);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_system_state_copy_get()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''system_log.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the value of the system state copy variable.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Returns the value of the copy of system state variable&lt;br /&gt;
 *&lt;br /&gt;
 * @param state  pointer to state holder&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_LOG_DATA_PTR_BAD        Data holder pointer is null&lt;br /&gt;
 *          ERR_SYS_LOG_CORRUPT         LOG dynamic pointer is null&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_system_state_copy_get(&lt;br /&gt;
    U32_t *state // pointer to state copy holder&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| state || U32_t pointer to state copy holder&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit  !! Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_LOG_DATA_PTR_BAD        || Data holder pointer is null&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_LOG_CORRUPT         || LOG dynamic pointer is null&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, copy_state;&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
// Get the system state copy&lt;br /&gt;
status = oceos_system_state_copy_get(&amp;amp;copy_state);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_system_state_copy_set()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''system_log.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function loads a value to tha system state copy variable.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Sets system state copy variable&lt;br /&gt;
 *&lt;br /&gt;
 * @param new_state&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_LOG_CORRUPT         LOG dynamic pointer is null&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_system_state_copy_set(&lt;br /&gt;
    U32_t new_state   // new value of system state variable&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| new_state || U32_t containing new system state copy&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit  !! Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_LOG_CORRUPT         || LOG dynamic pointer is null&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, new_state;&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
// Set new system state copy&lt;br /&gt;
status = oceos_system_state_copy_set(new_state);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:backup]]&lt;/div&gt;</summary>
		<author><name>Bkavanagh</name></author>
	</entry>
	<entry>
		<id>https://wiki.ocetechnology.com/mediawiki/index.php?title=OCEOSmp/blank&amp;diff=1675</id>
		<title>OCEOSmp/blank</title>
		<link rel="alternate" type="text/html" href="https://wiki.ocetechnology.com/mediawiki/index.php?title=OCEOSmp/blank&amp;diff=1675"/>
		<updated>2024-05-03T09:41:16Z</updated>

		<summary type="html">&lt;p&gt;Bkavanagh: Replaced content with &amp;quot;== Next Section ==  ===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;blank_function()&amp;lt;/span&amp;gt;=== &amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt; &amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Next Section ==&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;blank_function()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''header.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function does xyz...&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t oceosmp_blank(&lt;br /&gt;
    U32_t param&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| param || parameter to function&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit  !! Description&lt;br /&gt;
|-&lt;br /&gt;
| Error_name|| description&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, param;&lt;br /&gt;
...&lt;br /&gt;
// Do xyz&lt;br /&gt;
status = oceosmp_blank(param));&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:backup]]&lt;/div&gt;</summary>
		<author><name>Bkavanagh</name></author>
	</entry>
	<entry>
		<id>https://wiki.ocetechnology.com/mediawiki/index.php?title=OCEOSmp/blank&amp;diff=1674</id>
		<title>OCEOSmp/blank</title>
		<link rel="alternate" type="text/html" href="https://wiki.ocetechnology.com/mediawiki/index.php?title=OCEOSmp/blank&amp;diff=1674"/>
		<updated>2024-05-03T09:38:34Z</updated>

		<summary type="html">&lt;p&gt;Bkavanagh: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Next Section ==&lt;br /&gt;
&lt;br /&gt;
== Logging directives ==&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;Introduction&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Log Area Features  (for details of other areas see oceos_areas.h)&lt;br /&gt;
&lt;br /&gt;
The system log area holds the system log and the records of the present and previous values of the system state variable.&lt;br /&gt;
&lt;br /&gt;
It is set up initially as an array of 32-bit words that starts at a 32-bit aligned address provided by the application developer.&lt;br /&gt;
&lt;br /&gt;
It is recommended that this address be in non-volatile RAM memory if this is available to allow information be preserved across power-up cycles.&lt;br /&gt;
&lt;br /&gt;
OCEOS preserves log area information across resets as far as possible.&lt;br /&gt;
&lt;br /&gt;
The system log itself is a circular buffer of struct log entry. Older entries are overwritten by new entries once all entries are in use.&lt;br /&gt;
&lt;br /&gt;
The application developer can specify a function to be called when 3/4 of log entries are in use. This function is called again only after 3/4 of log entries have been read and the log has again become 3/4 full.&lt;br /&gt;
&lt;br /&gt;
The read and write indices are stored in the log area and if equal indicate that the log is empty.&lt;br /&gt;
&lt;br /&gt;
As with other OCEOS data areas, the log area starts with a header&lt;br /&gt;
*a 32-bit word holding a constant OCEOS_VERSION&lt;br /&gt;
*a 32-bit word holding the log area size in 32-bit words&lt;br /&gt;
*a 32-bit word, the system status variable&lt;br /&gt;
*a 32-bit word, the system status mask&lt;br /&gt;
*a 32-bit word, the accumulated system status&lt;br /&gt;
*a 32-bit word, the previous system status mask&lt;br /&gt;
*a 32-bit word, the log control, that gives whether the log full function was called&lt;br /&gt;
*the read index&lt;br /&gt;
*the write index&lt;br /&gt;
*an array of struct log_entry making up the system log itself&lt;br /&gt;
*ending with a 32-bit constant END_SENTINEL&lt;br /&gt;
&lt;br /&gt;
The system fixed meta structure at sysMetaPtr provides&lt;br /&gt;
&lt;br /&gt;
*system_log_ptr      the start address of the log area&lt;br /&gt;
*logEntries          the number of log entries&lt;br /&gt;
*logCreated          flag indicating log was created successfully&lt;br /&gt;
*logFullFunction     user defined function, called when the log becomes 3/4 full (or NULL if not used)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Log Entry Types and Structure'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/*****************************************************************************&lt;br /&gt;
 * LOG ENTRY TYPES&lt;br /&gt;
 *&lt;br /&gt;
 * A log entry type is an 8-bit number.&lt;br /&gt;
 * Values from 0 to 127 can be defined by the application.&lt;br /&gt;
 * Values from 128 to 255 are used by OCEOS as below.&lt;br /&gt;
 *&lt;br /&gt;
 *&lt;br /&gt;
 * NOTE: Add new log types at the end for backward compatibility&lt;br /&gt;
 */&lt;br /&gt;
enum LOG_ENTRY_TYPE{&lt;br /&gt;
  LOG_SYS_OK = 0x80U,&lt;br /&gt;
  LOG_OCEOS_ABORT,				// when exiting from oceos_start&lt;br /&gt;
  LOG_LOG_NOT_VALID_ENTRY,		// used to initialise log and when log empty&lt;br /&gt;
  LOG_INIT_TASK_START_FAIL,		// initial task passed to oceos_start failed&lt;br /&gt;
  LOG_DEADLINE_MISSED,			// task deadline missed&lt;br /&gt;
  LOG_JOB_NOT_ACTIVE,			// cpu_terminate but job not active, absurd&lt;br /&gt;
  LOG_JOB_NOT_FREE,				// job guarded but not free&lt;br /&gt;
  LOG_JOBS_INC_FAILED, 			// pending jobs increment failed&lt;br /&gt;
  LOG_JOB_NOT_GUARDED,			// paranoia&lt;br /&gt;
  LOG_CS_LOG_SPIN_FAIL,			// oceos_CPU_sleep, trying to update CS log&lt;br /&gt;
  LOG_MUTEX_ALREADY_HELD,		// oceos_mutex_wait, code returned, not needed&lt;br /&gt;
  LOG_MUTEX_INCORRECT_ORDER,	// oceos_mutex_wait&lt;br /&gt;
  LOG_MUTEX_EXIT_HOLDING,		// task exits holding one or more mutexes&lt;br /&gt;
  LOG_MUTEX_EXIT_NONE,			// __oceos_tasks_remove_mutexes called but no mutex held&lt;br /&gt;
  LOG_SEMAPHORE_PENDING_REMOVE_FAIL,	// timed_action.c&lt;br /&gt;
  LOG_SEMAPHORE_PENDING_QUEUE_FULL,		// __oceos_semaphore_add_pend&lt;br /&gt;
  LOG_SEMAPHORE_SPIN_FAILED,			// trying to access semaphore&lt;br /&gt;
  LOG_DATAQ_PENDING_QUEUE_FULL,&lt;br /&gt;
  LOG_DATAQ_PENDING_REMOVE_FAIL,&lt;br /&gt;
  LOG_DATAQ_SPIN_FAILED,&lt;br /&gt;
  LOG_TIMED_ACTION_TIMER_NULL,&lt;br /&gt;
  LOG_TIMED_ACTION_INVALID,&lt;br /&gt;
  LOG_TIMED_ACTION_BAD_INDEX,&lt;br /&gt;
  LOG_TIMED_ACTION_MISSED,&lt;br /&gt;
  LOG_TIMED_ACTION_Q_EMPTY,&lt;br /&gt;
  LOG_TIMED_ACTION_REMOVE_FAIL,&lt;br /&gt;
  LOG_TIMED_ACTION_BAD_JOB_ID,&lt;br /&gt;
  LOG_TIMED_Q_SPIN_FAIL,&lt;br /&gt;
  LOG_SYSTEM_ERROR,&lt;br /&gt;
  LOG_ATOMICINC_FAILED,&lt;br /&gt;
  LOG_PENDING_PRI_UPDATE_FAILED,&lt;br /&gt;
  LOG_KILL_TASK_INVALID_ID,      // Tried to kill task with invalid ID&lt;br /&gt;
  LOG_OCEOS_EXIT_REQUEST,         // oceos_exit command was called&lt;br /&gt;
  LOG_RWMUTEX_NOT_RETURNED,&lt;br /&gt;
  LOG_RWMUTEX_NOT_HIGHEST&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
/*****************************************************************************&lt;br /&gt;
 * Structures&lt;br /&gt;
 */&lt;br /&gt;
/**&lt;br /&gt;
 * Log entry structure&lt;br /&gt;
 */&lt;br /&gt;
struct log_entry{&lt;br /&gt;
  U64_t             time64;&lt;br /&gt;
&lt;br /&gt;
  unsigned int      entry_cpu          :8;&lt;br /&gt;
  unsigned int      entry_type         :8;&lt;br /&gt;
  unsigned int      entry_note         :16;	// not used at present&lt;br /&gt;
&lt;br /&gt;
  U32_t             entry_comment;&lt;br /&gt;
}__attribute__ ((aligned (8)));&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_log_add_entry()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''system_log.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function adds an entry to the log. The entry overwrites the oldest unread entry if the log is full.&lt;br /&gt;
Custom log entries can be added to enum LOG_ENTRY from 0 to 128.&lt;br /&gt;
The indices are incremented in a circular fashion. If the write index reaches the read_index the read index is moved on, as read and write indices equal would indicate an empty log.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Add an entry to the log.&lt;br /&gt;
 * this overwrites the oldest unread entry if the log is full.&lt;br /&gt;
 * Custom log entries can be added to enum LOG_ENTRY from 0 to 128&lt;br /&gt;
 *&lt;br /&gt;
 * N.B. The indices are incremented in a circular fashion.&lt;br /&gt;
 *      If the write index reaches the read_index the read index is moved on,&lt;br /&gt;
 *      as read and write indices equal would indicate an empty log.&lt;br /&gt;
 *&lt;br /&gt;
 * @param type  enum LOG_ENTRY_TYPE&lt;br /&gt;
 * @param info  extra information to be logged&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_LOG_CORRUPT         System Log area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Log directive called in wrong phase; can be used after oceos_init() called&lt;br /&gt;
 *          ERR_ID_INVALID              Log type invalid&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to acquire log guard&lt;br /&gt;
 *          ERR_LOG_INDEX_WRONG         Read/write log index is wrong&lt;br /&gt;
 */&lt;br /&gt;
S32_t   oceos_log_add_entry(&lt;br /&gt;
    enum LOG_ENTRY_TYPE type,   // 8 bits enum LOG_ENTRY_TYPE&lt;br /&gt;
    const U32_t        info     // information&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| enum LOG_ENTRY_TYPE || Log entry type (see previous section for a list)&lt;br /&gt;
|-&lt;br /&gt;
| info | U32_t with the log information&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit  !! Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_LOG_CORRUPT         || System Log area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Log directive called in wrong phase; can be used after oceos_init() called&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || Log type invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to acquire log guard&lt;br /&gt;
|-&lt;br /&gt;
| ERR_LOG_INDEX_WRONG         || Read/write log index is wrong&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, info;&lt;br /&gt;
...&lt;br /&gt;
// Log LOG_APP_COMMS__ERROR (defined in enum LOG_ENTRY_TYPE) and info with more details&lt;br /&gt;
status = oceos_log_add_entry(LOG_APP_COMMS__ERROR, info);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_log_get_indexed_entry()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''system_log.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the entry at the specified position in the log. The entry is not removed and the log and log indices are not changed.&lt;br /&gt;
One use of this function is to allow the log be examined after a reset.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Returns the entry at the specified position in the log.&lt;br /&gt;
 * The entry is not removed and the log and log indices are not changed.&lt;br /&gt;
 * (intended to allow the log be examined for example after reset)&lt;br /&gt;
 *&lt;br /&gt;
 * @param index         position in the log&lt;br /&gt;
 * @param outputPtr     pointer to return log entry&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_LOG_CORRUPT         System Log area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Log directive called in wrong phase; can be used after oceos_init() called&lt;br /&gt;
 *          ERR_LOG_INDEX_WRONG         Read log index is wrong&lt;br /&gt;
 *          ERR_LOG_DATA_PTR_BAD        Data holder pointer is null&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_log_get_indexed_entry(&lt;br /&gt;
    const unsigned int index,&lt;br /&gt;
    struct log_entry * const outputPtr&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| index || U32_t with position in the log&lt;br /&gt;
|-&lt;br /&gt;
| outputPtr || pointer to struct log_entry to hold the returned entry&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit  !! Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_LOG_CORRUPT         || System Log area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Log directive called in wrong phase; can be used after oceos_init() called&lt;br /&gt;
|-&lt;br /&gt;
| ERR_LOG_INDEX_WRONG         || Read log index is wrong&lt;br /&gt;
|-&lt;br /&gt;
| ERR_LOG_DATA_PTR_BAD        || Data holder pointer is null&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, index;&lt;br /&gt;
struct log_entry store_entry;&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
// Read log_entry at specified index into outputPtr&lt;br /&gt;
status = oceos_log_get_indexed_entry(index, &amp;amp;store_entry);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_log_remove_entry()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''system_log.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function reads and removes the oldest unread log entry. &lt;br /&gt;
If the log is not empty use the entry at the read index to update the value at the output pointer, returning OCEOS_SUCCESS.&lt;br /&gt;
If outputPtr is NULL, entry is removed but no returned.&lt;br /&gt;
If the log is empty, set the value at the output pointer to LOG_LOG_NOT_VALID_ENTRY and return ERR_LOG_EMPTY.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Read and remove the oldest unread log entry&lt;br /&gt;
 *&lt;br /&gt;
 * If the log is not empty use the entry at the read index to update the value&lt;br /&gt;
 * at the output pointer, returning OCEOS_SUCCESS.&lt;br /&gt;
 *&lt;br /&gt;
 * If outputPtr is NULL, entry is removed but no returned&lt;br /&gt;
 *&lt;br /&gt;
 * If the log is empty, set the value at the output pointer to LOG_LOG_NOT_VALID_ENTRY&lt;br /&gt;
 * and return ERR_LOG_EMPTY&lt;br /&gt;
 *&lt;br /&gt;
 * @param outputPtr   pointer to struct log_entry&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_LOG_CORRUPT         System Log area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Log directive called in wrong phase; can be used after oceos_init() called&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to acquire log guard&lt;br /&gt;
 *          ERR_LOG_INDEX_WRONG         Read/write log index is wrong&lt;br /&gt;
 *          ERR_LOG_EMPTY               Log is empty&lt;br /&gt;
 */&lt;br /&gt;
S32_t   oceos_log_remove_entry(&lt;br /&gt;
    struct log_entry * const outputPtr&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| outputPtr || pointer to struct log_entry&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit  !! Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_LOG_CORRUPT         || System Log area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Log directive called in wrong phase; can be used after oceos_init() called&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to acquire log guard&lt;br /&gt;
|-&lt;br /&gt;
| ERR_LOG_INDEX_WRONG         || Read/write log index is wrong&lt;br /&gt;
|-&lt;br /&gt;
| ERR_LOG_EMPTY               || Log is empty&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
struct log_entry *outputPtr;&lt;br /&gt;
...&lt;br /&gt;
// Read log_entry into outputPtr and remove the oldest unread log entry&lt;br /&gt;
status = oceos_log_remove_entry(outputPtr);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_log_reset()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''system_log.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function sets all log entries to LOG_LOG_NOT_VALID_ENTRY and the log to empty, with the read and write indices set to 0.&lt;br /&gt;
The log is empty if the index of the next write is the same as the index of the next read. It does not affect the system status variable. It does not affect the context switch log.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * oceos_log_reset()&lt;br /&gt;
 *&lt;br /&gt;
 * Set all log entries to LOG_LOG_NOT_VALID_ENTRY and the log to empty, with the&lt;br /&gt;
 * read and write indices set to 0. and function called flag 0&lt;br /&gt;
 *&lt;br /&gt;
 * The log is empty if the index of the next write&lt;br /&gt;
 * is the same as the index of the next read.&lt;br /&gt;
 *&lt;br /&gt;
 * Does not affect the system status variable&lt;br /&gt;
 * Does not affect the context switch log&lt;br /&gt;
 *&lt;br /&gt;
 * N.B The fixed data area may no longer be writable&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_LOG_CORRUPT         System Log area corrupt; reset failed&lt;br /&gt;
 *          ERR_WRONG_PHASE             Log directive called in wrong phase; can be used after oceos_init() called&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to acquire log guard&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_log_reset(void);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
There are no input parameters to this function.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit  !! Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_LOG_CORRUPT         || System Log area corrupt; reset failed&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Log directive called in wrong phase; can be used after oceos_init() called&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to acquire log guard&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
// Clear down the system log&lt;br /&gt;
status = oceos_log_reset();&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_log_get_size()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''system_log.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the number of entries in the log according to the current values of the read and write indices.&lt;br /&gt;
The value will be zero if the current values of the read and write indices are the same. There may still be useful information in the log, e.g. after system reset, this can be accessed using oceos_log_get_indexed_entry().&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Return the number of entries in the log&lt;br /&gt;
 * according to the current values of the read and write indices.&lt;br /&gt;
 *&lt;br /&gt;
 * The value will be zero if the current values of the read and write indices&lt;br /&gt;
 * are the same.&lt;br /&gt;
 *&lt;br /&gt;
 * There may still be useful information in the log, e.g. after system reset,&lt;br /&gt;
 * this can be accessed using oceos_log_get_indexed_entry()&lt;br /&gt;
 *&lt;br /&gt;
 * @param l_size        pointer to log size holder&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_LOG_CORRUPT         System Log area corrupt;&lt;br /&gt;
 *          ERR_WRONG_PHASE             Log directive called in wrong phase; can be used after oceos_init() called&lt;br /&gt;
 *          ERR_LOG_DATA_PTR_BAD        Pointer to log size holder is NULL&lt;br /&gt;
 *          ERR_LOG_INDEX_WRONG         Read/write log index is wrong&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_log_get_size(&lt;br /&gt;
    U32_t *l_size&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| l_size|| U32_t pointer where size will be written.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit  !! Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_LOG_CORRUPT         || System Log area corrupt;&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Log directive called in wrong phase; can be used after oceos_init() called&lt;br /&gt;
|-&lt;br /&gt;
| ERR_LOG_DATA_PTR_BAD        || Pointer to log size holder is NULL&lt;br /&gt;
|-&lt;br /&gt;
| ERR_LOG_INDEX_WRONG         || Read/write log index is wrong&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, size;&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
// Clear down the system log&lt;br /&gt;
status = oceos_log_get_size(&amp;amp;size);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;System State Variable and System State Mask&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The System State variable provides a record of anomalies or problems detected by OCEOSmp's automatic consistency checks. An application handler for these can be set to be called automatically.&lt;br /&gt;
&lt;br /&gt;
An anomaly or problem results in a flag bit being set in the 32-bit word used to store the system state variable. The flags are identified below.&lt;br /&gt;
&lt;br /&gt;
All flags are reset to zero by oceos_init() when OCEOSmp is initialised, and may also be reset by the application using the directive provided.&lt;br /&gt;
&lt;br /&gt;
To provide a record across OCEOSmp restarts a copy is updated automatically whenever the state variable is updated. This is not cleared by oceos_init() but may be cleared by the application using a directive.&lt;br /&gt;
&lt;br /&gt;
Application software can define a problem handling function to be called automatically when specified system state flags are set. The flags are specified by setting the corresponding bits in the system state mask. The function and the state mask are defined in the system configuration.&lt;br /&gt;
&lt;br /&gt;
Changing a state flag from clear to set results in the function being called (if defined). Subsequent settings of that flag have no effect until after it has been cleared using the directive provided.&lt;br /&gt;
&lt;br /&gt;
N.B. In many cases when OCEOSmp sets a System State flag it also makes an entry in the system log that provides further information.&lt;br /&gt;
&lt;br /&gt;
SYSTEM STATE VARIABLE FLAGS&lt;br /&gt;
&lt;br /&gt;
These flags are updated by OCEOSmp using inclusive 'OR' when a consistency check detects a problem or anomaly. A copy of the system state variable is updated also and accumulates a record of flag settings that is preserved across restarts of OCEOSmp. OCEOSmp restarts reset the system state variable but not the copy.&lt;br /&gt;
&lt;br /&gt;
Resetting the state variables is the responsibility of the application (except for the state variable reset done when OCEOSmp is restarted).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''System Status Bits'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
#define  STATUS_NORMAL                    0u    // No flag set                              YES&lt;br /&gt;
#define  STATUS_INVALID          0xffffffffu    // System status is invalid                 YES BUT NO DETAIL!!!&lt;br /&gt;
&lt;br /&gt;
#define  STATUS_MASK_NORMAL      0xffffffffu    // Always call user def fn                  YES&lt;br /&gt;
&lt;br /&gt;
/* Task related problems */&lt;br /&gt;
#define  STATUS_DISABLED_TASK_START    0x1U    // An attempt to start a disabled task&lt;br /&gt;
#define  STATUS_TASK_JOB_LIMIT_OVER    0x2U    // An attempt to execute a task when its jobs limit is already reached.&lt;br /&gt;
#define  STATUS_JOB_OVER_TIME          0x4U    // Job time from creation to completion exceeds allowed maximum for task. YES&lt;br /&gt;
#define  STATUS_JOB_INTERVAL_SHORT     0x8U    // Minimum time between job creations is less than the allowed minimum for task&lt;br /&gt;
#define  STATUS_READYQ_FULL           0x10U    // Ready queue unable to accept job as result of being full&lt;br /&gt;
#define  STATUS_READYQ_NO_REMOVE      0x20U    // Remove job from ready queue failed&lt;br /&gt;
&lt;br /&gt;
/* Mutex related problems */&lt;br /&gt;
#define  STATUS_MUTEX_ALREADY_HELD    0x40U    // Mutex wait() when mutex already held&lt;br /&gt;
#define  STATUS_MUTEX_NOT_HELD        0x80U    // Mutex signal() when not already held&lt;br /&gt;
#define  STATUS_MUTEX_NOT_RETURNED   0x100U    // Mutex not returned before job terminates&lt;br /&gt;
#define  STATUS_MUTEX_NOT_NESTED     0x200U    // Use of multiple mutexes not nested&lt;br /&gt;
&lt;br /&gt;
/* Counting semaphore and data queue related problems */&lt;br /&gt;
#define  STATUS_SEMAPHORE_JOBS_FULL  0x400U    // Attempt to add job to semaphore pending list when list full&lt;br /&gt;
#define  STATUS_DATAQ_JOBS_FULL      0x800U    // Attempt to add job to data queue pending list when list full&lt;br /&gt;
#define  STATUS_DATAQ_FULL          0x1000U    // Data queue write when queue already full&lt;br /&gt;
&lt;br /&gt;
/* Timed actions related problems */&lt;br /&gt;
#define  STATUS_TIMED_JOBS_FULL     0x2000U    // Timed actions queue already full for timed task start&lt;br /&gt;
#define  STATUS_TIMED_OUTPUT_FULL   0x4000U    // Timed actions queue already full for timed output&lt;br /&gt;
#define  STATUS_TIMED_ACTION_LATE   0x8000U    // Timed action late                          YES&lt;br /&gt;
&lt;br /&gt;
/* Default trap handler should have been replaced&lt;br /&gt;
 * NOT USED AT THE MOMENT*/&lt;br /&gt;
#define  STATUS_SYSTEM_ERROR       0x10000U    // ERROR was handled by default trap handler  YES&lt;br /&gt;
&lt;br /&gt;
/* Flag to indicate problem with Stack Pointer&lt;br /&gt;
 * NOT USED AT THE MOMENT*/&lt;br /&gt;
#define  STATUS_SP_WARNING         0x20000U    // SP not in expected range&lt;br /&gt;
/* Log system error */&lt;br /&gt;
#define  STATUS_BAD_LOG            0x40000U    // System log problem&lt;br /&gt;
#define  STATUS_SPIN_FAILED        0x80000U    // Get SPIN lock failed&lt;br /&gt;
/* Not using next few bits */&lt;br /&gt;
&lt;br /&gt;
/* Will have to exit */&lt;br /&gt;
#define  STATUS_BAD_SENTINEL     0x40000000U    // Area sentinel corrupt&lt;br /&gt;
#define  STATUS_BAD_META_PTR     0x80000000U    // Null meta pointer&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_system_state_get()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''system_log.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns of the system state variable.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Returns the value of the system state variable&lt;br /&gt;
 *&lt;br /&gt;
 * @param state  pointer to state holder&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_LOG_DATA_PTR_BAD        Data holder pointer is null&lt;br /&gt;
 *          ERR_SYS_LOG_CORRUPT         LOG dynamic pointer is null&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_system_state_get(&lt;br /&gt;
    U32_t *state // pointer to state holder&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| state || U32_t pointer to state holder&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit  !! Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_LOG_DATA_PTR_BAD        || Data holder pointer is null&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_LOG_CORRUPT         || LOG dynamic pointer is null&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, state;&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
// Get the system state&lt;br /&gt;
status = oceos_system_state_get(&amp;amp;state);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_system_state_set()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''system_log.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function sets system state variable.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Sets system state variable&lt;br /&gt;
 *&lt;br /&gt;
 * @param new_state&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_LOG_CORRUPT         LOG dynamic pointer is null&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_system_state_set(&lt;br /&gt;
    U32_t new_state   // new value of system state variable&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| new_state || U32_t containing new system state&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit  !! Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_LOG_CORRUPT         || LOG dynamic pointer is null&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, new_state;&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
// Set new system state&lt;br /&gt;
status = oceos_system_state_set(new_state);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_system_state_copy_get()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''system_log.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the value of the system state copy variable.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Returns the value of the copy of system state variable&lt;br /&gt;
 *&lt;br /&gt;
 * @param state  pointer to state holder&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_LOG_DATA_PTR_BAD        Data holder pointer is null&lt;br /&gt;
 *          ERR_SYS_LOG_CORRUPT         LOG dynamic pointer is null&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_system_state_copy_get(&lt;br /&gt;
    U32_t *state // pointer to state copy holder&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| state || U32_t pointer to state copy holder&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit  !! Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_LOG_DATA_PTR_BAD        || Data holder pointer is null&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_LOG_CORRUPT         || LOG dynamic pointer is null&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, copy_state;&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
// Get the system state copy&lt;br /&gt;
status = oceos_system_state_copy_get(&amp;amp;copy_state);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_system_state_copy_set()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''system_log.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function loads a value to tha system state copy variable.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Sets system state copy variable&lt;br /&gt;
 *&lt;br /&gt;
 * @param new_state&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_LOG_CORRUPT         LOG dynamic pointer is null&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_system_state_copy_set(&lt;br /&gt;
    U32_t new_state   // new value of system state variable&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| new_state || U32_t containing new system state copy&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit  !! Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_LOG_CORRUPT         || LOG dynamic pointer is null&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, new_state;&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
// Set new system state copy&lt;br /&gt;
status = oceos_system_state_copy_set(new_state);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;blank_function()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''header.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function does xyz...&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t oceosmp_blank(&lt;br /&gt;
    U32_t param&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| param || parameter to function&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit  !! Description&lt;br /&gt;
|-&lt;br /&gt;
| Error_name|| description&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, param;&lt;br /&gt;
...&lt;br /&gt;
// Do xyz&lt;br /&gt;
status = oceosmp_blank(param));&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:backup]]&lt;/div&gt;</summary>
		<author><name>Bkavanagh</name></author>
	</entry>
	<entry>
		<id>https://wiki.ocetechnology.com/mediawiki/index.php?title=OCEOSmp/blank&amp;diff=1673</id>
		<title>OCEOSmp/blank</title>
		<link rel="alternate" type="text/html" href="https://wiki.ocetechnology.com/mediawiki/index.php?title=OCEOSmp/blank&amp;diff=1673"/>
		<updated>2024-05-03T09:27:51Z</updated>

		<summary type="html">&lt;p&gt;Bkavanagh: /* System State Variable and System State Mask */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Next Section ==&lt;br /&gt;
&lt;br /&gt;
== Logging directives ==&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;Introduction&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Log Area Features  (for details of other areas see oceos_areas.h)&lt;br /&gt;
&lt;br /&gt;
The system log area holds the system log and the records of the present and previous values of the system state variable.&lt;br /&gt;
&lt;br /&gt;
It is set up initially as an array of 32-bit words that starts at a 32-bit aligned address provided by the application developer.&lt;br /&gt;
&lt;br /&gt;
It is recommended that this address be in non-volatile RAM memory if this is available to allow information be preserved across power-up cycles.&lt;br /&gt;
&lt;br /&gt;
OCEOS preserves log area information across resets as far as possible.&lt;br /&gt;
&lt;br /&gt;
The system log itself is a circular buffer of struct log entry. Older entries are overwritten by new entries once all entries are in use.&lt;br /&gt;
&lt;br /&gt;
The application developer can specify a function to be called when 3/4 of log entries are in use. This function is called again only after 3/4 of log entries have been read and the log has again become 3/4 full.&lt;br /&gt;
&lt;br /&gt;
The read and write indices are stored in the log area and if equal indicate that the log is empty.&lt;br /&gt;
&lt;br /&gt;
As with other OCEOS data areas, the log area starts with a header&lt;br /&gt;
*a 32-bit word holding a constant OCEOS_VERSION&lt;br /&gt;
*a 32-bit word holding the log area size in 32-bit words&lt;br /&gt;
*a 32-bit word, the system status variable&lt;br /&gt;
*a 32-bit word, the system status mask&lt;br /&gt;
*a 32-bit word, the accumulated system status&lt;br /&gt;
*a 32-bit word, the previous system status mask&lt;br /&gt;
*a 32-bit word, the log control, that gives whether the log full function was called&lt;br /&gt;
*the read index&lt;br /&gt;
*the write index&lt;br /&gt;
*an array of struct log_entry making up the system log itself&lt;br /&gt;
*ending with a 32-bit constant END_SENTINEL&lt;br /&gt;
&lt;br /&gt;
The system fixed meta structure at sysMetaPtr provides&lt;br /&gt;
&lt;br /&gt;
*system_log_ptr      the start address of the log area&lt;br /&gt;
*logEntries          the number of log entries&lt;br /&gt;
*logCreated          flag indicating log was created successfully&lt;br /&gt;
*logFullFunction     user defined function, called when the log becomes 3/4 full (or NULL if not used)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Log Entry Types and Structure'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/*****************************************************************************&lt;br /&gt;
 * LOG ENTRY TYPES&lt;br /&gt;
 *&lt;br /&gt;
 * A log entry type is an 8-bit number.&lt;br /&gt;
 * Values from 0 to 127 can be defined by the application.&lt;br /&gt;
 * Values from 128 to 255 are used by OCEOS as below.&lt;br /&gt;
 *&lt;br /&gt;
 *&lt;br /&gt;
 * NOTE: Add new log types at the end for backward compatibility&lt;br /&gt;
 */&lt;br /&gt;
enum LOG_ENTRY_TYPE{&lt;br /&gt;
  LOG_SYS_OK = 0x80U,&lt;br /&gt;
  LOG_OCEOS_ABORT,				// when exiting from oceos_start&lt;br /&gt;
  LOG_LOG_NOT_VALID_ENTRY,		// used to initialise log and when log empty&lt;br /&gt;
  LOG_INIT_TASK_START_FAIL,		// initial task passed to oceos_start failed&lt;br /&gt;
  LOG_DEADLINE_MISSED,			// task deadline missed&lt;br /&gt;
  LOG_JOB_NOT_ACTIVE,			// cpu_terminate but job not active, absurd&lt;br /&gt;
  LOG_JOB_NOT_FREE,				// job guarded but not free&lt;br /&gt;
  LOG_JOBS_INC_FAILED, 			// pending jobs increment failed&lt;br /&gt;
  LOG_JOB_NOT_GUARDED,			// paranoia&lt;br /&gt;
  LOG_CS_LOG_SPIN_FAIL,			// oceos_CPU_sleep, trying to update CS log&lt;br /&gt;
  LOG_MUTEX_ALREADY_HELD,		// oceos_mutex_wait, code returned, not needed&lt;br /&gt;
  LOG_MUTEX_INCORRECT_ORDER,	// oceos_mutex_wait&lt;br /&gt;
  LOG_MUTEX_EXIT_HOLDING,		// task exits holding one or more mutexes&lt;br /&gt;
  LOG_MUTEX_EXIT_NONE,			// __oceos_tasks_remove_mutexes called but no mutex held&lt;br /&gt;
  LOG_SEMAPHORE_PENDING_REMOVE_FAIL,	// timed_action.c&lt;br /&gt;
  LOG_SEMAPHORE_PENDING_QUEUE_FULL,		// __oceos_semaphore_add_pend&lt;br /&gt;
  LOG_SEMAPHORE_SPIN_FAILED,			// trying to access semaphore&lt;br /&gt;
  LOG_DATAQ_PENDING_QUEUE_FULL,&lt;br /&gt;
  LOG_DATAQ_PENDING_REMOVE_FAIL,&lt;br /&gt;
  LOG_DATAQ_SPIN_FAILED,&lt;br /&gt;
  LOG_TIMED_ACTION_TIMER_NULL,&lt;br /&gt;
  LOG_TIMED_ACTION_INVALID,&lt;br /&gt;
  LOG_TIMED_ACTION_BAD_INDEX,&lt;br /&gt;
  LOG_TIMED_ACTION_MISSED,&lt;br /&gt;
  LOG_TIMED_ACTION_Q_EMPTY,&lt;br /&gt;
  LOG_TIMED_ACTION_REMOVE_FAIL,&lt;br /&gt;
  LOG_TIMED_ACTION_BAD_JOB_ID,&lt;br /&gt;
  LOG_TIMED_Q_SPIN_FAIL,&lt;br /&gt;
  LOG_SYSTEM_ERROR,&lt;br /&gt;
  LOG_ATOMICINC_FAILED,&lt;br /&gt;
  LOG_PENDING_PRI_UPDATE_FAILED,&lt;br /&gt;
  LOG_KILL_TASK_INVALID_ID,      // Tried to kill task with invalid ID&lt;br /&gt;
  LOG_OCEOS_EXIT_REQUEST,         // oceos_exit command was called&lt;br /&gt;
  LOG_RWMUTEX_NOT_RETURNED,&lt;br /&gt;
  LOG_RWMUTEX_NOT_HIGHEST&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
/*****************************************************************************&lt;br /&gt;
 * Structures&lt;br /&gt;
 */&lt;br /&gt;
/**&lt;br /&gt;
 * Log entry structure&lt;br /&gt;
 */&lt;br /&gt;
struct log_entry{&lt;br /&gt;
  U64_t             time64;&lt;br /&gt;
&lt;br /&gt;
  unsigned int      entry_cpu          :8;&lt;br /&gt;
  unsigned int      entry_type         :8;&lt;br /&gt;
  unsigned int      entry_note         :16;	// not used at present&lt;br /&gt;
&lt;br /&gt;
  U32_t             entry_comment;&lt;br /&gt;
}__attribute__ ((aligned (8)));&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_log_add_entry()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''system_log.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function adds an entry to the log. The entry overwrites the oldest unread entry if the log is full.&lt;br /&gt;
Custom log entries can be added to enum LOG_ENTRY from 0 to 128.&lt;br /&gt;
The indices are incremented in a circular fashion. If the write index reaches the read_index the read index is moved on, as read and write indices equal would indicate an empty log.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Add an entry to the log.&lt;br /&gt;
 * this overwrites the oldest unread entry if the log is full.&lt;br /&gt;
 * Custom log entries can be added to enum LOG_ENTRY from 0 to 128&lt;br /&gt;
 *&lt;br /&gt;
 * N.B. The indices are incremented in a circular fashion.&lt;br /&gt;
 *      If the write index reaches the read_index the read index is moved on,&lt;br /&gt;
 *      as read and write indices equal would indicate an empty log.&lt;br /&gt;
 *&lt;br /&gt;
 * @param type  enum LOG_ENTRY_TYPE&lt;br /&gt;
 * @param info  extra information to be logged&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_LOG_CORRUPT         System Log area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Log directive called in wrong phase; can be used after oceos_init() called&lt;br /&gt;
 *          ERR_ID_INVALID              Log type invalid&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to acquire log guard&lt;br /&gt;
 *          ERR_LOG_INDEX_WRONG         Read/write log index is wrong&lt;br /&gt;
 */&lt;br /&gt;
S32_t   oceos_log_add_entry(&lt;br /&gt;
    enum LOG_ENTRY_TYPE type,   // 8 bits enum LOG_ENTRY_TYPE&lt;br /&gt;
    const U32_t        info     // information&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| enum LOG_ENTRY_TYPE || Log entry type (see previous section for a list)&lt;br /&gt;
|-&lt;br /&gt;
| info | U32_t with the log information&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit  !! Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_LOG_CORRUPT         || System Log area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Log directive called in wrong phase; can be used after oceos_init() called&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || Log type invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to acquire log guard&lt;br /&gt;
|-&lt;br /&gt;
| ERR_LOG_INDEX_WRONG         || Read/write log index is wrong&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, info;&lt;br /&gt;
...&lt;br /&gt;
// Log LOG_APP_COMMS__ERROR (defined in enum LOG_ENTRY_TYPE) and info with more details&lt;br /&gt;
status = oceos_log_add_entry(LOG_APP_COMMS__ERROR, info);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_log_get_indexed_entry()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''system_log.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the entry at the specified position in the log. The entry is not removed and the log and log indices are not changed.&lt;br /&gt;
One use of this function is to allow the log be examined after a reset.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Returns the entry at the specified position in the log.&lt;br /&gt;
 * The entry is not removed and the log and log indices are not changed.&lt;br /&gt;
 * (intended to allow the log be examined for example after reset)&lt;br /&gt;
 *&lt;br /&gt;
 * @param index         position in the log&lt;br /&gt;
 * @param outputPtr     pointer to return log entry&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_LOG_CORRUPT         System Log area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Log directive called in wrong phase; can be used after oceos_init() called&lt;br /&gt;
 *          ERR_LOG_INDEX_WRONG         Read log index is wrong&lt;br /&gt;
 *          ERR_LOG_DATA_PTR_BAD        Data holder pointer is null&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_log_get_indexed_entry(&lt;br /&gt;
    const unsigned int index,&lt;br /&gt;
    struct log_entry * const outputPtr&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| index || U32_t with position in the log&lt;br /&gt;
|-&lt;br /&gt;
| outputPtr || pointer to struct log_entry to hold the returned entry&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_LOG_CORRUPT         || System Log area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Log directive called in wrong phase; can be used after oceos_init() called&lt;br /&gt;
|-&lt;br /&gt;
| ERR_LOG_INDEX_WRONG         || Read log index is wrong&lt;br /&gt;
|-&lt;br /&gt;
| ERR_LOG_DATA_PTR_BAD        || Data holder pointer is null&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, index;&lt;br /&gt;
struct log_entry store_entry;&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
// Read log_entry at specified index into outputPtr&lt;br /&gt;
status = oceos_log_get_indexed_entry(index, &amp;amp;store_entry);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_log_remove_entry()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''system_log.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function reads and removes the oldest unread log entry. &lt;br /&gt;
If the log is not empty use the entry at the read index to update the value at the output pointer, returning OCEOS_SUCCESS.&lt;br /&gt;
If outputPtr is NULL, entry is removed but no returned.&lt;br /&gt;
If the log is empty, set the value at the output pointer to LOG_LOG_NOT_VALID_ENTRY and return ERR_LOG_EMPTY.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Read and remove the oldest unread log entry&lt;br /&gt;
 *&lt;br /&gt;
 * If the log is not empty use the entry at the read index to update the value&lt;br /&gt;
 * at the output pointer, returning OCEOS_SUCCESS.&lt;br /&gt;
 *&lt;br /&gt;
 * If outputPtr is NULL, entry is removed but no returned&lt;br /&gt;
 *&lt;br /&gt;
 * If the log is empty, set the value at the output pointer to LOG_LOG_NOT_VALID_ENTRY&lt;br /&gt;
 * and return ERR_LOG_EMPTY&lt;br /&gt;
 *&lt;br /&gt;
 * @param outputPtr   pointer to struct log_entry&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_LOG_CORRUPT         System Log area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Log directive called in wrong phase; can be used after oceos_init() called&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to acquire log guard&lt;br /&gt;
 *          ERR_LOG_INDEX_WRONG         Read/write log index is wrong&lt;br /&gt;
 *          ERR_LOG_EMPTY               Log is empty&lt;br /&gt;
 */&lt;br /&gt;
S32_t   oceos_log_remove_entry(&lt;br /&gt;
    struct log_entry * const outputPtr&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| outputPtr || pointer to struct log_entry&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit  !! Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_LOG_CORRUPT         || System Log area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Log directive called in wrong phase; can be used after oceos_init() called&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to acquire log guard&lt;br /&gt;
|-&lt;br /&gt;
| ERR_LOG_INDEX_WRONG         || Read/write log index is wrong&lt;br /&gt;
|-&lt;br /&gt;
| ERR_LOG_EMPTY               || Log is empty&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
struct log_entry *outputPtr;&lt;br /&gt;
...&lt;br /&gt;
// Read log_entry into outputPtr and remove the oldest unread log entry&lt;br /&gt;
status = oceos_log_remove_entry(outputPtr);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_log_reset()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''system_log.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function sets all log entries to LOG_LOG_NOT_VALID_ENTRY and the log to empty, with the read and write indices set to 0.&lt;br /&gt;
The log is empty if the index of the next write is the same as the index of the next read. It does not affect the system status variable. It does not affect the context switch log.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * oceos_log_reset()&lt;br /&gt;
 *&lt;br /&gt;
 * Set all log entries to LOG_LOG_NOT_VALID_ENTRY and the log to empty, with the&lt;br /&gt;
 * read and write indices set to 0. and function called flag 0&lt;br /&gt;
 *&lt;br /&gt;
 * The log is empty if the index of the next write&lt;br /&gt;
 * is the same as the index of the next read.&lt;br /&gt;
 *&lt;br /&gt;
 * Does not affect the system status variable&lt;br /&gt;
 * Does not affect the context switch log&lt;br /&gt;
 *&lt;br /&gt;
 * N.B The fixed data area may no longer be writable&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_LOG_CORRUPT         System Log area corrupt; reset failed&lt;br /&gt;
 *          ERR_WRONG_PHASE             Log directive called in wrong phase; can be used after oceos_init() called&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to acquire log guard&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_log_reset(void);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
There are no input parameters to this function.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit  !! Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_LOG_CORRUPT         || System Log area corrupt; reset failed&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Log directive called in wrong phase; can be used after oceos_init() called&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to acquire log guard&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
// Clear down the system log&lt;br /&gt;
status = oceos_log_reset();&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_log_get_size()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''system_log.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the number of entries in the log according to the current values of the read and write indices.&lt;br /&gt;
The value will be zero if the current values of the read and write indices are the same. There may still be useful information in the log, e.g. after system reset, this can be accessed using oceos_log_get_indexed_entry().&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Return the number of entries in the log&lt;br /&gt;
 * according to the current values of the read and write indices.&lt;br /&gt;
 *&lt;br /&gt;
 * The value will be zero if the current values of the read and write indices&lt;br /&gt;
 * are the same.&lt;br /&gt;
 *&lt;br /&gt;
 * There may still be useful information in the log, e.g. after system reset,&lt;br /&gt;
 * this can be accessed using oceos_log_get_indexed_entry()&lt;br /&gt;
 *&lt;br /&gt;
 * @param l_size        pointer to log size holder&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_LOG_CORRUPT         System Log area corrupt;&lt;br /&gt;
 *          ERR_WRONG_PHASE             Log directive called in wrong phase; can be used after oceos_init() called&lt;br /&gt;
 *          ERR_LOG_DATA_PTR_BAD        Pointer to log size holder is NULL&lt;br /&gt;
 *          ERR_LOG_INDEX_WRONG         Read/write log index is wrong&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_log_get_size(&lt;br /&gt;
    U32_t *l_size&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| l_size|| U32_t pointer where size will be written.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_LOG_CORRUPT         || System Log area corrupt;&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Log directive called in wrong phase; can be used after oceos_init() called&lt;br /&gt;
|-&lt;br /&gt;
| ERR_LOG_DATA_PTR_BAD        || Pointer to log size holder is NULL&lt;br /&gt;
|-&lt;br /&gt;
| ERR_LOG_INDEX_WRONG         || Read/write log index is wrong&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, size;&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
// Clear down the system log&lt;br /&gt;
status = oceos_log_get_size(&amp;amp;size);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;System State Variable and System State Mask&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The System State variable provides a record of anomalies or problems detected by OCEOSmp's automatic consistency checks. An application handler for these can be set to be called automatically.&lt;br /&gt;
&lt;br /&gt;
An anomaly or problem results in a flag bit being set in the 32-bit word used to store the system state variable. The flags are identified below.&lt;br /&gt;
&lt;br /&gt;
All flags are reset to zero by oceos_init() when OCEOSmp is initialised, and may also be reset by the application using the directive provided.&lt;br /&gt;
&lt;br /&gt;
To provide a record across OCEOSmp restarts a copy is updated automatically whenever the state variable is updated. This is not cleared by oceos_init() but may be cleared by the application using a directive.&lt;br /&gt;
&lt;br /&gt;
Application software can define a problem handling function to be called automatically when specified system state flags are set. The flags are specified by setting the corresponding bits in the system state mask. The function and the state mask are defined in the system configuration.&lt;br /&gt;
&lt;br /&gt;
Changing a state flag from clear to set results in the function being called (if defined). Subsequent settings of that flag have no effect until after it has been cleared using the directive provided.&lt;br /&gt;
&lt;br /&gt;
N.B. In many cases when OCEOSmp sets a System State flag it also makes an entry in the system log that provides further information.&lt;br /&gt;
&lt;br /&gt;
SYSTEM STATE VARIABLE FLAGS&lt;br /&gt;
&lt;br /&gt;
These flags are updated by OCEOSmp using inclusive 'OR' when a consistency check detects a problem or anomaly. A copy of the system state variable is updated also and accumulates a record of flag settings that is preserved across restarts of OCEOSmp. OCEOSmp restarts reset the system state variable but not the copy.&lt;br /&gt;
&lt;br /&gt;
Resetting the state variables is the responsibility of the application (except for the state variable reset done when OCEOSmp is restarted).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''System Status Bits'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
#define  STATUS_NORMAL                    0u    // No flag set                              YES&lt;br /&gt;
#define  STATUS_INVALID          0xffffffffu    // System status is invalid                 YES BUT NO DETAIL!!!&lt;br /&gt;
&lt;br /&gt;
#define  STATUS_MASK_NORMAL      0xffffffffu    // Always call user def fn                  YES&lt;br /&gt;
&lt;br /&gt;
/* Task related problems */&lt;br /&gt;
#define  STATUS_DISABLED_TASK_START    0x1U    // An attempt to start a disabled task&lt;br /&gt;
#define  STATUS_TASK_JOB_LIMIT_OVER    0x2U    // An attempt to execute a task when its jobs limit is already reached.&lt;br /&gt;
#define  STATUS_JOB_OVER_TIME          0x4U    // Job time from creation to completion exceeds allowed maximum for task. YES&lt;br /&gt;
#define  STATUS_JOB_INTERVAL_SHORT     0x8U    // Minimum time between job creations is less than the allowed minimum for task&lt;br /&gt;
#define  STATUS_READYQ_FULL           0x10U    // Ready queue unable to accept job as result of being full&lt;br /&gt;
#define  STATUS_READYQ_NO_REMOVE      0x20U    // Remove job from ready queue failed&lt;br /&gt;
&lt;br /&gt;
/* Mutex related problems */&lt;br /&gt;
#define  STATUS_MUTEX_ALREADY_HELD    0x40U    // Mutex wait() when mutex already held&lt;br /&gt;
#define  STATUS_MUTEX_NOT_HELD        0x80U    // Mutex signal() when not already held&lt;br /&gt;
#define  STATUS_MUTEX_NOT_RETURNED   0x100U    // Mutex not returned before job terminates&lt;br /&gt;
#define  STATUS_MUTEX_NOT_NESTED     0x200U    // Use of multiple mutexes not nested&lt;br /&gt;
&lt;br /&gt;
/* Counting semaphore and data queue related problems */&lt;br /&gt;
#define  STATUS_SEMAPHORE_JOBS_FULL  0x400U    // Attempt to add job to semaphore pending list when list full&lt;br /&gt;
#define  STATUS_DATAQ_JOBS_FULL      0x800U    // Attempt to add job to data queue pending list when list full&lt;br /&gt;
#define  STATUS_DATAQ_FULL          0x1000U    // Data queue write when queue already full&lt;br /&gt;
&lt;br /&gt;
/* Timed actions related problems */&lt;br /&gt;
#define  STATUS_TIMED_JOBS_FULL     0x2000U    // Timed actions queue already full for timed task start&lt;br /&gt;
#define  STATUS_TIMED_OUTPUT_FULL   0x4000U    // Timed actions queue already full for timed output&lt;br /&gt;
#define  STATUS_TIMED_ACTION_LATE   0x8000U    // Timed action late                          YES&lt;br /&gt;
&lt;br /&gt;
/* Default trap handler should have been replaced&lt;br /&gt;
 * NOT USED AT THE MOMENT*/&lt;br /&gt;
#define  STATUS_SYSTEM_ERROR       0x10000U    // ERROR was handled by default trap handler  YES&lt;br /&gt;
&lt;br /&gt;
/* Flag to indicate problem with Stack Pointer&lt;br /&gt;
 * NOT USED AT THE MOMENT*/&lt;br /&gt;
#define  STATUS_SP_WARNING         0x20000U    // SP not in expected range&lt;br /&gt;
/* Log system error */&lt;br /&gt;
#define  STATUS_BAD_LOG            0x40000U    // System log problem&lt;br /&gt;
#define  STATUS_SPIN_FAILED        0x80000U    // Get SPIN lock failed&lt;br /&gt;
/* Not using next few bits */&lt;br /&gt;
&lt;br /&gt;
/* Will have to exit */&lt;br /&gt;
#define  STATUS_BAD_SENTINEL     0x40000000U    // Area sentinel corrupt&lt;br /&gt;
#define  STATUS_BAD_META_PTR     0x80000000U    // Null meta pointer&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_system_state_get()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''system_log.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns of the system state variable.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Returns the value of the system state variable&lt;br /&gt;
 *&lt;br /&gt;
 * @param state  pointer to state holder&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_LOG_DATA_PTR_BAD        Data holder pointer is null&lt;br /&gt;
 *          ERR_SYS_LOG_CORRUPT         LOG dynamic pointer is null&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_system_state_get(&lt;br /&gt;
    U32_t *state // pointer to state holder&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| state || U32_t pointer to state holder&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_LOG_DATA_PTR_BAD        || Data holder pointer is null&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_LOG_CORRUPT         || LOG dynamic pointer is null&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, state;&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
// Get the system state&lt;br /&gt;
status = oceos_system_state_get(&amp;amp;state);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_system_state_set()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''system_log.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function sets system state variable.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Sets system state variable&lt;br /&gt;
 *&lt;br /&gt;
 * @param new_state&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_LOG_CORRUPT         LOG dynamic pointer is null&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_system_state_set(&lt;br /&gt;
    U32_t new_state   // new value of system state variable&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| new_state || U32_t containing new system state&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_LOG_CORRUPT         || LOG dynamic pointer is null&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, new_state;&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
// Set new system state&lt;br /&gt;
status = oceos_system_state_set(new_state);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_system_state_copy_get()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''system_log.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the value of the system state copy variable.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Returns the value of the copy of system state variable&lt;br /&gt;
 *&lt;br /&gt;
 * @param state  pointer to state holder&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_LOG_DATA_PTR_BAD        Data holder pointer is null&lt;br /&gt;
 *          ERR_SYS_LOG_CORRUPT         LOG dynamic pointer is null&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_system_state_copy_get(&lt;br /&gt;
    U32_t *state // pointer to state copy holder&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| state || U32_t pointer to state copy holder&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_LOG_DATA_PTR_BAD        || Data holder pointer is null&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_LOG_CORRUPT         || LOG dynamic pointer is null&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, copy_state;&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
// Get the system state copy&lt;br /&gt;
status = oceos_system_state_copy_get(&amp;amp;copy_state);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_system_state_copy_set()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''system_log.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function loads a value to tha system state copy variable.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Sets system state copy variable&lt;br /&gt;
 *&lt;br /&gt;
 * @param new_state&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_LOG_CORRUPT         LOG dynamic pointer is null&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_system_state_copy_set(&lt;br /&gt;
    U32_t new_state   // new value of system state variable&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| new_state || U32_t containing new system state copy&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_LOG_CORRUPT         || LOG dynamic pointer is null&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, new_state;&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
// Set new system state copy&lt;br /&gt;
status = oceos_system_state_copy_set(new_state);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;blank_function()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''header.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function does xyz...&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t oceosmp_blank(&lt;br /&gt;
    U32_t param&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| param || parameter to function&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit  !! Description&lt;br /&gt;
|-&lt;br /&gt;
| Error_name|| description&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, param;&lt;br /&gt;
...&lt;br /&gt;
// Do xyz&lt;br /&gt;
status = oceosmp_blank(param));&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:backup]]&lt;/div&gt;</summary>
		<author><name>Bkavanagh</name></author>
	</entry>
	<entry>
		<id>https://wiki.ocetechnology.com/mediawiki/index.php?title=OCEOSmp/blank&amp;diff=1672</id>
		<title>OCEOSmp/blank</title>
		<link rel="alternate" type="text/html" href="https://wiki.ocetechnology.com/mediawiki/index.php?title=OCEOSmp/blank&amp;diff=1672"/>
		<updated>2024-05-03T09:02:21Z</updated>

		<summary type="html">&lt;p&gt;Bkavanagh: /* oceos_log_remove_entry() */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Next Section ==&lt;br /&gt;
&lt;br /&gt;
== Logging directives ==&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;Introduction&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Log Area Features  (for details of other areas see oceos_areas.h)&lt;br /&gt;
&lt;br /&gt;
The system log area holds the system log and the records of the present and previous values of the system state variable.&lt;br /&gt;
&lt;br /&gt;
It is set up initially as an array of 32-bit words that starts at a 32-bit aligned address provided by the application developer.&lt;br /&gt;
&lt;br /&gt;
It is recommended that this address be in non-volatile RAM memory if this is available to allow information be preserved across power-up cycles.&lt;br /&gt;
&lt;br /&gt;
OCEOS preserves log area information across resets as far as possible.&lt;br /&gt;
&lt;br /&gt;
The system log itself is a circular buffer of struct log entry. Older entries are overwritten by new entries once all entries are in use.&lt;br /&gt;
&lt;br /&gt;
The application developer can specify a function to be called when 3/4 of log entries are in use. This function is called again only after 3/4 of log entries have been read and the log has again become 3/4 full.&lt;br /&gt;
&lt;br /&gt;
The read and write indices are stored in the log area and if equal indicate that the log is empty.&lt;br /&gt;
&lt;br /&gt;
As with other OCEOS data areas, the log area starts with a header&lt;br /&gt;
*a 32-bit word holding a constant OCEOS_VERSION&lt;br /&gt;
*a 32-bit word holding the log area size in 32-bit words&lt;br /&gt;
*a 32-bit word, the system status variable&lt;br /&gt;
*a 32-bit word, the system status mask&lt;br /&gt;
*a 32-bit word, the accumulated system status&lt;br /&gt;
*a 32-bit word, the previous system status mask&lt;br /&gt;
*a 32-bit word, the log control, that gives whether the log full function was called&lt;br /&gt;
*the read index&lt;br /&gt;
*the write index&lt;br /&gt;
*an array of struct log_entry making up the system log itself&lt;br /&gt;
*ending with a 32-bit constant END_SENTINEL&lt;br /&gt;
&lt;br /&gt;
The system fixed meta structure at sysMetaPtr provides&lt;br /&gt;
&lt;br /&gt;
*system_log_ptr      the start address of the log area&lt;br /&gt;
*logEntries          the number of log entries&lt;br /&gt;
*logCreated          flag indicating log was created successfully&lt;br /&gt;
*logFullFunction     user defined function, called when the log becomes 3/4 full (or NULL if not used)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Log Entry Types and Structure'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/*****************************************************************************&lt;br /&gt;
 * LOG ENTRY TYPES&lt;br /&gt;
 *&lt;br /&gt;
 * A log entry type is an 8-bit number.&lt;br /&gt;
 * Values from 0 to 127 can be defined by the application.&lt;br /&gt;
 * Values from 128 to 255 are used by OCEOS as below.&lt;br /&gt;
 *&lt;br /&gt;
 *&lt;br /&gt;
 * NOTE: Add new log types at the end for backward compatibility&lt;br /&gt;
 */&lt;br /&gt;
enum LOG_ENTRY_TYPE{&lt;br /&gt;
  LOG_SYS_OK = 0x80U,&lt;br /&gt;
  LOG_OCEOS_ABORT,				// when exiting from oceos_start&lt;br /&gt;
  LOG_LOG_NOT_VALID_ENTRY,		// used to initialise log and when log empty&lt;br /&gt;
  LOG_INIT_TASK_START_FAIL,		// initial task passed to oceos_start failed&lt;br /&gt;
  LOG_DEADLINE_MISSED,			// task deadline missed&lt;br /&gt;
  LOG_JOB_NOT_ACTIVE,			// cpu_terminate but job not active, absurd&lt;br /&gt;
  LOG_JOB_NOT_FREE,				// job guarded but not free&lt;br /&gt;
  LOG_JOBS_INC_FAILED, 			// pending jobs increment failed&lt;br /&gt;
  LOG_JOB_NOT_GUARDED,			// paranoia&lt;br /&gt;
  LOG_CS_LOG_SPIN_FAIL,			// oceos_CPU_sleep, trying to update CS log&lt;br /&gt;
  LOG_MUTEX_ALREADY_HELD,		// oceos_mutex_wait, code returned, not needed&lt;br /&gt;
  LOG_MUTEX_INCORRECT_ORDER,	// oceos_mutex_wait&lt;br /&gt;
  LOG_MUTEX_EXIT_HOLDING,		// task exits holding one or more mutexes&lt;br /&gt;
  LOG_MUTEX_EXIT_NONE,			// __oceos_tasks_remove_mutexes called but no mutex held&lt;br /&gt;
  LOG_SEMAPHORE_PENDING_REMOVE_FAIL,	// timed_action.c&lt;br /&gt;
  LOG_SEMAPHORE_PENDING_QUEUE_FULL,		// __oceos_semaphore_add_pend&lt;br /&gt;
  LOG_SEMAPHORE_SPIN_FAILED,			// trying to access semaphore&lt;br /&gt;
  LOG_DATAQ_PENDING_QUEUE_FULL,&lt;br /&gt;
  LOG_DATAQ_PENDING_REMOVE_FAIL,&lt;br /&gt;
  LOG_DATAQ_SPIN_FAILED,&lt;br /&gt;
  LOG_TIMED_ACTION_TIMER_NULL,&lt;br /&gt;
  LOG_TIMED_ACTION_INVALID,&lt;br /&gt;
  LOG_TIMED_ACTION_BAD_INDEX,&lt;br /&gt;
  LOG_TIMED_ACTION_MISSED,&lt;br /&gt;
  LOG_TIMED_ACTION_Q_EMPTY,&lt;br /&gt;
  LOG_TIMED_ACTION_REMOVE_FAIL,&lt;br /&gt;
  LOG_TIMED_ACTION_BAD_JOB_ID,&lt;br /&gt;
  LOG_TIMED_Q_SPIN_FAIL,&lt;br /&gt;
  LOG_SYSTEM_ERROR,&lt;br /&gt;
  LOG_ATOMICINC_FAILED,&lt;br /&gt;
  LOG_PENDING_PRI_UPDATE_FAILED,&lt;br /&gt;
  LOG_KILL_TASK_INVALID_ID,      // Tried to kill task with invalid ID&lt;br /&gt;
  LOG_OCEOS_EXIT_REQUEST,         // oceos_exit command was called&lt;br /&gt;
  LOG_RWMUTEX_NOT_RETURNED,&lt;br /&gt;
  LOG_RWMUTEX_NOT_HIGHEST&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
/*****************************************************************************&lt;br /&gt;
 * Structures&lt;br /&gt;
 */&lt;br /&gt;
/**&lt;br /&gt;
 * Log entry structure&lt;br /&gt;
 */&lt;br /&gt;
struct log_entry{&lt;br /&gt;
  U64_t             time64;&lt;br /&gt;
&lt;br /&gt;
  unsigned int      entry_cpu          :8;&lt;br /&gt;
  unsigned int      entry_type         :8;&lt;br /&gt;
  unsigned int      entry_note         :16;	// not used at present&lt;br /&gt;
&lt;br /&gt;
  U32_t             entry_comment;&lt;br /&gt;
}__attribute__ ((aligned (8)));&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_log_add_entry()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''system_log.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function adds an entry to the log. The entry overwrites the oldest unread entry if the log is full.&lt;br /&gt;
Custom log entries can be added to enum LOG_ENTRY from 0 to 128.&lt;br /&gt;
The indices are incremented in a circular fashion. If the write index reaches the read_index the read index is moved on, as read and write indices equal would indicate an empty log.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Add an entry to the log.&lt;br /&gt;
 * this overwrites the oldest unread entry if the log is full.&lt;br /&gt;
 * Custom log entries can be added to enum LOG_ENTRY from 0 to 128&lt;br /&gt;
 *&lt;br /&gt;
 * N.B. The indices are incremented in a circular fashion.&lt;br /&gt;
 *      If the write index reaches the read_index the read index is moved on,&lt;br /&gt;
 *      as read and write indices equal would indicate an empty log.&lt;br /&gt;
 *&lt;br /&gt;
 * @param type  enum LOG_ENTRY_TYPE&lt;br /&gt;
 * @param info  extra information to be logged&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_LOG_CORRUPT         System Log area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Log directive called in wrong phase; can be used after oceos_init() called&lt;br /&gt;
 *          ERR_ID_INVALID              Log type invalid&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to acquire log guard&lt;br /&gt;
 *          ERR_LOG_INDEX_WRONG         Read/write log index is wrong&lt;br /&gt;
 */&lt;br /&gt;
S32_t   oceos_log_add_entry(&lt;br /&gt;
    enum LOG_ENTRY_TYPE type,   // 8 bits enum LOG_ENTRY_TYPE&lt;br /&gt;
    const U32_t        info     // information&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| enum LOG_ENTRY_TYPE || Log entry type (see previous section for a list)&lt;br /&gt;
|-&lt;br /&gt;
| info | U32_t with the log information&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit  !! Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_LOG_CORRUPT         || System Log area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Log directive called in wrong phase; can be used after oceos_init() called&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || Log type invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to acquire log guard&lt;br /&gt;
|-&lt;br /&gt;
| ERR_LOG_INDEX_WRONG         || Read/write log index is wrong&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, info;&lt;br /&gt;
...&lt;br /&gt;
// Log LOG_APP_COMMS__ERROR (defined in enum LOG_ENTRY_TYPE) and info with more details&lt;br /&gt;
status = oceos_log_add_entry(LOG_APP_COMMS__ERROR, info);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_log_get_indexed_entry()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''system_log.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the entry at the specified position in the log. The entry is not removed and the log and log indices are not changed.&lt;br /&gt;
One use of this function is to allow the log be examined after a reset.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Returns the entry at the specified position in the log.&lt;br /&gt;
 * The entry is not removed and the log and log indices are not changed.&lt;br /&gt;
 * (intended to allow the log be examined for example after reset)&lt;br /&gt;
 *&lt;br /&gt;
 * @param index         position in the log&lt;br /&gt;
 * @param outputPtr     pointer to return log entry&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_LOG_CORRUPT         System Log area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Log directive called in wrong phase; can be used after oceos_init() called&lt;br /&gt;
 *          ERR_LOG_INDEX_WRONG         Read log index is wrong&lt;br /&gt;
 *          ERR_LOG_DATA_PTR_BAD        Data holder pointer is null&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_log_get_indexed_entry(&lt;br /&gt;
    const unsigned int index,&lt;br /&gt;
    struct log_entry * const outputPtr&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| index || U32_t with position in the log&lt;br /&gt;
|-&lt;br /&gt;
| outputPtr || pointer to struct log_entry to hold the returned entry&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_LOG_CORRUPT         || System Log area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Log directive called in wrong phase; can be used after oceos_init() called&lt;br /&gt;
|-&lt;br /&gt;
| ERR_LOG_INDEX_WRONG         || Read log index is wrong&lt;br /&gt;
|-&lt;br /&gt;
| ERR_LOG_DATA_PTR_BAD        || Data holder pointer is null&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, index;&lt;br /&gt;
struct log_entry store_entry;&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
// Read log_entry at specified index into outputPtr&lt;br /&gt;
status = oceos_log_get_indexed_entry(index, &amp;amp;store_entry);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_log_remove_entry()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''system_log.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function reads and removes the oldest unread log entry. &lt;br /&gt;
If the log is not empty use the entry at the read index to update the value at the output pointer, returning OCEOS_SUCCESS.&lt;br /&gt;
If outputPtr is NULL, entry is removed but no returned.&lt;br /&gt;
If the log is empty, set the value at the output pointer to LOG_LOG_NOT_VALID_ENTRY and return ERR_LOG_EMPTY.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Read and remove the oldest unread log entry&lt;br /&gt;
 *&lt;br /&gt;
 * If the log is not empty use the entry at the read index to update the value&lt;br /&gt;
 * at the output pointer, returning OCEOS_SUCCESS.&lt;br /&gt;
 *&lt;br /&gt;
 * If outputPtr is NULL, entry is removed but no returned&lt;br /&gt;
 *&lt;br /&gt;
 * If the log is empty, set the value at the output pointer to LOG_LOG_NOT_VALID_ENTRY&lt;br /&gt;
 * and return ERR_LOG_EMPTY&lt;br /&gt;
 *&lt;br /&gt;
 * @param outputPtr   pointer to struct log_entry&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_LOG_CORRUPT         System Log area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Log directive called in wrong phase; can be used after oceos_init() called&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to acquire log guard&lt;br /&gt;
 *          ERR_LOG_INDEX_WRONG         Read/write log index is wrong&lt;br /&gt;
 *          ERR_LOG_EMPTY               Log is empty&lt;br /&gt;
 */&lt;br /&gt;
S32_t   oceos_log_remove_entry(&lt;br /&gt;
    struct log_entry * const outputPtr&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| outputPtr || pointer to struct log_entry&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit  !! Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_LOG_CORRUPT         || System Log area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Log directive called in wrong phase; can be used after oceos_init() called&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to acquire log guard&lt;br /&gt;
|-&lt;br /&gt;
| ERR_LOG_INDEX_WRONG         || Read/write log index is wrong&lt;br /&gt;
|-&lt;br /&gt;
| ERR_LOG_EMPTY               || Log is empty&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
struct log_entry *outputPtr;&lt;br /&gt;
...&lt;br /&gt;
// Read log_entry into outputPtr and remove the oldest unread log entry&lt;br /&gt;
status = oceos_log_remove_entry(outputPtr);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_log_reset()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''system_log.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function sets all log entries to LOG_LOG_NOT_VALID_ENTRY and the log to empty, with the read and write indices set to 0.&lt;br /&gt;
The log is empty if the index of the next write is the same as the index of the next read. It does not affect the system status variable. It does not affect the context switch log.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * oceos_log_reset()&lt;br /&gt;
 *&lt;br /&gt;
 * Set all log entries to LOG_LOG_NOT_VALID_ENTRY and the log to empty, with the&lt;br /&gt;
 * read and write indices set to 0. and function called flag 0&lt;br /&gt;
 *&lt;br /&gt;
 * The log is empty if the index of the next write&lt;br /&gt;
 * is the same as the index of the next read.&lt;br /&gt;
 *&lt;br /&gt;
 * Does not affect the system status variable&lt;br /&gt;
 * Does not affect the context switch log&lt;br /&gt;
 *&lt;br /&gt;
 * N.B The fixed data area may no longer be writable&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_LOG_CORRUPT         System Log area corrupt; reset failed&lt;br /&gt;
 *          ERR_WRONG_PHASE             Log directive called in wrong phase; can be used after oceos_init() called&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to acquire log guard&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_log_reset(void);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
There are no input parameters to this function.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit  !! Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_LOG_CORRUPT         || System Log area corrupt; reset failed&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Log directive called in wrong phase; can be used after oceos_init() called&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to acquire log guard&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
// Clear down the system log&lt;br /&gt;
status = oceos_log_reset();&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_log_get_size()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''system_log.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the number of entries in the log according to the current values of the read and write indices.&lt;br /&gt;
The value will be zero if the current values of the read and write indices are the same. There may still be useful information in the log, e.g. after system reset, this can be accessed using oceos_log_get_indexed_entry().&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Return the number of entries in the log&lt;br /&gt;
 * according to the current values of the read and write indices.&lt;br /&gt;
 *&lt;br /&gt;
 * The value will be zero if the current values of the read and write indices&lt;br /&gt;
 * are the same.&lt;br /&gt;
 *&lt;br /&gt;
 * There may still be useful information in the log, e.g. after system reset,&lt;br /&gt;
 * this can be accessed using oceos_log_get_indexed_entry()&lt;br /&gt;
 *&lt;br /&gt;
 * @param l_size        pointer to log size holder&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_LOG_CORRUPT         System Log area corrupt;&lt;br /&gt;
 *          ERR_WRONG_PHASE             Log directive called in wrong phase; can be used after oceos_init() called&lt;br /&gt;
 *          ERR_LOG_DATA_PTR_BAD        Pointer to log size holder is NULL&lt;br /&gt;
 *          ERR_LOG_INDEX_WRONG         Read/write log index is wrong&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_log_get_size(&lt;br /&gt;
    U32_t *l_size&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| l_size|| U32_t pointer where size will be written.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_LOG_CORRUPT         || System Log area corrupt;&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Log directive called in wrong phase; can be used after oceos_init() called&lt;br /&gt;
|-&lt;br /&gt;
| ERR_LOG_DATA_PTR_BAD        || Pointer to log size holder is NULL&lt;br /&gt;
|-&lt;br /&gt;
| ERR_LOG_INDEX_WRONG         || Read/write log index is wrong&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, size;&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
// Clear down the system log&lt;br /&gt;
status = oceos_log_get_size(&amp;amp;size);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;System State Variable and System State Mask&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The System State variable provides a record of anomalies or problems detected by OCEOSmp's automatic consistency checks. An application handler for these can be set to be called automatically.&lt;br /&gt;
&lt;br /&gt;
An anomaly or problem results in a flag bit being set in the 32-bit word used to store the system state variable. The flags are identified below.&lt;br /&gt;
&lt;br /&gt;
All flags are reset to zero by oceos_init() when OCEOSmp is initialised, and may also be reset by the application using the directive provided.&lt;br /&gt;
&lt;br /&gt;
To provide a record across OCEOSmp restarts a copy is updated automatically whenever the state variable is updated. This is not cleared by oceos_init() but may be cleared by the application using a directive.&lt;br /&gt;
&lt;br /&gt;
Application software can define a problem handling function to be called automatically when specified system state flags are set. The flags are specified by setting the corresponding bits in the system state mask. The function and the state mask are defined in the system configuration.&lt;br /&gt;
&lt;br /&gt;
Changing a state flag from clear to set results in the function being called (if defined). Subsequent settings of that flag have no effect until after it has been cleared using the directive provided.&lt;br /&gt;
&lt;br /&gt;
N.B. In many cases when OCEOSmp sets a System State flag it also makes an entry in the system log that provides further information.&lt;br /&gt;
&lt;br /&gt;
SYSTEM STATE VARIABLE FLAGS&lt;br /&gt;
&lt;br /&gt;
These flags are updated by OCEOSmp using inclusive 'OR' when a consistency check detects a problem or anomaly. A copy of the system state variable is updated also and accumulates a record of flag settings that is preserved across restarts of OCEOSmp. OCEOSmp restarts reset the system state variable but not the copy.&lt;br /&gt;
&lt;br /&gt;
Resetting the state variables is the responsibility of the application (except for the state variable reset done when OCEOSmp is restarted).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''System Status Bits'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
#define  STATUS_NORMAL                    0u    // No flag set                              YES&lt;br /&gt;
#define  STATUS_INVALID          0xffffffffu    // System status is invalid                 YES BUT NO DETAIL!!!&lt;br /&gt;
&lt;br /&gt;
#define  STATUS_MASK_NORMAL      0xffffffffu    // Always call user def fn                  YES&lt;br /&gt;
&lt;br /&gt;
/* Task related problems */&lt;br /&gt;
#define  STATUS_DISABLED_TASK_START    0x1U    // An attempt to start a disabled task&lt;br /&gt;
#define  STATUS_TASK_JOB_LIMIT_OVER    0x2U    // An attempt to execute a task when its jobs limit is already reached.&lt;br /&gt;
#define  STATUS_JOB_OVER_TIME          0x4U    // Job time from creation to completion exceeds allowed maximum for task. YES&lt;br /&gt;
#define  STATUS_JOB_INTERVAL_SHORT     0x8U    // Minimum time between job creations is less than the allowed minimum for task&lt;br /&gt;
#define  STATUS_READYQ_FULL           0x10U    // Ready queue unable to accept job as result of being full&lt;br /&gt;
#define  STATUS_READYQ_NO_REMOVE      0x20U    // Remove job from ready queue failed&lt;br /&gt;
&lt;br /&gt;
/* Mutex related problems */&lt;br /&gt;
#define  STATUS_MUTEX_ALREADY_HELD    0x40U    // Mutex wait() when mutex already held&lt;br /&gt;
#define  STATUS_MUTEX_NOT_HELD        0x80U    // Mutex signal() when not already held&lt;br /&gt;
#define  STATUS_MUTEX_NOT_RETURNED   0x100U    // Mutex not returned before job terminates&lt;br /&gt;
#define  STATUS_MUTEX_NOT_NESTED     0x200U    // Use of multiple mutexes not nested&lt;br /&gt;
&lt;br /&gt;
/* Counting semaphore and data queue related problems */&lt;br /&gt;
#define  STATUS_SEMAPHORE_JOBS_FULL  0x400U    // Attempt to add job to semaphore pending list when list full&lt;br /&gt;
#define  STATUS_DATAQ_JOBS_FULL      0x800U    // Attempt to add job to data queue pending list when list full&lt;br /&gt;
#define  STATUS_DATAQ_FULL          0x1000U    // Data queue write when queue already full&lt;br /&gt;
&lt;br /&gt;
/* Timed actions related problems */&lt;br /&gt;
#define  STATUS_TIMED_JOBS_FULL     0x2000U    // Timed actions queue already full for timed task start&lt;br /&gt;
#define  STATUS_TIMED_OUTPUT_FULL   0x4000U    // Timed actions queue already full for timed output&lt;br /&gt;
#define  STATUS_TIMED_ACTION_LATE   0x8000U    // Timed action late                          YES&lt;br /&gt;
&lt;br /&gt;
/* Default trap handler should have been replaced&lt;br /&gt;
 * NOT USED AT THE MOMENT*/&lt;br /&gt;
#define  STATUS_SYSTEM_ERROR       0x10000U    // ERROR was handled by default trap handler  YES&lt;br /&gt;
&lt;br /&gt;
/* Flag to indicate problem with Stack Pointer&lt;br /&gt;
 * NOT USED AT THE MOMENT*/&lt;br /&gt;
#define  STATUS_SP_WARNING         0x20000U    // SP not in expected range&lt;br /&gt;
/* Log system error */&lt;br /&gt;
#define  STATUS_BAD_LOG            0x40000U    // System log problem&lt;br /&gt;
#define  STATUS_SPIN_FAILED        0x80000U    // Get SPIN lock failed&lt;br /&gt;
/* Not using next few bits */&lt;br /&gt;
&lt;br /&gt;
/* Will have to exit */&lt;br /&gt;
#define  STATUS_BAD_SENTINEL     0x40000000U    // Area sentinel corrupt&lt;br /&gt;
#define  STATUS_BAD_META_PTR     0x80000000U    // Null meta pointer&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;blank_function()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''header.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function does xyz...&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t oceosmp_blank(&lt;br /&gt;
    U32_t param&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| param || parameter to function&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit  !! Description&lt;br /&gt;
|-&lt;br /&gt;
| Error_name|| description&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, param;&lt;br /&gt;
...&lt;br /&gt;
// Do xyz&lt;br /&gt;
status = oceosmp_blank(param));&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:backup]]&lt;/div&gt;</summary>
		<author><name>Bkavanagh</name></author>
	</entry>
	<entry>
		<id>https://wiki.ocetechnology.com/mediawiki/index.php?title=OCEOSmp/blank&amp;diff=1671</id>
		<title>OCEOSmp/blank</title>
		<link rel="alternate" type="text/html" href="https://wiki.ocetechnology.com/mediawiki/index.php?title=OCEOSmp/blank&amp;diff=1671"/>
		<updated>2024-05-03T08:38:18Z</updated>

		<summary type="html">&lt;p&gt;Bkavanagh: /* oceos_log_remove_entry() */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Next Section ==&lt;br /&gt;
&lt;br /&gt;
== Logging directives ==&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;Introduction&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Log Area Features  (for details of other areas see oceos_areas.h)&lt;br /&gt;
&lt;br /&gt;
The system log area holds the system log and the records of the present and previous values of the system state variable.&lt;br /&gt;
&lt;br /&gt;
It is set up initially as an array of 32-bit words that starts at a 32-bit aligned address provided by the application developer.&lt;br /&gt;
&lt;br /&gt;
It is recommended that this address be in non-volatile RAM memory if this is available to allow information be preserved across power-up cycles.&lt;br /&gt;
&lt;br /&gt;
OCEOS preserves log area information across resets as far as possible.&lt;br /&gt;
&lt;br /&gt;
The system log itself is a circular buffer of struct log entry. Older entries are overwritten by new entries once all entries are in use.&lt;br /&gt;
&lt;br /&gt;
The application developer can specify a function to be called when 3/4 of log entries are in use. This function is called again only after 3/4 of log entries have been read and the log has again become 3/4 full.&lt;br /&gt;
&lt;br /&gt;
The read and write indices are stored in the log area and if equal indicate that the log is empty.&lt;br /&gt;
&lt;br /&gt;
As with other OCEOS data areas, the log area starts with a header&lt;br /&gt;
*a 32-bit word holding a constant OCEOS_VERSION&lt;br /&gt;
*a 32-bit word holding the log area size in 32-bit words&lt;br /&gt;
*a 32-bit word, the system status variable&lt;br /&gt;
*a 32-bit word, the system status mask&lt;br /&gt;
*a 32-bit word, the accumulated system status&lt;br /&gt;
*a 32-bit word, the previous system status mask&lt;br /&gt;
*a 32-bit word, the log control, that gives whether the log full function was called&lt;br /&gt;
*the read index&lt;br /&gt;
*the write index&lt;br /&gt;
*an array of struct log_entry making up the system log itself&lt;br /&gt;
*ending with a 32-bit constant END_SENTINEL&lt;br /&gt;
&lt;br /&gt;
The system fixed meta structure at sysMetaPtr provides&lt;br /&gt;
&lt;br /&gt;
*system_log_ptr      the start address of the log area&lt;br /&gt;
*logEntries          the number of log entries&lt;br /&gt;
*logCreated          flag indicating log was created successfully&lt;br /&gt;
*logFullFunction     user defined function, called when the log becomes 3/4 full (or NULL if not used)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Log Entry Types and Structure'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/*****************************************************************************&lt;br /&gt;
 * LOG ENTRY TYPES&lt;br /&gt;
 *&lt;br /&gt;
 * A log entry type is an 8-bit number.&lt;br /&gt;
 * Values from 0 to 127 can be defined by the application.&lt;br /&gt;
 * Values from 128 to 255 are used by OCEOS as below.&lt;br /&gt;
 *&lt;br /&gt;
 *&lt;br /&gt;
 * NOTE: Add new log types at the end for backward compatibility&lt;br /&gt;
 */&lt;br /&gt;
enum LOG_ENTRY_TYPE{&lt;br /&gt;
  LOG_SYS_OK = 0x80U,&lt;br /&gt;
  LOG_OCEOS_ABORT,				// when exiting from oceos_start&lt;br /&gt;
  LOG_LOG_NOT_VALID_ENTRY,		// used to initialise log and when log empty&lt;br /&gt;
  LOG_INIT_TASK_START_FAIL,		// initial task passed to oceos_start failed&lt;br /&gt;
  LOG_DEADLINE_MISSED,			// task deadline missed&lt;br /&gt;
  LOG_JOB_NOT_ACTIVE,			// cpu_terminate but job not active, absurd&lt;br /&gt;
  LOG_JOB_NOT_FREE,				// job guarded but not free&lt;br /&gt;
  LOG_JOBS_INC_FAILED, 			// pending jobs increment failed&lt;br /&gt;
  LOG_JOB_NOT_GUARDED,			// paranoia&lt;br /&gt;
  LOG_CS_LOG_SPIN_FAIL,			// oceos_CPU_sleep, trying to update CS log&lt;br /&gt;
  LOG_MUTEX_ALREADY_HELD,		// oceos_mutex_wait, code returned, not needed&lt;br /&gt;
  LOG_MUTEX_INCORRECT_ORDER,	// oceos_mutex_wait&lt;br /&gt;
  LOG_MUTEX_EXIT_HOLDING,		// task exits holding one or more mutexes&lt;br /&gt;
  LOG_MUTEX_EXIT_NONE,			// __oceos_tasks_remove_mutexes called but no mutex held&lt;br /&gt;
  LOG_SEMAPHORE_PENDING_REMOVE_FAIL,	// timed_action.c&lt;br /&gt;
  LOG_SEMAPHORE_PENDING_QUEUE_FULL,		// __oceos_semaphore_add_pend&lt;br /&gt;
  LOG_SEMAPHORE_SPIN_FAILED,			// trying to access semaphore&lt;br /&gt;
  LOG_DATAQ_PENDING_QUEUE_FULL,&lt;br /&gt;
  LOG_DATAQ_PENDING_REMOVE_FAIL,&lt;br /&gt;
  LOG_DATAQ_SPIN_FAILED,&lt;br /&gt;
  LOG_TIMED_ACTION_TIMER_NULL,&lt;br /&gt;
  LOG_TIMED_ACTION_INVALID,&lt;br /&gt;
  LOG_TIMED_ACTION_BAD_INDEX,&lt;br /&gt;
  LOG_TIMED_ACTION_MISSED,&lt;br /&gt;
  LOG_TIMED_ACTION_Q_EMPTY,&lt;br /&gt;
  LOG_TIMED_ACTION_REMOVE_FAIL,&lt;br /&gt;
  LOG_TIMED_ACTION_BAD_JOB_ID,&lt;br /&gt;
  LOG_TIMED_Q_SPIN_FAIL,&lt;br /&gt;
  LOG_SYSTEM_ERROR,&lt;br /&gt;
  LOG_ATOMICINC_FAILED,&lt;br /&gt;
  LOG_PENDING_PRI_UPDATE_FAILED,&lt;br /&gt;
  LOG_KILL_TASK_INVALID_ID,      // Tried to kill task with invalid ID&lt;br /&gt;
  LOG_OCEOS_EXIT_REQUEST,         // oceos_exit command was called&lt;br /&gt;
  LOG_RWMUTEX_NOT_RETURNED,&lt;br /&gt;
  LOG_RWMUTEX_NOT_HIGHEST&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
/*****************************************************************************&lt;br /&gt;
 * Structures&lt;br /&gt;
 */&lt;br /&gt;
/**&lt;br /&gt;
 * Log entry structure&lt;br /&gt;
 */&lt;br /&gt;
struct log_entry{&lt;br /&gt;
  U64_t             time64;&lt;br /&gt;
&lt;br /&gt;
  unsigned int      entry_cpu          :8;&lt;br /&gt;
  unsigned int      entry_type         :8;&lt;br /&gt;
  unsigned int      entry_note         :16;	// not used at present&lt;br /&gt;
&lt;br /&gt;
  U32_t             entry_comment;&lt;br /&gt;
}__attribute__ ((aligned (8)));&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_log_add_entry()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''system_log.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function adds an entry to the log. The entry overwrites the oldest unread entry if the log is full.&lt;br /&gt;
Custom log entries can be added to enum LOG_ENTRY from 0 to 128.&lt;br /&gt;
The indices are incremented in a circular fashion. If the write index reaches the read_index the read index is moved on, as read and write indices equal would indicate an empty log.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Add an entry to the log.&lt;br /&gt;
 * this overwrites the oldest unread entry if the log is full.&lt;br /&gt;
 * Custom log entries can be added to enum LOG_ENTRY from 0 to 128&lt;br /&gt;
 *&lt;br /&gt;
 * N.B. The indices are incremented in a circular fashion.&lt;br /&gt;
 *      If the write index reaches the read_index the read index is moved on,&lt;br /&gt;
 *      as read and write indices equal would indicate an empty log.&lt;br /&gt;
 *&lt;br /&gt;
 * @param type  enum LOG_ENTRY_TYPE&lt;br /&gt;
 * @param info  extra information to be logged&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_LOG_CORRUPT         System Log area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Log directive called in wrong phase; can be used after oceos_init() called&lt;br /&gt;
 *          ERR_ID_INVALID              Log type invalid&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to acquire log guard&lt;br /&gt;
 *          ERR_LOG_INDEX_WRONG         Read/write log index is wrong&lt;br /&gt;
 */&lt;br /&gt;
S32_t   oceos_log_add_entry(&lt;br /&gt;
    enum LOG_ENTRY_TYPE type,   // 8 bits enum LOG_ENTRY_TYPE&lt;br /&gt;
    const U32_t        info     // information&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| enum LOG_ENTRY_TYPE || Log entry type (see previous section for a list)&lt;br /&gt;
|-&lt;br /&gt;
| info | U32_t with the log information&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit  !! Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_LOG_CORRUPT         || System Log area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Log directive called in wrong phase; can be used after oceos_init() called&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || Log type invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to acquire log guard&lt;br /&gt;
|-&lt;br /&gt;
| ERR_LOG_INDEX_WRONG         || Read/write log index is wrong&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, info;&lt;br /&gt;
...&lt;br /&gt;
// Log LOG_APP_COMMS__ERROR (defined in enum LOG_ENTRY_TYPE) and info with more details&lt;br /&gt;
status = oceos_log_add_entry(LOG_APP_COMMS__ERROR, info);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_log_get_indexed_entry()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''system_log.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns the entry at the specified position in the log. The entry is not removed and the log and log indices are not changed.&lt;br /&gt;
One use of this function is to allow the log be examined after a reset.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Returns the entry at the specified position in the log.&lt;br /&gt;
 * The entry is not removed and the log and log indices are not changed.&lt;br /&gt;
 * (intended to allow the log be examined for example after reset)&lt;br /&gt;
 *&lt;br /&gt;
 * @param index         position in the log&lt;br /&gt;
 * @param outputPtr     pointer to return log entry&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_LOG_CORRUPT         System Log area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Log directive called in wrong phase; can be used after oceos_init() called&lt;br /&gt;
 *          ERR_LOG_INDEX_WRONG         Read log index is wrong&lt;br /&gt;
 *          ERR_LOG_DATA_PTR_BAD        Data holder pointer is null&lt;br /&gt;
 */&lt;br /&gt;
S32_t oceos_log_get_indexed_entry(&lt;br /&gt;
    const unsigned int index,&lt;br /&gt;
    struct log_entry * const outputPtr&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| index || U32_t with position in the log&lt;br /&gt;
|-&lt;br /&gt;
| outputPtr || pointer to struct log_entry to hold the returned entry&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_LOG_CORRUPT         || System Log area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Log directive called in wrong phase; can be used after oceos_init() called&lt;br /&gt;
|-&lt;br /&gt;
| ERR_LOG_INDEX_WRONG         || Read log index is wrong&lt;br /&gt;
|-&lt;br /&gt;
| ERR_LOG_DATA_PTR_BAD        || Data holder pointer is null&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, index;&lt;br /&gt;
struct log_entry store_entry;&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
// Read log_entry at specified index into outputPtr&lt;br /&gt;
status = oceos_log_get_indexed_entry(index, &amp;amp;store_entry);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_log_remove_entry()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''system_log.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function reads and removes the oldest unread log entry. &lt;br /&gt;
If the log is not empty use the entry at the read index to update the value at the output pointer, returning OCEOS_SUCCESS.&lt;br /&gt;
If outputPtr is NULL, entry is removed but no returned.&lt;br /&gt;
If the log is empty, set the value at the output pointer to LOG_LOG_NOT_VALID_ENTRY and return ERR_LOG_EMPTY.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Read and remove the oldest unread log entry&lt;br /&gt;
 *&lt;br /&gt;
 * If the log is not empty use the entry at the read index to update the value&lt;br /&gt;
 * at the output pointer, returning OCEOS_SUCCESS.&lt;br /&gt;
 *&lt;br /&gt;
 * If outputPtr is NULL, entry is removed but no returned&lt;br /&gt;
 *&lt;br /&gt;
 * If the log is empty, set the value at the output pointer to LOG_LOG_NOT_VALID_ENTRY&lt;br /&gt;
 * and return ERR_LOG_EMPTY&lt;br /&gt;
 *&lt;br /&gt;
 * @param outputPtr   pointer to struct log_entry&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_LOG_CORRUPT         System Log area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Log directive called in wrong phase; can be used after oceos_init() called&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to acquire log guard&lt;br /&gt;
 *          ERR_LOG_INDEX_WRONG         Read/write log index is wrong&lt;br /&gt;
 *          ERR_LOG_EMPTY               Log is empty&lt;br /&gt;
 */&lt;br /&gt;
S32_t   oceos_log_remove_entry(&lt;br /&gt;
    struct log_entry * const outputPtr&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| outputPtr || pointer to struct log_entry&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit  !! Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_LOG_CORRUPT         || System Log area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Log directive called in wrong phase; can be used after oceos_init() called&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to acquire log guard&lt;br /&gt;
|-&lt;br /&gt;
| ERR_LOG_INDEX_WRONG         || Read/write log index is wrong&lt;br /&gt;
|-&lt;br /&gt;
| ERR_LOG_EMPTY               || Log is empty&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
struct log_entry *outputPtr;&lt;br /&gt;
...&lt;br /&gt;
// Read log_entry into outputPtr and remove the oldest unread log entry&lt;br /&gt;
status = oceos_log_remove_entry(LOG_APP_COMMS__ERROR, info);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;blank_function()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''header.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function does xyz...&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t oceosmp_blank(&lt;br /&gt;
    U32_t param&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| param || parameter to function&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit  !! Description&lt;br /&gt;
|-&lt;br /&gt;
| Error_name|| description&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, param;&lt;br /&gt;
...&lt;br /&gt;
// Do xyz&lt;br /&gt;
status = oceosmp_blank(param));&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:backup]]&lt;/div&gt;</summary>
		<author><name>Bkavanagh</name></author>
	</entry>
	<entry>
		<id>https://wiki.ocetechnology.com/mediawiki/index.php?title=OCEOSmp/blank&amp;diff=1670</id>
		<title>OCEOSmp/blank</title>
		<link rel="alternate" type="text/html" href="https://wiki.ocetechnology.com/mediawiki/index.php?title=OCEOSmp/blank&amp;diff=1670"/>
		<updated>2024-05-02T17:03:41Z</updated>

		<summary type="html">&lt;p&gt;Bkavanagh: /* blank_function() */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Next Section ==&lt;br /&gt;
&lt;br /&gt;
== Logging directives ==&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;Introduction&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Log Area Features  (for details of other areas see oceos_areas.h)&lt;br /&gt;
&lt;br /&gt;
The system log area holds the system log and the records of the present and previous values of the system state variable.&lt;br /&gt;
&lt;br /&gt;
It is set up initially as an array of 32-bit words that starts at a 32-bit aligned address provided by the application developer.&lt;br /&gt;
&lt;br /&gt;
It is recommended that this address be in non-volatile RAM memory if this is available to allow information be preserved across power-up cycles.&lt;br /&gt;
&lt;br /&gt;
OCEOS preserves log area information across resets as far as possible.&lt;br /&gt;
&lt;br /&gt;
The system log itself is a circular buffer of struct log entry. Older entries are overwritten by new entries once all entries are in use.&lt;br /&gt;
&lt;br /&gt;
The application developer can specify a function to be called when 3/4 of log entries are in use. This function is called again only after 3/4 of log entries have been read and the log has again become 3/4 full.&lt;br /&gt;
&lt;br /&gt;
The read and write indices are stored in the log area and if equal indicate that the log is empty.&lt;br /&gt;
&lt;br /&gt;
As with other OCEOS data areas, the log area starts with a header&lt;br /&gt;
*a 32-bit word holding a constant OCEOS_VERSION&lt;br /&gt;
*a 32-bit word holding the log area size in 32-bit words&lt;br /&gt;
*a 32-bit word, the system status variable&lt;br /&gt;
*a 32-bit word, the system status mask&lt;br /&gt;
*a 32-bit word, the accumulated system status&lt;br /&gt;
*a 32-bit word, the previous system status mask&lt;br /&gt;
*a 32-bit word, the log control, that gives whether the log full function was called&lt;br /&gt;
*the read index&lt;br /&gt;
*the write index&lt;br /&gt;
*an array of struct log_entry making up the system log itself&lt;br /&gt;
*ending with a 32-bit constant END_SENTINEL&lt;br /&gt;
&lt;br /&gt;
The system fixed meta structure at sysMetaPtr provides&lt;br /&gt;
&lt;br /&gt;
*system_log_ptr      the start address of the log area&lt;br /&gt;
*logEntries          the number of log entries&lt;br /&gt;
*logCreated          flag indicating log was created successfully&lt;br /&gt;
*logFullFunction     user defined function, called when the log becomes 3/4 full (or NULL if not used)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Log Entry Types and Structure'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/*****************************************************************************&lt;br /&gt;
 * LOG ENTRY TYPES&lt;br /&gt;
 *&lt;br /&gt;
 * A log entry type is an 8-bit number.&lt;br /&gt;
 * Values from 0 to 127 can be defined by the application.&lt;br /&gt;
 * Values from 128 to 255 are used by OCEOS as below.&lt;br /&gt;
 *&lt;br /&gt;
 *&lt;br /&gt;
 * NOTE: Add new log types at the end for backward compatibility&lt;br /&gt;
 */&lt;br /&gt;
enum LOG_ENTRY_TYPE{&lt;br /&gt;
  LOG_SYS_OK = 0x80U,&lt;br /&gt;
  LOG_OCEOS_ABORT,				// when exiting from oceos_start&lt;br /&gt;
  LOG_LOG_NOT_VALID_ENTRY,		// used to initialise log and when log empty&lt;br /&gt;
  LOG_INIT_TASK_START_FAIL,		// initial task passed to oceos_start failed&lt;br /&gt;
  LOG_DEADLINE_MISSED,			// task deadline missed&lt;br /&gt;
  LOG_JOB_NOT_ACTIVE,			// cpu_terminate but job not active, absurd&lt;br /&gt;
  LOG_JOB_NOT_FREE,				// job guarded but not free&lt;br /&gt;
  LOG_JOBS_INC_FAILED, 			// pending jobs increment failed&lt;br /&gt;
  LOG_JOB_NOT_GUARDED,			// paranoia&lt;br /&gt;
  LOG_CS_LOG_SPIN_FAIL,			// oceos_CPU_sleep, trying to update CS log&lt;br /&gt;
  LOG_MUTEX_ALREADY_HELD,		// oceos_mutex_wait, code returned, not needed&lt;br /&gt;
  LOG_MUTEX_INCORRECT_ORDER,	// oceos_mutex_wait&lt;br /&gt;
  LOG_MUTEX_EXIT_HOLDING,		// task exits holding one or more mutexes&lt;br /&gt;
  LOG_MUTEX_EXIT_NONE,			// __oceos_tasks_remove_mutexes called but no mutex held&lt;br /&gt;
  LOG_SEMAPHORE_PENDING_REMOVE_FAIL,	// timed_action.c&lt;br /&gt;
  LOG_SEMAPHORE_PENDING_QUEUE_FULL,		// __oceos_semaphore_add_pend&lt;br /&gt;
  LOG_SEMAPHORE_SPIN_FAILED,			// trying to access semaphore&lt;br /&gt;
  LOG_DATAQ_PENDING_QUEUE_FULL,&lt;br /&gt;
  LOG_DATAQ_PENDING_REMOVE_FAIL,&lt;br /&gt;
  LOG_DATAQ_SPIN_FAILED,&lt;br /&gt;
  LOG_TIMED_ACTION_TIMER_NULL,&lt;br /&gt;
  LOG_TIMED_ACTION_INVALID,&lt;br /&gt;
  LOG_TIMED_ACTION_BAD_INDEX,&lt;br /&gt;
  LOG_TIMED_ACTION_MISSED,&lt;br /&gt;
  LOG_TIMED_ACTION_Q_EMPTY,&lt;br /&gt;
  LOG_TIMED_ACTION_REMOVE_FAIL,&lt;br /&gt;
  LOG_TIMED_ACTION_BAD_JOB_ID,&lt;br /&gt;
  LOG_TIMED_Q_SPIN_FAIL,&lt;br /&gt;
  LOG_SYSTEM_ERROR,&lt;br /&gt;
  LOG_ATOMICINC_FAILED,&lt;br /&gt;
  LOG_PENDING_PRI_UPDATE_FAILED,&lt;br /&gt;
  LOG_KILL_TASK_INVALID_ID,      // Tried to kill task with invalid ID&lt;br /&gt;
  LOG_OCEOS_EXIT_REQUEST,         // oceos_exit command was called&lt;br /&gt;
  LOG_RWMUTEX_NOT_RETURNED,&lt;br /&gt;
  LOG_RWMUTEX_NOT_HIGHEST&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
/*****************************************************************************&lt;br /&gt;
 * Structures&lt;br /&gt;
 */&lt;br /&gt;
/**&lt;br /&gt;
 * Log entry structure&lt;br /&gt;
 */&lt;br /&gt;
struct log_entry{&lt;br /&gt;
  U64_t             time64;&lt;br /&gt;
&lt;br /&gt;
  unsigned int      entry_cpu          :8;&lt;br /&gt;
  unsigned int      entry_type         :8;&lt;br /&gt;
  unsigned int      entry_note         :16;	// not used at present&lt;br /&gt;
&lt;br /&gt;
  U32_t             entry_comment;&lt;br /&gt;
}__attribute__ ((aligned (8)));&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_log_add_entry()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''system_log.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function adds an entry to the log. The entry overwrites the oldest unread entry if the log is full.&lt;br /&gt;
Custom log entries can be added to enum LOG_ENTRY from 0 to 128.&lt;br /&gt;
The indices are incremented in a circular fashion. If the write index reaches the read_index the read index is moved on, as read and write indices equal would indicate an empty log.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Add an entry to the log.&lt;br /&gt;
 * this overwrites the oldest unread entry if the log is full.&lt;br /&gt;
 * Custom log entries can be added to enum LOG_ENTRY from 0 to 128&lt;br /&gt;
 *&lt;br /&gt;
 * N.B. The indices are incremented in a circular fashion.&lt;br /&gt;
 *      If the write index reaches the read_index the read index is moved on,&lt;br /&gt;
 *      as read and write indices equal would indicate an empty log.&lt;br /&gt;
 *&lt;br /&gt;
 * @param type  enum LOG_ENTRY_TYPE&lt;br /&gt;
 * @param info  extra information to be logged&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_LOG_CORRUPT         System Log area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Log directive called in wrong phase; can be used after oceos_init() called&lt;br /&gt;
 *          ERR_ID_INVALID              Log type invalid&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to acquire log guard&lt;br /&gt;
 *          ERR_LOG_INDEX_WRONG         Read/write log index is wrong&lt;br /&gt;
 */&lt;br /&gt;
S32_t   oceos_log_add_entry(&lt;br /&gt;
    enum LOG_ENTRY_TYPE type,   // 8 bits enum LOG_ENTRY_TYPE&lt;br /&gt;
    const U32_t        info     // information&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| enum LOG_ENTRY_TYPE || Log entry type (see previous section for a list)&lt;br /&gt;
|-&lt;br /&gt;
| info | U32_t with the log information&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit  !! Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_LOG_CORRUPT         || System Log area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Log directive called in wrong phase; can be used after oceos_init() called&lt;br /&gt;
|-&lt;br /&gt;
| ERR_ID_INVALID              || Log type invalid&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to acquire log guard&lt;br /&gt;
|-&lt;br /&gt;
| ERR_LOG_INDEX_WRONG         || Read/write log index is wrong&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, info;&lt;br /&gt;
...&lt;br /&gt;
// Log LOG_APP_COMMS__ERROR (defined in enum LOG_ENTRY_TYPE) and info with more details&lt;br /&gt;
status = oceos_log_add_entry(LOG_APP_COMMS__ERROR, info);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;oceos_log_remove_entry()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''system_log.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function reads and removes the oldest unread log entry. &lt;br /&gt;
If the log is not empty use the entry at the read index to update the value at the output pointer, returning OCEOS_SUCCESS.&lt;br /&gt;
If outputPtr is NULL, entry is removed but no returned.&lt;br /&gt;
If the log is empty, set the value at the output pointer to LOG_LOG_NOT_VALID_ENTRY and return ERR_LOG_EMPTY.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Read and remove the oldest unread log entry&lt;br /&gt;
 *&lt;br /&gt;
 * If the log is not empty use the entry at the read index to update the value&lt;br /&gt;
 * at the output pointer, returning OCEOS_SUCCESS.&lt;br /&gt;
 *&lt;br /&gt;
 * If outputPtr is NULL, entry is removed but no returned&lt;br /&gt;
 *&lt;br /&gt;
 * If the log is empty, set the value at the output pointer to LOG_LOG_NOT_VALID_ENTRY&lt;br /&gt;
 * and return ERR_LOG_EMPTY&lt;br /&gt;
 *&lt;br /&gt;
 * @param outputPtr   pointer to struct log_entry&lt;br /&gt;
 *&lt;br /&gt;
 * @return  OCEOS_SUCCESS&lt;br /&gt;
 *          ERR_SYS_FIXED_CORRUPT       System Fixed area corrupt&lt;br /&gt;
 *          ERR_SYS_LOG_CORRUPT         System Log area corrupt&lt;br /&gt;
 *          ERR_WRONG_PHASE             Log directive called in wrong phase; can be used after oceos_init() called&lt;br /&gt;
 *          ERR_SYS_BUSY                Failed to acquire log guard&lt;br /&gt;
 *          ERR_LOG_INDEX_WRONG         Read/write log index is wrong&lt;br /&gt;
 *          ERR_LOG_EMPTY               Log is empty&lt;br /&gt;
 */&lt;br /&gt;
S32_t   oceos_log_remove_entry(&lt;br /&gt;
    struct log_entry * const outputPtr&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| outputPtr || pointer to struct log_entry&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit  !! Description&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_FIXED_CORRUPT       || System Fixed area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_LOG_CORRUPT         || System Log area corrupt&lt;br /&gt;
|-&lt;br /&gt;
| ERR_WRONG_PHASE             || Log directive called in wrong phase; can be used after oceos_init() called&lt;br /&gt;
|-&lt;br /&gt;
| ERR_SYS_BUSY                || Failed to acquire log guard&lt;br /&gt;
|-&lt;br /&gt;
| ERR_LOG_INDEX_WRONG         || Read/write log index is wrong&lt;br /&gt;
|-&lt;br /&gt;
| ERR_LOG_EMPTY               || Log is empty&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status;&lt;br /&gt;
struct log_entry *outputPtr;&lt;br /&gt;
...&lt;br /&gt;
// Read log_entry into outputPtr and remove the oldest unread log entry&lt;br /&gt;
status = oceos_log_remove_entry(LOG_APP_COMMS__ERROR, info);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;blank_function()&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;blockquote style=&amp;quot;border-left-style: none;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Header File'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
'''''header.h'''''&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Description'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function does xyz...&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Prototype'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t oceosmp_blank(&lt;br /&gt;
    U32_t param&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Parameters'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Parameter || Description&lt;br /&gt;
|-&lt;br /&gt;
| param || parameter to function&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Returns'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Error bit  !! Description&lt;br /&gt;
|-&lt;br /&gt;
| Error_name|| description&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#1b7ac2&amp;quot;&amp;gt;'''Example Usage'''&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
S32_t status, param;&lt;br /&gt;
...&lt;br /&gt;
// Do xyz&lt;br /&gt;
status = oceosmp_blank(param));&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:backup]]&lt;/div&gt;</summary>
		<author><name>Bkavanagh</name></author>
	</entry>
</feed>