1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
|
/*
* Copyright (c) 2013, The Linux Foundation. All rights reserved.
*
* Previously licensed under the ISC license by Qualcomm Atheros, Inc.
*
*
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
* above copyright notice and this permission notice appear in all
* copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
* WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
* AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
/*
* This file was originally distributed by Qualcomm Atheros, Inc.
* under proprietary terms before Copyright ownership was assigned
* to the Linux Foundation.
*/
/*===========================================================================
b a p A p i I n f o . C
OVERVIEW:
This software unit holds the implementation of the WLAN BAP modules
Information functions.
The functions externalized by this module are to be called ONLY by other
WLAN modules (HDD) that properly register with the BAP Layer initially.
DEPENDENCIES:
Are listed for each API below.
Copyright (c) 2008 Qualcomm Technologies, Inc.
All Rights Reserved.
Qualcomm Technologies Confidential and Proprietary
===========================================================================*/
/*===========================================================================
EDIT HISTORY FOR FILE
This section contains comments describing changes made to the module.
Notice that changes are listed in reverse chronological order.
$Header: /cygdrive/c/Dropbox/M7201JSDCAAPAD52240B/WM/platform/msm7200/Src/Drivers/SD/ClientDrivers/WLAN/QCT_BTAMP_PAL/CORE/BAP/src/bapApiInfo.c,v 1.2 2008/11/10 22:55:24 jzmuda Exp jzmuda $$DateTime$$Author: jzmuda $
when who what, where, why
---------- --- --------------------------------------------------------
2008-09-15 jez Created module
===========================================================================*/
/*----------------------------------------------------------------------------
* Include Files
* -------------------------------------------------------------------------*/
//#include "wlan_qct_tl.h"
#include "vos_trace.h"
#include "sme_Api.h"
/* BT-AMP PAL API header file */
#include "bapApi.h"
#include "bapInternal.h"
//#define BAP_DEBUG
/*----------------------------------------------------------------------------
* Preprocessor Definitions and Constants
* -------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
* Type Declarations
* -------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
* Global Data Definitions
* -------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
* Static Variable Definitions
* -------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
* Static Function Declarations and Definitions
* -------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
* Externalized Function Definitions
* -------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
* Function Declarations and Documentation
* -------------------------------------------------------------------------*/
/* Informational Parameters */
/*----------------------------------------------------------------------------
FUNCTION WLAN_BAPReadLocalVersionInfo()
DESCRIPTION
Implements the actual HCI Read Local Version Info command. There
is no need for a callback because when this call returns the action
has been completed.
DEPENDENCIES
NA.
PARAMETERS
IN
btampHandle: pointer to the BAP handle. Returned from WLANBAP_GetNewHndl.
// There are really no input parameters in this command.
// Just the command opcode itself is sufficient.
IN/OUT
pBapHCIEvent: Return event value for the command complete event.
(The caller of this routine is responsible for sending
the Command Complete event up the HCI interface.)
RETURN VALUE
The result code associated with performing the operation
VOS_STATUS_E_FAULT: pointer to pBapHCIReadLocalVersionInfo is NULL
VOS_STATUS_SUCCESS: Success
SIDE EFFECTS
----------------------------------------------------------------------------*/
VOS_STATUS
WLAN_BAPReadLocalVersionInfo
(
ptBtampHandle btampHandle,
tpBtampHCI_Event pBapHCIEvent /* This now encodes ALL event types */
/* Including "Read" Command Complete*/
)
{
/* Validate params */
if (btampHandle == NULL) {
return VOS_STATUS_E_FAULT;
}
VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "%s: btampHandle value: %p", __func__, btampHandle);
/* Format the command complete event to return... */
pBapHCIEvent->bapHCIEventCode = BTAMP_TLV_HCI_COMMAND_COMPLETE_EVENT;
pBapHCIEvent->u.btampCommandCompleteEvent.present = 1;
pBapHCIEvent->u.btampCommandCompleteEvent.num_hci_command_packets = 1;
pBapHCIEvent->u.btampCommandCompleteEvent.command_opcode
= BTAMP_TLV_HCI_READ_LOCAL_VERSION_INFO_CMD;
pBapHCIEvent->u.btampCommandCompleteEvent.cc_event.Read_Local_Version_Info.status
= WLANBAP_STATUS_SUCCESS;
pBapHCIEvent->u.btampCommandCompleteEvent.cc_event.Read_Local_Version_Info.HC_HCI_Version
= WLANBAP_HCI_VERSION;
pBapHCIEvent->u.btampCommandCompleteEvent.cc_event.Read_Local_Version_Info.HC_HCI_Revision
= WLANBAP_HCI_REVISION;
pBapHCIEvent->u.btampCommandCompleteEvent.cc_event.Read_Local_Version_Info.HC_PAL_Version
= WLANBAP_PAL_VERSION;
pBapHCIEvent->u.btampCommandCompleteEvent.cc_event.Read_Local_Version_Info.HC_Manufac_Name
= WLANBAP_QUALCOMM_COMPANY_ID;
pBapHCIEvent->u.btampCommandCompleteEvent.cc_event.Read_Local_Version_Info.HC_PAL_Sub_Version
= WLANBAP_PAL_SUBVERSION;
return VOS_STATUS_SUCCESS;
} /* WLAN_BAPReadLocalVersionInfo */
/*----------------------------------------------------------------------------
FUNCTION WLAN_BAPReadLocalSupportedCmds()
DESCRIPTION
Implements the actual HCI Read Local Supported Commands. There
is no need for a callback because when this call returns the action
has been completed.
DEPENDENCIES
NA.
PARAMETERS
IN
btampHandle: pointer to the BAP handle. Returned from WLANBAP_GetNewHndl.
// There are really no input parameters in this command.
// Just the command opcode itself is sufficient.
IN/OUT
pBapHCIEvent: Return event value for the command complete event.
(The caller of this routine is responsible for sending
the Command Complete event up the HCI interface.)
RETURN VALUE
The result code associated with performing the operation
VOS_STATUS_E_FAULT: pointer to pBapHCIReadLocalSupportedCmds is NULL
VOS_STATUS_SUCCESS: Success
SIDE EFFECTS
----------------------------------------------------------------------------*/
VOS_STATUS
WLAN_BAPReadLocalSupportedCmds
(
ptBtampHandle btampHandle,
tpBtampHCI_Event pBapHCIEvent /* This now encodes ALL event types */
/* Including "Read" Command Complete*/
)
{
v_U8_t supportedCmds[] = WLANBAP_PAL_SUPPORTED_HCI_CMDS;
/*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
/* Validate params */
if (btampHandle == NULL) {
return VOS_STATUS_E_FAULT;
}
VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "%s: btampHandle value: %p", __func__, btampHandle);
/* Format the command complete event to return... */
pBapHCIEvent->bapHCIEventCode = BTAMP_TLV_HCI_COMMAND_COMPLETE_EVENT;
pBapHCIEvent->u.btampCommandCompleteEvent.present = 1;
pBapHCIEvent->u.btampCommandCompleteEvent.num_hci_command_packets = 1;
pBapHCIEvent->u.btampCommandCompleteEvent.command_opcode
= BTAMP_TLV_HCI_READ_LOCAL_SUPPORTED_CMDS_CMD;
pBapHCIEvent->u.btampCommandCompleteEvent.cc_event.Read_Local_Supported_Cmds.status
= WLANBAP_STATUS_SUCCESS;
/* Return the supported commands bitmask */
vos_mem_copy(
pBapHCIEvent->u.btampCommandCompleteEvent.cc_event.Read_Local_Supported_Cmds.HC_Support_Cmds,
supportedCmds,
sizeof( supportedCmds));
return VOS_STATUS_SUCCESS;
} /* WLAN_BAPReadLocalSupportedCmds */
/*----------------------------------------------------------------------------
FUNCTION WLAN_BAPReadBufferSize()
DESCRIPTION
Implements the actual HCI Read Buffer Size command. There
is no need for a callback because when this call returns the action
has been completed.
DEPENDENCIES
NA.
PARAMETERS
IN
btampHandle: pointer to the BAP handle. Returned from WLANBAP_GetNewHndl.
pBapHCIReadBufferSize: pointer to the "HCI Read Buffer Size" Structure.
IN/OUT
pBapHCIEvent: Return event value for the command complete event.
(The caller of this routine is responsible for sending
the Command Complete event up the HCI interface.)
RETURN VALUE
The result code associated with performing the operation
VOS_STATUS_E_FAULT: pointer to pBapHCIReadBufferSize is NULL
VOS_STATUS_SUCCESS: Success
SIDE EFFECTS
----------------------------------------------------------------------------*/
VOS_STATUS
WLAN_BAPReadBufferSize
(
ptBtampHandle btampHandle,
tpBtampHCI_Event pBapHCIEvent /* This now encodes ALL event types */
/* Including "Read" Command Complete*/
)
{
/* Validate params */
if (btampHandle == NULL) {
return VOS_STATUS_E_FAULT;
}
VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "%s: btampHandle value: %p", __func__, btampHandle);
/* Format the command complete event to return... */
pBapHCIEvent->bapHCIEventCode = BTAMP_TLV_HCI_COMMAND_COMPLETE_EVENT;
pBapHCIEvent->u.btampCommandCompleteEvent.present = 1;
pBapHCIEvent->u.btampCommandCompleteEvent.num_hci_command_packets = 1;
pBapHCIEvent->u.btampCommandCompleteEvent.command_opcode
= BTAMP_TLV_HCI_READ_BUFFER_SIZE_CMD;
pBapHCIEvent->u.btampCommandCompleteEvent.cc_event.Read_Buffer_Size.status
= WLANBAP_STATUS_SUCCESS;
/* Return the supported Buffer sizes */
pBapHCIEvent->u.btampCommandCompleteEvent.cc_event.Read_Buffer_Size.HC_ACL_Data_Packet_Length
= WLANBAP_MAX_80211_PAL_PDU_SIZE;
pBapHCIEvent->u.btampCommandCompleteEvent.cc_event.Read_Buffer_Size.HC_SCO_Packet_Length
= 0; /* Invalid assignment to Uint8, makes 0 */
pBapHCIEvent->u.btampCommandCompleteEvent.cc_event.Read_Buffer_Size.HC_Total_Num_ACL_Packets
= 16;
pBapHCIEvent->u.btampCommandCompleteEvent.cc_event.Read_Buffer_Size.HC_Total_Num_SCO_Packets
= 0;
return VOS_STATUS_SUCCESS;
} /* WLAN_BAPReadBufferSize */
/*----------------------------------------------------------------------------
FUNCTION WLAN_BAPReadDataBlockSize()
DESCRIPTION
Implements the actual HCI Read Data Block Size command. There
is no need for a callback because when this call returns the action
has been completed.
DEPENDENCIES
NA.
PARAMETERS
IN
btampHandle: pointer to the BAP handle. Returned from WLANBAP_GetNewHndl.
IN/OUT
pBapHCIEvent: Return event value for the command complete event.
(The caller of this routine is responsible for sending
the Command Complete event up the HCI interface.)
RETURN VALUE
The result code associated with performing the operation
VOS_STATUS_E_FAULT: pointer to pBapHCIReadDataBlockSize is NULL
VOS_STATUS_SUCCESS: Success
SIDE EFFECTS
----------------------------------------------------------------------------*/
VOS_STATUS
WLAN_BAPReadDataBlockSize
(
ptBtampHandle btampHandle,
tpBtampHCI_Event pBapHCIEvent /* This now encodes ALL event types */
/* Including "Read" Command Complete*/
)
{
/* Validate params */
if ((btampHandle == NULL) || (NULL == pBapHCIEvent))
{
return VOS_STATUS_E_FAULT;
}
VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "%s: btampHandle value: %p", __func__, btampHandle);
/* Format the command complete event to return... */
pBapHCIEvent->bapHCIEventCode = BTAMP_TLV_HCI_COMMAND_COMPLETE_EVENT;
pBapHCIEvent->u.btampCommandCompleteEvent.present = 1;
pBapHCIEvent->u.btampCommandCompleteEvent.num_hci_command_packets = 1;
pBapHCIEvent->u.btampCommandCompleteEvent.command_opcode
= BTAMP_TLV_HCI_READ_DATA_BLOCK_SIZE_CMD;
pBapHCIEvent->u.btampCommandCompleteEvent.cc_event.Read_Data_Block_Size.status
= WLANBAP_STATUS_SUCCESS;
/* Return the supported Block sizes */
pBapHCIEvent->u.btampCommandCompleteEvent.cc_event.Read_Data_Block_Size.HC_Data_Block_Length
= WLANBAP_MAX_80211_PAL_PDU_SIZE;
pBapHCIEvent->u.btampCommandCompleteEvent.cc_event.Read_Data_Block_Size.HC_Max_ACL_Data_Packet_Length
= WLANBAP_MAX_80211_PAL_PDU_SIZE;
pBapHCIEvent->u.btampCommandCompleteEvent.cc_event.Read_Data_Block_Size.HC_Total_Num_Data_Blocks
= 16;
return VOS_STATUS_SUCCESS;
} /* WLAN_BAPReadDataBlockSize */
/*----------------------------------------------------------------------------
FUNCTION WLAN_BAPSetConfig()
DESCRIPTION
The function updates some configuration for BAP module in SME during SMEs
close -> open sequence.
BAP applies the new configuration at the next transaction.
DEPENDENCIES
NA.
PARAMETERS
IN
btampHandle: pointer to the BAP handle. Returned from WLANBAP_GetNewHndl.
pBapHCIReadRSSI: pointer to the "HCI Read RSSI" structure.
IN
pConfig: a pointer to a caller allocated object of typedef struct WLANBAP_ConfigType.
RETURN VALUE
The result code associated with performing the operation
VOS_STATUS_E_FAULT: pConfig or btampHandle is NULL
VOS_STATUS_SUCCESS: Success
SIDE EFFECTS
----------------------------------------------------------------------------*/
VOS_STATUS
WLAN_BAPSetConfig
(
ptBtampHandle btampHandle,
WLANBAP_ConfigType *pConfig
)
{
ptBtampContext btampContext;
/* Validate params */
if ((NULL == btampHandle)|| (NULL == pConfig))
{
return VOS_STATUS_E_FAULT;
}
btampContext = (ptBtampContext) btampHandle; /* btampContext value */
btampContext->config.ucPreferredChannel = pConfig->ucPreferredChannel;
return VOS_STATUS_SUCCESS;
}
/*----------------------------------------------------------------------------
FUNCTION WLAN_BAPGetMask()
DESCRIPTION
The function gets the updated event mask from BAP core.
DEPENDENCIES
NA.
PARAMETERS
IN
btampHandle: pointer to the BAP handle. Returned from WLANBAP_GetNewHndl.
IN
pEvent_mask_page_2: a pointer to a caller allocated object of 8 bytes.
RETURN VALUE
The result code associated with performing the operation
VOS_STATUS_E_FAULT: pEvent_mask_page_2 or btampHandle is NULL
VOS_STATUS_SUCCESS: Success
SIDE EFFECTS
----------------------------------------------------------------------------*/
VOS_STATUS
WLAN_BAPGetMask( ptBtampHandle btampHandle,
v_U8_t *pEvent_mask_page_2)
{
ptBtampContext btampContext;
/* Validate params */
if ((NULL == btampHandle)|| (NULL == pEvent_mask_page_2))
{
return VOS_STATUS_E_FAULT;
}
btampContext = (ptBtampContext) btampHandle; /* btampContext value */
vos_mem_copy( pEvent_mask_page_2,
btampContext->event_mask_page_2,
8 );
return VOS_STATUS_SUCCESS;
}
/*----------------------------------------------------------------------------
FUNCTION WLAN_BAPDisconnect()
DESCRIPTION
The function to request to BAP core to disconnect currecnt AMP connection.
DEPENDENCIES
NA.
PARAMETERS
IN
btampHandle: pointer to the BAP handle. Returned from WLANBAP_GetNewHndl.
RETURN VALUE
The result code associated with performing the operation
VOS_STATUS_E_FAULT: btampHandle is NULL
VOS_STATUS_SUCCESS: Success
SIDE EFFECTS
----------------------------------------------------------------------------*/
VOS_STATUS
WLAN_BAPDisconnect
(
ptBtampHandle btampHandle
)
{
ptBtampContext btampContext = (ptBtampContext) btampHandle;
tWLAN_BAPEvent bapEvent; /* State machine event */
v_U8_t status; /* return the BT-AMP status here */
VOS_STATUS vosStatus;
/*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_FATAL, "%s: btampHandle value: %p", __func__, btampHandle);
/* Validate params */
if (btampHandle == NULL)
{
VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_FATAL,
"btampHandle is NULL in %s", __func__);
return VOS_STATUS_E_FAULT;
}
/* Fill in the event structure */
bapEvent.event = eWLAN_BAP_MAC_INDICATES_MEDIA_DISCONNECTION;
bapEvent.params = NULL;
/* Handle event */
vosStatus = btampFsm(btampContext, &bapEvent, &status);
/* Fill in the event structure */
bapEvent.event = eWLAN_BAP_MAC_READY_FOR_CONNECTIONS;
bapEvent.params = NULL;
/* Handle event */
vosStatus = btampFsm(btampContext, &bapEvent, &status);
return VOS_STATUS_SUCCESS;
}
/*----------------------------------------------------------------------------
FUNCTION WLAN_BAPSessionOn()
DESCRIPTION
The function to check from BAP core if AMP connection is up right now.
DEPENDENCIES
NA.
PARAMETERS
IN
btampHandle: pointer to the BAP handle. Returned from WLANBAP_GetNewHndl.
RETURN VALUE
The result code associated with performing the operation
VOS_TRUE: AMP connection is on
VOS_FALSE: AMP connection is not on
SIDE EFFECTS
----------------------------------------------------------------------------*/
v_BOOL_t WLAN_BAPSessionOn
(
ptBtampHandle btampHandle
)
{
ptBtampContext btampContext = (ptBtampContext) btampHandle;
/*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_INFO_HIGH, "%s: btampHandle value: %p", __func__, btampHandle);
/* Validate params */
if (btampHandle == NULL)
{
VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR,
"btampHandle is NULL in %s", __func__);
//?? shall we say true or false
return VOS_FALSE;
}
return btampContext->btamp_session_on;
}
|