R_RTOS  0.1
DistributedRealTimeOperatingSystemfortheARMCortexMArchitecture

Functions for creating, initializing, maintaining and handling monitors. More...

Data Structures

struct  mntr
 Monitor for synchronized access. More...
 

Macros

#define MEM_OBJECTS_MNTR   ((uint8_t)0x4u)
 Number of SyncEle that will be allocated by the Monitor mechanism in its memory pool. More...
 
#define NR_OF_MNTRS   ((uint8_t)0x2u)
 Number of Mutexes in the system. More...
 

Typedefs

typedef enum mntrAccssType ACCSSType
 Enumeration of the access types for access on a monitor.
 
typedef enum mntrAccessState MntrState
 See mntrAccessState.
 
typedef uint8_t mntrRfrcCnt
 Reference counter data type.
 

Enumerations

Functions

static RetCode mntr_appendToWaitrList (PMntr const mntr, PTskTCB const waitrTsk)
 Append the specified Task to the specified Monitor's wait queue. More...
 
static RetCode mntr_getNextWaitr (PMntr const mntr)
 Examine the specified Monitor's wait queue and release the entities accordingly. More...
 
RetCode mntr_INIT (void)
 Initialize the Monitor functionality. More...
 
RetCode mntr_InitMntr (const MntrNr mntrNr, const Data const data)
 Initialize the monitor with the given MntrNr. More...
 
RetCode mntr_ReqstReadAccssMntr (const MntrNr mntrNr, PTskTCB const tsk)
 Request read access to the data protected by the monitor. More...
 
RetCode mntr_ReqstWriteAccssMntr (const MntrNr mntrNr, PTskTCB const tsk)
 Request write access to the data protected by the monitor. More...
 
RetCode mntr_ReleaseAccssMntr (const MntrNr mntrNr)
 Release a previously made access request (read or write). More...
 

Variables

R_RTOS_memMngr h typedef uint8_t mntrFlgs
 8 bit representation of the current monitor access type
 
static MemPoolID memPoolID_MNTR
 Memory pool ID for Monitors. More...
 
static Mntr ar_Mntr [NR_OF_MNTRS]
 Array that holds all available Monitors.
 

Detailed Description

Functions for creating, initializing, maintaining and handling monitors.

Macro Definition Documentation

#define MEM_OBJECTS_MNTR   ((uint8_t)0x4u)

Number of SyncEle that will be allocated by the Monitor mechanism in its memory pool.

Note
User Defined
#define NR_OF_MNTRS   ((uint8_t)0x2u)

Number of Mutexes in the system.

Note
User Defined

Enumeration Type Documentation

Access types for the monitor.

The access flags are independent of the state flags. Thus a monitor can be locked or set free regardless of its state. Convenience flags, however, are introduced for common combinations.

State Flags:

Flag Meaning
Free Monitor can be accessed
Pending A blocking operation is pending, therefore further access is denied
Lock Monitor is locked and no access is granted

Access Flags:

Flag Meaning State
NOOP No operation Free
Read Read access Free
Write Write access Pending or Lock
Enumerator
MNTR_LOCK_ERROR 

Error state.

MNTR_READ 

Read access.

MNTR_WRITE 

Write Access.

MNTR_NOOP 

No operation.

MNTR_FREE 

Free state.

MNTR_FREE_READ 

MNTR_FREE | MNTR_READ.

MNTR_FREE_NOOP 

MNTR_FREE | MNTR_NOOP.

MNTR_PENDING 

Pending state.

MNTR_PENDING_WRITE 

MNTR_PENDING | MNTR_WRITE.

MNTR_LOCK 

Lock state.

MNTR_LOCK_WRITE 

MNTR_LOCK | MNTR_WRITE.

MNTR_RW 

MNTR_READ | MNTR_WRITE.

MNTR_RPW 

MNTR_FREE | MNTR_PENDING | MNTR_LOCK | MNTR_READ | MNTR_WRITE.

MNTR_WPW 

MNTR_FREE | MNTR_PENDING | MNTR_WRITE.

Enumeration of the access types for access on a monitor.

Enumerator
MNTR_ACCESS_NONE 

MNTR_ACCESS_NONE.

MNTR_ACCESS_READ 

MNTR_ACCESS_READ.

MNTR_ACCESS_WRITE 

MNTR_ACCESS_WRITE.

MNTR_ACCESS_DELETE 

MNTR_ACCESS_DELETE.

MNTR_ACCESS_MODIFY 

MNTR_ACCESS_MODIFY.

Function Documentation

static RetCode mntr_appendToWaitrList ( PMntr const  mntr,
PTskTCB const  waitrTsk 
)
static

Append the specified Task to the specified Monitor's wait queue.

Parameters
[in]mntrMonitor the function is called for
[in]waitrTskTask that shall be appended to the monitor's wait queue
Returns
RetCode
RET_OK
RET_NOK
static RetCode mntr_getNextWaitr ( PMntr const  mntr)
static

Examine the specified Monitor's wait queue and release the entities accordingly.

Parameters
[in]mntrMonitors whose wait queue is examined
Returns
RetCode
RET_OK
RET_NOK
RetCode mntr_INIT ( void  )

Initialize the Monitor functionality.

Returns
RetCode
RET_OK Everything is ok
Warning
Must be called before any monitor function/operation is called!
RetCode mntr_InitMntr ( const MntrNr  mntrNr,
const Data const  data 
)

Initialize the monitor with the given MntrNr.

Parameters
[in]mntrNrNumber of the monitor the function is called for
[in]dataData to be protected by the monitor
Returns
RetCode
RET_OK Successful
RET_NOK Failed
Note
This function is called by mntr_INIT for all available monitors with default values.
RetCode mntr_ReleaseAccssMntr ( const MntrNr  mntrNr)

Release a previously made access request (read or write).

Parameters
[in]mntrNrNumber of the monitor the function is called for
Returns
RetCode
RET_OK Successful
RET_NOK Failed
Note
This function is used to release both: read and write accesses.
RetCode mntr_ReqstReadAccssMntr ( const MntrNr  mntrNr,
PTskTCB const  tsk 
)

Request read access to the data protected by the monitor.

Parameters
[in]mntrNrNumber of the monitor the function is called for
[in]tskTask the read access request is made for
Returns
RetCode
RET_OK Successful
RET_NOK Failed
Note
Multiple simultaneous read accesses are possible, whereas only one write access can be given.
RetCode mntr_ReqstWriteAccssMntr ( const MntrNr  mntrNr,
PTskTCB const  tsk 
)

Request write access to the data protected by the monitor.

Parameters
[in]mntrNrNumber of the monitor the function is called for
[in]tskTask the write access request is made for
Returns
RetCode
RET_OK Successful
RET_NOK Failed
Note
Only one write access at a time is granted.

Variable Documentation

memPoolID_MNTR
static

Memory pool ID for Monitors.

SyncEle for blocked tasks are allocated from this memory pool