R_RTOS  0.1
DistributedRealTimeOperatingSystemfortheARMCortexMArchitecture
R_RTOS_monitor.h
Go to the documentation of this file.
1 
14 #ifndef HEADERS_R_RTOS_MONITOR_H_
15 #define HEADERS_R_RTOS_MONITOR_H_
16 
17 #include "R_RTOS_inc.h"
18 #include "R_RTOS_memMngr.h
19 
20 
24 typedef uint8_t mntrFlgs;
25 
52 typedef enum mntrAccessState
53 {
54  //MNTR_LOCK_TO_BE_DELETED_ON_RELEASE
55  MNTR_LOCK_ERROR = (mntrFlgs) 0x00u,
56  MNTR_READ = (mntrFlgs) 0x1u,
57  MNTR_WRITE = (mntrFlgs) 0x2u,
58 
59  MNTR_NOOP = (mntrFlgs) 0x8u,
60 
61  MNTR_FREE = (mntrFlgs) 0x10u,
62  MNTR_FREE_READ = (mntrFlgs) 0x11u,
63  MNTR_FREE_NOOP = (mntrFlgs) 0x18u,
64 
65  MNTR_PENDING = (mntrFlgs) 0x20u,
66  MNTR_PENDING_WRITE = (mntrFlgs) 0x22u,
67 
68  MNTR_LOCK = (mntrFlgs) 0x40u,
69  MNTR_LOCK_WRITE = (mntrFlgs) 0x42u,
70 
71  MNTR_RW = (mntrFlgs) 0x3u,
72  MNTR_RPW = (mntrFlgs) 0x72u,
73  MNTR_WPW = (mntrFlgs) 0x62u
74 } MntrState;
75 
80 typedef uint8_t mntrRfrcCnt;
81 
93 typedef struct mntr
94 {
95  Data protectedData; //!> Pointer to the data to protect
96  TskID mntrWaitrsQTskIDStrt;
100  //MemPoolID memPoolID; //!> MemPoolID of the memory pool the waiter element memory need is served
101 } Mntr, *PMntr;
102 
111 RetCode mntr_INIT( void );
112 
125 RetCode mntr_InitMntr( const MntrNr mntrNr, const Data const data /* = NULL */ );
126 
127 
128 RetCode mntr_DelMntr( const MntrNr mntrNr );
129 
142 RetCode mntr_ReqstReadAccssMntr( const MntrNr mntrNr, PTskTCB const tsk );
143 
156 RetCode mntr_ReqstWriteAccssMntr( const MntrNr mntrNr, PTskTCB const tsk );
157 
169 RetCode mntr_ReleaseAccssMntr( const MntrNr mntrNr );
170 
175 #endif /* HEADERS_R_RTOS_MONITOR_H_ */
RetCode mntr_ReleaseAccssMntr(const MntrNr mntrNr)
Release a previously made access request (read or write).
Definition: R_RTOS_monitor.c:278
RetCode mntr_ReqstWriteAccssMntr(const MntrNr mntrNr, PTskTCB const tsk)
Request write access to the data protected by the monitor.
Definition: R_RTOS_monitor.c:226
Defines, Typedefs and Macros for the whole system.
uint32_t * Data
Data to store in a data container.
Definition: R_RTOS_inc.h:400
uint8_t TskID
Task identification number (ID).
Definition: R_RTOS_inc.h:532
TskID mntrWaitrsQTskIDEnd
TskID of the task containing the start of the waiters list
Definition: R_RTOS_monitor.h:97
RetCode mntr_ReqstReadAccssMntr(const MntrNr mntrNr, PTskTCB const tsk)
Request read access to the data protected by the monitor.
Definition: R_RTOS_monitor.c:172
mntrRfrcCnt refCntr
Current (access) state of the monitor
Definition: R_RTOS_monitor.h:99
RetCode mntr_InitMntr(const MntrNr mntrNr, const Data const data)
Initialize the monitor with the given MntrNr.
Definition: R_RTOS_monitor.c:137
Task Control Block.
Definition: R_RTOS_inc.h:1322
uint8_t mntrRfrcCnt
Reference counter data type.
Definition: R_RTOS_monitor.h:80
enum mntrAccessState MntrState
See mntrAccessState.
RetCode mntr_INIT(void)
Initialize the Monitor functionality.
Definition: R_RTOS_monitor.c:126
uint8_t RetCode
Return codes for functions.
Definition: R_RTOS_inc.h:1424
Monitor for synchronized access.
Definition: R_RTOS_monitor.h:93
MntrState curState
TskID of the task containing the end of the waiters list
Definition: R_RTOS_monitor.h:98