Commit | Line | Data |
---|---|---|
c5c77ba1 JK |
1 | #ifndef __WILC_MSG_QUEUE_H__ |
2 | #define __WILC_MSG_QUEUE_H__ | |
3 | ||
4 | /*! | |
5 | * @file wilc_msgqueue.h | |
6 | * @brief Message Queue OS wrapper functionality | |
7 | * @author syounan | |
8 | * @sa wilc_oswrapper.h top level OS wrapper file | |
9 | * @date 30 Aug 2010 | |
10 | * @version 1.0 | |
11 | */ | |
12 | ||
c3ea8a72 DL |
13 | #include "wilc_platform.h" |
14 | #include "wilc_errorsupport.h" | |
15 | #include "wilc_memory.h" | |
c3ea8a72 | 16 | |
c5c77ba1 JK |
17 | /*! |
18 | * @struct tstrWILC_MsgQueueAttrs | |
19 | * @brief Message Queue API options | |
20 | * @author syounan | |
21 | * @date 30 Aug 2010 | |
22 | * @version 1.0 | |
23 | */ | |
24 | typedef struct { | |
c5c77ba1 | 25 | /* a dummy member to avoid compiler errors*/ |
63d03e47 | 26 | u8 dummy; |
c5c77ba1 JK |
27 | |
28 | } tstrWILC_MsgQueueAttrs; | |
29 | ||
c5c77ba1 JK |
30 | /*! |
31 | * @brief Creates a new Message queue | |
32 | * @details Creates a new Message queue, if the feature | |
33 | * CONFIG_WILC_MSG_QUEUE_IPC_NAME is enabled and pstrAttrs->pcName | |
34 | * is not Null, then this message queue can be used for IPC with | |
35 | * any other message queue having the same name in the system | |
36 | * @param[in,out] pHandle handle to the message queue object | |
37 | * @param[in] pstrAttrs Optional attributes, NULL for default | |
38 | * @return Error code indicating sucess/failure | |
39 | * @sa tstrWILC_MsgQueueAttrs | |
40 | * @author syounan | |
41 | * @date 30 Aug 2010 | |
42 | * @version 1.0 | |
43 | */ | |
44 | WILC_ErrNo WILC_MsgQueueCreate(WILC_MsgQueueHandle *pHandle, | |
45 | tstrWILC_MsgQueueAttrs *pstrAttrs); | |
46 | ||
47 | ||
48 | /*! | |
49 | * @brief Sends a message | |
50 | * @details Sends a message, this API will block unil the message is | |
51 | * actually sent or until it is timedout (as long as the feature | |
52 | * CONFIG_WILC_MSG_QUEUE_TIMEOUT is enabled and pstrAttrs->u32Timeout | |
53 | * is not set to WILC_OS_INFINITY), zero timeout is a valid value | |
54 | * @param[in] pHandle handle to the message queue object | |
55 | * @param[in] pvSendBuffer pointer to the data to send | |
56 | * @param[in] u32SendBufferSize the size of the data to send | |
57 | * @param[in] pstrAttrs Optional attributes, NULL for default | |
58 | * @return Error code indicating sucess/failure | |
59 | * @sa tstrWILC_MsgQueueAttrs | |
60 | * @author syounan | |
61 | * @date 30 Aug 2010 | |
62 | * @version 1.0 | |
63 | */ | |
64 | WILC_ErrNo WILC_MsgQueueSend(WILC_MsgQueueHandle *pHandle, | |
4e4467fd | 65 | const void *pvSendBuffer, u32 u32SendBufferSize, |
c5c77ba1 JK |
66 | tstrWILC_MsgQueueAttrs *pstrAttrs); |
67 | ||
68 | ||
69 | /*! | |
70 | * @brief Receives a message | |
71 | * @details Receives a message, this API will block unil a message is | |
72 | * received or until it is timedout (as long as the feature | |
73 | * CONFIG_WILC_MSG_QUEUE_TIMEOUT is enabled and pstrAttrs->u32Timeout | |
74 | * is not set to WILC_OS_INFINITY), zero timeout is a valid value | |
75 | * @param[in] pHandle handle to the message queue object | |
76 | * @param[out] pvRecvBuffer pointer to a buffer to fill with the received message | |
77 | * @param[in] u32RecvBufferSize the size of the receive buffer | |
78 | * @param[out] pu32ReceivedLength the length of received data | |
79 | * @param[in] pstrAttrs Optional attributes, NULL for default | |
80 | * @return Error code indicating sucess/failure | |
81 | * @sa tstrWILC_MsgQueueAttrs | |
82 | * @author syounan | |
83 | * @date 30 Aug 2010 | |
84 | * @version 1.0 | |
85 | */ | |
86 | WILC_ErrNo WILC_MsgQueueRecv(WILC_MsgQueueHandle *pHandle, | |
4e4467fd CL |
87 | void *pvRecvBuffer, u32 u32RecvBufferSize, |
88 | u32 *pu32ReceivedLength, | |
c5c77ba1 JK |
89 | tstrWILC_MsgQueueAttrs *pstrAttrs); |
90 | ||
91 | ||
92 | /*! | |
93 | * @brief Destroys an existing Message queue | |
94 | * @param[in] pHandle handle to the message queue object | |
95 | * @param[in] pstrAttrs Optional attributes, NULL for default | |
96 | * @return Error code indicating sucess/failure | |
97 | * @sa tstrWILC_MsgQueueAttrs | |
98 | * @author syounan | |
99 | * @date 30 Aug 2010 | |
100 | * @version 1.0 | |
101 | */ | |
102 | WILC_ErrNo WILC_MsgQueueDestroy(WILC_MsgQueueHandle *pHandle, | |
103 | tstrWILC_MsgQueueAttrs *pstrAttrs); | |
104 | ||
105 | ||
106 | ||
107 | #endif |