Functions for creating, initializing, maintaining and handling monitors.
More...
Functions for creating, initializing, maintaining and handling monitors.
#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
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.
|
Append the specified Task to the specified Monitor's wait queue.
- Parameters
-
[in] | mntr | Monitor the function is called for |
[in] | waitrTsk | Task that shall be appended to the monitor's wait queue |
- Returns
- RetCode
-
RET_OK
-
RET_NOK
Examine the specified Monitor's wait queue and release the entities accordingly.
- Parameters
-
[in] | mntr | Monitors whose wait queue is examined |
- Returns
- RetCode
-
RET_OK
-
RET_NOK
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] | mntrNr | Number of the monitor the function is called for |
[in] | data | Data 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] | mntrNr | Number 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] | mntrNr | Number of the monitor the function is called for |
[in] | tsk | Task 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] | mntrNr | Number of the monitor the function is called for |
[in] | tsk | Task 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.
Memory pool ID for Monitors.
SyncEle for blocked tasks are allocated from this memory pool