R_RTOS  0.1
DistributedRealTimeOperatingSystemfortheARMCortexMArchitecture
R_RTOS_msgQueuing.h
Go to the documentation of this file.
1 
21 #ifndef HEADERS_R_RTOS_MSGQUEUING_H_
22 #define HEADERS_R_RTOS_MSGQUEUING_H_
23 
24 #include "R_RTOS_inc.h"
25 
31 #define MAX_MSGQ_SIZE (uint8_t)0x8u
32 
35 #define MAX_MSGQ_MSK (uint8_t)(MAX_MSGQ_SIZE-(uint8_t)0x1u)
36 
43 typedef enum partIDType
44 {
45  PartID_TSK = (uint8_t) 0x0u,
46  PartID_SYS = (uint8_t) 0x1u
47 } PartIDType;
48 
58 typedef struct mqDummyElmnt
59 {
60  void *element;
62 
72 typedef struct mqPub
73 {
74  volatile PTskTCB publisher;
75 } MQPub, *PMQPub;
76 
80 typedef PMQPub MQPubs;
81 
91 typedef struct mqTskSub
92 {
93  volatile PTskMB tskMailBox;
95 
105 typedef struct mqSysSub
106 {
108 } MQSysSub, *PMQSysSub;
109 
119 typedef struct mqSub
120 {
121  union
122  {
123  MQTskSub tskSub;
124  MQSysSub sysSub;
125  } mqSubT;
126 } MQSub, *PMQSub;
127 
131 typedef PMQSub MQSubs;
132 
139 typedef enum mqPrtcpntTypeEnum
140 {
141  MQPrtcpnt_TskPub = (uint8_t) 0x1u,
142  MQPrtcpnt_TskSub = (uint8_t) 0x3u,
143  MQPrtcpnt_SysSub = (uint8_t) 0x4u
144 } MQPrtcpntType;
145 
155 typedef struct mqPrtcpnt
156 {
160  uint8_t DUMMY;
161  union
162  {
163  MQPub pub;
164  MQSub sub;
165  MQDummyElmnt dummy;
166  } MQElmnt;
168 
172 typedef PMQPrtcpnt MQPrtcpnts;
173 
183 typedef struct msgQ
184 {
185  MQData dataQueue[MAX_MSGQ_SIZE ];
186  MQPrtcpnts pubs;
187  MQPrtcpnts subs;
189  uint8_t dataQueueStart;
190  uint8_t dataQueueEnd;
191  uint8_t subscbrCnt;
192  //uint8_t msgQSize; //Dynamic message queue sizing... instead of subscrbrCnt
193 } MsgQ, *PMsgQ;
194 
201 RetCode msgQ_initQueue( QID msgQID);
202 
208 RetCode msgQ_delQueue( const QID msgQID );
209 
217 RetCode msgQ_regTskPub( PTskTCB const pubTsk, const QID msgQID );
218 
228 RetCode msgQ_regSysPub( const uint8_t participant, const QID msgQID );
229 
238  PTskTCB const subTsk,
239  const QID msgQID);
240 
248 RetCode msgQ_regSysSub( const SysFktID subSysFktID, const QID msgQID );
249 
257 RetCode msgQ_unSub( const QID msgQID, const uint16_t id );
258 
271  const QID msgQID,
272  const DataSize size,
273  const DataType type,
274  CData const data );
286  const QID msgQID,
287  const TskID tskID,
288  PMQData * data );
289 
299  const QID msgQID,
300  const TskID tskID,
301  PMQData * data );
302 
307 #endif /* HEADERS_R_RTOS_MSGQUEUING_H_ */
struct mqPrtcpnt * nxtMQPrtcpnt
pointer to the next participant in the list
Definition: R_RTOS_msgQueuing.h:157
MQPrtcpnts pubs
list of all publishers for the queue
Definition: R_RTOS_msgQueuing.h:186
PartID mqPrtcpntID
PartID of the participant.
Definition: R_RTOS_msgQueuing.h:158
Message queue participant structure for task and system subscribers and publishers.
Definition: R_RTOS_msgQueuing.h:155
uint8_t dataQueueEnd
last element in the queue
Definition: R_RTOS_msgQueuing.h:190
struct mqPrtcpnt MQPrtcpnt
mqPrtcpnt
Structure of a function call related to a message queue.
Definition: R_RTOS_inc.h:1029
Task publisher type.
Definition: R_RTOS_msgQueuing.h:141
Identifier for a message queue participant.
Definition: R_RTOS_inc.h:429
struct mqPrtcpnt * PMQPrtcpnt
Pointer to amqPrtcpnt.
uint8_t DUMMY
unused dummy byte
Definition: R_RTOS_msgQueuing.h:160
RetCode msgQ_readDataFrmQ(const QID msgQID, const TskID tskID, PMQData *data)
Read the most recent unread data from the message queue related to QID.
Definition: R_RTOS_msgQueuing.c:530
enum partIDType PartIDType
partIDType
Task subscriber element related to a message queue.
Definition: R_RTOS_msgQueuing.h:91
struct mqPub * PMQPub
Pointer to a mqPub.
struct mqSub MQSub
mqSub
uint8_t QID
Identifier for a message queue.
Definition: R_RTOS_inc.h:416
Defines, Typedefs and Macros for the whole system.
uint8_t subscbrCnt
amount of subscribers to this queue
Definition: R_RTOS_msgQueuing.h:191
RetCode msgQ_unSub(const QID msgQID, const uint16_t id)
Unsubscribe the participant specified by id from the message queue related to the QID...
Definition: R_RTOS_msgQueuing.c:431
RetCode msgQ_regTskSub(PTskTCB const subTsk, const QID msgQID)
Register a task to the message queue related to the QID as a subscriber.
Definition: R_RTOS_msgQueuing.c:328
QID queueID
identifier of the message queue
Definition: R_RTOS_msgQueuing.h:188
RetCode msgQ_pubDataToQ(const QID msgQID, const DataSize size, const DataType type, CData const data)
Publish constant data of a given size and type to the message queue related to the QID...
Definition: R_RTOS_msgQueuing.c:502
uint8_t DataSize
Size of the data in a data container.
Definition: R_RTOS_inc.h:395
RetCode msgQ_takeDataFrmQ(const QID msgQID, const TskID tskID, PMQData *data)
Definition: R_RTOS_msgQueuing.c:570
struct mqTskSub MQTskSub
mqTskSub
RetCode msgQ_initQueue(QID msgQID)
Initialize the message queue with the given QID.
Definition: R_RTOS_msgQueuing.c:220
struct mqSub * PMQSub
Pointer to a mqSub.
RetCode msgQ_regTskPub(PTskTCB const pubTsk, const QID msgQID)
Register a task to the message queue related to the QID as a publisher.
Definition: R_RTOS_msgQueuing.c:272
enum mqPrtcpntTypeEnum MQPrtcpntType
mqPrtcpntTypeEnum
MQPrtcpnts subs
list of all subscribers to the queue
Definition: R_RTOS_msgQueuing.h:187
System subscriber type.
Definition: R_RTOS_msgQueuing.h:143
volatile PTskMB tskMailBox
mailBox of the subscriber
Definition: R_RTOS_msgQueuing.h:93
struct mqDummyElmnt MQDummyElmnt
mqDummyElmnt
uint8_t dataQueueStart
first element in the queue ( ALSO THE OFFSET FOR THE CIRCULAR ARRAY BUFFER!!! )
Definition: R_RTOS_msgQueuing.h:189
Task mailbox for messaging services.
Definition: R_RTOS_inc.h:989
PMQPub MQPubs
Pointer to MQPub elements for a publisher list.
Definition: R_RTOS_msgQueuing.h:80
Message queue which contains publishers, subscribers, data as well as information about the queue...
Definition: R_RTOS_msgQueuing.h:183
uint8_t TskID
Task identification number (ID).
Definition: R_RTOS_inc.h:532
RetCode msgQ_delQueue(const QID msgQID)
Delete the message queue with the given QID.
Definition: R_RTOS_msgQueuing.c:243
enum dataTypes DataType
Enumeration of data types for data stored within another structure.
struct mqPub MQPub
mqPub
RetCode msgQ_regSysPub(const uint8_t participant, const QID msgQID)
Register a system function to the message queue related to the QID as a publisher.
Unified subscriber element related to a message queue.
Definition: R_RTOS_msgQueuing.h:119
void * element
Dummy element.
Definition: R_RTOS_msgQueuing.h:60
Dummy of a message queue element.
Definition: R_RTOS_msgQueuing.h:58
Publisher element related to a message queue.
Definition: R_RTOS_msgQueuing.h:72
const uint32_t * CData
pointer a constant double word (32 bit) of data.
Definition: R_RTOS_inc.h:887
struct mqTskSub * PMQTskSub
Pointer to a mqTskSub.
RetCode msgQ_regSysSub(const SysFktID subSysFktID, const QID msgQID)
Register a system function to the message queue related to the QID as a subscriber.
Definition: R_RTOS_msgQueuing.c:387
volatile PMsgFktCall msgCallBack
callback function of the system function subscriber
Definition: R_RTOS_msgQueuing.h:107
Task PartID Type.
Definition: R_RTOS_msgQueuing.h:45
Task Control Block.
Definition: R_RTOS_inc.h:1322
volatile PTskTCB publisher
pointer to the TskTCB of the publisher
Definition: R_RTOS_msgQueuing.h:74
Circular array backed fixed size buffer for data entities.
Definition: R_RTOS_inc.h:904
System subscriber element related to a message queue.
Definition: R_RTOS_msgQueuing.h:105
struct mqSysSub MQSysSub
mqSysSub
#define MAX_MSGQ_SIZE
Maximum size of one single message queue.
Definition: R_RTOS_msgQueuing.h:31
mqPrtcpntTypeEnum
Enumeration of message queue participant types.
Definition: R_RTOS_msgQueuing.h:139
uint8_t SysFktID
System function ID.
Definition: R_RTOS_inc.h:361
System PartID Type.
Definition: R_RTOS_msgQueuing.h:46
PMQPrtcpnt MQPrtcpnts
Pointer to MQPrtcpnt elements for a list.
Definition: R_RTOS_msgQueuing.h:172
struct msgQ MsgQ
Message queue which contains publishers, subscribers, data as well as information about the queue...
struct mqSysSub * PMQSysSub
Pointer to a mqSysSub.
partIDType
Enumeration of PartID types.
Definition: R_RTOS_msgQueuing.h:43
uint8_t RetCode
Return codes for functions.
Definition: R_RTOS_inc.h:1424
PMQSub MQSubs
Pointer to MQSub elements for a subscriber list.
Definition: R_RTOS_msgQueuing.h:131
Task subscriber type.
Definition: R_RTOS_msgQueuing.h:142
union mqPrtcpnt::@1 MQElmnt
specialized participant structures in a union
MQPrtcpntType prtcpntType
type of the participant
Definition: R_RTOS_msgQueuing.h:159
struct mqDummyElmnt * PMQDummyElmnt
Pointer to a mqDummyElmnt.