aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/staging/wilc1000/wilc_msgqueue.h
blob: 35b10019eebd079c5068fd47515bfa0a8e008e0b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
#ifndef __WILC_MSG_QUEUE_H__
#define __WILC_MSG_QUEUE_H__

/*!
 *  @file	wilc_msgqueue.h
 *  @brief	Message Queue OS wrapper functionality
 *  @author	syounan
 *  @sa		wilc_oswrapper.h top level OS wrapper file
 *  @date	30 Aug 2010
 *  @version	1.0
 */

#include "wilc_platform.h"
#include "wilc_errorsupport.h"
#include "wilc_memory.h"
#include "wilc_strutils.h"

/*!
 *  @struct             tstrWILC_MsgQueueAttrs
 *  @brief		Message Queue API options
 *  @author		syounan
 *  @date		30 Aug 2010
 *  @version		1.0
 */
typedef struct {
	/* a dummy member to avoid compiler errors*/
	u8 dummy;

} tstrWILC_MsgQueueAttrs;

/*!
 *  @brief		Creates a new Message queue
 *  @details		Creates a new Message queue, if the feature
 *                              CONFIG_WILC_MSG_QUEUE_IPC_NAME is enabled and pstrAttrs->pcName
 *                              is not Null, then this message queue can be used for IPC with
 *                              any other message queue having the same name in the system
 *  @param[in,out]	pHandle handle to the message queue object
 *  @param[in]	pstrAttrs Optional attributes, NULL for default
 *  @return		Error code indicating sucess/failure
 *  @sa			tstrWILC_MsgQueueAttrs
 *  @author		syounan
 *  @date		30 Aug 2010
 *  @version		1.0
 */
WILC_ErrNo WILC_MsgQueueCreate(WILC_MsgQueueHandle *pHandle,
			       tstrWILC_MsgQueueAttrs *pstrAttrs);


/*!
 *  @brief		Sends a message
 *  @details		Sends a message, this API will block unil the message is
 *                              actually sent or until it is timedout (as long as the feature
 *                              CONFIG_WILC_MSG_QUEUE_TIMEOUT is enabled and pstrAttrs->u32Timeout
 *                              is not set to WILC_OS_INFINITY), zero timeout is a valid value
 *  @param[in]	pHandle handle to the message queue object
 *  @param[in]	pvSendBuffer pointer to the data to send
 *  @param[in]	u32SendBufferSize the size of the data to send
 *  @param[in]	pstrAttrs Optional attributes, NULL for default
 *  @return		Error code indicating sucess/failure
 *  @sa			tstrWILC_MsgQueueAttrs
 *  @author		syounan
 *  @date		30 Aug 2010
 *  @version		1.0
 */
WILC_ErrNo WILC_MsgQueueSend(WILC_MsgQueueHandle *pHandle,
			     const void *pvSendBuffer, u32 u32SendBufferSize,
			     tstrWILC_MsgQueueAttrs *pstrAttrs);


/*!
 *  @brief		Receives a message
 *  @details		Receives a message, this API will block unil a message is
 *                              received or until it is timedout (as long as the feature
 *                              CONFIG_WILC_MSG_QUEUE_TIMEOUT is enabled and pstrAttrs->u32Timeout
 *                              is not set to WILC_OS_INFINITY), zero timeout is a valid value
 *  @param[in]	pHandle handle to the message queue object
 *  @param[out]	pvRecvBuffer pointer to a buffer to fill with the received message
 *  @param[in]	u32RecvBufferSize the size of the receive buffer
 *  @param[out]	pu32ReceivedLength the length of received data
 *  @param[in]	pstrAttrs Optional attributes, NULL for default
 *  @return		Error code indicating sucess/failure
 *  @sa			tstrWILC_MsgQueueAttrs
 *  @author		syounan
 *  @date		30 Aug 2010
 *  @version		1.0
 */
WILC_ErrNo WILC_MsgQueueRecv(WILC_MsgQueueHandle *pHandle,
			     void *pvRecvBuffer, u32 u32RecvBufferSize,
			     u32 *pu32ReceivedLength,
			     tstrWILC_MsgQueueAttrs *pstrAttrs);


/*!
 *  @brief		Destroys an existing  Message queue
 *  @param[in]	pHandle handle to the message queue object
 *  @param[in]	pstrAttrs Optional attributes, NULL for default
 *  @return		Error code indicating sucess/failure
 *  @sa			tstrWILC_MsgQueueAttrs
 *  @author		syounan
 *  @date		30 Aug 2010
 *  @version		1.0
 */
WILC_ErrNo WILC_MsgQueueDestroy(WILC_MsgQueueHandle *pHandle,
				tstrWILC_MsgQueueAttrs *pstrAttrs);



#endif