Difference between revisions of "OCEOSmp/blank"
(Replaced content with " == Next Section == ===<span style="color:#0000ff">blank_function()</span>=== <blockquote style="border-left-style: none;"> <span style="color:#1b7ac2">'''Header File'''<...") Tag: Replaced |
|||
Line 1: | Line 1: | ||
== Next Section == | == Next Section == | ||
===<span style="color:#0000ff">oceos_dataq_create()</span>=== | |||
<blockquote style="border-left-style: none;"> | |||
<span style="color:#1b7ac2">'''Header File'''</span><br> | |||
'''''dataq.h'''''<br> | |||
<span style="color:#1b7ac2">'''Description'''</span><br> | |||
This function creates a data queue with the specified characteristics. | |||
<span style="color:#1b7ac2">'''Prototype'''</span><br> | |||
<syntaxhighlight lang="C"> | |||
/** | |||
* Create data queue | |||
* If use_timeout = TRUE, timed actions must be initialised | |||
* | |||
* @param dataq_id data queue ID | |||
* @param dataq_size data queue size | |||
* @param pen_q_size pending jobs queue size | |||
* @param roll_over whether to roll over when full | |||
* @param use_timeout if TRUE, directive oceos_dataq_read_restart_timeout can be used | |||
* | |||
* @return OCEOS_SUCCESS | |||
* ERR_SYS_FIXED_CORRUPT System Fixed area corrupt | |||
* ERR_WRONG_CPU_CORE Executing directive on wrong CPU | |||
* ERR_WRONG_PHASE Called before oceos_init() is done | |||
* ERR_TOO_MANY MAX number of DATAQs already created | |||
* ERR_ID_INVALID DATAQ ID outside allowed range 0 to 62 | |||
* ERR_ID_WRONG DATAQ ID >= number of DATAQs | |||
* ERR_DQ_ALREADY_ALLOCATED DATAQ ID already used | |||
* ERR_DQ_SIZE_WRONG DATAQ size outside allowed range 1 to 255 | |||
* ERR_DQ_PENQ_SIZE_WRONG DATAQ pending queue size outside allowed range 1 to 253 | |||
* ERR_DQ_TA_MAX_NUM_REACHED Number of timed actions exceeds MAX allowed 255, | |||
* each task on DATAQ pending queue is timed action | |||
*/ | |||
S32_t oceos_dataq_create( | |||
dataq_t dataq_id, // data queue ID | |||
U16_t dataq_size, // data queue size | |||
U16_t pen_q_size, // pending jobs queue size | |||
BOOLE_t roll_over, // whether to roll over when full | |||
BOOLE_t use_timeout // whether timeout is used oceos_dataq_read_restart_timeout | |||
); | |||
</syntaxhighlight> | |||
<span style="color:#1b7ac2">'''Parameters'''</span><br> | |||
{| class="wikitable" | |||
|- | |||
! Parameter !! Description | |||
|- | |||
| dataq_id || dataq_t data queue ID (number between 0 and 62) | |||
|- | |||
| dataq_size || data queue size (max number of pointers than can be added to the queue) | |||
|- | |||
| pen_q_size || pending jobs queue size | |||
|- | |||
| roll_over || whether to roll over when full (0 => disabled, 1 => enabled) | |||
|- | |||
| use_timeout || if TRUE, directive oceos_dataq_read_restart_timeout can be used | |||
|} | |||
<span style="color:#1b7ac2">'''Returns'''</span><br> | |||
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below. | |||
{| class="wikitable" | |||
|- | |||
| ERR_SYS_FIXED_CORRUPT || System Fixed area corrupt | |||
|- | |||
| ERR_WRONG_CPU_CORE || Executing directive on wrong CPU | |||
|- | |||
| ERR_WRONG_PHASE || Called before oceos_init() is done | |||
|- | |||
| ERR_TOO_MANY || MAX number of DATAQs already created | |||
|- | |||
| ERR_ID_INVALID || DATAQ ID outside allowed range 0 to 62 | |||
|- | |||
| ERR_ID_WRONG || DATAQ ID >= number of DATAQs | |||
|- | |||
| ERR_DQ_ALREADY_ALLOCATED || DATAQ ID already used | |||
|- | |||
| ERR_DQ_SIZE_WRONG || DATAQ size outside allowed range 1 to 255 | |||
|- | |||
| ERR_DQ_PENQ_SIZE_WRONG || DATAQ pending queue size outside allowed range 1 to 253 | |||
|- | |||
| ERR_DQ_TA_MAX_NUM_REACHED || Number of timed actions exceeds MAX allowed 255, each task on DATAQ pending queue is timed action | |||
|} | |||
<span style="color:#1b7ac2">'''Example Usage'''</span><br> | |||
<syntaxhighlight lang="C"> | |||
S32_t status; | |||
... | |||
// Create data queue d_3 with size 20, max pending jobs of 10, rollover enabled, timeouts disabled | |||
status = oceos_dataq_create(d_3, 20, 10, 1, 0)); | |||
</syntaxhighlight> | |||
</blockquote> | |||
===<span style="color:#0000ff">oceos_dataq_write()</span>=== | |||
<blockquote style="border-left-style: none;"> | |||
<span style="color:#1b7ac2">'''Header File'''</span><br> | |||
'''''dataq.h'''''<br> | |||
<span style="color:#1b7ac2">'''Description'''</span><br> | |||
This function puts a non-null pointer on the specified data queue. | |||
<span style="color:#1b7ac2">'''Prototype'''</span><br> | |||
<syntaxhighlight lang="C"> | |||
/** | |||
* Puts pointer to the data on data queue. | |||
* Pointer to the data must not be NULL | |||
* | |||
* @param dataq_t dataq_id Data queue ID | |||
* @param void* data Non-null pointer to data | |||
* | |||
* @return OCEOS_SUCCESS | |||
* WARN_DQ_NOW_FULL Warning, DATAQ is full now | |||
* WARN_JOB_NOT_GUARDED | |||
* | |||
* ERR_SYS_FIXED_CORRUPT System Fixed area corrupt | |||
* ERR_SYS_DYN_CORRUPT System Dynamic area corrupt | |||
* ERR_WRONG_PHASE Directive was called before OCEOS initialisation is finished | |||
* ERR_ID_INVALID DATAQ ID outside allowed range 0 to 62 | |||
* ERR_ID_WRONG DATAQ ID >= number of DATAQs | |||
* ERR_DQ_DATA_BAD Data pointer is null | |||
* ERR_SYS_BUSY Failed to acquire guard | |||
* ERR_TOO_MANY DATAQ is full | |||
* ERR_DQ_JOB_ID_WRONG Job ID of the task on pending queue is wrong | |||
* ERR_TA_NOT_FOUND Timed action index to be removed for job not found | |||
* ERR_TA_START_FAILED Timed action re-start failed after job remove from timed action queue | |||
*/ | |||
S32_t oceos_dataq_write( | |||
dataq_t dataq_id, // data queue ID | |||
void *data // non-null pointer to data | |||
); | |||
</syntaxhighlight> | |||
<span style="color:#1b7ac2">'''Parameters'''</span><br> | |||
{| class="wikitable" | |||
|- | |||
! Parameter !! Description | |||
|- | |||
| dataq_id || dataq_t with value of Data queue ID | |||
| ptr || void* pointer to application data (non-null pointer) | |||
|} | |||
<span style="color:#1b7ac2">'''Returns'''</span><br> | |||
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below. | |||
{| class="wikitable" | |||
|- | |||
| WARN_DQ_NOW_FULL || Warning, DATAQ is full now | |||
|- | |||
| WARN_JOB_NOT_GUARDED || | |||
|- | |||
| ERR_SYS_FIXED_CORRUPT || System Fixed area corrupt | |||
|- | |||
| ERR_SYS_DYN_CORRUPT || System Dynamic area corrupt | |||
|- | |||
| ERR_WRONG_PHASE || Directive was called before OCEOS initialisation is finished | |||
|- | |||
| ERR_ID_INVALID || DATAQ ID outside allowed range 0 to 62 | |||
|- | |||
| ERR_ID_WRONG || DATAQ ID >= number of DATAQs | |||
|- | |||
| ERR_DQ_DATA_BAD || Data pointer is null | |||
|- | |||
| ERR_SYS_BUSY || Failed to acquire guard | |||
|- | |||
| ERR_TOO_MANY || DATAQ is full | |||
|- | |||
| ERR_DQ_JOB_ID_WRONG || Job ID of the task on pending queue is wrong | |||
|- | |||
| ERR_TA_NOT_FOUND || Timed action index to be removed for job not found | |||
|- | |||
| ERR_TA_START_FAILED || Timed action re-start failed after job remove from timed action queue | |||
|} | |||
<span style="color:#1b7ac2">'''Example Usage'''</span><br> | |||
<syntaxhighlight lang="C"> | |||
S32_t status; | |||
char[100] message_in; | |||
... | |||
// Put pointer to message_in on data queue s_2 | |||
status = oceos_dataq_write(s_2, (void *)message_in); | |||
</syntaxhighlight> | |||
</blockquote> | |||
===<span style="color:#0000ff">blank_function()</span>=== | ===<span style="color:#0000ff">blank_function()</span>=== | ||
Line 40: | Line 223: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
</blockquote> | </blockquote> | ||
[[Category:backup]] | [[Category:backup]] |
Revision as of 11:18, 1 May 2024
Next Section
oceos_dataq_create()
Header File
dataq.h
Description
This function creates a data queue with the specified characteristics.Prototype
/** * Create data queue * If use_timeout = TRUE, timed actions must be initialised * * @param dataq_id data queue ID * @param dataq_size data queue size * @param pen_q_size pending jobs queue size * @param roll_over whether to roll over when full * @param use_timeout if TRUE, directive oceos_dataq_read_restart_timeout can be used * * @return OCEOS_SUCCESS * ERR_SYS_FIXED_CORRUPT System Fixed area corrupt * ERR_WRONG_CPU_CORE Executing directive on wrong CPU * ERR_WRONG_PHASE Called before oceos_init() is done * ERR_TOO_MANY MAX number of DATAQs already created * ERR_ID_INVALID DATAQ ID outside allowed range 0 to 62 * ERR_ID_WRONG DATAQ ID >= number of DATAQs * ERR_DQ_ALREADY_ALLOCATED DATAQ ID already used * ERR_DQ_SIZE_WRONG DATAQ size outside allowed range 1 to 255 * ERR_DQ_PENQ_SIZE_WRONG DATAQ pending queue size outside allowed range 1 to 253 * ERR_DQ_TA_MAX_NUM_REACHED Number of timed actions exceeds MAX allowed 255, * each task on DATAQ pending queue is timed action */ S32_t oceos_dataq_create( dataq_t dataq_id, // data queue ID U16_t dataq_size, // data queue size U16_t pen_q_size, // pending jobs queue size BOOLE_t roll_over, // whether to roll over when full BOOLE_t use_timeout // whether timeout is used oceos_dataq_read_restart_timeout );Parameters
Parameter Description dataq_id dataq_t data queue ID (number between 0 and 62) dataq_size data queue size (max number of pointers than can be added to the queue) pen_q_size pending jobs queue size roll_over whether to roll over when full (0 => disabled, 1 => enabled) use_timeout if TRUE, directive oceos_dataq_read_restart_timeout can be used Returns
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.
ERR_SYS_FIXED_CORRUPT System Fixed area corrupt ERR_WRONG_CPU_CORE Executing directive on wrong CPU ERR_WRONG_PHASE Called before oceos_init() is done ERR_TOO_MANY MAX number of DATAQs already created ERR_ID_INVALID DATAQ ID outside allowed range 0 to 62 ERR_ID_WRONG DATAQ ID >= number of DATAQs ERR_DQ_ALREADY_ALLOCATED DATAQ ID already used ERR_DQ_SIZE_WRONG DATAQ size outside allowed range 1 to 255 ERR_DQ_PENQ_SIZE_WRONG DATAQ pending queue size outside allowed range 1 to 253 ERR_DQ_TA_MAX_NUM_REACHED Number of timed actions exceeds MAX allowed 255, each task on DATAQ pending queue is timed action Example Usage
S32_t status; ... // Create data queue d_3 with size 20, max pending jobs of 10, rollover enabled, timeouts disabled status = oceos_dataq_create(d_3, 20, 10, 1, 0));
oceos_dataq_write()
Header File
dataq.h
Description
This function puts a non-null pointer on the specified data queue.Prototype
/** * Puts pointer to the data on data queue. * Pointer to the data must not be NULL * * @param dataq_t dataq_id Data queue ID * @param void* data Non-null pointer to data * * @return OCEOS_SUCCESS * WARN_DQ_NOW_FULL Warning, DATAQ is full now * WARN_JOB_NOT_GUARDED * * ERR_SYS_FIXED_CORRUPT System Fixed area corrupt * ERR_SYS_DYN_CORRUPT System Dynamic area corrupt * ERR_WRONG_PHASE Directive was called before OCEOS initialisation is finished * ERR_ID_INVALID DATAQ ID outside allowed range 0 to 62 * ERR_ID_WRONG DATAQ ID >= number of DATAQs * ERR_DQ_DATA_BAD Data pointer is null * ERR_SYS_BUSY Failed to acquire guard * ERR_TOO_MANY DATAQ is full * ERR_DQ_JOB_ID_WRONG Job ID of the task on pending queue is wrong * ERR_TA_NOT_FOUND Timed action index to be removed for job not found * ERR_TA_START_FAILED Timed action re-start failed after job remove from timed action queue */ S32_t oceos_dataq_write( dataq_t dataq_id, // data queue ID void *data // non-null pointer to data );Parameters
Parameter Description dataq_id dataq_t with value of Data queue ID ptr void* pointer to application data (non-null pointer) Returns
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.
WARN_DQ_NOW_FULL Warning, DATAQ is full now WARN_JOB_NOT_GUARDED ERR_SYS_FIXED_CORRUPT System Fixed area corrupt ERR_SYS_DYN_CORRUPT System Dynamic area corrupt ERR_WRONG_PHASE Directive was called before OCEOS initialisation is finished ERR_ID_INVALID DATAQ ID outside allowed range 0 to 62 ERR_ID_WRONG DATAQ ID >= number of DATAQs ERR_DQ_DATA_BAD Data pointer is null ERR_SYS_BUSY Failed to acquire guard ERR_TOO_MANY DATAQ is full ERR_DQ_JOB_ID_WRONG Job ID of the task on pending queue is wrong ERR_TA_NOT_FOUND Timed action index to be removed for job not found ERR_TA_START_FAILED Timed action re-start failed after job remove from timed action queue Example Usage
S32_t status; char[100] message_in; ... // Put pointer to message_in on data queue s_2 status = oceos_dataq_write(s_2, (void *)message_in);
blank_function()
Header File
header.h
Description
This function does xyz...Prototype
S32_t oceosmp_blank( U32_t param );Parameters
Parameter Description param parameter to function Returns
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.
Error bit !! Description Example Usage
S32_t status, param; ... // Do xyz status = oceosmp_blank(param));