WE310F5  39.00.000
m2mb_os_q.h
Go to the documentation of this file.
1 /* $version: 301934 */
2 /*===============================================================================================*/
3 /* >>> Copyright (C) Telit Communications S.p.A. Italy All Rights Reserved. <<< */
27 #ifndef M2MB_OS_Q_H
28 #define M2MB_OS_Q_H
29 
30 #ifdef __cplusplus
31 extern "C" {
32 #endif
33 
43 /*-----------------------------------------------------------------------------------------------*/
44 
49 /*-----------------------------------------------------------------------------------------------*/
50 
51 
52 /* Global declarations ==========================================================================*/
53 #define M2MB_OS_Q_INVALID 0
54 #define M2MB_OS_Q_INVALID_ATTR 0
55 #define M2MB_OS_Q_TX_PRIORITIZE 1
56 
57 /* used to get how many word32 are needed for specified "type" struct : see M2MB_OS_Q_SEL_CMD_MSG_SIZE */
58 #define WORD32_FOR_MSG( type ) ( ( sizeof( type ) % 4 ) == 0 ? sizeof( type ) / 4 : sizeof( type ) / 4 + 1 )
59 /* then for decide how many bytes to reserve for any message in the queue : see M2MB_OS_Q_SEL_CMD_QSIZE */
60 #define BYTES_FOR_MSG( type ) ( 4 * WORD32_FOR_MSG( type ) )
61 
62 /*-----------------------------------------------------------------------------------------------
63 
64  can be called directly without specify CMDS_ARGS
65  osRes = m2mb_os_q_setAttrItem_( &qAttrHandle,
66  M2MB_OS_Q_SEL_CMD_CREATE_ATTR, NULL,
67  M2MB_OS_Q_SEL_CMD_NAME, "Myqueue_T",
68  M2MB_OS_Q_SEL_CMD_QSTART, &QueueArea,
69  M2MB_OS_Q_SEL_CMD_MSG_SIZE, WORD32_FOR_MSG( MY_MSG_T ),
70  M2MB_OS_Q_SEL_CMD_QSIZE, sizeof(QueueArea)
71  );
72  -----------------------------------------------------------------------------------------------*/
73 #define m2mb_os_q_setAttrItem_( h, args,... ) m2mb_os_q_setAttrItem( h, CMDS_ARGS( args ) )
74 
75 /* Global typedefs --------------------------------------------------------------- */
76 
77 typedef enum
78 {
81  /* use as Os name: only available for creation */
83  /* if set, usr name could be different from Os used in creation */
85  /* size of message in 32 bit words: 1 to 16 max */
87  /* if not specified will be allocated by system: if specified align to MEM_W
88  to avoid possible loosing space for 1 message
89  */
91  /* size in byte */
93  /* number of task suspended on the queue */
95  /* first task (M2MB_OS_TASK_HANDLE) to be served when msg will be enqueued */
97  /* number of messages enqueued on the queue*/
99  /* number of messages the queue currently has space for */
101 
102  /* ---- */
106 
107 
108 typedef struct M2MB_OS_Q_HANDLE_TAG *M2MB_OS_Q_HANDLE;
109 typedef struct M2MB_OS_Q_ATTR_HANDLE_TAG *M2MB_OS_Q_ATTR_HANDLE;
110 
111 /* Global functions =============================================================================*/
112 
113 /*-----------------------------------------------------------------------------------------------*/
252 /*-----------------------------------------------------------------------------------------------*/
254 
255 /*-----------------------------------------------------------------------------------------------*/
296 /*-----------------------------------------------------------------------------------------------*/
298 
299 /*-----------------------------------------------------------------------------------------------*/
352 /*-----------------------------------------------------------------------------------------------*/
353  M2MB_OS_RESULT_E m2mb_os_q_rx( M2MB_OS_Q_HANDLE qHandle, void *pDest, UINT32 timeoutTicks );
354 
355 /*-----------------------------------------------------------------------------------------------*/
411 /*-----------------------------------------------------------------------------------------------*/
413  M2MB_OS_Q_HANDLE qHandle,
414  void *pSource,
415  UINT32 timeoutTicks,
416  UINT8 priority
417 );
418 
419 /*-----------------------------------------------------------------------------------------------*/
460 /*-----------------------------------------------------------------------------------------------*/
462 
463 /*-----------------------------------------------------------------------------------------------*/
498 /*-----------------------------------------------------------------------------------------------*/
500 
501 /*-----------------------------------------------------------------------------------------------*/
577 /*-----------------------------------------------------------------------------------------------*/
579 
580 /*-----------------------------------------------------------------------------------------------*/
642 /*-----------------------------------------------------------------------------------------------*/
644  M2MB_OS_Q_HANDLE qHandle,
645  M2MB_OS_Q_SEL_CMD_E selCmd,
646  MEM_W *pOut,
647  void *pIn
648 );
649 
650 /*-----------------------------------------------------------------------------------------------*/
692 /*-----------------------------------------------------------------------------------------------*/
694  M2MB_OS_Q_HANDLE qHandle,
695  M2MB_OS_Q_SEL_CMD_E selCmd,
696  void *pIn
697 );
698 
699 
700 #ifdef __cplusplus
701 }
702 #endif
703 
704 #endif /* M2MB_OS_H */
705 
#define ENUM_TO_INT(Prefix)
Definition: m2mb_types.h:207
M2MB_OS_RESULT_E m2mb_os_q_clear(M2MB_OS_Q_HANDLE qHandle)
Clear all messages from the queue.
unsigned char UINT8
Definition: m2mb_types.h:86
M2MB_OS_RESULT_E m2mb_os_q_getItem(M2MB_OS_Q_HANDLE qHandle, M2MB_OS_Q_SEL_CMD_E selCmd, MEM_W *pOut, void *pIn)
Get specific properties of the queue.
M2MB_OS_RESULT_E m2mb_os_q_hptf(M2MB_OS_Q_HANDLE queueHandle)
Prioritize queue suspension list Set HPTF: Highest Priority Task First to receive the message from qu...
M2MB_OS_RESULT_E m2mb_os_q_init(M2MB_OS_Q_HANDLE *pQHandle, M2MB_OS_Q_ATTR_HANDLE *pQAttrHandle)
Message Queue creation.
struct M2MB_OS_Q_HANDLE_TAG * M2MB_OS_Q_HANDLE
Definition: m2mb_os_q.h:108
struct M2MB_OS_Q_ATTR_HANDLE_TAG * M2MB_OS_Q_ATTR_HANDLE
Definition: m2mb_os_q.h:109
enum M2MB_OS_RESULT M2MB_OS_RESULT_E
M2MB_OS_RESULT_E m2mb_os_q_deinit(M2MB_OS_Q_HANDLE qHandle)
Message Queue Deinit or Deletion.
unsigned long int UINT32
Definition: m2mb_types.h:88
UINT32 MEM_W
Definition: m2mb_types.h:94
M2MB_OS_Q_SEL_CMD_E
Definition: m2mb_os_q.h:77
M2MB_OS_RESULT_E m2mb_os_q_rx(M2MB_OS_Q_HANDLE qHandle, void *pDest, UINT32 timeoutTicks)
Receive message from the queue.
M2MB_OS_RESULT_E m2mb_os_q_setAttrItem(M2MB_OS_Q_ATTR_HANDLE *pQAttrHandle, UINT8 nCmds,...)
Set specific attribute for queue creation.
M2MB_OS_RESULT_E m2mb_os_q_tx(M2MB_OS_Q_HANDLE qHandle, void *pSource, UINT32 timeoutTicks, UINT8 priority)
Send message to the queue.
M2MB_OS_RESULT_E m2mb_os_q_setItem(M2MB_OS_Q_HANDLE qHandle, M2MB_OS_Q_SEL_CMD_E selCmd, void *pIn)
Set specific properties of the queue.