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

Embed: (wiki syntax)

« Back to documentation index

r_ospl_RTX.c File Reference

r_ospl_RTX.c File Reference

OS Porting Layer API for RTX. More...

Go to the source code of this file.

Functions

errnum_t R_OSPL_Initialize (const void *const in_NullConfig)
 Initializes the internal of OSPL.
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.
errnum_t R_OSPL_SetInterruptPriority (bsp_int_src_t const IRQ_Num, int_fast32_t const Priority)
 Sets the priority of the interrupt line.
void R_OSPL_MEMORY_Flush (r_ospl_flush_t const FlushType)
 Flushes cache memory.
static bool_t R_OSPL_Is1bitOnly_Fast32_Sub (uint_fast32_t Value)
 R_OSPL_Is1bitOnly_Fast32_Sub.
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.
errnum_t R_OSPL_Delay (uint32_t const DelayTime_msec)
 Waits for a while until passed time.
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.

Detailed Description

OS Porting Layer API for RTX.

Module:
OSPL
PublicVersion:
0.90

(=R_OSPL_VERSION)

Rev:
35
Date:
2014-04-15 21:38:18 +0900#

Definition in file r_ospl_RTX.c.


Function Documentation

errnum_t R_OSPL_Delay ( uint32_t const   DelayTime_msec )

Waits for a while until passed time.

Parameters:
DelayTime_msecTime 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.

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:
ThreadIdThe thread ID attached the target event
ClearFlags1The 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:
ThreadIdThe 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:
ThreadIdThe thread ID attached the target event
SetFlagsThe 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:
WaigingFlagsThe bit flags set to 1 waiting or "R_OSPL_ANY_FLAG"
out_GotFlagsNULL is permitted. Output: 16 bit flags or "R_OSPL_TIMEOUT"
Timeout_msecTime 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.

errnum_t R_OSPL_Initialize ( const void *const   NullConfig )

Initializes the internal of OSPL.

Parameters:
NullConfigSpecify 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.

static bool_t R_OSPL_Is1bitOnly_Fast32_Sub ( uint_fast32_t  Value ) [static]

R_OSPL_Is1bitOnly_Fast32_Sub.

Parameters
None
Returns:
None.

Definition at line 273 of file r_ospl_RTX.c.

void R_OSPL_MEMORY_Flush ( r_ospl_flush_t const   FlushType )

Flushes cache memory.

Parameters:
FlushTypeThe 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.

void R_OSPL_MEMORY_GetSpecification ( r_ospl_memory_spec_t *const   out_MemorySpec )

Gets the specification about memory and cache memory.

Parameters:
out_MemorySpecThe 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:
FlushTypeThe 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.

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:
selfA queue object
out_AddressOutput: Address of allocated element
Timeout_msecTimeout (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_selfOutput: Address of initialized queue object
QueueDefineInitial 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:
selfA queue object
AddressAddress 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:
selfA queue object
out_AddressOutput: Address of received element
Timeout_msecTimeout (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:
selfA queue object
out_StatusOutput: 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_Put ( r_ospl_queue_t self,
void *  Address 
)

Sends the element to the queue.

Parameters:
selfA queue object
AddressAddress 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.

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_NumInterrupt request number
PriorityPriority. 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.

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.