blob: 6fdc27f968b7b81eae773691c5f6b77d5ba315fa [file] [log] [blame]
Jeff Johnson295189b2012-06-20 16:38:30 -07001/*
Jeff Johnson32d95a32012-09-10 13:15:23 -07002 * Copyright (c) 2012, The Linux Foundation. All rights reserved.
Jeff Johnson295189b2012-06-20 16:38:30 -07003 *
4 * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
5 *
6 *
7 * Permission to use, copy, modify, and/or distribute this software for
8 * any purpose with or without fee is hereby granted, provided that the
9 * above copyright notice and this permission notice appear in all
10 * copies.
11 *
12 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
13 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
14 * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
15 * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
16 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
17 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
18 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
19 * PERFORMANCE OF THIS SOFTWARE.
20 */
21
22#if !defined( __VOS_MQ_H )
23#define __VOS_MQ_H
24
25/**=========================================================================
26
27 \file vos_mq.h
28
29 \brief virtual Operating System Services (vOSS) message queue APIs
30
31 Message Queue Definitions and API
32
33 Copyright 2008 (c) Qualcomm, Incorporated. All Rights Reserved.
34
35 Qualcomm Confidential and Proprietary.
36
37 ========================================================================*/
38
39/* $Header$ */
40
41/*--------------------------------------------------------------------------
42 Include Files
43 ------------------------------------------------------------------------*/
44#include <vos_types.h>
45#include <vos_status.h>
46
47/*--------------------------------------------------------------------------
48 Preprocessor definitions and constants
49 ------------------------------------------------------------------------*/
50
51/*--------------------------------------------------------------------------
52 Type declarations
53 ------------------------------------------------------------------------*/
54
55/// vos Message Type.
56/// This represnets a message that can be posted to another module through
57/// the voss Message Queues.
58///
59/// \note This is mapped directly to the tSirMsgQ for backward
60/// compatibility with the legacy MAC code.
61
62typedef struct vos_msg_s
63{
64 v_U16_t type;
65 /*
66 * This field can be used as sequence number/dialog token for matching
67 * requests and responses.
68 */
69 v_U16_t reserved;
70 /**
71 * Based on the type either a bodyptr pointer into
72 * memory or bodyval as a 32 bit data is used.
73 * bodyptr: is always a freeable pointer, one should always
74 * make sure that bodyptr is always freeable.
75 *
76 * Messages should use either bodyptr or bodyval; not both !!!.
77 */
78 void *bodyptr;
79
80 v_U32_t bodyval;
81
82} vos_msg_t;
83
84
85/*-------------------------------------------------------------------------
86 Function declarations and documenation
87 ------------------------------------------------------------------------*/
88
89/// Message Queue IDs
90typedef enum
91{
92 /// Message Queue ID for messages bound for SME
93 VOS_MQ_ID_SME = VOS_MODULE_ID_SME,
94
95 /// Message Queue ID for messages bound for PE
96 VOS_MQ_ID_PE = VOS_MODULE_ID_PE,
97
98#ifndef FEATURE_WLAN_INTEGRATED_SOC
99 /// Message Queue ID for messages bound for HAL
100 VOS_MQ_ID_HAL = VOS_MODULE_ID_HAL,
101#else
102 /// Message Queue ID for messages bound for WDA
103 VOS_MQ_ID_WDA = VOS_MODULE_ID_WDA,
104#endif
105
106 /// Message Queue ID for messages bound for TL
107 VOS_MQ_ID_TL = VOS_MODULE_ID_TL,
108
109#ifndef FEATURE_WLAN_INTEGRATED_SOC
110 /// Message Queue ID for messages bound for SSC
111 VOS_MQ_ID_SSC = VOS_MODULE_ID_SSC,
112#endif
113
114 /// Message Queue ID for messages bound for the SYS module
115 VOS_MQ_ID_SYS = VOS_MODULE_ID_SYS,
116
117#ifndef FEATURE_WLAN_INTEGRATED_SOC
118 /// Message Queue ID for SDIO Interrupt Handle in SAL
119 VOS_MQ_ID_SAL = VOS_MODULE_ID_SAL
120#else
121 /// Message Queue ID for messages bound for WDA
122 VOS_MQ_ID_WDI = VOS_MODULE_ID_WDI,
123#endif
124
125} VOS_MQ_ID;
126
127
128/**---------------------------------------------------------------------------
129
130 \brief vos_mq_post_message() - post a message to a message queue
131
132 This API allows messages to be posted to a specific message queue. Messages
133 can be posted to the following message queues:
134
135 <ul>
136 <li> SME
137 <li> PE
138 <li> HAL
139 <li> TL
140 </ul>
141
142 \param msgQueueId - identifies the message queue upon which the message
143 will be posted.
144
145 \param message - a pointer to a message buffer. Memory for this message
146 buffer is allocated by the caller and free'd by the vOSS after the
147 message is posted to the message queue. If the consumer of the
148 message needs anything in this message, it needs to copy the contents
149 before returning from the message queue handler.
150
151 \return VOS_STATUS_SUCCESS - the message has been successfully posted
152 to the message queue.
153
154 VOS_STATUS_E_INVAL - The value specified by msgQueueId does not
155 refer to a valid Message Queue Id.
156
157 VOS_STATUS_E_FAULT - message is an invalid pointer.
158
159 VOS_STATUS_E_FAILURE - the message queue handler has reported
160 an unknown failure.
161
162 \sa
163
164 --------------------------------------------------------------------------*/
165VOS_STATUS vos_mq_post_message( VOS_MQ_ID msgQueueId, vos_msg_t *message );
166
167
168/**---------------------------------------------------------------------------
169
170 \brief vos_tx_mq_serialize() - serialize a message to the Tx execution flow
171
172 This API allows messages to be posted to a specific message queue in the
173 Tx excution flow. Messages for the Tx execution flow can be posted only
174 to the following queue.
175
176 <ul>
177 <li> TL
178 <li> WDI/SSC
179 </ul>
180
181 \param msgQueueId - identifies the message queue upon which the message
182 will be posted.
183
184 \param message - a pointer to a message buffer. Body memory for this message
185 buffer is allocated by the caller and free'd by the vOSS after the
186 message is dispacthed to the appropriate component. If the consumer
187 of the message needs to keep anything in the body, it needs to copy
188 the contents before returning from the message handler.
189
190 \return VOS_STATUS_SUCCESS - the message has been successfully posted
191 to the message queue.
192
193 VOS_STATUS_E_INVAL - The value specified by msgQueueId does not
194 refer to a valid Message Queue Id.
195
196 VOS_STATUS_E_FAULT - message is an invalid pointer.
197
198 VOS_STATUS_E_FAILURE - the message queue handler has reported
199 an unknown failure.
200
201 \sa
202
203 --------------------------------------------------------------------------*/
204VOS_STATUS vos_tx_mq_serialize( VOS_MQ_ID msgQueueId, vos_msg_t *message );
205
206#ifdef FEATURE_WLAN_INTEGRATED_SOC
207/**---------------------------------------------------------------------------
208
209 \brief vos_rx_mq_serialize() - serialize a message to the Rx execution flow
210
211 This API allows messages to be posted to a specific message queue in the
212 Tx excution flow. Messages for the Rx execution flow can be posted only
213 to the following queue.
214
215 <ul>
216 <li> WDI
217 </ul>
218
219 \param msgQueueId - identifies the message queue upon which the message
220 will be posted.
221
222 \param message - a pointer to a message buffer. Body memory for this message
223 buffer is allocated by the caller and free'd by the vOSS after the
224 message is dispacthed to the appropriate component. If the consumer
225 of the message needs to keep anything in the body, it needs to copy
226 the contents before returning from the message handler.
227
228 \return VOS_STATUS_SUCCESS - the message has been successfully posted
229 to the message queue.
230
231 VOS_STATUS_E_INVAL - The value specified by msgQueueId does not
232 refer to a valid Message Queue Id.
233
234 VOS_STATUS_E_FAULT - message is an invalid pointer.
235
236 VOS_STATUS_E_FAILURE - the message queue handler has reported
237 an unknown failure.
238
239 \sa
240
241 --------------------------------------------------------------------------*/
242VOS_STATUS vos_rx_mq_serialize( VOS_MQ_ID msgQueueId, vos_msg_t *message );
243
244#endif
245
246#endif // if !defined __VOS_MQ_H