WE310F5  39.00.000
m2mb_os_mtx.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_MTX_H
28 #define M2MB_OS_MTX_H
29 
30 #ifdef __cplusplus
31 extern "C" {
32 #endif
33 
43 /*-----------------------------------------------------------------------------------------------*/
44 
49 /*-----------------------------------------------------------------------------------------------*/
50 
51 
52 /* GLOBAL DECLARATIONS ----------------------------------------------------------- */
53 #define M2MB_OS_MTX_INVALID 0
54 #define M2MB_OS_MTX_INVALID_ATTR 0
55 
56 /* Global declarations ==========================================================================*/
57 
58 /*-----------------------------------------------------------------------------------------------
59 
60  can be called directly without specify CMDS_ARGS
61  osRes = m2mb_os_mtx_setAttrItem_( &mtxAttrHandle,
62  M2MB_OS_MTX_SEL_CMD_CREATE_ATTR, NULL,
63  M2MB_OS_MTX_SEL_CMD_NAME, "myMtx1",
64  M2MB_OS_MTX_SEL_CMD_USRNAME, "myUserMtx1",
65  M2MB_OS_MTX_SEL_CMD_INHERIT, inheritVal
66  );
67  -----------------------------------------------------------------------------------------------*/
68 #define m2mb_os_mtx_setAttrItem_( h, args,... ) m2mb_os_mtx_setAttrItem( h, CMDS_ARGS( args ) )
69 
70 /* Global typedefs --------------------------------------------------------------- */
71 
72 typedef enum
73 {
76  /* use as Os name during creation */
78  /* if set, usr name could be different from Os during creation */
80  /* select if priority inheritance will be active for it. To avoid priority inversion, priority of the task
81  owning the mutex will be temporarily raised to the task of the highest priority waiting for the mutex */
83  /* high priority task first option cmd not supported: here only for backward compatibility
84  see function tx_hptf_com(...) for the desired functionality */
87  /* number of task suspended on this resource */
89  /* first task (M2MB_OS_TASK_HANDLE) to be served when resource will be available */
91  /* owner (M2MB_OS_TASK_HANDLE) of the resource mtxHandle */
93 
94  /* ---- */
98 
99 typedef struct M2MB_OS_MTX_HANDLE_TAG * M2MB_OS_MTX_HANDLE;
100 typedef struct M2MB_OS_MTX_ATTR_HANDLE_TAG * M2MB_OS_MTX_ATTR_HANDLE;
101 
102 
103 
104 /* Global functions =============================================================================*/
105 
106 /*-----------------------------------------------------------------------------------------------*/
163 /*-----------------------------------------------------------------------------------------------*/
165  M2MB_OS_MTX_HANDLE *pMtxHandle,
166  M2MB_OS_MTX_ATTR_HANDLE *pMtxAttr
167 );
168 
169 /*-----------------------------------------------------------------------------------------------*/
208 /*-----------------------------------------------------------------------------------------------*/
210 
211 /*-----------------------------------------------------------------------------------------------*/
265 /*-----------------------------------------------------------------------------------------------*/
266  M2MB_OS_RESULT_E m2mb_os_mtx_get( M2MB_OS_MTX_HANDLE mtxHandle, UINT32 timeoutTicks );
267 
268 /*-----------------------------------------------------------------------------------------------*/
309 /*-----------------------------------------------------------------------------------------------*/
311 
312 /*-----------------------------------------------------------------------------------------------*/
356 /*-----------------------------------------------------------------------------------------------*/
358 
359 /*-----------------------------------------------------------------------------------------------*/
422 /*-----------------------------------------------------------------------------------------------*/
424  M2MB_OS_MTX_ATTR_HANDLE *pMtxAttrHandle,
425  UINT8 nCmds,
426  ...
427 );
428 
429 /*-----------------------------------------------------------------------------------------------*/
497 /*-----------------------------------------------------------------------------------------------*/
499  M2MB_OS_MTX_HANDLE mtxHandle,
500  M2MB_OS_MTX_SEL_CMD_E selCmd,
501  MEM_W *pOut,
502  void *pIn
503 );
504 
505 /*-----------------------------------------------------------------------------------------------*/
545 /*-----------------------------------------------------------------------------------------------*/
547  M2MB_OS_MTX_SEL_CMD_E selCmd,
548  void *pIn
549  );
550 
551 
552 #ifdef __cplusplus
553 }
554 #endif
555 
556 #endif /* M2MB_OS_MTX_H */
M2MB_OS_RESULT_E m2mb_os_mtx_put(M2MB_OS_MTX_HANDLE mtxHandle)
Release ownership of the mutex (if counter = 0: exit critical section)
#define ENUM_TO_INT(Prefix)
Definition: m2mb_types.h:207
M2MB_OS_RESULT_E m2mb_os_mtx_getItem(M2MB_OS_MTX_HANDLE mtxHandle, M2MB_OS_MTX_SEL_CMD_E selCmd, MEM_W *pOut, void *pIn)
Get specific properties of the mutex.
M2MB_OS_RESULT_E m2mb_os_mtx_hptf(M2MB_OS_MTX_HANDLE mtxHandle)
Prioritize mutex suspension list HPTF: Highest Priority Task First.
unsigned char UINT8
Definition: m2mb_types.h:86
M2MB_OS_RESULT_E m2mb_os_mtx_deinit(M2MB_OS_MTX_HANDLE mtxHandle)
Mutex deinit or deletion.
M2MB_OS_RESULT_E m2mb_os_mtx_setAttrItem(M2MB_OS_MTX_ATTR_HANDLE *pMtxAttrHandle, UINT8 nCmds,...)
Set specific attribute for mutex creation.
struct M2MB_OS_MTX_ATTR_HANDLE_TAG * M2MB_OS_MTX_ATTR_HANDLE
Definition: m2mb_os_mtx.h:100
M2MB_OS_RESULT_E m2mb_os_mtx_init(M2MB_OS_MTX_HANDLE *pMtxHandle, M2MB_OS_MTX_ATTR_HANDLE *pMtxAttr)
Mutex Creation.
M2MB_OS_RESULT_E m2mb_os_mtx_setItem(M2MB_OS_MTX_HANDLE mtxHandle, M2MB_OS_MTX_SEL_CMD_E selCmd, void *pIn)
Set specific properties of the mutex.
enum M2MB_OS_RESULT M2MB_OS_RESULT_E
struct M2MB_OS_MTX_HANDLE_TAG * M2MB_OS_MTX_HANDLE
Definition: m2mb_os_mtx.h:99
unsigned long int UINT32
Definition: m2mb_types.h:88
UINT32 MEM_W
Definition: m2mb_types.h:94
M2MB_OS_MTX_SEL_CMD_E
Definition: m2mb_os_mtx.h:72
M2MB_OS_RESULT_E m2mb_os_mtx_get(M2MB_OS_MTX_HANDLE mtxHandle, UINT32 timeoutTicks)
Get the ownership of the mutex (critical session enter)