Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1 | /* |
Kiet Lam | 842dad0 | 2014-02-18 18:44:02 -0800 | [diff] [blame^] | 2 | * Copyright (c) 2012-2013 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. |
Gopichand Nakkala | 92f07d8 | 2013-01-08 21:16:34 -0800 | [diff] [blame] | 20 | */ |
Kiet Lam | 842dad0 | 2014-02-18 18:44:02 -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_DXE_H |
| 29 | #define WLAN_QCT_DXE_H |
| 30 | |
| 31 | /**========================================================================= |
| 32 | |
| 33 | @file wlan_qct_dxe.h |
| 34 | |
| 35 | @brief |
| 36 | |
| 37 | This file contains the external API exposed by the wlan data transfer abstraction layer module. |
| 38 | Copyright (c) 2008 QUALCOMM Incorporated. All Rights Reserved. |
| 39 | Qualcomm Confidential and Proprietary |
| 40 | ========================================================================*/ |
| 41 | |
| 42 | /*=========================================================================== |
| 43 | |
| 44 | EDIT HISTORY FOR FILE |
| 45 | |
| 46 | |
| 47 | This section contains comments describing changes made to the module. |
| 48 | Notice that changes are listed in reverse chronological order. |
| 49 | |
| 50 | |
| 51 | $Header:$ $DateTime: $ $Author: $ |
| 52 | |
| 53 | |
| 54 | when who what, where, why |
| 55 | -------- --- ---------------------------------------------------------- |
| 56 | 08/03/10 schang Created module. |
| 57 | |
| 58 | ===========================================================================*/ |
| 59 | |
| 60 | /*=========================================================================== |
| 61 | |
| 62 | INCLUDE FILES FOR MODULE |
| 63 | |
| 64 | ===========================================================================*/ |
| 65 | |
| 66 | /*---------------------------------------------------------------------------- |
| 67 | * Include Files |
| 68 | * -------------------------------------------------------------------------*/ |
| 69 | #include "wlan_qct_pal_api.h" |
| 70 | #include "wlan_qct_pal_packet.h" |
| 71 | #include "wlan_qct_pal_status.h" |
| 72 | #include "wlan_qct_pal_type.h" |
| 73 | #include "wlan_qct_pal_msg.h" |
| 74 | #include "wlan_qct_pal_sync.h" |
| 75 | #include "wlan_qct_wdi_dts.h" |
| 76 | |
| 77 | /*---------------------------------------------------------------------------- |
| 78 | * Type Declarations |
| 79 | * -------------------------------------------------------------------------*/ |
| 80 | /* DXE Descriptor contents SWAP option flag */ |
| 81 | |
| 82 | //#define WLANDXE_ENDIAN_SWAP_ENABLE |
| 83 | |
| 84 | /* Default RX OS frame buffer size |
| 85 | * Size must be same with Vos Packet Size */ |
| 86 | #define WLANDXE_DEFAULT_RX_OS_BUFFER_SIZE (VPKT_SIZE_BUFFER) |
| 87 | |
| 88 | /*The maximum number of packets that can be chained in dxe for the Low |
| 89 | priority channel |
| 90 | Note: Increased it to 240 from 128 for Windows(EA) becase Windows is |
| 91 | able to push 2~6 packet chain in one NET_BUFFER. It causes TX low |
| 92 | resource condition more easily than LA. It ends up to cause low |
| 93 | throughut number and spend more CPU time*/ |
| 94 | #ifdef WINDOWS_DT |
| 95 | #define WLANDXE_LO_PRI_RES_NUM 240 |
| 96 | #else |
| 97 | #define WLANDXE_LO_PRI_RES_NUM 128 |
| 98 | #endif |
| 99 | |
| 100 | |
| 101 | /*The maximum number of packets that can be chained in dxe for the HI |
| 102 | priority channel */ |
| 103 | #define WLANDXE_HI_PRI_RES_NUM 10 |
| 104 | |
| 105 | typedef enum |
| 106 | { |
| 107 | WLANDXE_POWER_STATE_FULL, |
| 108 | WLANDXE_POWER_STATE_IMPS, |
| 109 | WLANDXE_POWER_STATE_BMPS, |
| 110 | WLANDXE_POWER_STATE_BMPS_PENDING, |
| 111 | WLANDXE_POWER_STATE_DOWN, |
| 112 | WLANDXE_POWER_STATE_MAX |
| 113 | } WLANDXE_PowerStateType; |
| 114 | |
| 115 | typedef enum |
| 116 | { |
| 117 | WLANDXE_RIVA_POWER_STATE_ACTIVE, |
| 118 | WLANDXE_RIVA_POWER_STATE_IMPS_UNKNOWN, |
| 119 | WLANDXE_RIVA_POWER_STATE_BMPS_UNKNOWN, |
| 120 | WLANDXE_RIVA_POWER_STATE_DOWN_UNKNOWN, |
| 121 | WLANDXE_RIVA_POWER_STATE_MAX |
| 122 | } WLANDXE_RivaPowerStateType; |
| 123 | |
| 124 | /*========================================================================== |
| 125 | @ Type Name |
| 126 | WLANDXE_RxFrameReadyCbType |
| 127 | |
| 128 | @ Description |
| 129 | RX Frame Ready indication CB |
| 130 | |
| 131 | @ Parameters |
Jeff Johnson | a8a1a48 | 2012-12-12 16:49:33 -0800 | [diff] [blame] | 132 | pVoid pAdapter : Driver global control block pointer |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 133 | palPacket pRXFramePtr : Received Frame Pointer |
| 134 | pVoid userCtxt : DTS user contect pointer |
| 135 | |
| 136 | @ Return |
| 137 | wpt_status |
| 138 | ===========================================================================*/ |
| 139 | typedef WDTS_RxFrameReadyCbType WLANDXE_RxFrameReadyCbType; |
| 140 | |
| 141 | /*========================================================================== |
| 142 | @ Type Name |
| 143 | WLANDXE_TxCompleteCbType |
| 144 | |
| 145 | @ Description |
| 146 | TX complete indication CB |
| 147 | |
| 148 | @ Parameters |
Jeff Johnson | a8a1a48 | 2012-12-12 16:49:33 -0800 | [diff] [blame] | 149 | pVoid pAdapter : Driver global control block pointer |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 150 | void pTXFramePtr : Completed TX Frame Pointer |
| 151 | pVoid userCtxt : DTS user contect pointer |
| 152 | |
| 153 | @ Return |
| 154 | wpt_status |
| 155 | ===========================================================================*/ |
| 156 | typedef WDTS_TxCompleteCbType WLANDXE_TxCompleteCbType; |
| 157 | |
| 158 | /*========================================================================== |
| 159 | @ Type Name |
| 160 | WLANDXE_LowResourceCbType |
| 161 | |
| 162 | @ Description |
| 163 | DXE Low resource indication CB |
| 164 | |
| 165 | @ Parameters |
Jeff Johnson | a8a1a48 | 2012-12-12 16:49:33 -0800 | [diff] [blame] | 166 | pVoid pAdapter : Driver global control block pointer |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 167 | BOOL lowResourceCondition : DXE low resource or not |
| 168 | pVoid userCtxt : DTS user contect pointer |
| 169 | |
| 170 | @ Return |
| 171 | wpt_status |
| 172 | ===========================================================================*/ |
| 173 | typedef WDTS_LowResourceCbType WLANDXE_LowResourceCbType; |
| 174 | |
| 175 | /*========================================================================== |
| 176 | @ Type Name |
| 177 | WLANDXE_SetPowerStateCbType |
| 178 | |
| 179 | @ Description |
| 180 | DXE Set power state ACK callback. This callback function should be |
| 181 | invoked by the DXE to notify WDI that set power state request is complete |
| 182 | |
| 183 | @ Parameters |
| 184 | status status of the set operation |
| 185 | pUserData Cookie that should be passed back to the caller along with the |
| 186 | callback. |
| 187 | |
| 188 | @ Return |
| 189 | None |
| 190 | ===========================================================================*/ |
| 191 | typedef WDTS_SetPSCbType WLANDXE_SetPowerStateCbType; |
| 192 | |
| 193 | /*------------------------------------------------------------------------- |
| 194 | *Function declarations and documenation |
| 195 | *-------------------------------------------------------------------------*/ |
| 196 | /*========================================================================== |
| 197 | @ Function Name |
| 198 | WLANDXE_Open |
| 199 | |
| 200 | @ Description |
| 201 | Open host DXE driver, allocate DXE resources |
| 202 | Allocate, DXE local control block, DXE descriptor pool, DXE descriptor control block pool |
| 203 | |
| 204 | @ Parameters |
Jeff Johnson | a8a1a48 | 2012-12-12 16:49:33 -0800 | [diff] [blame] | 205 | pVoid pAdapter : Driver global control block pointer |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 206 | |
| 207 | @ Return |
| 208 | pVoid DXE local module control block pointer |
| 209 | ===========================================================================*/ |
| 210 | void *WLANDXE_Open |
| 211 | ( |
| 212 | void |
| 213 | ); |
| 214 | |
| 215 | /*========================================================================== |
| 216 | @ Function Name |
| 217 | WLANDXE_ClientRegistration |
| 218 | |
| 219 | @ Description |
| 220 | Make callback functions registration into DXE driver from DXE driver client |
| 221 | |
| 222 | @ Parameters |
| 223 | pVoid pDXEContext : DXE module control block |
| 224 | WDTS_RxFrameReadyCbType rxFrameReadyCB : RX Frame ready CB function pointer |
| 225 | WDTS_TxCompleteCbType txCompleteCB : TX complete CB function pointer |
| 226 | WDTS_LowResourceCbType lowResourceCB : Low DXE resource notification CB function pointer |
| 227 | void *userContext : DXE Cliennt control block |
| 228 | |
| 229 | @ Return |
| 230 | wpt_status |
| 231 | ===========================================================================*/ |
| 232 | wpt_status WLANDXE_ClientRegistration |
| 233 | ( |
| 234 | void *pDXEContext, |
| 235 | WDTS_RxFrameReadyCbType rxFrameReadyCB, |
| 236 | WDTS_TxCompleteCbType txCompleteCB, |
| 237 | WDTS_LowResourceCbType lowResourceCB, |
| 238 | void *userContext |
| 239 | ); |
| 240 | |
| 241 | /*========================================================================== |
| 242 | @ Function Name |
| 243 | WLANDXE_Start |
| 244 | |
| 245 | @ Description |
| 246 | Start Host DXE driver |
| 247 | Initialize DXE channels and start channel |
| 248 | |
| 249 | @ Parameters |
| 250 | pVoid pDXEContext : DXE module control block |
| 251 | |
| 252 | @ Return |
| 253 | wpt_status |
| 254 | ===========================================================================*/ |
| 255 | wpt_status WLANDXE_Start |
| 256 | ( |
| 257 | void *pDXEContext |
| 258 | ); |
| 259 | |
| 260 | /*========================================================================== |
| 261 | @ Function Name |
| 262 | WLANDXE_TXFrame |
| 263 | |
| 264 | @ Description |
| 265 | Trigger frame transmit from host to RIVA |
| 266 | |
| 267 | @ Parameters |
| 268 | pVoid pDXEContext : DXE Control Block |
| 269 | wpt_packet pPacket : transmit packet structure |
| 270 | WDTS_ChannelType channel : TX channel |
| 271 | |
| 272 | @ Return |
| 273 | wpt_status |
| 274 | ===========================================================================*/ |
| 275 | wpt_status WLANDXE_TxFrame |
| 276 | ( |
| 277 | void *pDXEContext, |
| 278 | wpt_packet *pPacket, |
| 279 | WDTS_ChannelType channel |
| 280 | ); |
| 281 | |
| 282 | |
| 283 | /*========================================================================== |
| 284 | @ Function Name |
| 285 | WLANDXE_CompleteTX |
| 286 | |
| 287 | @ Description |
| 288 | Informs DXE that the current series of Tx packets is complete |
| 289 | |
| 290 | @ Parameters |
| 291 | pDXEContext : DXE Control Block |
| 292 | ucTxResReq TX resource number required by TL/WDI |
| 293 | |
| 294 | @ Return |
| 295 | wpt_status |
| 296 | ===========================================================================*/ |
| 297 | wpt_status |
| 298 | WLANDXE_CompleteTX |
| 299 | ( |
| 300 | void* pDXEContext, |
| 301 | wpt_uint32 ucTxResReq |
| 302 | ); |
| 303 | |
| 304 | /*========================================================================== |
| 305 | @ Function Name |
| 306 | WLANDXE_Stop |
| 307 | |
| 308 | @ Description |
| 309 | Stop DXE channels and DXE engine operations |
| 310 | |
| 311 | @ Parameters |
| 312 | pVoid pDXEContext : DXE Control Block |
| 313 | |
| 314 | @ Return |
| 315 | wpt_status |
| 316 | ===========================================================================*/ |
| 317 | wpt_status WLANDXE_Stop |
| 318 | ( |
| 319 | void *pDXEContext |
| 320 | ); |
| 321 | |
| 322 | /*========================================================================== |
| 323 | @ Function Name |
| 324 | WLANDXE_Close |
| 325 | |
| 326 | @ Description |
| 327 | Close DXE channels |
| 328 | Free DXE related resources |
| 329 | DXE descriptor free |
| 330 | Descriptor control block free |
| 331 | Pre allocated RX buffer free |
| 332 | |
| 333 | @ Parameters |
| 334 | pVoid pDXEContext : DXE Control Block |
| 335 | |
| 336 | @ Return |
| 337 | wpt_status |
| 338 | ===========================================================================*/ |
| 339 | wpt_status WLANDXE_Close |
| 340 | ( |
| 341 | void *pDXEContext |
| 342 | ); |
| 343 | |
| 344 | /*========================================================================== |
| 345 | @ Function Name |
| 346 | WLANDXE_TriggerTX |
| 347 | |
| 348 | @ Description |
| 349 | TBD |
| 350 | |
| 351 | @ Parameters |
| 352 | pVoid pDXEContext : DXE Control Block |
| 353 | |
| 354 | @ Return |
| 355 | wpt_status |
| 356 | ===========================================================================*/ |
| 357 | wpt_status WLANDXE_TriggerTX |
| 358 | ( |
| 359 | void *pDXEContext |
| 360 | ); |
| 361 | |
| 362 | /*========================================================================== |
| 363 | @ Function Name |
| 364 | WLANDXE_SetPowerState |
| 365 | |
| 366 | @ Description |
| 367 | From Client let DXE knows what is the WLAN HW(RIVA) power state |
| 368 | |
| 369 | @ Parameters |
| 370 | pVoid pDXEContext : DXE Control Block |
| 371 | WLANDXE_PowerStateType powerState |
| 372 | |
| 373 | @ Return |
| 374 | wpt_status |
| 375 | ===========================================================================*/ |
| 376 | wpt_status WLANDXE_SetPowerState |
| 377 | ( |
| 378 | void *pDXEContext, |
| 379 | WDTS_PowerStateType powerState, |
| 380 | WDTS_SetPSCbType cBack |
| 381 | ); |
| 382 | |
| 383 | /*========================================================================== |
| 384 | @ Function Name |
| 385 | WLANDXE_GetFreeTxDataResNumber |
| 386 | |
| 387 | @ Description |
| 388 | Returns free descriptor numbers for TX data channel (TX high priority) |
| 389 | |
| 390 | @ Parameters |
| 391 | pVoid pDXEContext : DXE Control Block |
| 392 | |
| 393 | @ Return |
| 394 | wpt_uint32 Free descriptor number of TX high pri ch |
| 395 | ===========================================================================*/ |
| 396 | wpt_uint32 WLANDXE_GetFreeTxDataResNumber |
| 397 | ( |
| 398 | void *pDXEContext |
| 399 | ); |
| 400 | |
Madan Mohan Koyyalamudi | 8cb5398 | 2012-09-28 14:34:47 -0700 | [diff] [blame] | 401 | /*========================================================================== |
| 402 | @ Function Name |
| 403 | WLANDXE_ChannelDebug |
| 404 | |
| 405 | @ Description |
| 406 | Display DXE Channel debugging information |
| 407 | User may request to display DXE channel snapshot |
| 408 | Or if host driver detects any abnormal stcuk may display |
| 409 | |
| 410 | @ Parameters |
Jeff Johnson | b88db98 | 2012-12-10 13:34:59 -0800 | [diff] [blame] | 411 | displaySnapshot : Display DXE snapshot option |
Madan Mohan Koyyalamudi | 8cb5398 | 2012-09-28 14:34:47 -0700 | [diff] [blame] | 412 | enableStallDetect : Enable stall detect feature |
| 413 | This feature will take effect to data performance |
| 414 | Not integrate till fully verification |
| 415 | |
| 416 | @ Return |
| 417 | NONE |
| 418 | |
| 419 | ===========================================================================*/ |
| 420 | void WLANDXE_ChannelDebug |
| 421 | ( |
| 422 | wpt_boolean displaySnapshot, |
Madan Mohan Koyyalamudi | 24a00f9 | 2012-10-22 15:21:02 -0700 | [diff] [blame] | 423 | wpt_boolean enableStallDetect |
Madan Mohan Koyyalamudi | 8cb5398 | 2012-09-28 14:34:47 -0700 | [diff] [blame] | 424 | ); |
| 425 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 426 | #ifdef WLANDXE_TEST_CHANNEL_ENABLE |
| 427 | /*========================================================================== |
| 428 | @ Function Name |
| 429 | WLANDXE_UnitTest |
| 430 | |
| 431 | @ Description |
| 432 | Temporary for the DXE module test |
| 433 | |
| 434 | @ Parameters |
| 435 | NONE |
| 436 | |
| 437 | @ Return |
| 438 | NONE |
| 439 | |
| 440 | ===========================================================================*/ |
| 441 | void WLANDXE_UnitTestStartDXE |
| 442 | ( |
| 443 | void |
| 444 | ); |
| 445 | |
| 446 | /*========================================================================== |
| 447 | @ Function Name |
| 448 | |
| 449 | @ Description |
| 450 | |
| 451 | @ Parameters |
| 452 | |
| 453 | @ Return |
| 454 | |
| 455 | ===========================================================================*/ |
| 456 | void WLANDXE_UnitTestDataTransfer |
| 457 | ( |
| 458 | void |
| 459 | ); |
| 460 | |
| 461 | /*========================================================================== |
| 462 | @ Function Name |
| 463 | |
| 464 | @ Description |
| 465 | |
| 466 | @ Parameters |
| 467 | |
| 468 | @ Return |
| 469 | |
| 470 | ===========================================================================*/ |
| 471 | void WLANDXE_UnitTestEventHandle |
| 472 | ( |
| 473 | void *dxeCB |
| 474 | ); |
| 475 | #endif /* WLANDXE_TEST_CHANNEL_ENABLE */ |
| 476 | #endif /* WLAN_QCT_DXE_H */ |