Difference between revisions of "OCEOSmp/blank"

From wiki
Jump to navigation Jump to search
(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 ==
= Timing directives =
===<span style="color:#0000ff">Introduction</span>===
<blockquote style="border-left-style: none;">
SPARC:
In OCEOS system time is based on two chained 32-bit timers.
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
values since the timers count down.
The scaler associated with the timers is configured based on the system clock frequency to decrement the low order timer every microsecond. This
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.
ARM Cortex-M:
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.
Note: When the processor is halted for debugging the counter does not decrement.
OCEOS initializes the timer to be driven from MCK and counting down to zero asserts SysTick exception request.
OCEOS has 64 bit counter which is increased by 0xFFFFFF value every time timer reloads.
RISC-V:
TBD
The units of OCEOS system time are microseconds on SPARC and ARM and on RISC-V the period of the clock cycle.
The system time is reset to 0 by oceos_init()
===<span style="color:#0000ff">oceos_time_sys_get64()</span>===
<blockquote style="border-left-style: none;">
<span style="color:#1b7ac2">'''Header File'''</span><br>
'''''oceos_timer.h'''''<br>
<span style="color:#1b7ac2">'''Description'''</span><br>
This function returns the current system time as a 64-bit number.
<span style="color:#1b7ac2">'''Prototype'''</span><br>
<syntaxhighlight lang="C">
**
* Get the current system time (64-bit)
*
* @return U64_t
*/
U64_t oceos_time_sys_get64(void);
</syntaxhighlight>
<span style="color:#1b7ac2">'''Parameters'''</span><br>
There are no parameters to this function.
<span style="color:#1b7ac2">'''Returns'''</span><br>
This function returns an S64_t with the current system time.
<span style="color:#1b7ac2">'''Example Usage'''</span><br>
<syntaxhighlight lang="C">
S64_t now;
...
// Get the time
now = oceos_time_sys_get64();
</syntaxhighlight>
</blockquote>
===<span style="color:#0000ff">oceos_time_sys_get32()</span>===
<blockquote style="border-left-style: none;">
<span style="color:#1b7ac2">'''Header File'''</span><br>
'''''oceos_timer.h'''''<br>
<span style="color:#1b7ac2">'''Description'''</span><br>
This function returns the low 32 bits of the system time.
<span style="color:#1b7ac2">'''Prototype'''</span><br>
<syntaxhighlight lang="C">
/**
* Get the current system time (low 32 bits of 64 bit value)
*
* @return U32_t
*/
U32_t oceos_time_sys_get32(void);
</syntaxhighlight>
<span style="color:#1b7ac2">'''Parameters'''</span><br>
There are no parameters to this function.
<span style="color:#1b7ac2">'''Returns'''</span><br>
This function returns an S32_t with the current system time.
<span style="color:#1b7ac2">'''Example Usage'''</span><br>
<syntaxhighlight lang="C">
S32_t now;
...
// Get the time
now = oceos_time_sys_get32();
</syntaxhighlight>
</blockquote>


===<span style="color:#0000ff">blank_function()</span>===
===<span style="color:#0000ff">blank_function()</span>===
<blockquote style="border-left-style: none;">
<blockquote style="border-left-style: none;">
<span style="color:#1b7ac2">'''Header File'''</span><br>
<span style="color:#1b7ac2">'''Header File'''</span><br>
'''''header.h'''''<br>
'''''header.h'''''<br>

Revision as of 14:05, 3 May 2024

Next Section

Timing directives

Introduction

SPARC: In OCEOS system time is based on two chained 32-bit timers.

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 values since the timers count down.

The scaler associated with the timers is configured based on the system clock frequency to decrement the low order timer every microsecond. This 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.

ARM Cortex-M: 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.

Note: When the processor is halted for debugging the counter does not decrement.

OCEOS initializes the timer to be driven from MCK and counting down to zero asserts SysTick exception request. OCEOS has 64 bit counter which is increased by 0xFFFFFF value every time timer reloads.

RISC-V: TBD

The units of OCEOS system time are microseconds on SPARC and ARM and on RISC-V the period of the clock cycle.

The system time is reset to 0 by oceos_init()

oceos_time_sys_get64()

Header File
oceos_timer.h

Description
This function returns the current system time as a 64-bit number.

Prototype

**
 * Get the current system time (64-bit)
 *
 * @return U64_t
 */
U64_t oceos_time_sys_get64(void);

Parameters

There are no parameters to this function.

Returns
This function returns an S64_t with the current system time.

Example Usage

S64_t now;
...
// Get the time
now = oceos_time_sys_get64();

oceos_time_sys_get32()

Header File
oceos_timer.h

Description
This function returns the low 32 bits of the system time.

Prototype

/**
 * Get the current system time (low 32 bits of 64 bit value)
 *
 * @return U32_t
 */
U32_t oceos_time_sys_get32(void);

Parameters
There are no parameters to this function.

Returns
This function returns an S32_t with the current system time.

Example Usage

S32_t now;
...
// Get the time
now = oceos_time_sys_get32();


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
Error_name description

Example Usage

S32_t status, param;
...
// Do xyz
status = oceosmp_blank(param));