Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1 | /* |
Sravan Kumar Kairam | 84e995f | 2016-05-27 16:16:21 +0530 | [diff] [blame] | 2 | * Copyright (c) 2012-2013, 2016 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_PAL_DEVICE_H |
| 29 | #define WLAN_QCT_PAL_DEVICE_H |
| 30 | /* ==================================================================================================================== |
| 31 | |
| 32 | @file wlan_qct_pal_device.h |
| 33 | |
| 34 | @brief |
| 35 | This file contains the external API exposed by WLAN PAL Device specific functionalities |
| 36 | Copyright (c) 2011 Qualcomm Incorporated. All Rights Reserved |
| 37 | Qualcomm Confidential and Properietary |
| 38 | |
| 39 | * ==================================================================================================================*/ |
| 40 | |
| 41 | /* ==================================================================================================================== |
| 42 | EDIT HISTORY FOR FILE |
| 43 | |
| 44 | This section contains comments describing changes made to the module. |
| 45 | Notice that changes are listed in reverse chronological order |
| 46 | |
| 47 | When Who What, Where, Why |
| 48 | --------- -------- ------------------------------------------------------------------------------- |
| 49 | FEB/07/11 sch Create module |
| 50 | * ==================================================================================================================*/ |
| 51 | |
| 52 | /* ==================================================================================================================== |
| 53 | INCLUDE FILES FOR MODULES |
| 54 | * ==================================================================================================================*/ |
| 55 | #include "wlan_qct_pal_type.h" |
| 56 | #include "wlan_qct_pal_status.h" |
| 57 | #include "wlan_qct_pal_trace.h" |
| 58 | |
| 59 | /* ==================================================================================================================== |
| 60 | PREPROCESSORS AND DEFINITIONS |
| 61 | * ==================================================================================================================*/ |
| 62 | #define DXE_INTERRUPT_TX_COMPLE 0x02 |
| 63 | #define DXE_INTERRUPT_RX_READY 0x04 |
| 64 | #define WPAL_ISR_CLIENT_MAX 0x08 |
| 65 | |
| 66 | #define WPAL_SMSM_WLAN_TX_ENABLE 0x00000400 |
| 67 | #define WPAL_SMSM_WLAN_TX_RINGS_EMPTY 0x00000200 |
| 68 | |
Mihir Shete | 40a5565 | 2014-03-02 14:14:47 +0530 | [diff] [blame] | 69 | typedef enum |
| 70 | { |
| 71 | WPAL_DEBUG_START_HEALTH_TIMER = 1<<0, |
| 72 | WPAL_DEBUG_TX_DESC_RESYNC = 1<<1, |
| 73 | } WPAL_DeviceDebugFlags; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 74 | /* ==================================================================================================================== |
| 75 | @ Function Name |
| 76 | wpalIsrType |
| 77 | |
| 78 | @ Description |
| 79 | DXE ISR functio prototype |
| 80 | DXE should register ISR function into platform |
| 81 | |
| 82 | @ Parameters |
| 83 | pVoid pDXEContext : DXE module control block |
| 84 | |
| 85 | @ Return |
| 86 | NONE |
| 87 | * ==================================================================================================================*/ |
| 88 | typedef void (* wpalIsrType)(void *usrCtxt); |
| 89 | |
| 90 | /* ==================================================================================================================== |
| 91 | GLOBAL FUNCTIONS |
| 92 | * ==================================================================================================================*/ |
| 93 | /* ==================================================================================================================== |
| 94 | @ Function Name |
| 95 | |
| 96 | @ Description |
| 97 | |
| 98 | @ Arguments |
| 99 | |
| 100 | @ Return value |
| 101 | |
| 102 | @ Note |
| 103 | |
| 104 | * ==================================================================================================================*/ |
| 105 | wpt_status wpalDeviceInit |
| 106 | ( |
Arun Kumar Khandavalli | ebb1948 | 2014-03-25 13:56:53 +0530 | [diff] [blame] | 107 | void *devHandle |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 108 | ); |
| 109 | |
| 110 | /* ==================================================================================================================== |
| 111 | @ Function Name |
| 112 | |
| 113 | @ Description |
| 114 | |
| 115 | @ Arguments |
| 116 | |
| 117 | @ Return value |
| 118 | |
| 119 | @ Note |
| 120 | |
| 121 | * ==================================================================================================================*/ |
| 122 | wpt_status wpalDeviceClose |
| 123 | ( |
| 124 | void *deviceC |
| 125 | ); |
| 126 | |
| 127 | /* ========================================================================== |
| 128 | CLIENT SERVICE EXPOSE FUNCTIONS GENERIC |
| 129 | * =========================================================================*/ |
| 130 | /** |
| 131 | @brief wpalRegisterInterrupt provides a mechansim for client |
| 132 | to register support for a given interrupt |
| 133 | |
| 134 | The DXE interface supports two interrupts, TX Complete and RX |
| 135 | Available. This interface provides the mechanism whereby a client |
| 136 | can register to support one of these. It is expected that the core |
| 137 | DXE implementation will invoke this API twice, once for each interrupt. |
| 138 | |
| 139 | @param intType: Enumeration of the interrupt type (TX or RX) |
| 140 | @param callbackFunction: ISR function pointer |
| 141 | @param usrCtxt: User context passed back whenever the |
| 142 | callbackFunction is invoked |
| 143 | |
| 144 | @return SUCCESS if the registration was successful |
| 145 | */ |
| 146 | wpt_status wpalRegisterInterrupt |
| 147 | ( |
| 148 | wpt_uint32 intType, |
| 149 | wpalIsrType callbackFunction, |
| 150 | void *usrCtxt |
| 151 | ); |
| 152 | |
| 153 | /** |
| 154 | @brief wpalUnRegisterInterrupt provides a mechansim for client |
| 155 | to un-register for a given interrupt |
| 156 | |
| 157 | When DXE stop, remove registered information from PAL |
| 158 | |
| 159 | @param intType: Enumeration of the interrupt type (TX or RX) |
| 160 | |
| 161 | @return NONE |
| 162 | */ |
| 163 | |
| 164 | void wpalUnRegisterInterrupt |
| 165 | ( |
| 166 | wpt_uint32 intType |
| 167 | ); |
| 168 | |
| 169 | /** |
| 170 | @brief wpalEnableInterrupt provides a mechansim for a client |
| 171 | to request that a given interrupt be enabled |
| 172 | |
| 173 | The DXE interface supports two interrupts, TX Complete and RX |
| 174 | Available. This interface provides the mechanism whereby a client |
| 175 | can request that the platform-specific adaptation layer allows a |
| 176 | given interrupt to occur. The expectation is that if a given |
| 177 | interrupt is not enabled, if the interrupt occurs then the APPS CPU |
| 178 | will not be interrupted. |
| 179 | |
| 180 | @param intType: Enumeration of the interrupt type (TX or RX) |
| 181 | |
| 182 | @return SUCCESS if the interrupt was enabled |
| 183 | */ |
| 184 | wpt_status wpalEnableInterrupt |
| 185 | ( |
| 186 | wpt_uint32 intType |
| 187 | ); |
| 188 | |
| 189 | /** |
| 190 | @brief wpalDisableInterrupt provides a mechansim for a client |
| 191 | to request that a given interrupt be disabled |
| 192 | |
| 193 | The DXE interface supports two interrupts, TX Complete and RX |
| 194 | Available. This interface provides the mechanism whereby a client |
| 195 | can request that the platform-specific adaptation layer not allow a |
| 196 | given interrupt to occur. The expectation is that if a given |
| 197 | interrupt is not enabled, if the interrupt occurs then the APPS CPU |
| 198 | will not be interrupted. |
| 199 | |
| 200 | @param intType: Enumeration of the interrupt type (TX or RX) |
| 201 | |
| 202 | @return SUCCESS if the interrupt was disabled |
| 203 | */ |
| 204 | wpt_status wpalDisableInterrupt |
| 205 | ( |
| 206 | wpt_uint32 intType |
| 207 | ); |
| 208 | |
| 209 | /** |
| 210 | @brief wpalWriteRegister provides a mechansim for a client |
| 211 | to write data into a hardware data register |
| 212 | |
| 213 | @param address: Physical memory address of the register |
| 214 | @param data: Data value to be written |
| 215 | |
| 216 | @return SUCCESS if the data was successfully written |
| 217 | */ |
| 218 | wpt_status wpalReadRegister |
| 219 | ( |
| 220 | wpt_uint32 address, |
| 221 | wpt_uint32 *data |
| 222 | ); |
| 223 | |
| 224 | /** |
| 225 | @brief wpalReadRegister provides a mechansim for a client |
| 226 | to read data from a hardware data register |
| 227 | |
| 228 | @param address: Physical memory address of the register |
| 229 | @param data: Return location for value that is read |
| 230 | |
| 231 | @return SUCCESS if the data was successfully read |
| 232 | */ |
| 233 | wpt_status wpalWriteRegister |
| 234 | ( |
| 235 | wpt_uint32 address, |
| 236 | wpt_uint32 data |
| 237 | ); |
| 238 | |
| 239 | /** |
| 240 | @brief wpalReadDeviceMemory provides a mechansim for a client |
| 241 | to read data from the hardware address space |
| 242 | |
| 243 | @param address: Start address of physical memory to be read |
| 244 | @param d_buffer: Virtual destination address to which the |
| 245 | data will be written |
| 246 | @param len: Number of bytes of data to be read |
| 247 | |
| 248 | @return SUCCESS if the data was successfully read |
| 249 | */ |
| 250 | wpt_status wpalReadDeviceMemory |
| 251 | ( |
| 252 | wpt_uint32 address, |
| 253 | wpt_uint8 *DestBuffer, |
| 254 | wpt_uint32 len |
| 255 | ); |
| 256 | |
| 257 | /** |
| 258 | @brief wpalWriteDeviceMemory provides a mechansim for a client |
| 259 | to write data into the hardware address space |
| 260 | |
| 261 | @param address: Start address of physical memory to be written |
| 262 | @param s_buffer: Virtual source address from which the data will |
| 263 | be read |
| 264 | @param len: Number of bytes of data to be written |
| 265 | |
| 266 | @return SUCCESS if the data was successfully written |
| 267 | */ |
| 268 | wpt_status wpalWriteDeviceMemory |
| 269 | ( |
| 270 | wpt_uint32 address, |
| 271 | wpt_uint8 *srcBuffer, |
| 272 | wpt_uint32 len |
| 273 | ); |
| 274 | |
| 275 | /** |
| 276 | @brief wpalNotifySmsm provides a mechansim for a client to |
| 277 | notify SMSM to start DXE engine and/or condition of Tx |
| 278 | ring buffer |
| 279 | |
| 280 | @param clrSt: bit(s) to be cleared on the MASK |
| 281 | @param setSt: bit(s) to be set on the MASK |
| 282 | |
| 283 | @return SUCCESS if the operation is successful |
| 284 | */ |
| 285 | wpt_status wpalNotifySmsm |
| 286 | ( |
| 287 | wpt_uint32 clrSt, |
| 288 | wpt_uint32 setSt |
| 289 | ); |
| 290 | |
| 291 | /** |
| 292 | @brief wpalActivateRxInterrupt activates wpalRxIsr |
| 293 | |
| 294 | @param NONE |
| 295 | |
| 296 | @return NONE |
| 297 | */ |
| 298 | void wpalActivateRxInterrupt(void); |
| 299 | |
| 300 | /** |
| 301 | @brief wpalInactivateRxInterrupt inactivates wpalRxIsr |
| 302 | |
| 303 | @param NONE |
| 304 | |
| 305 | @return NONE |
| 306 | */ |
| 307 | void wpalInactivateRxInterrupt(void); |
| 308 | |
Sravan Kumar Kairam | 84e995f | 2016-05-27 16:16:21 +0530 | [diff] [blame] | 309 | |
| 310 | int wpal_get_int_state |
| 311 | ( |
| 312 | wpt_uint32 intType |
| 313 | ); |
| 314 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 315 | #endif /* WLAN_QCT_PAL_DEVICE_H*/ |