blob: 363c94637deb1ababe2c4bda4389f14a7c684d91 [file] [log] [blame]
Jeff Johnson295189b2012-06-20 16:38:30 -07001/*
Mihir Shetebe94ebb2015-05-26 12:07:14 +05302 * Copyright (c) 2012-2015 The Linux Foundation. All rights reserved.
Kiet Lam1ed83fc2014-02-19 01:15:45 -08003 *
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.
Gopichand Nakkala92f07d82013-01-08 21:16:34 -080020 */
Kiet Lam1ed83fc2014-02-19 01:15:45 -080021
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
Jeff Johnson295189b2012-06-20 16:38:30 -070028#ifndef __WLAN_QCT_DTS_H
29#define __WLAN_QCT_DTS_H
Madan Mohan Koyyalamudi01cba042013-01-10 21:56:05 -080030
31#include "wlan_qct_wdi.h"
32
Jeff Johnson295189b2012-06-20 16:38:30 -070033/**=========================================================================
34 *
35 * \file wlan_qct_wdi_dts.h
36 *
37 * \brief define Datas Trnasport Service API
38 *
39 * WLAN Device Abstraction layer interface for Transport drivers (SDIO/DXE)
40 * DESCRIPTION
41 * This file contains the API exposed by the
42 * wlan device abstarction layer module for abstracting DXE/SDIO.
43 *
Jeff Johnson295189b2012-06-20 16:38:30 -070044 *
45 * Example usage for DXE.
46 * ----------------------
47 * On Platform init
48 * DAL will then invoke WDTS_open
49 *
50 * On DAL init
51 * DAL will invike WDTS_start
52 *
53 * On transmit:
54 * DAL will invoke WDTS_TxPacket API
55 *
56 * On transmit complete:
57 * DXE will serialize into TX thread
58 * In TX thread it will invoke
59 *
60 * On receive:
61 * DXE will serialize into RX thread
62 * In TX thread it will invoke WDTS_RXPacket API
63 *
64 * On DXE ring full:
65 * DXE will serialize into TX thread
66 * In TX thread it will invoke WDTS_OOResourceNotification API
67 */
68
69typedef enum
70{
71 WDTS_CHANNEL_TX_LOW_PRI,
72 WDTS_CHANNEL_TX_HIGH_PRI,
73 WDTS_CHANNEL_RX_LOW_PRI,
74 WDTS_CHANNEL_RX_HIGH_PRI,
Mihir Shetee6618162015-03-16 14:48:42 +053075 WDTS_CHANNEL_RX_LOG,
Mihir Shetebe94ebb2015-05-26 12:07:14 +053076 WDTS_CHANNEL_RX_FW_LOG,
Jeff Johnson295189b2012-06-20 16:38:30 -070077 WDTS_CHANNEL_MAX
78} WDTS_ChannelType;
79
Mihir Shetee6618162015-03-16 14:48:42 +053080#define WDTS_TRANSPORT_CHANNELS_MASK \
81 (1<<WDTS_CHANNEL_TX_LOW_PRI | 1<<WDTS_CHANNEL_TX_HIGH_PRI \
82 | 1<<WDTS_CHANNEL_RX_LOW_PRI | 1<<WDTS_CHANNEL_RX_HIGH_PRI)
83
84#define WDTS_RX_LOG_CHANNEL_MASK (1<<WDTS_CHANNEL_RX_LOG)
Mihir Shetebe94ebb2015-05-26 12:07:14 +053085#define WDTS_RX_FW_LOG_CHANNEL_MASK (1<<WDTS_CHANNEL_RX_FW_LOG)
Mihir Shetee6618162015-03-16 14:48:42 +053086
Jeff Johnson295189b2012-06-20 16:38:30 -070087typedef enum
88{
89 WDTS_POWER_STATE_FULL,
90 WDTS_POWER_STATE_IMPS,
91 WDTS_POWER_STATE_BMPS,
92 WDTS_POWER_STATE_DOWN,
93 WDTS_POWER_STATE_MAX
94} WDTS_PowerStateType;
95
Sravan Kumar Kairam80d06ee2015-09-28 12:53:20 +053096typedef enum
97{
98 WDTS_LOGGING_STATUS_SUCCESS,
99 WDTS_LOGGING_STATUS_ERROR
100} WDTS_LoggingSessionStatus;
Jeff Johnson295189b2012-06-20 16:38:30 -0700101
102typedef wpt_status (*WDTS_TxCompleteCbType)(void *pContext, wpt_packet *pFrame, wpt_status status);
103typedef wpt_status (*WDTS_RxFrameReadyCbType) (void *pContext, wpt_packet *pFrame, WDTS_ChannelType channel);
104typedef wpt_status (*WDTS_LowResourceCbType)(void *pContext, WDTS_ChannelType channel, wpt_boolean on);
105typedef void (*WDTS_SetPSCbType)(wpt_status status, unsigned int dxePhyAddr);
Mihir Shetec4093f92015-05-28 15:21:11 +0530106typedef void (*WDTS_MbReceiveMsgType)(void *pContext);
Mihir Shete5affadc2015-05-29 20:54:57 +0530107typedef void (*WDTS_RxLogDoneType)(void *pContext);
Mihir Shetec4093f92015-05-28 15:21:11 +0530108
Jeff Johnson295189b2012-06-20 16:38:30 -0700109/* DTS Set power state ACK callback.
110 * This callback function should be invoked by the DTS to notify WDI that set
111 * power state request is complete.
112 * Parameters:
113 * status: status of the set operation
114 * pUserData:Cookie that should be passed back to the caller along with the callback.
115 * Return Value: None.
116 *
117 */
118typedef void (*WDTS_SetPowerStateCbType)(wpt_status status,
119 unsigned int dxePhyAddr,
120 void* pUserData);
Mihir Shetec4093f92015-05-28 15:21:11 +0530121typedef struct
122{
123 WDTS_RxFrameReadyCbType rxFrameReadyCB;
124 WDTS_TxCompleteCbType txCompleteCB;
125 WDTS_LowResourceCbType lowResourceCB;
126 WDTS_MbReceiveMsgType receiveMbMsgCB;
Mihir Shete5affadc2015-05-29 20:54:57 +0530127 WDTS_RxLogDoneType receiveLogCompleteCB;
Mihir Shetec4093f92015-05-28 15:21:11 +0530128}WDTS_ClientCallbacks;
Jeff Johnson295189b2012-06-20 16:38:30 -0700129
130typedef struct {
131 void * (*open)(void);
132 wpt_status (*start) (void *pContext);
Mihir Shetec4093f92015-05-28 15:21:11 +0530133 wpt_status (*register_client)(void *pContext, WDTS_ClientCallbacks, void *clientData);
Jeff Johnson295189b2012-06-20 16:38:30 -0700134 wpt_status (*xmit) (void *pContext, wpt_packet *packet, WDTS_ChannelType channel);
135 wpt_status (*txComplete) (void *pContext, wpt_uint32 ucTxResReq);
136 wpt_status (*setPowerState) (void *pContext, WDTS_PowerStateType powerState,
137 WDTS_SetPSCbType cBack);
Madan Mohan Koyyalamudi8cb53982012-09-28 14:34:47 -0700138 void (*channelDebug)(wpt_boolean displaySnapshot,
Mihir Shete40a55652014-03-02 14:14:47 +0530139 wpt_uint8 debugFlags);
Sravan Kumar Kairam6eac7522015-11-27 23:37:02 +0530140 void (*kickDxe) (void);
Jeff Johnson295189b2012-06-20 16:38:30 -0700141 wpt_status (*stop) (void *pContext);
142 wpt_status (*close) (void *pContext);
143 wpt_uint32 (*getFreeTxDataResNumber) (void *pContext);
Mihir Shete5affadc2015-05-29 20:54:57 +0530144 wpt_uint32 (*setupLogTransfer) (wpt_uint64 bufferAddr, wpt_uint32 bufferSize);
145 wpt_status (*startLogTransfer) (void);
Jeff Johnson295189b2012-06-20 16:38:30 -0700146} WDTS_TransportDriverTrype;
147
148typedef struct {
149 WDTS_SetPowerStateCbType cback;
150 void* pUserData;
151} WDTS_SetPowerStateCbInfoType;
152
Madan Mohan Koyyalamudi01cba042013-01-10 21:56:05 -0800153/* Tx/Rx stats function
154 * This function should be invoked to fetch the current stats
155 * Parameters:
156 * pStats:Pointer to the collected stats
157 * len: length of buffer pointed to by pStats
158 * Return Status: None
159 */
160void WDTS_GetTrafficStats(WDI_TrafficStatsType** pStats, wpt_uint32 *len);
161
162/* WDTS_DeactivateTrafficStats
163 * This function should be invoked to suspend traffic stats collection
164 * Parameters: None
165 * Return Status: None
166 */
167void WDTS_DeactivateTrafficStats(void);
168
169/* WDTS_ActivateTrafficStats
170 * This function should be invoked to activate traffic stats collection
171 * Parameters: None
172 * Return Status: None
173 */
174void WDTS_ActivateTrafficStats(void);
175
176/* WDTS_ClearTrafficStats
177 * This function should be invoked to clear all past stats
178 * Parameters: None
179 * Return Status: None
180 */
181void WDTS_ClearTrafficStats(void);
182
Jeff Johnson295189b2012-06-20 16:38:30 -0700183/* DTS open function.
184 * On open the transport device should initialize itself.
185 * Parameters:
186 * pContext:Cookie that should be passed back to the caller along
187 * with the callback.
188 *
189 * Return Value: SUCCESS Completed successfully.
190 * FAILURE_XXX Request was rejected due XXX Reason.
191
192 */
193wpt_status WDTS_openTransport( void *pContext);
194
195
196
197
198/* DTS start function.
199 * On start the transport device should start running.
200 * Parameters:
201 * pContext:Cookie that should be passed back to the caller along
202 * with the callback.
203 *
204 * Return Value: SUCCESS Completed successfully.
205 * FAILURE_XXX Request was rejected due XXX Reason.
206 *
207 */
208wpt_status WDTS_startTransport( void *pContext);
209
210
211
212
213/* DTS Tx packet function.
214 * This function should be invoked by the DAL Dataservice to schedule transmit frame through DXE/SDIO.
215 * Parameters:
216 * pContext:Cookie that should be passed back to the caller along with the callback.
217 * pFrame:Refernce to PAL frame.
218 * Return Value: SUCCESS Completed successfully.
219 * FAILURE_XXX Request was rejected due XXX Reason.
220 *
221 */
222wpt_status WDTS_TxPacket(void *pContext, wpt_packet *pFrame);
223
224/* DTS Tx Complete function.
225 * This function should be invoked by the DAL Dataservice to notify tx completion to DXE/SDIO.
226 * Parameters:
227 * pContext:Cookie that should be passed back to the caller along with the callback.
228 * ucTxResReq:TX resource number required by TL
229 * Return Value: SUCCESS Completed successfully.
230 * FAILURE_XXX Request was rejected due XXX Reason.
231 *
232 */
233wpt_status WDTS_CompleteTx(void *pContext, wpt_uint32 ucTxResReq);
234
235/* DTS Set power state function.
236 * This function should be invoked by the DAL to notify the WLAN device power state.
237 * Parameters:
238 * pContext:Cookie that should be passed back to the caller along with the callback.
239 * powerState:Power state of the WLAN device.
240 * Return Value: SUCCESS Set successfully in DXE control blk.
241 * FAILURE_XXX Request was rejected due XXX Reason.
242 *
243 */
244wpt_status WDTS_SetPowerState(void *pContext, WDTS_PowerStateType powerState,
245 WDTS_SetPowerStateCbType cback);
246
Madan Mohan Koyyalamudi8cb53982012-09-28 14:34:47 -0700247/* DTS Transport Channel Debug
248 * Display DXE Channel debugging information
249 * User may request to display DXE channel snapshot
250 * Or if host driver detects any abnormal stcuk may display
251 * Parameters:
Jeff Johnsonb88db982012-12-10 13:34:59 -0800252 * displaySnapshot : Display DXE snapshot option
Mihir Shete40a55652014-03-02 14:14:47 +0530253 * debugFlags : Enable stall detect features
254 * defined by WPAL_DeviceDebugFlags
255 * These features may effect
256 * data performance.
257 *
258 * Not integrate till fully verification
Madan Mohan Koyyalamudi8cb53982012-09-28 14:34:47 -0700259 * Return Value: NONE
260 *
261 */
Mihir Shete40a55652014-03-02 14:14:47 +0530262void WDTS_ChannelDebug(wpt_boolean displaySnapshot, wpt_uint8 debugFlags);
Madan Mohan Koyyalamudi8cb53982012-09-28 14:34:47 -0700263
Sravan Kumar Kairam6eac7522015-11-27 23:37:02 +0530264/* DTS Transport Channel Kick Dxe
265 * Request Kick DXE when HDD TX timeout happen
266 *
267 * Parameters : NONE
268 * Return Value: NONE
269 *
270 */
271void WDTS_ChannelKickDxe(void);
272
Jeff Johnson295189b2012-06-20 16:38:30 -0700273/* DTS Stop function.
274 * Stop Transport driver, ie DXE, SDIO
275 * Parameters:
276 * pContext:Cookie that should be passed back to the caller along with the callback.
277 * Return Value: SUCCESS Completed successfully.
278 * FAILURE_XXX Request was rejected due XXX Reason.
279 *
280 */
281wpt_status WDTS_Stop(void *pContext);
282
283/* DTS Close function.
284 * Close Transport driver, ie DXE, SDIO
285 * Parameters:
286 * pContext:Cookie that should be passed back to the caller along with the callback.
287 * Return Value: SUCCESS Completed successfully.
288 * FAILURE_XXX Request was rejected due XXX Reason.
289 *
290 */
291wpt_status WDTS_Close(void *pContext);
292
293/* Get free TX data descriptor number from DXE
294 * Parameters:
295 * pContext: Cookie that should be passed back to the caller along with the callback.
296 * Return Value: number of free descriptors for TX data channel
297 *
298 */
299wpt_uint32 WDTS_GetFreeTxDataResNumber(void *pContext);
300
Viral Modif45f7672013-09-06 13:29:06 -0700301/* API to fill Rate Info based on the mac efficiency passed to it
302 * macEff si used to caclulate mac throughput based on each rate index/PHY rate.
303 * This is eventually used by MAS to calculate RX stats periodically sent to FW
304 * The start and end Rate Index are the other arguments to this API - the new mac
305 * efficiency passed to this API (Arg1) is only applied between startRateIndex (arg2) and endRateIndex (arg3).
306 */
307void WDTS_FillRateInfo(wpt_uint8 macEff, wpt_int16 startRateIndex, wpt_int16 endRateIndex);
Jeff Johnson295189b2012-06-20 16:38:30 -0700308#endif