blob: 16b96fbd8ed047a4b80999e84e7e26b86f7b8e30 [file] [log] [blame]
Jeff Johnson295189b2012-06-20 16:38:30 -07001/*
Jeff Johnson2bbc0292017-09-19 08:38:56 -07002 * Copyright (c) 2012-2013, 2017 The Linux Foundation. All rights reserved.
Kiet Lam842dad02014-02-18 18:44:02 -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 Lam842dad02014-02-18 18:44:02 -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/*===========================================================================
29
30 b a p A p i S t a t u s . C
31
32 OVERVIEW:
33
34 This software unit holds the implementation of the WLAN BAP modules
35 Status functions.
36
37 The functions externalized by this module are to be called ONLY by other
38 WLAN modules (HDD) that properly register with the BAP Layer initially.
39
40 DEPENDENCIES:
41
42 Are listed for each API below.
43
44
Jeff Johnson295189b2012-06-20 16:38:30 -070045===========================================================================*/
46
47/*===========================================================================
48
49 EDIT HISTORY FOR FILE
50
51
52 This section contains comments describing changes made to the module.
53 Notice that changes are listed in reverse chronological order.
54
55
56 $Header: /cygdrive/d/Builds/M7201JSDCAAPAD52240B/WM/platform/msm7200/Src/Drivers/SD/ClientDrivers/WLAN/QCT_BTAMP_RSN/CORE/BAP/src/bapApiStatus.c,v 1.7 2009/03/09 08:45:04 jzmuda Exp jzmuda $$DateTime$$Author: jzmuda $
57
58
59 when who what, where, why
60---------- --- --------------------------------------------------------
612008-09-15 jez Created module
62
63===========================================================================*/
64
65/*----------------------------------------------------------------------------
66 * Include Files
67 * -------------------------------------------------------------------------*/
68//#include "wlan_qct_tl.h"
69#include "vos_trace.h"
70
71/* BT-AMP PAL API header file */
72#include "bapApi.h"
73#include "bapInternal.h"
74
75//#define BAP_DEBUG
76/*----------------------------------------------------------------------------
77 * Preprocessor Definitions and Constants
78 * -------------------------------------------------------------------------*/
79
80
81/*----------------------------------------------------------------------------
82 * Type Declarations
83 * -------------------------------------------------------------------------*/
84
85/*----------------------------------------------------------------------------
86 * Global Data Definitions
87 * -------------------------------------------------------------------------*/
88
89/*----------------------------------------------------------------------------
90 * Static Variable Definitions
91 * -------------------------------------------------------------------------*/
92
93/*----------------------------------------------------------------------------
94 * Static Function Declarations and Definitions
95 * -------------------------------------------------------------------------*/
96
97/*----------------------------------------------------------------------------
98 * Externalized Function Definitions
99* -------------------------------------------------------------------------*/
100
101/*----------------------------------------------------------------------------
102 * Function Declarations and Documentation
103 * -------------------------------------------------------------------------*/
104
105/*
106Status Parameters
107*/
108
109/*----------------------------------------------------------------------------
110
111 FUNCTION WLAN_BAPReadFailedContactCounter()
112
113 DESCRIPTION
114 Implements the actual HCI Read Failed Contact Counter command. There
115 is no need for a callback because when this call returns the action
116 has been completed.
117
118 DEPENDENCIES
119 NA.
120
121 PARAMETERS
122
123 IN
124 btampHandle: pointer to the BAP handle. Returned from WLANBAP_GetNewHndl.
125 pBapHCIReadFailedContactCounter: pointer to the "HCI Read Failed Contact Counter" structure.
126 pFailedContactCounter: pointer to return value for the "Failed Contact Counter"
127
128 IN/OUT
129 pBapHCIEvent: Return event value for the command complete event.
130 (The caller of this routine is responsible for sending
131 the Command Complete event up the HCI interface.)
132
133 RETURN VALUE
134 The result code associated with performing the operation
135
136 VOS_STATUS_E_FAULT: pointer to pBapHCIReadFailedContactCounter or
137 pFailedContactCounter is NULL
138 VOS_STATUS_SUCCESS: Success
139
140 SIDE EFFECTS
141
142----------------------------------------------------------------------------*/
143VOS_STATUS
144WLAN_BAPReadFailedContactCounter
145(
146 ptBtampHandle btampHandle,
147 tBtampTLVHCI_Read_Failed_Contact_Counter_Cmd *pBapHCIReadFailedContactCounter,
148 tpBtampHCI_Event pBapHCIEvent /* This now encodes ALL event types */
149 /* Including "Read" Command Complete*/
150)
151{
152
153 return VOS_STATUS_SUCCESS;
154} /* WLAN_BAPReadFailedContactCounter */
155
156/*----------------------------------------------------------------------------
157
158 FUNCTION WLAN_BAPResetFailedContactCounter()
159
160 DESCRIPTION
161 Implements the actual HCI Reset Failed Contact Counter command. There
162 is no need for a callback because when this call returns the action
163 has been completed.
164
165 DEPENDENCIES
166 NA.
167
168 PARAMETERS
169
170 IN
171 btampHandle: pointer to the BAP handle. Returned from WLANBAP_GetNewHndl.
172 pBapHCIResetFailedContactCounter: pointer to the "HCI Reset Failed Contact Counter" structure.
173
174 IN/OUT
175 pBapHCIEvent: Return event value for the command complete event.
176 (The caller of this routine is responsible for sending
177 the Command Complete event up the HCI interface.)
178
179 RETURN VALUE
180 The result code associated with performing the operation
181
182 VOS_STATUS_E_FAULT: pointer to pBapHCIResetFailedContactCounter is NULL
183 VOS_STATUS_SUCCESS: Success
184
185 SIDE EFFECTS
186
187----------------------------------------------------------------------------*/
188VOS_STATUS
189WLAN_BAPResetFailedContactCounter
190(
191 ptBtampHandle btampHandle,
192 tBtampTLVHCI_Reset_Failed_Contact_Counter_Cmd *pBapHCIResetFailedContactCounter,
193 tpBtampHCI_Event pBapHCIEvent /* This now encodes ALL event types */
194 /* Including Command Complete and Command Status*/
195)
196{
197
198 return VOS_STATUS_SUCCESS;
199} /* WLAN_BAPResetFailedContactCounter */
200
201/*----------------------------------------------------------------------------
202
203 FUNCTION WLAN_BAPReadLinkQuality()
204
205 DESCRIPTION
206 Implements the actual HCI Read Link Quality command. There
207 is no need for a callback because when this call returns the action
208 has been completed.
209
210 DEPENDENCIES
211 NA.
212
213 PARAMETERS
214
215 IN
216 btampHandle: pointer to the BAP handle. Returned from WLANBAP_GetNewHndl.
217 pBapHCIReadLinkQuality: pointer to the "HCI Read Link Quality" structure.
218 pBapHCILinkQuality: pointer to return value for the "Link Quality"
219
220 IN/OUT
221 pBapHCIEvent: Return event value for the command complete event.
222 (The caller of this routine is responsible for sending
223 the Command Complete event up the HCI interface.)
224
225 RETURN VALUE
226 The result code associated with performing the operation
227
228 VOS_STATUS_E_FAULT: pointer to pBapHCIReadLinkQuality or
229 pBapHCILinkQuality is NULL
230 VOS_STATUS_SUCCESS: Success
231
232 SIDE EFFECTS
233
234----------------------------------------------------------------------------*/
235VOS_STATUS
236WLAN_BAPReadLinkQuality
237(
238 ptBtampHandle btampHandle,
239 tBtampTLVHCI_Read_Link_Quality_Cmd *pBapHCIReadLinkQuality,
240 tpBtampHCI_Event pBapHCIEvent /* This now encodes ALL event types */
241 /* Including Command Complete and Command Status*/
242)
243{
244 ptBtampContext btampContext = (ptBtampContext) btampHandle;
245 v_U8_t phyLinkHandle;
246 /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
247
248 VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH,
Jeff Johnson2bbc0292017-09-19 08:38:56 -0700249 "%s: btampHandle value: %pK", __func__, btampHandle);
Jeff Johnson295189b2012-06-20 16:38:30 -0700250
251 /* Validate params */
252 if ((NULL == btampHandle) || (NULL == pBapHCIReadLinkQuality) ||
253 (NULL == pBapHCIEvent))
254 {
255 VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -0700256 "Invalid input parameters in %s", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -0700257 return VOS_STATUS_E_FAULT;
258 }
259
260 /* Validate the physical link handle extracted from
261 input parameter. This parameter has 2 bytes for physical handle
262 (only lower byte valid) */
263 phyLinkHandle = (v_U8_t) pBapHCIReadLinkQuality->log_link_handle;
264
265 pBapHCIEvent->u.btampCommandCompleteEvent.cc_event.Read_Link_Quality.log_link_handle
266 = phyLinkHandle;
267 pBapHCIEvent->u.btampCommandCompleteEvent.cc_event.Read_Link_Quality.link_quality = 0;
268
269 if (phyLinkHandle != btampContext->phy_link_handle)
270 {
271 VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -0700272 "Invalid Physical link handle in %s", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -0700273 pBapHCIEvent->u.btampCommandCompleteEvent.cc_event.Read_Link_Quality.status
274 = WLANBAP_ERROR_INVALID_HCI_CMND_PARAM;
275 }
276 else
277 {
278 /* Get the Link quality indication status from control block.
279 Link quality value is being updated on the SME callback */
280 pBapHCIEvent->u.btampCommandCompleteEvent.cc_event.Read_Link_Quality.link_quality
281 = btampContext->link_quality;
282
283 pBapHCIEvent->u.btampCommandCompleteEvent.cc_event.Read_Link_Quality.status
284 = WLANBAP_STATUS_SUCCESS;
285 }
286
287 /* Fill in the parameters for command complete event... */
288 pBapHCIEvent->bapHCIEventCode = BTAMP_TLV_HCI_COMMAND_COMPLETE_EVENT;
289 pBapHCIEvent->u.btampCommandCompleteEvent.present = TRUE;
290 pBapHCIEvent->u.btampCommandCompleteEvent.num_hci_command_packets = 1;
291 pBapHCIEvent->u.btampCommandCompleteEvent.command_opcode
292 = BTAMP_TLV_HCI_READ_LINK_QUALITY_CMD;
293
294 return VOS_STATUS_SUCCESS;
295} /* WLAN_BAPReadLinkQuality */
296
297/*----------------------------------------------------------------------------
298
299 FUNCTION WLAN_BAPReadRSSI()
300
301 DESCRIPTION
302 Implements the actual HCI Read RSSI command. There
303 is no need for a callback because when this call returns the action
304 has been completed.
305
306 DEPENDENCIES
307 NA.
308
309 PARAMETERS
310
311 IN
312 btampHandle: pointer to the BAP handle. Returned from WLANBAP_GetNewHndl.
313 pBapHCIReadRSSI: pointer to the "HCI Read RSSI" structure.
314 pBapHCIRSSI: pointer to return value for the "RSSI".
315
316 IN/OUT
317 pBapHCIEvent: Return event value for the command complete event.
318 (The caller of this routine is responsible for sending
319 the Command Complete event up the HCI interface.)
320
321 RETURN VALUE
322 The result code associated with performing the operation
323
324 VOS_STATUS_E_FAULT: pointer to pBapHCIReadRSSI or
325 pBapHCIRSSI is NULL
326 VOS_STATUS_SUCCESS: Success
327
328 SIDE EFFECTS
329
330----------------------------------------------------------------------------*/
331VOS_STATUS
332WLAN_BAPReadRSSI
333(
334 ptBtampHandle btampHandle,
335 tBtampTLVHCI_Read_RSSI_Cmd *pBapHCIReadRSSI,
336 tpBtampHCI_Event pBapHCIEvent /* This now encodes ALL event types */
337 /* Including Command Complete and Command Status*/
338)
339{
340 VOS_STATUS vosStatus;
341 ptBtampContext btampContext = (ptBtampContext) btampHandle;
342 v_U8_t phyLinkHandle;
343 /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
344
345 VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH,
Jeff Johnson2bbc0292017-09-19 08:38:56 -0700346 "%s: btampHandle value: %pK", __func__, btampHandle);
Jeff Johnson295189b2012-06-20 16:38:30 -0700347
348 /* Validate params */
349 if ((NULL == btampHandle) || (NULL == pBapHCIReadRSSI) ||
350 (NULL == pBapHCIEvent))
351 {
352 VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -0700353 "Invalid input parameters in %s", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -0700354 return VOS_STATUS_E_FAULT;
355 }
356
357 /* Validate the physical link handle extracted from
358 input parameter. This parameter has 2 bytes for physical handle
359 (only lower byte valid) */
360 phyLinkHandle = (v_U8_t) pBapHCIReadRSSI->log_link_handle;
361
362 pBapHCIEvent->u.btampCommandCompleteEvent.cc_event.Read_RSSI.phy_link_handle
363 = phyLinkHandle;
364 pBapHCIEvent->u.btampCommandCompleteEvent.cc_event.Read_RSSI.rssi = 0;
365
366 if (phyLinkHandle != btampContext->phy_link_handle)
367 {
368 VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -0700369 "Invalid Physical link handle in %s", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -0700370 pBapHCIEvent->u.btampCommandCompleteEvent.cc_event.Read_RSSI.status
371 = WLANBAP_ERROR_INVALID_HCI_CMND_PARAM;
372 }
373 else
374 {
375 /* Get the RSSI value for this station (physical link) */
376 vosStatus = WLANTL_GetRssi(btampContext->pvosGCtx, btampContext->ucSTAId,
377 &pBapHCIEvent->u.btampCommandCompleteEvent.cc_event.Read_RSSI.rssi);
378
379 if (VOS_STATUS_SUCCESS == vosStatus)
380 {
381 /* GetRssi success, indicate the to upper layer */
382 pBapHCIEvent->u.btampCommandCompleteEvent.cc_event.Read_RSSI.status
383 = WLANBAP_STATUS_SUCCESS;
384 }
385 else
386 {
387 /* API failed, indicate unspecified error to upper layer */
388 pBapHCIEvent->u.btampCommandCompleteEvent.cc_event.Read_RSSI.status
389 = WLANBAP_ERROR_UNSPECIFIED_ERROR;
390 }
391 }
392
393 /* Fill in the parameters for command complete event... */
394 pBapHCIEvent->bapHCIEventCode = BTAMP_TLV_HCI_COMMAND_COMPLETE_EVENT;
395 pBapHCIEvent->u.btampCommandCompleteEvent.present = TRUE;
396 pBapHCIEvent->u.btampCommandCompleteEvent.num_hci_command_packets = 1;
397 pBapHCIEvent->u.btampCommandCompleteEvent.command_opcode
398 = BTAMP_TLV_HCI_READ_RSSI_CMD;
399
400 return VOS_STATUS_SUCCESS;
401} /* WLAN_BAPReadRSSI */
402
403/*----------------------------------------------------------------------------
404
405 FUNCTION WLAN_BAPReadLocalAMPInfo()
406
407 DESCRIPTION
408 Implements the actual HCI Read Local AMP Information command. There
409 is no need for a callback because when this call returns the action
410 has been completed.
411
412 DEPENDENCIES
413 NA.
414
415 PARAMETERS
416
417 IN
418 btampHandle: pointer to the BAP handle. Returned from WLANBAP_GetNewHndl.
419 pBapHCIReadLocalAMPInfo: pointer to the "HCI Read Local AMP Info" Structure.
420
421 IN/OUT
422 pBapHCIEvent: Return event value for the command complete event.
423 (The caller of this routine is responsible for sending
424 the Command Complete event up the HCI interface.)
425
426 RETURN VALUE
427 The result code associated with performing the operation
428
429 VOS_STATUS_E_FAULT: pointer to pBapHCIReadLocalAMPInfo or
430 pBapHCILocalAMPInfo is NULL
431 VOS_STATUS_SUCCESS: Success
432
433 SIDE EFFECTS
434
435----------------------------------------------------------------------------*/
436VOS_STATUS
437WLAN_BAPReadLocalAMPInfo
438(
439 ptBtampHandle btampHandle,
440 tBtampTLVHCI_Read_Local_AMP_Information_Cmd *pBapHCIReadLocalAMPInfo,
441 tpBtampHCI_Event pBapHCIEvent /* This now encodes ALL event types */
442 /* Including Command Complete and Command Status*/
443)
444{
445 /* Validate params */
446 if (btampHandle == NULL) {
447 return VOS_STATUS_E_FAULT;
448 }
449
450 /* Validate params */
451 if (pBapHCIReadLocalAMPInfo == NULL) {
452 return VOS_STATUS_E_FAULT;
453 }
454
Jeff Johnson2bbc0292017-09-19 08:38:56 -0700455 VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "%s: btampHandle value: %pK", __func__, btampHandle);
Jeff Johnson295189b2012-06-20 16:38:30 -0700456
457
458 /* Format the command complete event to return... */
459 pBapHCIEvent->bapHCIEventCode = BTAMP_TLV_HCI_COMMAND_COMPLETE_EVENT;
460 pBapHCIEvent->u.btampCommandCompleteEvent.present = 1;
461 pBapHCIEvent->u.btampCommandCompleteEvent.num_hci_command_packets = 1;
462 pBapHCIEvent->u.btampCommandCompleteEvent.command_opcode
463 = BTAMP_TLV_HCI_READ_LOCAL_AMP_INFORMATION_CMD;
464 pBapHCIEvent->u.btampCommandCompleteEvent.cc_event.Read_Local_AMP_Info.status
465 = WLANBAP_STATUS_SUCCESS;
466 pBapHCIEvent->u.btampCommandCompleteEvent.cc_event.Read_Local_AMP_Info.HC_AMP_Status
467 = WLANBAP_HCI_AMP_STATUS_NOT_SHARED;
468 pBapHCIEvent->u.btampCommandCompleteEvent.cc_event.Read_Local_AMP_Info.HC_Total_BW
469 = 24000;
470 pBapHCIEvent->u.btampCommandCompleteEvent.cc_event.Read_Local_AMP_Info.HC_Max_Guaranteed_BW
471 = 12000;
472 pBapHCIEvent->u.btampCommandCompleteEvent.cc_event.Read_Local_AMP_Info.HC_Min_Latency
473 = 100;
474 pBapHCIEvent->u.btampCommandCompleteEvent.cc_event.Read_Local_AMP_Info.HC_Max_PDU_Size
475 = WLANBAP_MAX_80211_PAL_PDU_SIZE;
476 pBapHCIEvent->u.btampCommandCompleteEvent.cc_event.Read_Local_AMP_Info.HC_Controller_Type
477 = 1;
478#if 0
479AMP Info PAL_Capabilities: Size: 2 Octets
480
481Value Parameter Description
4820xXXXX Bit 0: "Service Type = Guaranteed" is not supported by PAL = 0
483 "Service Type = Guaranteed" is supported by PAL = 1
484 Bits 15-1: Reserved (shall be set to 0)
485 (See EFS in Generic AMP FIPD [1])
486#endif //0
487 pBapHCIEvent->u.btampCommandCompleteEvent.cc_event.Read_Local_AMP_Info.HC_PAL_Capabilities
488 = 0x00; // was 0x03. Completely wrong.
489 pBapHCIEvent->u.btampCommandCompleteEvent.cc_event.Read_Local_AMP_Info.HC_AMP_Assoc_Length
490 = 248;
491 //= 40;
492 pBapHCIEvent->u.btampCommandCompleteEvent.cc_event.Read_Local_AMP_Info.HC_Max_Flush_Timeout
493 = 10000; //10;
494 pBapHCIEvent->u.btampCommandCompleteEvent.cc_event.Read_Local_AMP_Info.HC_BE_Flush_Timeout
495 = 10000; //8;
496
497 return VOS_STATUS_SUCCESS;
498} /* WLAN_BAPReadLocalAMPInfo */
499
500/*----------------------------------------------------------------------------
501
502 FUNCTION WLAN_BAPReadLocalAMPAssoc()
503
504 DESCRIPTION
505 Implements the actual HCI Read Local AMP Assoc command. There
506 is no need for a callback because when this call returns the action
507 has been completed.
508
509 DEPENDENCIES
510 NA.
511
512 PARAMETERS
513
514 IN
515 btampHandle: pointer to the BAP handle. Returned from WLANBAP_GetNewHndl.
516 pBapHCIReadLocalAMPAssoc: pointer to the "HCI Read Local AMP Assoc" Structure.
517
518 IN/OUT
519 pBapHCIEvent: Return event value for the command complete event.
520 (The caller of this routine is responsible for sending
521 the Command Complete event up the HCI interface.)
522
523
524 RETURN VALUE
525 The result code associated with performing the operation
526
527 VOS_STATUS_E_FAULT: pointer to pBapHCIReadLocalAMPAssoc
528 (or pBapHCILocalAMPAssoc) is NULL
529 VOS_STATUS_SUCCESS: Success
530
531 SIDE EFFECTS
532
533----------------------------------------------------------------------------*/
534VOS_STATUS
535WLAN_BAPReadLocalAMPAssoc
536(
537 ptBtampHandle btampHandle,
538 tBtampTLVHCI_Read_Local_AMP_Assoc_Cmd *pBapHCIReadLocalAMPAssoc,
539 tpBtampHCI_Event pBapHCIEvent /* This now encodes ALL event types */
540 /* Including Command Complete and Command Status*/
541)
542{
543 VOS_STATUS vosStatus;
544 ptBtampContext btampContext = (ptBtampContext) btampHandle; /* btampContext value */
545 tHalHandle hHal;
546 tBtampAMP_ASSOC btamp_ASSOC;
547 v_U32_t nConsumed = 0;
548 /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
549
550
551 /* Validate params */
552 if ((pBapHCIReadLocalAMPAssoc == NULL) || (NULL == btampHandle))
553 {
554 VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -0700555 "param is NULL in %s", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -0700556
557 return VOS_STATUS_E_FAULT;
558 }
559 hHal = VOS_GET_HAL_CB(btampContext->pvosGCtx);
560 if (NULL == hHal)
561 {
562 VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -0700563 "hHal is NULL in %s", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -0700564 return VOS_STATUS_E_FAULT;
565 }
566
Jeff Johnson2bbc0292017-09-19 08:38:56 -0700567 VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "%s: btampHandle value: %pK", __func__, btampHandle);
Jeff Johnson295189b2012-06-20 16:38:30 -0700568
569 VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -0700570 "In %s, phy_link_handle = %d", __func__,
Jeff Johnson295189b2012-06-20 16:38:30 -0700571 pBapHCIReadLocalAMPAssoc->phy_link_handle);
572
573 /* Update the MAC address and SSID if in case the Read Local AMP Assoc
574 * Request is made before Create Physical Link creation.
575 */
576 WLANBAP_ReadMacConfig (btampContext);
577
578 /* Fill in the contents of an AMP_Assoc structure in preparation
579 * for Packing it into the AMP_assoc_fragment field of the Read
580 * Local AMP Assoc Command Complete Event
581 */
582 /* Return the local MAC address */
583 btamp_ASSOC.AMP_Assoc_MAC_Addr.present = 1;
584 vos_mem_copy(
585 btamp_ASSOC.AMP_Assoc_MAC_Addr.mac_addr,
586 btampContext->self_mac_addr,
Rajesh Babu Prathipati4c347592014-07-01 18:46:42 +0530587 sizeof(btampContext->self_mac_addr));
Jeff Johnson295189b2012-06-20 16:38:30 -0700588
589 /*Save the local AMP assoc info*/
590 vos_mem_copy(btampContext->btamp_AMP_Assoc.HC_mac_addr,
591 btampContext->self_mac_addr,
Rajesh Babu Prathipati4c347592014-07-01 18:46:42 +0530592 sizeof(btampContext->self_mac_addr));
Jeff Johnson295189b2012-06-20 16:38:30 -0700593
594
595 /* JEZ090303: This logic should return a single channel list with the */
596 /* selected channel, if we have one. */
597 //if (btampContext->channel)
598 if (1)
599 {
600 /* Return the local Preferred Channel List */
601 /* Return both the Regulatory Info and one channel list */
602 btamp_ASSOC.AMP_Assoc_Preferred_Channel_List.present = 1;
Rajesh Babu Prathipati4c347592014-07-01 18:46:42 +0530603 vos_mem_copy (btamp_ASSOC.AMP_Assoc_Preferred_Channel_List.country, "XXX", 3);
Jeff Johnson295189b2012-06-20 16:38:30 -0700604 /*Save the local AMP assoc info*/
605 vos_mem_copy(btampContext->btamp_AMP_Assoc.HC_pref_country, "XXX", 3);
606
607 btamp_ASSOC.AMP_Assoc_Preferred_Channel_List.num_triplets = 2;
608 btamp_ASSOC.AMP_Assoc_Preferred_Channel_List.triplets[0][0] = 201;
609 btamp_ASSOC.AMP_Assoc_Preferred_Channel_List.triplets[0][1] = 254;
610 btamp_ASSOC.AMP_Assoc_Preferred_Channel_List.triplets[0][2] = 0;
611
612 if (( BT_INITIATOR == btampContext->BAPDeviceRole ) &&
613 ( 0 != btampContext->channel ))
614 {
615 btamp_ASSOC.AMP_Assoc_Preferred_Channel_List.triplets[1][0] = btampContext->channel;
616 btamp_ASSOC.AMP_Assoc_Preferred_Channel_List.triplets[1][1] = 0x01; //we are AP - we start on their 1st preferred channel
617 btamp_ASSOC.AMP_Assoc_Preferred_Channel_List.triplets[1][2] = 0x11;
618 }
619 else
620 {
621 if (btampContext->config.ucPreferredChannel)
622 {
623 btamp_ASSOC.AMP_Assoc_Preferred_Channel_List.triplets[1][0] = btampContext->config.ucPreferredChannel;
624 btamp_ASSOC.AMP_Assoc_Preferred_Channel_List.triplets[1][1] =
625 0x0B - btampContext->config.ucPreferredChannel + 1;
626 }
627 else
628 {
629 btamp_ASSOC.AMP_Assoc_Preferred_Channel_List.triplets[1][0] = 0x01;
630 btamp_ASSOC.AMP_Assoc_Preferred_Channel_List.triplets[1][1] = 0x0B; //all channels for 1 to 11
631 }
632
633 btamp_ASSOC.AMP_Assoc_Preferred_Channel_List.triplets[1][2] = 0x11;
634 }
635 } else
636 {
637 /* Return the local Preferred Channel List */
638 /* Return only the Regulatory Info */
639 btamp_ASSOC.AMP_Assoc_Preferred_Channel_List.present = 1;
Rajesh Babu Prathipati4c347592014-07-01 18:46:42 +0530640 vos_mem_copy (btamp_ASSOC.AMP_Assoc_Preferred_Channel_List.country, "XXX", 3);
Jeff Johnson295189b2012-06-20 16:38:30 -0700641 btamp_ASSOC.AMP_Assoc_Preferred_Channel_List.num_triplets = 1;
642 btamp_ASSOC.AMP_Assoc_Preferred_Channel_List.triplets[0][0] = 201;
643 btamp_ASSOC.AMP_Assoc_Preferred_Channel_List.triplets[0][1] = 254;
644 btamp_ASSOC.AMP_Assoc_Preferred_Channel_List.triplets[0][2] = 0;
645
646 }
647
648 /*Save the local AMP assoc info*/
649 btampContext->btamp_AMP_Assoc.HC_pref_num_triplets = btamp_ASSOC.AMP_Assoc_Preferred_Channel_List.num_triplets;
650 btampContext->btamp_AMP_Assoc.HC_pref_triplets[0][0] = btamp_ASSOC.AMP_Assoc_Preferred_Channel_List.triplets[0][0];
651 btampContext->btamp_AMP_Assoc.HC_pref_triplets[0][1] = btamp_ASSOC.AMP_Assoc_Preferred_Channel_List.triplets[0][1];
652 btampContext->btamp_AMP_Assoc.HC_pref_triplets[0][2] = btamp_ASSOC.AMP_Assoc_Preferred_Channel_List.triplets[0][2];
653 btampContext->btamp_AMP_Assoc.HC_pref_triplets[1][0] = btamp_ASSOC.AMP_Assoc_Preferred_Channel_List.triplets[1][0];
654 btampContext->btamp_AMP_Assoc.HC_pref_triplets[1][1] = btamp_ASSOC.AMP_Assoc_Preferred_Channel_List.triplets[1][1];
655 btampContext->btamp_AMP_Assoc.HC_pref_triplets[1][2] = btamp_ASSOC.AMP_Assoc_Preferred_Channel_List.triplets[1][2];
656
657 /* Also, at this point, lie and tell the other side we are connected on */
658 /* the one channel we support. I hope this convinces the peer as BT-AMP AP */
659 /* We really want him to use our channel. Since we only support one.*/
660 /* Return the local Connected Channel */
661 btamp_ASSOC.AMP_Assoc_Connected_Channel.present = 1;
Rajesh Babu Prathipati4c347592014-07-01 18:46:42 +0530662 vos_mem_copy (btamp_ASSOC.AMP_Assoc_Connected_Channel.country, "XXX", 3);
Jeff Johnson295189b2012-06-20 16:38:30 -0700663 btamp_ASSOC.AMP_Assoc_Connected_Channel.num_triplets = 2;
664 btamp_ASSOC.AMP_Assoc_Connected_Channel.triplets[0][0] = 201;
665 btamp_ASSOC.AMP_Assoc_Connected_Channel.triplets[0][1] = 254;
666 btamp_ASSOC.AMP_Assoc_Connected_Channel.triplets[0][2] = 0;
667 //btamp_ASSOC.AMP_Assoc_Connected_Channel.triplets[1][0] = 0x01;
668 btamp_ASSOC.AMP_Assoc_Connected_Channel.triplets[1][0] = (0 != btampContext->channel)?btampContext->channel:0x01;
669 btamp_ASSOC.AMP_Assoc_Connected_Channel.triplets[1][1] = 0x01;
670 btamp_ASSOC.AMP_Assoc_Connected_Channel.triplets[1][2] = 0x11;
671
672
673 /* Return the local PAL Capabilities */
674 btamp_ASSOC.AMP_Assoc_PAL_Capabilities.present = 1;
675
676#if 0
677AMP ASSOC Pal Capabilities: Size: 4 Octets
678
679 Value Description
680 4 TypeID for 802.11 PAL Capabilities
681
682 4 Length
683
684 0xXXXXXXXX Bit 0:
685 0 signifies the PAL is not capable of utilizing
686 received Activity Reports
687 1 signifies the PAL is capable of utilizing
688 received Activity Reports
689 Bit 1:
690 0 signifies the PAL is not capable of utilizing
691 scheduling information sent in an Activity Report
692 1 signifies the PAL is capable of utilizing
693 scheduling information sent in an Activity Report
694 Bits 2..31 Reserved
695
696#endif //0
697
698 btamp_ASSOC.AMP_Assoc_PAL_Capabilities.pal_capabilities
699// = btampContext->btamp_Remote_AMP_Assoc.HC_pal_capabilities;
700 //= 0x03;
701 = 0x00;
702
703 /* Return the local PAL Version */
704 btamp_ASSOC.AMP_Assoc_PAL_Version.present = 1;
705
706 /* Return the version and company ID data */
707 btamp_ASSOC.AMP_Assoc_PAL_Version.pal_version = WLANBAP_PAL_VERSION;
708 btamp_ASSOC.AMP_Assoc_PAL_Version.pal_CompanyID = WLANBAP_QUALCOMM_COMPANY_ID; // Qualcomm Company ID
709 btamp_ASSOC.AMP_Assoc_PAL_Version.pal_subversion = WLANBAP_PAL_SUBVERSION;
710
711 //Pack the AMP Assoc structure
712 vosStatus = btampPackAMP_ASSOC(
713 hHal,
714 &btamp_ASSOC,
715 pBapHCIEvent->u.btampCommandCompleteEvent.cc_event.Read_Read_Local_AMP_Assoc.AMP_assoc_fragment,
716 248,
717 &nConsumed);
718
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -0700719 VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "%s: nConsumed value: %d", __func__, nConsumed);
Jeff Johnson295189b2012-06-20 16:38:30 -0700720
721 /* Format the command complete event to return... */
722 pBapHCIEvent->bapHCIEventCode = BTAMP_TLV_HCI_COMMAND_COMPLETE_EVENT;
723 pBapHCIEvent->u.btampCommandCompleteEvent.present = 1;
724 pBapHCIEvent->u.btampCommandCompleteEvent.num_hci_command_packets = 1;
725 pBapHCIEvent->u.btampCommandCompleteEvent.command_opcode
726 = BTAMP_TLV_HCI_READ_LOCAL_AMP_ASSOC_CMD;
727 /*Validate the Physical handle*/
728 if(pBapHCIReadLocalAMPAssoc->phy_link_handle !=
729 btampContext->phy_link_handle) {
730 VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -0700731 "%s: Wrong Physical Link handle in Read Local AMP Assoc cmd: current: %x, new: %x", __func__,
Jeff Johnson295189b2012-06-20 16:38:30 -0700732 btampContext->phy_link_handle,
733 pBapHCIReadLocalAMPAssoc->phy_link_handle);
734
735 pBapHCIEvent->u.btampCommandCompleteEvent.cc_event.Read_Read_Local_AMP_Assoc.status
736 = WLANBAP_ERROR_NO_CNCT;
737 } else
738 pBapHCIEvent->u.btampCommandCompleteEvent.cc_event.Read_Read_Local_AMP_Assoc.status
739 = WLANBAP_STATUS_SUCCESS;
740 pBapHCIEvent->u.btampCommandCompleteEvent.cc_event.Read_Read_Local_AMP_Assoc.phy_link_handle
741 = pBapHCIReadLocalAMPAssoc->phy_link_handle;
742 /* We will fit in one fragment, so remaining is exactly equal to encoded size*/
743 pBapHCIEvent->u.btampCommandCompleteEvent.cc_event.Read_Read_Local_AMP_Assoc.remaining_length
744 = nConsumed;
745
746 return VOS_STATUS_SUCCESS;
747} /* WLAN_BAPReadLocalAMPAssoc */
748
749/*----------------------------------------------------------------------------
750
751 FUNCTION WLAN_BAPWriteRemoteAMPAssoc()
752
753 DESCRIPTION
754 Implements the actual HCI Write Remote AMP Assoc command. There
755 is no need for a callback because when this call returns the action
756 has been completed.
757
758 DEPENDENCIES
759 NA.
760
761 PARAMETERS
762
763 IN
764 btampHandle: pointer to the BAP handle. Returned from WLANBAP_GetNewHndl.
765 pBapHCIWriteRemoteAMPAssoc: pointer to the "HCI Write Remote AMP Assoc" Structure.
766
767 IN/OUT
768 pBapHCIEvent: Return event value for the command complete event.
769 (The caller of this routine is responsible for sending
770 the Command Complete event up the HCI interface.)
771
772 RETURN VALUE
773 The result code associated with performing the operation
774
775 VOS_STATUS_E_FAULT: pointer to pBapHCIWriteRemoteAMPAssoc is NULL
776 VOS_STATUS_SUCCESS: Success
777
778 SIDE EFFECTS
779
780----------------------------------------------------------------------------*/
781VOS_STATUS
782WLAN_BAPWriteRemoteAMPAssoc
783(
784 ptBtampHandle btampHandle,
785 tBtampTLVHCI_Write_Remote_AMP_ASSOC_Cmd *pBapHCIWriteRemoteAMPAssoc,
786 tpBtampHCI_Event pBapHCIEvent /* This now encodes ALL event types */
787 /* Including Command Complete and Command Status*/
788)
789{
790 tWLAN_BAPEvent bapEvent; /* State machine event */
791 VOS_STATUS vosStatus;
792 tBtampHCI_Event bapHCIEvent;
793
794 /* I am using btampContext, instead of pBapPhysLinkMachine */
795 //tWLAN_BAPbapPhysLinkMachine *pBapPhysLinkMachine;
796 ptBtampContext btampContext = (ptBtampContext) btampHandle; /* btampContext value */
797 v_U8_t status; /* return the BT-AMP status here */
798
799 /* Validate params */
800 if (pBapHCIWriteRemoteAMPAssoc == NULL) {
801 return VOS_STATUS_E_FAULT;
802 }
803
Jeff Johnson2bbc0292017-09-19 08:38:56 -0700804 VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "%s: btampHandle value: %pK", __func__, btampHandle);
Jeff Johnson295189b2012-06-20 16:38:30 -0700805
806 /* Fill in the event structure */
807 bapEvent.event = eWLAN_BAP_HCI_WRITE_REMOTE_AMP_ASSOC;
808 bapEvent.params = pBapHCIWriteRemoteAMPAssoc;
809
Jeff Johnson2bbc0292017-09-19 08:38:56 -0700810 VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "%s: btampContext value: %pK", __func__, btampContext);
Jeff Johnson295189b2012-06-20 16:38:30 -0700811
812 /* Handle event */
813 vosStatus = btampFsm(btampContext, &bapEvent, &status);
814
815 /* Format the command complete event to return... */
816 pBapHCIEvent->bapHCIEventCode = BTAMP_TLV_HCI_COMMAND_COMPLETE_EVENT;
817 pBapHCIEvent->u.btampCommandCompleteEvent.present = 1;
818 pBapHCIEvent->u.btampCommandCompleteEvent.num_hci_command_packets = 1;
819 pBapHCIEvent->u.btampCommandCompleteEvent.command_opcode
820 = BTAMP_TLV_HCI_WRITE_REMOTE_AMP_ASSOC_CMD;
821 pBapHCIEvent->u.btampCommandCompleteEvent.cc_event.Write_Remote_AMP_Assoc.status
822 = status;
823 pBapHCIEvent->u.btampCommandCompleteEvent.cc_event.Write_Remote_AMP_Assoc.phy_link_handle
824 = pBapHCIWriteRemoteAMPAssoc->phy_link_handle;
825
826 if(WLANBAP_ERROR_NO_SUITABLE_CHANNEL == status)
827 {
828 /* Format the Physical Link Complete event to return... */
829 bapHCIEvent.bapHCIEventCode = BTAMP_TLV_HCI_PHYSICAL_LINK_COMPLETE_EVENT;
830 bapHCIEvent.u.btampPhysicalLinkCompleteEvent.present = 1;
831 bapHCIEvent.u.btampPhysicalLinkCompleteEvent.status = status;
832 bapHCIEvent.u.btampPhysicalLinkCompleteEvent.phy_link_handle
833 = btampContext->phy_link_handle;
834 bapHCIEvent.u.btampPhysicalLinkCompleteEvent.ch_number
835 = 0;
836
837 vosStatus = (*btampContext->pBapHCIEventCB)
838 (
839 btampContext->pHddHdl, /* this refers the BSL per application context */
840 &bapHCIEvent, /* This now encodes ALL event types */
841 VOS_TRUE /* Flag to indicate assoc-specific event */
842 );
843 }
844
845 /* ... */
846
847 return VOS_STATUS_SUCCESS;
848} /* WLAN_BAPWriteRemoteAMPAssoc */
849
850
851
852
853
854