blob: 8f76bee2244764612e0f8a2cdc9b70f2ba3b38a3 [file] [log] [blame]
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001/*
2 * Copyright (c) 2014 The Linux Foundation. All rights reserved.
3 *
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/*
23 * This file was originally distributed by Qualcomm Atheros, Inc.
24 * under proprietary terms before Copyright ownership was assigned
25 * to the Linux Foundation.
26 */
27
28#if !defined( __CDS_MQ_H )
29#define __CDS_MQ_H
30
31/**=========================================================================
32
33 \file cds_mq.h
34
35 \brief virtual Operating System Services (CDF) message queue APIs
36
37 Message Queue Definitions and API
38
39 ========================================================================*/
40
41/*--------------------------------------------------------------------------
42 Include Files
43 ------------------------------------------------------------------------*/
44#include <cdf_types.h>
45#include <cdf_status.h>
46
47/*--------------------------------------------------------------------------
48 Preprocessor definitions and constants
49 ------------------------------------------------------------------------*/
50
51/*--------------------------------------------------------------------------
52 Type declarations
53 ------------------------------------------------------------------------*/
54
55/* cds Message Type.
56 This represnets a message that can be posted to another module through
57 the cds Message Queues.
58 \note This is mapped directly to the tSirMsgQ for backward
59 compatibility with the legacy MAC code */
60
61typedef struct cds_msg_s {
62 uint16_t type;
63 /*
64 * This field can be used as sequence number/dialog token for matching
65 * requests and responses.
66 */
67 uint16_t reserved;
68 /**
69 * Based on the type either a bodyptr pointer into
70 * memory or bodyval as a 32 bit data is used.
71 * bodyptr: is always a freeable pointer, one should always
72 * make sure that bodyptr is always freeable.
73 *
74 * Messages should use either bodyptr or bodyval; not both !!!.
75 */
76 void *bodyptr;
77
78 uint32_t bodyval;
79
80 /*
81 * Some messages provide a callback function. The function signature
82 * must be agreed upon between the two entities exchanging the message
83 */
84 void *callback;
85
86} cds_msg_t;
87
88/*-------------------------------------------------------------------------
89 Function declarations and documenation
90 ------------------------------------------------------------------------*/
91
92/* Message Queue IDs */
93typedef enum {
94 /* Message Queue ID for messages bound for SME */
95 CDS_MQ_ID_SME = CDF_MODULE_ID_SME,
96
97 /* Message Queue ID for messages bound for PE */
98 CDS_MQ_ID_PE = CDF_MODULE_ID_PE,
99
100 /* Message Queue ID for messages bound for WMA */
101 CDS_MQ_ID_WMA = CDF_MODULE_ID_WMA,
102
103 /* Message Queue ID for messages bound for the SYS module */
104 CDS_MQ_ID_SYS = CDF_MODULE_ID_SYS,
105
106} CDS_MQ_ID;
107
108/**---------------------------------------------------------------------------
109
110 \brief cds_mq_post_message() - post a message to a message queue
111
112 This API allows messages to be posted to a specific message queue. Messages
113 can be posted to the following message queues:
114
115 <ul>
116 <li> SME
117 <li> PE
118 <li> HAL
119 <li> TL
120 </ul>
121
122 \param msgQueueId - identifies the message queue upon which the message
123 will be posted.
124
125 \param message - a pointer to a message buffer. Memory for this message
126 buffer is allocated by the caller and free'd by the CDF after the
127 message is posted to the message queue. If the consumer of the
128 message needs anything in this message, it needs to copy the contents
129 before returning from the message queue handler.
130
131 \return CDF_STATUS_SUCCESS - the message has been successfully posted
132 to the message queue.
133
134 CDF_STATUS_E_INVAL - The value specified by msgQueueId does not
135 refer to a valid Message Queue Id.
136
137 CDF_STATUS_E_FAULT - message is an invalid pointer.
138
139 CDF_STATUS_E_FAILURE - the message queue handler has reported
140 an unknown failure.
141
142 \sa
143
144 --------------------------------------------------------------------------*/
145CDF_STATUS cds_mq_post_message(CDS_MQ_ID msgQueueId, cds_msg_t *message);
146
147/**---------------------------------------------------------------------------
148
149 \brief cds_send_mb_message_to_mac() - post a message to a message queue
150
151 \param pBuf is a buffer allocated by caller. The actual structure varies
152 base on message type
153
154 \return CDF_STATUS_SUCCESS - the message has been successfully posted
155 to the message queue.
156
157 CDF_STATUS_E_FAILURE - the message queue handler has reported
158 an unknown failure.
159
160 \sa
161 --------------------------------------------------------------------------*/
162
163CDF_STATUS cds_send_mb_message_to_mac(void *pBuf);
164
165#endif /* if !defined __CDS_MQ_H */