Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1 | /* |
Mihir Shete | be94ebb | 2015-05-26 12:07:14 +0530 | [diff] [blame] | 2 | * Copyright (c) 2012-2015 The Linux Foundation. All rights reserved. |
Kiet Lam | 1ed83fc | 2014-02-19 01:15:45 -0800 | [diff] [blame] | 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. |
Gopichand Nakkala | 92f07d8 | 2013-01-08 21:16:34 -0800 | [diff] [blame] | 20 | */ |
Kiet Lam | 1ed83fc | 2014-02-19 01:15:45 -0800 | [diff] [blame] | 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 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 28 | #ifndef __WLAN_QCT_DTS_H |
| 29 | #define __WLAN_QCT_DTS_H |
Madan Mohan Koyyalamudi | 01cba04 | 2013-01-10 21:56:05 -0800 | [diff] [blame] | 30 | |
| 31 | #include "wlan_qct_wdi.h" |
| 32 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 33 | /**========================================================================= |
| 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 Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 44 | * |
| 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 | |
| 69 | typedef 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 Shete | e661816 | 2015-03-16 14:48:42 +0530 | [diff] [blame] | 75 | WDTS_CHANNEL_RX_LOG, |
Mihir Shete | be94ebb | 2015-05-26 12:07:14 +0530 | [diff] [blame] | 76 | WDTS_CHANNEL_RX_FW_LOG, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 77 | WDTS_CHANNEL_MAX |
| 78 | } WDTS_ChannelType; |
| 79 | |
Mihir Shete | e661816 | 2015-03-16 14:48:42 +0530 | [diff] [blame] | 80 | #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 Shete | be94ebb | 2015-05-26 12:07:14 +0530 | [diff] [blame] | 85 | #define WDTS_RX_FW_LOG_CHANNEL_MASK (1<<WDTS_CHANNEL_RX_FW_LOG) |
Mihir Shete | e661816 | 2015-03-16 14:48:42 +0530 | [diff] [blame] | 86 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 87 | typedef 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 Kairam | 80d06ee | 2015-09-28 12:53:20 +0530 | [diff] [blame] | 96 | typedef enum |
| 97 | { |
| 98 | WDTS_LOGGING_STATUS_SUCCESS, |
| 99 | WDTS_LOGGING_STATUS_ERROR |
| 100 | } WDTS_LoggingSessionStatus; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 101 | |
| 102 | typedef wpt_status (*WDTS_TxCompleteCbType)(void *pContext, wpt_packet *pFrame, wpt_status status); |
| 103 | typedef wpt_status (*WDTS_RxFrameReadyCbType) (void *pContext, wpt_packet *pFrame, WDTS_ChannelType channel); |
| 104 | typedef wpt_status (*WDTS_LowResourceCbType)(void *pContext, WDTS_ChannelType channel, wpt_boolean on); |
| 105 | typedef void (*WDTS_SetPSCbType)(wpt_status status, unsigned int dxePhyAddr); |
Mihir Shete | c4093f9 | 2015-05-28 15:21:11 +0530 | [diff] [blame] | 106 | typedef void (*WDTS_MbReceiveMsgType)(void *pContext); |
Mihir Shete | 5affadc | 2015-05-29 20:54:57 +0530 | [diff] [blame] | 107 | typedef void (*WDTS_RxLogDoneType)(void *pContext); |
Mihir Shete | c4093f9 | 2015-05-28 15:21:11 +0530 | [diff] [blame] | 108 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 109 | /* 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 | */ |
| 118 | typedef void (*WDTS_SetPowerStateCbType)(wpt_status status, |
| 119 | unsigned int dxePhyAddr, |
| 120 | void* pUserData); |
Mihir Shete | c4093f9 | 2015-05-28 15:21:11 +0530 | [diff] [blame] | 121 | typedef struct |
| 122 | { |
| 123 | WDTS_RxFrameReadyCbType rxFrameReadyCB; |
| 124 | WDTS_TxCompleteCbType txCompleteCB; |
| 125 | WDTS_LowResourceCbType lowResourceCB; |
| 126 | WDTS_MbReceiveMsgType receiveMbMsgCB; |
Mihir Shete | 5affadc | 2015-05-29 20:54:57 +0530 | [diff] [blame] | 127 | WDTS_RxLogDoneType receiveLogCompleteCB; |
Mihir Shete | c4093f9 | 2015-05-28 15:21:11 +0530 | [diff] [blame] | 128 | }WDTS_ClientCallbacks; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 129 | |
| 130 | typedef struct { |
| 131 | void * (*open)(void); |
| 132 | wpt_status (*start) (void *pContext); |
Mihir Shete | c4093f9 | 2015-05-28 15:21:11 +0530 | [diff] [blame] | 133 | wpt_status (*register_client)(void *pContext, WDTS_ClientCallbacks, void *clientData); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 134 | 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 Koyyalamudi | 8cb5398 | 2012-09-28 14:34:47 -0700 | [diff] [blame] | 138 | void (*channelDebug)(wpt_boolean displaySnapshot, |
Mihir Shete | 40a5565 | 2014-03-02 14:14:47 +0530 | [diff] [blame] | 139 | wpt_uint8 debugFlags); |
Sravan Kumar Kairam | 6eac752 | 2015-11-27 23:37:02 +0530 | [diff] [blame^] | 140 | void (*kickDxe) (void); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 141 | wpt_status (*stop) (void *pContext); |
| 142 | wpt_status (*close) (void *pContext); |
| 143 | wpt_uint32 (*getFreeTxDataResNumber) (void *pContext); |
Mihir Shete | 5affadc | 2015-05-29 20:54:57 +0530 | [diff] [blame] | 144 | wpt_uint32 (*setupLogTransfer) (wpt_uint64 bufferAddr, wpt_uint32 bufferSize); |
| 145 | wpt_status (*startLogTransfer) (void); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 146 | } WDTS_TransportDriverTrype; |
| 147 | |
| 148 | typedef struct { |
| 149 | WDTS_SetPowerStateCbType cback; |
| 150 | void* pUserData; |
| 151 | } WDTS_SetPowerStateCbInfoType; |
| 152 | |
Madan Mohan Koyyalamudi | 01cba04 | 2013-01-10 21:56:05 -0800 | [diff] [blame] | 153 | /* 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 | */ |
| 160 | void 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 | */ |
| 167 | void 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 | */ |
| 174 | void 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 | */ |
| 181 | void WDTS_ClearTrafficStats(void); |
| 182 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 183 | /* 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 | */ |
| 193 | wpt_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 | */ |
| 208 | wpt_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 | */ |
| 222 | wpt_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 | */ |
| 233 | wpt_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 | */ |
| 244 | wpt_status WDTS_SetPowerState(void *pContext, WDTS_PowerStateType powerState, |
| 245 | WDTS_SetPowerStateCbType cback); |
| 246 | |
Madan Mohan Koyyalamudi | 8cb5398 | 2012-09-28 14:34:47 -0700 | [diff] [blame] | 247 | /* 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 Johnson | b88db98 | 2012-12-10 13:34:59 -0800 | [diff] [blame] | 252 | * displaySnapshot : Display DXE snapshot option |
Mihir Shete | 40a5565 | 2014-03-02 14:14:47 +0530 | [diff] [blame] | 253 | * 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 Koyyalamudi | 8cb5398 | 2012-09-28 14:34:47 -0700 | [diff] [blame] | 259 | * Return Value: NONE |
| 260 | * |
| 261 | */ |
Mihir Shete | 40a5565 | 2014-03-02 14:14:47 +0530 | [diff] [blame] | 262 | void WDTS_ChannelDebug(wpt_boolean displaySnapshot, wpt_uint8 debugFlags); |
Madan Mohan Koyyalamudi | 8cb5398 | 2012-09-28 14:34:47 -0700 | [diff] [blame] | 263 | |
Sravan Kumar Kairam | 6eac752 | 2015-11-27 23:37:02 +0530 | [diff] [blame^] | 264 | /* DTS Transport Channel Kick Dxe |
| 265 | * Request Kick DXE when HDD TX timeout happen |
| 266 | * |
| 267 | * Parameters : NONE |
| 268 | * Return Value: NONE |
| 269 | * |
| 270 | */ |
| 271 | void WDTS_ChannelKickDxe(void); |
| 272 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 273 | /* 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 | */ |
| 281 | wpt_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 | */ |
| 291 | wpt_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 | */ |
| 299 | wpt_uint32 WDTS_GetFreeTxDataResNumber(void *pContext); |
| 300 | |
Viral Modi | f45f767 | 2013-09-06 13:29:06 -0700 | [diff] [blame] | 301 | /* 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 | */ |
| 307 | void WDTS_FillRateInfo(wpt_uint8 macEff, wpt_int16 startRateIndex, wpt_int16 endRateIndex); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 308 | #endif |