Graphics framework for GR-PEACH. When you use this program, we judge you have agreed to the following contents. https://developer.mbed.org/teams/Renesas/wiki/About-LICENSE
Dependents: ImageZoomInout_Sample ImageRotaion_Sample ImageScroll_Sample GR-PEACH_LCD_4_3inch_Save_to_USB ... more
r_ospl.h File Reference
OS Porting Layer. More...
Go to the source code of this file.
Functions | |
int32_t | R_OSPL_GetVersion (void) |
Returns version number of OSPL. | |
bool_t | R_OSPL_IsPreemption (void) |
Returns whether the environment is supported preemption. | |
errnum_t | R_OSPL_Initialize (const void *const NullConfig) |
Initializes the internal of OSPL. | |
INLINE void | R_NOOP (void) |
No operation from C++ specification. | |
bool_t | R_OSPL_OnRaisingErrorForMISRA (bool_t const Condition, const char_t *const File, int_t const Line) |
Sub routine of IF macro. | |
r_ospl_thread_id_t | R_OSPL_THREAD_GetCurrentId (void) |
Get running thread ID (for OS less and OS-using environment) | |
void | R_OSPL_EVENT_Set (r_ospl_thread_id_t const ThreadId, bit_flags32_t const SetFlags) |
Set one or some bits to 1. | |
void | R_OSPL_EVENT_Clear (r_ospl_thread_id_t const ThreadId, bit_flags32_t const ClearFlags1) |
Set one or some bits to 0. | |
bit_flags32_t | R_OSPL_EVENT_Get (r_ospl_thread_id_t const ThreadId) |
Get 16bit flags value. | |
errnum_t | R_OSPL_EVENT_Wait (bit_flags32_t const WaigingFlags, bit_flags32_t *const out_GotFlags, uint32_t const Timeout_msec) |
Waits for setting the flags in 16bit and clear received flags. | |
void | R_OSPL_FLAG32_InitConst (volatile r_ospl_flag32_t *const self) |
Clears all flags in 32bit to 0. | |
void | R_OSPL_FLAG32_Set (volatile r_ospl_flag32_t *const self, bit_flags32_t const SetFlags) |
Set one or some bits to 1. | |
void | R_OSPL_FLAG32_Clear (volatile r_ospl_flag32_t *const self, bit_flags32_t const ClearFlags1) |
Set one or some bits to 0. | |
bit_flags32_t | R_OSPL_FLAG32_Get (volatile const r_ospl_flag32_t *const self) |
Get 32bit flags value. | |
bit_flags32_t | R_OSPL_FLAG32_GetAndClear (volatile r_ospl_flag32_t *const self) |
Get 32bit flags value. | |
errnum_t | R_OSPL_QUEUE_Create (r_ospl_queue_t **out_self, r_ospl_queue_def_t *QueueDefine) |
Initializes a queue. | |
errnum_t | R_OSPL_QUEUE_GetStatus (r_ospl_queue_t *self, const r_ospl_queue_status_t **out_Status) |
Gets status of the queue. | |
errnum_t | R_OSPL_QUEUE_Allocate (r_ospl_queue_t *self, void *out_Address, uint32_t Timeout_msec) |
Allocates an element from the queue object. | |
errnum_t | R_OSPL_QUEUE_Put (r_ospl_queue_t *self, void *Address) |
Sends the element to the queue. | |
errnum_t | R_OSPL_QUEUE_Get (r_ospl_queue_t *self, void *out_Address, uint32_t Timeout_msec) |
Receives the element from the queue. | |
errnum_t | R_OSPL_QUEUE_Free (r_ospl_queue_t *self, void *Address) |
Releases the element to the queue object. | |
errnum_t | R_OSPL_QUEUE_Print (r_ospl_queue_t *self) |
Print status of the queue object. | |
void | R_OSPL_ASYNC_CopyExceptAThread (const r_ospl_async_t *const Source, r_ospl_async_t *const Destination) |
CopyExceptAThread. | |
void | R_OSPL_CallInterruptCallback (const r_ospl_caller_t *const self, const r_ospl_interrupt_t *const InterruptSource) |
Calls the interrupt callback function. | |
void | R_OSPL_CALLER_Initialize (r_ospl_caller_t *const self, r_ospl_async_t *const Async, volatile void *const PointerToState, int_t const StateValueOfOnInterrupting, void *const I_Lock, const r_ospl_i_lock_vtable_t *const I_LockVTable) |
Initialize <r_ospl_caller_t>. | |
INLINE int_fast32_t | R_OSPL_CALLER_GetRootChannelNum (const r_ospl_caller_t *const self) |
GetRootChannelNum. | |
void | R_OSPL_OnInterruptForUnregistered (uint32_t const int_sense) |
Interrupt callback function for unregisterd interrupt. | |
void | R_OSPL_EnableAllInterrupt (void) |
Releases all disabled interrupts. | |
bool_t | R_OSPL_DisableAllInterrupt (void) |
Disables all interrupts. | |
errnum_t | R_OSPL_SetInterruptPriority (bsp_int_src_t const IRQ_Num, int_fast32_t const Priority) |
Sets the priority of the interrupt line. | |
errnum_t | R_OSPL_LockChannel (int_fast32_t ChannelNum, int_fast32_t *out_ChannelNum, mcu_lock_t HardwareIndexMin, mcu_lock_t HardwareIndexMax) |
Locks by channel number. | |
errnum_t | R_OSPL_UnlockChannel (int_fast32_t ChannelNum, errnum_t e, mcu_lock_t HardwareIndexMin, mcu_lock_t HardwareIndexMax) |
Unlocks by channel number. | |
void | R_OSPL_C_LOCK_InitConst (r_ospl_c_lock_t *const self) |
Initializes the C-lock object. | |
errnum_t | R_OSPL_C_LOCK_Lock (r_ospl_c_lock_t *const self) |
Locks the target, if lockable state. | |
errnum_t | R_OSPL_C_LOCK_Unlock (r_ospl_c_lock_t *const self) |
Unlocks the target. | |
bool_t | R_OSPL_I_LOCK_LockStub (void *const self_) |
Do nothing. | |
void | R_OSPL_I_LOCK_UnlockStub (void *const self_) |
Do nothing. | |
void | R_OSPL_I_LOCK_RequestFinalizeStub (void *const self_) |
Do nothing. | |
void | R_OSPL_MEMORY_Flush (r_ospl_flush_t const FlushType) |
Flushes cache memory. | |
errnum_t | R_OSPL_MEMORY_RangeFlush (r_ospl_flush_t const FlushType, const void *const StartAddress, size_t const Length) |
Flushes cache memory with the range of virtual address. | |
void | R_OSPL_MEMORY_GetSpecification (r_ospl_memory_spec_t *const out_MemorySpec) |
Gets the specification about memory and cache memory. | |
void | R_OSPL_MEMORY_Barrier (void) |
Set a memory barrier. | |
void | R_OSPL_InstructionSyncBarrier (void) |
Set a instruction barrier. | |
errnum_t | R_OSPL_ToPhysicalAddress (const volatile void *const Address, uintptr_t *const out_PhysicalAddress) |
Changes to physical address. | |
errnum_t | R_OSPL_ToCachedAddress (const volatile void *const Address, void *const out_CachedAddress) |
Changes to the address in the L1 cache area. | |
errnum_t | R_OSPL_ToUncachedAddress (const volatile void *const Address, void *const out_UncachedAddress) |
Changes to the address in the L1 uncached area. | |
errnum_t | R_OSPL_MEMORY_GetLevelOfFlush (const void *Address, int_fast32_t *out_Level) |
Gets the level of cache for flushing the memory indicated by the address. | |
errnum_t | R_OSPL_AXI_Get2ndCacheAttribute (uintptr_t const PhysicalAddress, r_ospl_axi_cache_attribute_t *const out_CacheAttribute) |
Get 2nd cache attribute of AXI bus for peripheral (not CPU) from physical address. | |
errnum_t | R_OSPL_AXI_GetProtection (uintptr_t const physical_address, r_ospl_axi_protection_t *const out_protection) |
Gets protection attribute of AXI bus from the address. | |
errnum_t | R_OSPL_Delay (uint32_t const DelayTime_msec) |
Waits for a while until passed time. | |
errnum_t | R_OSPL_FTIMER_InitializeIfNot (r_ospl_ftimer_spec_t *const out_Specification) |
Set up the free running timer. | |
void | R_OSPL_FTIMER_GetSpecification (r_ospl_ftimer_spec_t *const out_Specification) |
Gets the specification of free running timer. | |
uint32_t | R_OSPL_FTIMER_Get (void) |
Get current time of free running timer. | |
errnum_t | R_OSPL_FTIMER_IsPast (const r_ospl_ftimer_spec_t *const ts, uint32_t const Now, uint32_t const TargetTime, bool_t *const out_IsPast) |
Returns whether specified time was passed. | |
INLINE uint32_t | R_OSPL_FTIMER_TimeToCount (const r_ospl_ftimer_spec_t *const ts, uint32_t const msec) |
Change from mili-second unit to free running timer unit. | |
INLINE uint32_t | R_OSPL_FTIMER_CountToTime (const r_ospl_ftimer_spec_t *const ts, uint32_t const Count) |
Change from free running timer unit to mili-second unit. | |
void | R_OSPL_TABLE_InitConst (r_ospl_table_t *const self, void *const Area, size_t const AreaByteSize, bool_t const Is_T_Lock) |
Initializes an index table. | |
errnum_t | R_OSPL_TABLE_GetIndex (r_ospl_table_t *const self, const void *const Key, int_fast32_t *const out_Index, r_ospl_if_not_t const TypeOfIfNot) |
Returns index from related key. | |
void | R_OSPL_TABLE_Free (r_ospl_table_t *const self, const void *const Key) |
Separates relationship of specified key and related index. | |
void | R_OSPL_TABLE_Print (r_ospl_table_t *const self) |
Print status of specified index table object (for debug) | |
INLINE uint_fast32_t | BIT_And_Sub (bit_flags_fast32_t const Variable, bit_flags_fast32_t const ConstValue) |
Sub routine of bitwise operation. | |
void | R_DebugBreak (const char_t *const File, int_fast32_t const Line) |
The function callbacked from OSPL for breaking. | |
void | R_OSPL_RaiseUnrecoverable (errnum_t const e) |
Raises the error of system unrecoverable. | |
INLINE errnum_t | R_OSPL_MergeErrNum (errnum_t const CurrentError, errnum_t const AppendError) |
Merge the error code raised in the finalizing operation. | |
void | R_OSPL_SetErrNum (errnum_t const e) |
Sets an error code to TLS (Thread Local Storage). | |
errnum_t | R_OSPL_GetErrNum (void) |
Returns the error code from TLS (Thread Local Storage). | |
void | R_OSPL_CLEAR_ERROR (void) |
Clears the error state. | |
int_fast32_t | R_OSPL_GET_ERROR_ID (void) |
Returns the number of current error. | |
void | R_OSPL_SET_BREAK_ERROR_ID (int_fast32_t ID) |
Register to break at raising error at the moment. | |
void | R_OSPL_SET_DEBUG_WORK (void *WorkArea, uint32_t WorkAreaSize) |
Set the debug work area. | |
r_ospl_error_t * | R_OSPL_GetCurrentThreadError (void) |
Returns debbug information of current thread. | |
void | R_OSPL_MODIFY_THREAD_LOCKED_COUNT (int_fast32_t Plus) |
Modifies count of objects that current thread has locked. | |
int_fast32_t | R_OSPL_GET_THREAD_LOCKED_COUNT (void) |
Returns count of objects that current thread has locked. |
Detailed Description
OS Porting Layer.
Main Header. Functions.
- Module:
- OSPL
- PublicVersion:
- 0.90
(=R_OSPL_VERSION)
- Rev:
- 35
- Date:
- 2014-04-15 21:38:18 +0900#
Definition in file r_ospl.h.
Function Documentation
INLINE uint_fast32_t BIT_And_Sub | ( | bit_flags_fast32_t const | Variable, |
bit_flags_fast32_t const | ConstValue | ||
) |
void R_DebugBreak | ( | const char_t *const | File, |
int_fast32_t const | Line | ||
) |
The function callbacked from OSPL for breaking.
- Parameters:
-
Variable The value of target bit flags ConstValue The value that investigating bits are 1
- Returns:
- Whether the all passed bit are 0
- Description
- Set a break point at this function. In Release configuration, "File = NULL, Line = 0". If "File = NULL", "Line" argument is error code. This function can be customized by application developer.
Definition at line 65 of file DebugBreak.c.
INLINE void R_NOOP | ( | void | ) |
void R_OSPL_ASYNC_CopyExceptAThread | ( | const r_ospl_async_t *const | Source, |
r_ospl_async_t *const | Destination | ||
) |
errnum_t R_OSPL_AXI_Get2ndCacheAttribute | ( | uintptr_t const | PhysicalAddress, |
r_ospl_axi_cache_attribute_t *const | out_CacheAttribute | ||
) |
Get 2nd cache attribute of AXI bus for peripheral (not CPU) from physical address.
- Parameters:
-
PhysicalAddress The physical address in the memory area out_CacheAttribute Output: Cache_attribute, AWCACHE[3:0], ARCACHE[3:0]
- Returns:
- Error code. If there is no error, the return value is 0.
Definition at line 359 of file r_ospl_memory.c.
errnum_t R_OSPL_AXI_GetProtection | ( | uintptr_t const | physical_address, |
r_ospl_axi_protection_t *const | out_protection | ||
) |
Gets protection attribute of AXI bus from the address.
- Parameters:
-
PhysicalAddress The physical address in the memory area out_CacheAttribute Output: The protection attribute of AXI bus AWPROT[2:0], ARPROT[2:0]
- Returns:
- Error code. If there is no error, the return value is 0.
Definition at line 416 of file r_ospl_memory.c.
void R_OSPL_C_LOCK_InitConst | ( | r_ospl_c_lock_t *const | self ) |
errnum_t R_OSPL_C_LOCK_Lock | ( | r_ospl_c_lock_t *const | self ) |
Locks the target, if lockable state.
- Parameters:
-
self C-lock object
- Returns:
- Error code. If there is no error, the return value is 0.
- Description
- Even if lock owner called this function, if lock object was already locked, E_ACCESS_DENIED error is raised.
"R_OSPL_C_LOCK_Lock" does not do exclusive control.
errnum_t R_OSPL_C_LOCK_Unlock | ( | r_ospl_c_lock_t *const | self ) |
Unlocks the target.
- Parameters:
-
self C-lock object
- Returns:
- Error code. If there is no error, the return value is 0.
- Description
- If this function was called with unlocked object, this function does nothing and raises "E_ACCESS_DENIED" error.
If self == NULL, this function does nothing and raises no error. E_NOT_THREAD error is raised, if this function was called from the interrupt context.
- I - lock does not do in this function.
"R_OSPL_C_LOCK_Unlock" does not do exclusive control.
INLINE int_fast32_t R_OSPL_CALLER_GetRootChannelNum | ( | const r_ospl_caller_t *const | self ) |
void R_OSPL_CALLER_Initialize | ( | r_ospl_caller_t *const | self, |
r_ospl_async_t *const | Async, | ||
volatile void *const | PointerToState, | ||
int_t const | StateValueOfOnInterrupting, | ||
void *const | I_Lock, | ||
const r_ospl_i_lock_vtable_t *const | I_LockVTable | ||
) |
void R_OSPL_CallInterruptCallback | ( | const r_ospl_caller_t *const | self, |
const r_ospl_interrupt_t *const | InterruptSource | ||
) |
INLINE void R_OSPL_CLEAR_ERROR | ( | void | ) |
Clears the error state.
- Parameters
- None
- Returns:
- None
- Description
- This function does nothing, if "R_OSPL_ERROR_BREAK" macro and "R_OSPL_TLS_ERROR_CODE" macro were defined to be 0. The following descriptions are available, if "R_OSPL_ERROR_BREAK" macro was defined to be 1.
Whether the state is the error state is stored in thread local storage. "R_OSPL_GetErrNum" function returns 0 after called this function.
If the error state was not cleared, the following descriptions were caused.
- Breaks at "R_DEBUG_BREAK_IF_ERROR" macro
- "R_OSPL_SET_BREAK_ERROR_ID" function behaves not expected behavior because the count of error is not counted up.
errnum_t R_OSPL_Delay | ( | uint32_t const | DelayTime_msec ) |
Waits for a while until passed time.
- Parameters:
-
DelayTime_msec Time of waiting (millisecond)
- Returns:
- Error code. If there is no error, the return value is 0.
- Description
- Maximum value is "R_OSPL_MAX_TIME_OUT" (=65533).
Definition at line 348 of file r_ospl_RTX.c.
bool_t R_OSPL_DisableAllInterrupt | ( | void | ) |
Disables all interrupts.
- Parameters
- None
- Returns:
- None
- Description
- Driver user should not call this function. Call this function at begin of area of all interrupts disabled. This function does not disable NMI.
- Example
void Func() { bool_t was_all_enabled = false; was_all_enabled = R_OSPL_DisableAllInterrupt(); // All interrupt disabled if ( was_all_enabled ) { R_OSPL_EnableAllInterrupt(); } }
void R_OSPL_EnableAllInterrupt | ( | void | ) |
Releases all disabled interrupts.
- Parameters
- None
- Returns:
- None
- Description
- Driver user should not call this function. Call this function at the end of area of all interrupts disabled. Do not release, if all interrupts was already disabled by caller function. This function does not release disabled NMI.
void R_OSPL_EVENT_Clear | ( | r_ospl_thread_id_t const | ThreadId, |
bit_flags32_t const | ClearFlags1 | ||
) |
Set one or some bits to 0.
- Parameters:
-
ThreadId The thread ID attached the target event ClearFlags1 The value of bit flags that clearing bit is 1
- Returns:
- None
- Description
- It is not necessary to call this function after called "R_OSPL_EVENT_Wait" function.
The way that all bit flags is cleared is setting "R_OSPL_EVENT_ALL_BITS" (=0x0000FFFF) at "ClearFlags1" argument.
When other thread was nofied by calling "R_OSPL_EVENT_Set", "R_OSPL_EVENT_Clear" must not be called from caller (notifier) thread.
For OS less, there is the area disabled all interrupts.
Do nothing, when "ThreadId" = "NULL"
Definition at line 131 of file r_ospl_RTX.c.
bit_flags32_t R_OSPL_EVENT_Get | ( | r_ospl_thread_id_t const | ThreadId ) |
Get 16bit flags value.
- Parameters:
-
ThreadId The thread ID attached the target event
- Returns:
- The value of 16bit flags
- Description
- This API cannot be used in newest specification.
In receiving the event, call "R_OSPL_EVENT_Wait" function instead of "R_OSPL_EVENT_Get" function or call "R_OSPL_EVENT_Clear" function passed the NOT operated value of flags got by "R_OSPL_EVENT_Get" function.
Definition at line 158 of file r_ospl_RTX.c.
void R_OSPL_EVENT_Set | ( | r_ospl_thread_id_t const | ThreadId, |
bit_flags32_t const | SetFlags | ||
) |
Set one or some bits to 1.
- Parameters:
-
ThreadId The thread ID attached the target event SetFlags The value of bit flags that target bit is 1
- Returns:
- None
- Description
- For OS less, there is the area disabled all interrupts.
- For OS - using environment, the thread waiting in "R_OSPL_EVENT_Wait" function might wake up soon.
Do nothing, when "ThreadId" = "NULL"
Definition at line 110 of file r_ospl_RTX.c.
errnum_t R_OSPL_EVENT_Wait | ( | bit_flags32_t const | WaigingFlags, |
bit_flags32_t *const | out_GotFlags, | ||
uint32_t const | Timeout_msec | ||
) |
Waits for setting the flags in 16bit and clear received flags.
- Parameters:
-
WaigingFlags The bit flags set to 1 waiting or "R_OSPL_ANY_FLAG" out_GotFlags NULL is permitted. Output: 16 bit flags or "R_OSPL_TIMEOUT" Timeout_msec Time out (millisecond) or "R_OSPL_INFINITE"
- Returns:
- Error code. If there is no error, the return value is 0.
- Description
- Waits in this function until the flags become passed flags pattern by "R_OSPL_EVENT_Set" function.
Check "r_ospl_async_t::ReturnValue", when the asynchronous operation was ended.
Definition at line 177 of file r_ospl_RTX.c.
void R_OSPL_FLAG32_Clear | ( | volatile r_ospl_flag32_t *const | self, |
bit_flags32_t const | ClearFlags1 | ||
) |
Set one or some bits to 0.
- Parameters:
-
self The value of 32bit flags ClearFlags1 The value of bit flags that clearing bit is 1
- Returns:
- None
- Description
- Operates following operation.
volatile bit_flags32_t self->Flags; bit_flags32_t ClearFlags1; self->Flags &= ~ClearFlags1;
Set "R_OSPL_FLAG32_ALL_BITS", if you wanted to clear all bits.
This function is not atomic because "&=" operator is "Read Modify Write" operation.
bit_flags32_t R_OSPL_FLAG32_Get | ( | volatile const r_ospl_flag32_t *const | self ) |
Get 32bit flags value.
- Parameters:
-
self The value of 32bit flags
- Returns:
- The value of 32bit flags
- Description
- In receiving the event, call "R_OSPL_FLAG32_GetAndClear" function instead of "R_OSPL_FLAG32_Get" function or call "R_OSPL_FLAG32_Clear" function passed the NOT operated value of flags got by "R_OSPL_FLAG32_Get" function.
Operates following operation. volatile bit_flags32_t self->Flags; bit_flags32_t return_flags; return_flags = self->Flags; return return_flags;
bit_flags32_t R_OSPL_FLAG32_GetAndClear | ( | volatile r_ospl_flag32_t *const | self ) |
Get 32bit flags value.
- Parameters:
-
self The value of 32bit flags
- Returns:
- The value of 32bit flags
- Description
- Operates following operation.
volatile bit_flags32_t self->Flags; bit_flags32_t return_flags; return_flags = self->Flags; self->Flags = 0; return return_flags;
This function is not atomic because the value might be set before clearing to 0.
void R_OSPL_FLAG32_InitConst | ( | volatile r_ospl_flag32_t *const | self ) |
Clears all flags in 32bit to 0.
- Parameters:
-
self The value of 32bit flags
- Returns:
- None
- Description
- Operates following operation.
volatile bit_flags32_t self->flags; self->flags = 0;
void R_OSPL_FLAG32_Set | ( | volatile r_ospl_flag32_t *const | self, |
bit_flags32_t const | SetFlags | ||
) |
Set one or some bits to 1.
- Parameters:
-
self The value of 32bit flags SetFlags The value of bit flags that target bit is 1
- Returns:
- None
- Description
- Operates following operation. This function is not atomic because "|=" operator is "Read Modify Write" operation.
volatile bit_flags32_t self->Flags; bit_flags32_t SetFlags; self->Flags |= SetFlags;
INLINE uint32_t R_OSPL_FTIMER_CountToTime | ( | const r_ospl_ftimer_spec_t *const | ts, |
uint32_t const | Count | ||
) |
Change from free running timer unit to mili-second unit.
- Parameters:
-
ts Precision of the free running timer Count The value of free running timer unit
- Returns:
- The value of mili-second unit
- Description
- The fractional part is been round down. (Because overflow does not occur, when "Count = r_ospl_ftimer_spec_t::MaxCount" )
This function calculates like the following formula.
( Count * ts->msec_Numerator ) / ts->msec_Denominator
uint32_t R_OSPL_FTIMER_Get | ( | void | ) |
Get current time of free running timer.
- Parameters
- None
- Returns:
- The current clock count of free run timer
- Description
- Call "R_OSPL_FTIMER_InitializeIfNot" function before calling this function. Call "R_OSPL_FTIMER_IsPast" function, when it is determined whether time passed.
- Example
errnum_t e; r_ospl_ftimer_spec_t ts; uint32_t start; uint32_t end; e= R_OSPL_FTIMER_InitializeIfNot( &ts ); IF(e){goto fin;} start = R_OSPL_FTIMER_Get(); // The section of measuring end = R_OSPL_FTIMER_Get(); printf( "%d msec\n", R_OSPL_FTIMER_CountToTime( &ts, end - start ) );
void R_OSPL_FTIMER_GetSpecification | ( | r_ospl_ftimer_spec_t *const | out_Specification ) |
errnum_t R_OSPL_FTIMER_InitializeIfNot | ( | r_ospl_ftimer_spec_t *const | out_Specification ) |
Set up the free running timer.
- Parameters:
-
out_Specification NULL is permitted. Output: The precision of the free run timer
- Returns:
- Error code. If there is no error, the return value is 0.
- Description
- The free running timer does not stop.
If the counter of the free running timer was overflow, the counter returns to 0. Even in interrupt handler, the counter does count up. OSPL free running timer does not use any interrupt.
Using timer can be selected by "R_OSPL_FTIMER_IS" macro.
If the free running timer was already set up, this function does not set up it, outputs to "out_Specification" argument and does not raise any error.
When OSPL API function with timeout or "R_OSPL_Delay" function was called, "R_OSPL_FTIMER_InitializeIfNot" function is callbacked from these functions.
There is all interrupt disabled area inside.
errnum_t R_OSPL_FTIMER_IsPast | ( | const r_ospl_ftimer_spec_t *const | ts, |
uint32_t const | Now, | ||
uint32_t const | TargetTime, | ||
bool_t *const | out_IsPast | ||
) |
Returns whether specified time was passed.
- Parameters:
-
ts Precision of the free running timer Now Count of current time TargetTime Count of target time out_IsPast Output: Whether the target time was past or not
- Returns:
- Error code. If there is no error, the return value is 0.
INLINE uint32_t R_OSPL_FTIMER_TimeToCount | ( | const r_ospl_ftimer_spec_t *const | ts, |
uint32_t const | msec | ||
) |
Change from mili-second unit to free running timer unit.
- Parameters:
-
ts Precision of the free running timer msec The value of mili-second unit
- Returns:
- The value of free running timer unit
- Description
- The fractional part is been round up. (For waiting time must be more than specified time.)
This function calculates like the following formula.
( msec * ts->msec_Denominator + ts->msec_Numerator - 1 ) / ts->msec_Numerator
- Attention: If "ts - >msec_Denominator" was more than "ts->msec_Numerator", take care of overflow.
INLINE int_fast32_t R_OSPL_GET_ERROR_ID | ( | void | ) |
Returns the number of current error.
- Parameters
- None
- Returns:
- The number of current error
- Description
- This function does nothing, if "R_OSPL_ERROR_BREAK" macro was defined to be 0. The following descriptions are available, if "R_OSPL_ERROR_BREAK" macro was defined to be 1.
This function returns 0, if any errors were not raised.
This function returns 1, if first error was raised.
After that, this function returns 2, if second error was raised after calling "R_OSPL_CLEAR_ERROR" function. This function does not return 0 after that the error was cleared by calling "R_OSPL_CLEAR_ERROR". The number of current error is running number in the whole of system (all threads).
Error is raised by following macros.
IF, IF_D, ASSERT_R, ASSERT_D
The process breaks at a moment of error raised, if the number of current error was set to "R_OSPL_SET_BREAK_ERROR_ID" macro.
INLINE int_fast32_t R_OSPL_GET_THREAD_LOCKED_COUNT | ( | void | ) |
r_ospl_error_t* R_OSPL_GetCurrentThreadError | ( | void | ) |
errnum_t R_OSPL_GetErrNum | ( | void | ) |
Returns the error code from TLS (Thread Local Storage).
- Parameters
- None
- Returns:
- Error code
- Description
- Usually error code is returned. If API function cannot return any error code, API function may have the specification of getting error code by "R_OSPL_GetErrNum".
There is this function, if "R_OSPL_TLS_ERROR_CODE" macro was defined to be 1. This function returns 0 after called "R_OSPL_CLEAR_ERROR" function.
int32_t R_OSPL_GetVersion | ( | void | ) |
bool_t R_OSPL_I_LOCK_LockStub | ( | void *const | self_ ) |
void R_OSPL_I_LOCK_RequestFinalizeStub | ( | void *const | self_ ) |
void R_OSPL_I_LOCK_UnlockStub | ( | void *const | self_ ) |
errnum_t R_OSPL_Initialize | ( | const void *const | NullConfig ) |
Initializes the internal of OSPL.
- Parameters:
-
NullConfig Specify NULL
- Returns:
- None
- Description
- Initializes internal mutual exclusion objects. However, "R_OSPL_Initialize" function does not have to be called for OSPL of "R_OSPL_IS_PREEMPTION = 0". "E_ACCESS_DENIED" error is raised, when the OSPL API that it is necessary to call "R_OSPL_Initialize" before calling the API was called.
Definition at line 91 of file r_ospl_RTX.c.
void R_OSPL_InstructionSyncBarrier | ( | void | ) |
bool_t R_OSPL_IsPreemption | ( | void | ) |
errnum_t R_OSPL_LockChannel | ( | int_fast32_t | ChannelNum, |
int_fast32_t * | out_ChannelNum, | ||
mcu_lock_t | HardwareIndexMin, | ||
mcu_lock_t | HardwareIndexMax | ||
) |
Locks by channel number.
- Parameters:
-
ChannelNum Locking channel number or "R_OSPL_UNLOCKED_CHANNEL" out_ChannelNum Output: Locked channel number, (in) NULL is permitted HardwareIndexMin Hardware index of channel number = 0 HardwareIndexMax Hardware index of max channel number
- Returns:
- Error code. If there is no error, the return value is 0
- Description
- This function is called from the internal of "R_DRIVER_Initialize" function or "R_DRIVER_LockChannel" function. This function calls "R_BSP_HardwareLock".
void R_OSPL_MEMORY_Barrier | ( | void | ) |
void R_OSPL_MEMORY_Flush | ( | r_ospl_flush_t const | FlushType ) |
Flushes cache memory.
- Parameters:
-
FlushType The operation of flush
- Returns:
- None
- Description
- Call the function of the driver after flushing input output buffer in the cache memory, If the data area accessing by the hardware is on cache and the driver did not manage the cache memory. Whether the driver manages the cache memory is depend on the driver specification.
Definition at line 241 of file r_ospl_RTX.c.
errnum_t R_OSPL_MEMORY_GetLevelOfFlush | ( | const void * | Address, |
int_fast32_t * | out_Level | ||
) |
Gets the level of cache for flushing the memory indicated by the address.
- Parameters:
-
Address The address in flushing memory out_Level Output: 0=Not need to flush, 1=L1 cache only, 2=both of L1 and L2 cache
- Returns:
- Error code. If there is no error, the return value is 0.
Definition at line 290 of file r_ospl_memory.c.
void R_OSPL_MEMORY_GetSpecification | ( | r_ospl_memory_spec_t *const | out_MemorySpec ) |
Gets the specification about memory and cache memory.
- Parameters:
-
out_MemorySpec The specification about memory and cache memory
- Returns:
- None
Definition at line 332 of file r_ospl_RTX.c.
errnum_t R_OSPL_MEMORY_RangeFlush | ( | r_ospl_flush_t const | FlushType, |
const void *const | StartAddress, | ||
size_t const | Length | ||
) |
Flushes cache memory with the range of virtual address.
- Parameters:
-
FlushType The operation of flush
- Returns:
- None
- Description
- Align "StartAddress" argument and "Length" argument to cache line size. If not aligned, E_OTHERS error is raised. Refer to : R_OSPL_MEMORY_GetSpecification
If the data area written by the hardware and read from CPU was in cache rea, when the hardware started without invalidate ("R_OSPL_FLUSH_WRITEBACK_INVALIDATE" or "R_OSPL_FLUSH_INVALIDATE"), invalidate the data area and read it after finished to write by hardware. (If the driver does not manage the cache memory.)
Definition at line 298 of file r_ospl_RTX.c.
Merge the error code raised in the finalizing operation.
- Parameters:
-
CurrentError Current error code AppendError New append error code
- Returns:
- Merged error code
- Description
- When the state was error state, if other new error was raised, new error code is ignored.
- If "CurrentError != 0", this function returns "CurrentError" argument.
- If "CurrentError == 0", this function returns "AppendError" argument.
This function can be modify by user.
- Example
ee= Sample(); e= R_OSPL_MergeErrNum( e, ee ); return e;
INLINE void R_OSPL_MODIFY_THREAD_LOCKED_COUNT | ( | int_fast32_t | Plus ) |
Modifies count of objects that current thread has locked.
- Parameters:
-
Plus The value of adding to the counter.
- Returns:
- None
- Description
- The counter is subtracted, if this argument was minus.
Drivers calls this function. This function is not called from OSPL. This function does nothing, if "R_OSPL_ERROR_BREAK" macro is 0.
void R_OSPL_OnInterruptForUnregistered | ( | uint32_t const | int_sense ) |
Interrupt callback function for unregisterd interrupt.
- Parameters:
-
int_sense (See INTC driver)
- Returns:
- None
Definition at line 105 of file mcu_interrupts.c.
bool_t R_OSPL_OnRaisingErrorForMISRA | ( | bool_t const | Condition, |
const char_t *const | File, | ||
int_t const | Line | ||
) |
errnum_t R_OSPL_QUEUE_Allocate | ( | r_ospl_queue_t * | self, |
void * | out_Address, | ||
uint32_t | Timeout_msec | ||
) |
Allocates an element from the queue object.
- Parameters:
-
self A queue object out_Address Output: Address of allocated element Timeout_msec Timeout (msec) or R_OSPL_INFINITE
- Returns:
- Error code. If there is no error, the return value is 0
- Description
- An error will be raised, if "Timeout_msec != 0" in interrupt context. It becomes "*out_Address = NULL", when it was timeout and "Timeout_msec = 0". E_TIME_OUT error is raised, when it was timeout and "Timeout_msec != 0".
Definition at line 418 of file r_ospl_RTX.c.
errnum_t R_OSPL_QUEUE_Create | ( | r_ospl_queue_t ** | out_self, |
r_ospl_queue_def_t * | QueueDefine | ||
) |
Initializes a queue.
- Parameters:
-
out_self Output: Address of initialized queue object QueueDefine Initial attributes of queue and work area
- Returns:
- Error code. If there is no error, the return value is 0
- Description
- It is not possible to call this function from the library. This function is called from porting layer of the driver and send created queue to the driver.
OSPL does not have finalizing function (portabled with CMSIS). An object specified "QueueDefine" argument can be specified to the create function 1 times only. Some OS does not have this limitation.
The address of a variable as "r_ospl_queue_t*" type is set at "out_self" argument. Internal variables of the queue are stored in the variable specified with "QueueDefine" argument.
Definition at line 385 of file r_ospl_RTX.c.
errnum_t R_OSPL_QUEUE_Free | ( | r_ospl_queue_t * | self, |
void * | Address | ||
) |
Releases the element to the queue object.
- Parameters:
-
self A queue object Address Address of received element
- Returns:
- Error code. If there is no error, the return value is 0
- Description
- It is correct, even if other thread put to the queue or get from the queue from calling "R_OSPL_QUEUE_Get" to calling "R_OSPL_QUEUE_Free".
Definition at line 505 of file r_ospl_RTX.c.
errnum_t R_OSPL_QUEUE_Get | ( | r_ospl_queue_t * | self, |
void * | out_Address, | ||
uint32_t | Timeout_msec | ||
) |
Receives the element from the queue.
- Parameters:
-
self A queue object out_Address Output: Address of received element Timeout_msec Timeout (msec) or R_OSPL_INFINITE
- Returns:
- Error code. If there is no error, the return value is 0
- Description
- Call "R_OSPL_QUEUE_Free" function after finishing to access to the element. Don't access the memory area of the element after calling "R_OSPL_QUEUE_Free".
"E_NOT_THREAD" error is raised, if "Timeout_msec = 0" was specified from interrupt context. It is not possible to wait for put data to the queue in interrupt context.
"*out_Address" is NULL and any errors are not raised, if it becomed to timeout and "Timeout_msec = 0". "E_TIME_OUT" is raised, if "Timeout_msec != 0".
Specify "Timeout_msec = 0", call the following functions by the following order and use an event for preventing to block to receive other events by the thread having waited for the queue.
Sending Side
- R_OSPL_QUEUE_Allocate
- R_OSPL_QUEUE_Put
- R_OSPL_EVENT_Set
Receiving Side
- R_OSPL_EVENT_Wait
- R_OSPL_QUEUE_Get
- R_OSPL_QUEUE_Free
In OS less environment, "R_OSPL_QUEUE_Get" supports pseudo multi threading. See "R_OSPL_THREAD_GetIsWaiting" function.
Definition at line 470 of file r_ospl_RTX.c.
errnum_t R_OSPL_QUEUE_GetStatus | ( | r_ospl_queue_t * | self, |
const r_ospl_queue_status_t ** | out_Status | ||
) |
Gets status of the queue.
- Parameters:
-
self A queue object out_Status Output: Pointer to the status structure
- Returns:
- Error code. If there is no error, the return value is 0
- Description
- Got status are the information at calling moment. If ohter threads were run, the status will be changed. See "R_DRIVER_GetAsyncStatus" function about pointer type of "out_Status" argument
Definition at line 408 of file r_ospl_RTX.c.
errnum_t R_OSPL_QUEUE_Print | ( | r_ospl_queue_t * | self ) |
Print status of the queue object.
- Parameters:
-
self A queue object
- Returns:
- Error code. If there is no error, the return value is 0
errnum_t R_OSPL_QUEUE_Put | ( | r_ospl_queue_t * | self, |
void * | Address | ||
) |
Sends the element to the queue.
- Parameters:
-
self A queue object Address Address of element to put
- Returns:
- Error code. If there is no error, the return value is 0
- Description
- It is correct, even if other thread put to the queue or get from the queue from calling "R_OSPL_QUEUE_Allocate" to calling "R_OSPL_QUEUE_Put".
The message put to the queue by this function receives the thread calling "R_OSPL_QUEUE_Get" function.
Definition at line 450 of file r_ospl_RTX.c.
void R_OSPL_RaiseUnrecoverable | ( | errnum_t const | e ) |
Raises the error of system unrecoverable.
- Parameters:
-
e Error code
- Returns:
- None
- Description
- The error of system unrecoverable is the error of impossible to
- self - recover by process or main system. Example, the heap area was broken or there are not any responses from hardware. This error can be recoverable by OS or the system controller(e.g. Software reset)
Example, when an error of recovery process was raised, "R_OSPL_RaiseUnrecoverable" function must be called.
"R_OSPL_RaiseUnrecoverable" function can be customized by the application. By default, it calls "R_DebugBreak" function and falls into the infinite loop.
Definition at line 63 of file r_ospl_unrecoverable.c.
INLINE void R_OSPL_SET_BREAK_ERROR_ID | ( | int_fast32_t | ID ) |
Register to break at raising error at the moment.
- Parameters:
-
ID Breaking number of error
- Returns:
- None
- Description
- This function does nothing, if "R_OSPL_ERROR_BREAK" macro was defined to be 0. The following descriptions are available, if "R_OSPL_ERROR_BREAK" macro was defined to be 1.
Set a break point at "R_DebugBreak" function, when the process breaks at the error raised code.
The number of "ErrorID" argument can be known by "R_DEBUG_BREAK_IF_ERROR" macro or "R_OSPL_GET_ERROR_ID" macro.
- In multi - threading environment, the number of "ErrorID" argument is the number of raised errors in all threads. But when "ErrorID" argument was set to be over 2, call "R_OSPL_SET_DEBUG_WORK" function before calling "R_OSPL_SET_BREAK_ERROR_ID" function.
The following code breaks at first error.
The following code breaks at next error after resuming from meny errors.
R_OSPL_SET_BREAK_ERROR_ID( R_OSPL_GET_ERROR_ID() + 1 );
void R_OSPL_SET_DEBUG_WORK | ( | void * | WorkArea, |
uint32_t | WorkAreaSize | ||
) |
Set the debug work area.
- Parameters:
-
WorkArea Start address of work area WorkAreaSize Size of work area (byte). See. <R_OSPL_DEBUG_WORK_SIZE>
- Returns:
- None
- Description
- This function does nothing, if "R_OSPL_ERROR_BREAK" macro was defined to be 0. The following descriptions are available, if "R_OSPL_ERROR_BREAK" macro was defined to be 1.
Set the debug work area, when "R_OSPL_SET_BREAK_ERROR_ID" function supports multi thread. "E_NO_DEBUG_TLS" error is raised, if the debug work area was not set, when errors was raised in 2 or more threads. It is not necessary to call this function, if error handling did by one thread only.
- Example
#if R_OSPL_ERROR_BREAK #define GS_MAX_THREAD 10 static uint8_t gs_DebugWorkArea[ R_OSPL_DEBUG_WORK_SIZE( GS_MAX_THREAD ) ]; #endif R_OSPL_SET_DEBUG_WORK( gs_DebugWorkArea, sizeof(gs_DebugWorkArea) );
void R_OSPL_SetErrNum | ( | errnum_t const | e ) |
Sets an error code to TLS (Thread Local Storage).
- Parameters:
-
e Raising error code
- Returns:
- None
- Description
- Usually error code is returned. If API function cannot return any error code, API function can have the specification of setting error code by "R_OSPL_SetErrNum".
There is this function, if "R_OSPL_TLS_ERROR_CODE" macro was defined to be 1. This function does nothing, if any error code was stored already in TLS. The state does not change to error state, if "R_OSPL_SetErrNum" function was called only. See "R_OSPL_GET_ERROR_ID".
errnum_t R_OSPL_SetInterruptPriority | ( | bsp_int_src_t const | IRQ_Num, |
int_fast32_t const | Priority | ||
) |
Sets the priority of the interrupt line.
- Parameters:
-
IRQ_Num Interrupt request number Priority Priority. The less the prior.
- Returns:
- Error code. If there is no error, the return value is 0
Definition at line 231 of file r_ospl_RTX.c.
void R_OSPL_TABLE_Free | ( | r_ospl_table_t *const | self, |
const void *const | Key | ||
) |
errnum_t R_OSPL_TABLE_GetIndex | ( | r_ospl_table_t *const | self, |
const void *const | Key, | ||
int_fast32_t *const | out_Index, | ||
r_ospl_if_not_t const | TypeOfIfNot | ||
) |
void R_OSPL_TABLE_InitConst | ( | r_ospl_table_t *const | self, |
void *const | Area, | ||
size_t const | AreaByteSize, | ||
bool_t const | Is_T_Lock | ||
) |
void R_OSPL_TABLE_Print | ( | r_ospl_table_t *const | self ) |
r_ospl_thread_id_t R_OSPL_THREAD_GetCurrentId | ( | void | ) |
Get running thread ID (for OS less and OS-using environment)
- Parameters
- None
- Returns:
- The current running thread ID
- Description
- It is possible to use this function for both OS less and OS - using environment. For OS less, returns thread ID passed to "R_OSPL_THREAD_SetCurrentId" function. "NULL" is returned, if in interrupt context.
Definition at line 101 of file r_ospl_RTX.c.
errnum_t R_OSPL_ToCachedAddress | ( | const volatile void *const | Address, |
void *const | out_CachedAddress | ||
) |
Changes to the address in the L1 cache area.
- Parameters:
-
Address Virtual address out_CachedAddress Output: Virtual address for cached area
- Returns:
- Error code. If there is no error, the return value is 0.
- Description
- This function must be modified by MMU setting. If "E_ACCESS_DENIED" error was raised, you may know the variable by looking at value of "Address" argument and map file.
Definition at line 157 of file r_ospl_memory.c.
errnum_t R_OSPL_ToPhysicalAddress | ( | const volatile void *const | Address, |
uintptr_t *const | out_PhysicalAddress | ||
) |
Changes to physical address.
- Parameters:
-
Address Virtual address out_PhysicalAddress Output: Physical address
- Returns:
- Error code. If there is no error, the return value is 0.
- Description
- This function must be modified by MMU setting.
Definition at line 134 of file r_ospl_memory.c.
errnum_t R_OSPL_ToUncachedAddress | ( | const volatile void *const | Address, |
void *const | out_UncachedAddress | ||
) |
Changes to the address in the L1 uncached area.
- Parameters:
-
Address Virtual address out_UncachedAddress Output: Virtual address for uncached area
- Returns:
- Error code. If there is no error, the return value is 0.
- Description
- This function must be modified by MMU setting. If "E_ACCESS_DENIED" error was raised, you may know the variable by looking at value of "Address" argument and map file.
Definition at line 218 of file r_ospl_memory.c.
errnum_t R_OSPL_UnlockChannel | ( | int_fast32_t | ChannelNum, |
errnum_t | e, | ||
mcu_lock_t | HardwareIndexMin, | ||
mcu_lock_t | HardwareIndexMax | ||
) |
Unlocks by channel number.
- Parameters:
-
ChannelNum Channel number e Raising error code, If there is no error, 0 HardwareIndexMin Hardware index of channel number = 0 HardwareIndexMax Hardware index of max channel number
- Returns:
- Error code. If there is no error, the return value is 0
- Description
- This function is called from the internal of "R_DRIVER_Finalize" function or "R_DRIVER_UnlockChannel" function. This function calls "R_BSP_HardwareUnlock".
Generated on Tue Jul 12 2022 11:15:06 by 1.7.2